106{
109
112
113 try {
114
115 JParser<> zap(
"Example program to test performance of merge sort.");
116
119
121 }
122 catch(const exception &error) {
124 }
125
126
129 }
130
131 const double period = 1.0e9 /
rate_Hz;
132
133 const double Tmin = 0.0;
134 const double Tmax = 1.0e8;
135
136 const int NUMBER_OF_PMTS = 31;
138
139
140
141 typedef double hit_type;
143 const JElement_t getElement;
146
147
148
149
151
153
154 for (int i = 0; i != NUMBER_OF_PMTS; ++i) {
155
157 input[i].push_back(getElement(t1));
158 }
159
160 NOTICE(
"PMT[" <<
setw(2) << i <<
"] " << input[i].size() <<
endl);
161
163 }
164
165
168 JTimer(
"std::inplace_merge"),
170 };
171
172
173 {
175
177
179
180 buffer.clear();
181
182 for (int i = 0; i != NUMBER_OF_PMTS; ++i) {
184 }
185
186 std::sort(buffer.begin(), buffer.end());
187
189
192 }
193 }
194
195 {
197
199
201
203
205
206 for (int i = 0; i != NUMBER_OF_PMTS; ++i) {
207 n += input[i].size();
208 }
209
210 buffer.resize(n);
211
212 JBuffer1D::iterator out = buffer.begin();
213
215
216 for (int i = 0; i != NUMBER_OF_PMTS; ++i) {
217
218 out =
copy(input[i].begin(), input[i].end(), out);
219
221 }
222
224
226
228 ASSERT(
is_sorted(buffer.begin(), buffer.end()),
"Test std::inplace_merge.");
229 }
230 }
231
232 {
235
237
239
240 buffer.clear();
241
242 merge(input, buffer);
243
245
248 }
249 }
250
251
252 for (int i = 0; i != sizeof(timer)/sizeof(timer[0]); ++i) {
254 }
255}
#define ASSERT(A,...)
Assert macro.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Auxiliary class for CPU timing and usage.
void print(std::ostream &out, const JScale_t scale=milli_t) const
Print timer data.
Template definition of a multi-dimensional oscillation probability interpolation table.
Utility class to parse command line options.
void copy(const Head &from, JHead &to)
Copy header from from to to.
void putEndMarker(std::vector< JElement_t, JAllocator_t > &buffer, const JElement_t &value)
Put end marker.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).