Line data Source code
1 : // This file (tlog-compare.cc) was created by Ron Rechenmacher <ron@fnal.gov> on
2 : // Sep 24, 2020. "TERMS AND CONDITIONS" governing this file are in the README
3 : // or COPYING file. If you do not have such a file, one can be obtained by
4 : // contacting Ron or Fermi Lab in Batavia IL, 60510, phone: 630-840-3000.
5 : // $RCSfile: .emacs.gnu,v $
6 : // rev="$Revision: 1.34 $$Date: 2019/04/22 15:23:54 $";
7 :
8 : struct test_desc_t {
9 : char const *desc;
10 : unsigned loop_decimate;
11 : } test_desc[]= {{"const short msg", 1},
12 : {"1 arg", 1},
13 : {"2 args", 1},
14 : {"8 args (7 ints, 1 float)", 1},
15 : {"8 args (1 ints, 7 float)", 1},
16 : {"snprintf of same 8 args (stringstream)", 1},
17 : {"(repeat) const short msg", 1},
18 : {"2 args traceTID=-1 - first TLOG", 1},
19 : {"2 args TRACE macro", 1},
20 : {"8 args (7 ints, 1 float) - TLOG_SCOPED() TLOG_ADD", 1},
21 : {"8 args (7 ints, 1 float) - TLOG_SCOPED(){TLOG_ADD}", 1},
22 : {"2 args - NoTLOG - OPTIMIZED out", 1}};
23 : #define USAGE \
24 : "\
25 : usage: %s [opts] [tests_mask [modes_mask]]\n\
26 : modes_mask (combinations of Slow and Fast):\n\
27 : b0 - M0S0\n\
28 : b1 - M1S0\n\
29 : b2 - M1S1\n\
30 : b3 - M0S1\n\
31 : opts:\n\
32 : -l<loops> base loops (default: %u)\n\
33 : -n add normalized column\n\
34 : tests_mask:\n", \
35 : basename(argv[0]), DFLT_TEST_COMPARE_ITERS
36 :
37 : #include <libgen.h> // basename
38 : #include <stdio.h> // printf
39 : #include <getopt.h> // this does not appear to be posix, but eliminates gcc v10 warnings
40 : #include <unistd.h> // getopt
41 : #define TRACE_USE_STATIC_STREAMER 1
42 : #include <TRACE/trace.h> // TLOG
43 : #include <time.h> // clock_gettime, struct timespec
44 :
45 : #define DFLT_TEST_COMPARE_ITERS 1000000
46 :
47 0 : static uint64_t gettimeofday_ns() // 2**64 = 10**19.26592 giving 10 digits for the seconds (since 1970)
48 : { // 10**10 seconds == 317 years
49 0 : struct timespec ts;
50 0 : clock_gettime(CLOCK_REALTIME, &ts);
51 0 : return (uint64_t)(ts.tv_sec * 1000000000 + ts.tv_nsec);
52 : }
53 :
54 0 : int count_bits(unsigned input)
55 : {
56 0 : int bits= 0;
57 0 : for (unsigned bb= 0; bb < (sizeof(input) * 8 /*bitsPerByte*/); ++bb)
58 0 : if (input & (1 << bb)) ++bits;
59 0 : return bits;
60 : }
61 :
62 0 : int main(int argc, char *argv[])
63 : {
64 0 : char buffer[200];
65 0 : uint64_t mark;
66 0 : uint32_t delta;
67 0 : unsigned loops= DFLT_TEST_COMPARE_ITERS;
68 0 : unsigned tests_mask= 0xfff; // all tests
69 0 : unsigned modes_mask= 0xf; // all mode combinations
70 0 : int fd;
71 0 : int opt, args; // for how I use getopt
72 0 : int opt_loops= -1;
73 0 : bool opt_normalize= false;
74 :
75 0 : while ((opt= getopt(argc, argv, "?hl:n")) != -1) {
76 0 : switch (opt) {
77 : // '?' is also what you get w/ "invalid option -- -"
78 0 : case '?':
79 0 : case 'h':
80 0 : printf(USAGE);
81 0 : for (unsigned bb= 0; bb < sizeof(test_desc) / sizeof(test_desc[0]); ++bb) {
82 0 : printf(" %cb%d - %s\n", (bb & 3) == 3 ? '_' : ' ', bb, test_desc[bb].desc);
83 : }
84 0 : exit(0);
85 0 : break;
86 0 : case 'l': opt_loops= (int)strtoul(optarg, NULL, 0); break;
87 0 : case 'n': opt_normalize= true;
88 : }
89 : }
90 0 : args= argc - optind;
91 :
92 0 : if (opt_loops > -1) loops= opt_loops;
93 0 : opt_loops= loops; // save
94 :
95 0 : fd= open("/dev/null", O_WRONLY);
96 0 : dup2(fd, 1); // redirect stdout to /dev/null
97 0 : setlocale(LC_NUMERIC, "en_US"); // make ' printf flag work -- setting LC_NUMERIC in env does not seem to work
98 :
99 0 : setenv("TRACE_MSGMAX", "0", 0);
100 0 : TRACE_CNTL("mode", 3);
101 0 : traceControl_rwp->mode.bits.M= 1; // NOTE: TRACE_CNTL("modeM",1) hardwired to NOT enable when not mapped!
102 :
103 : #define STRT_PRN(fmt2args, a1, a2) \
104 : sprintf(buffer, fmt2args, a1, a2); \
105 : fprintf(stderr, "%-60s", buffer); \
106 : fflush(stderr)
107 : // ELF 6/6/18: GCC v6_3_0 does not like %', removing the '...
108 : #define END_FMT "%10u ns, %9.4f ns/TLOG, %13.3f Mtlogs/s", delta, (double)delta / loops, (double)loops * 1000 / delta
109 : #define CONTINUE \
110 : fprintf(stderr, "Continuing.\n"); \
111 : continue
112 :
113 0 : if (args >= 1) tests_mask= (unsigned)strtoul(argv[optind], NULL, 0);
114 0 : if (args >= 2) modes_mask= (unsigned)strtoul(argv[optind + 1], NULL, 0);
115 0 : struct results_t {
116 : uint32_t delta;
117 : unsigned loops;
118 : };
119 0 : unsigned total_tests= count_bits(tests_mask) * count_bits(modes_mask);
120 0 : size_t results_bytes= sizeof(results_t) * total_tests;
121 0 : results_t *results_a= (results_t *)malloc(results_bytes);
122 0 : char prop[]= {'|', '/', '-', '\\'};
123 0 : results_t normal= {0, 0};
124 :
125 0 : unsigned test= 0;
126 0 : for (int jj= 0; jj < 4; ++jj) {
127 : //unsigned tstmod= (1U << jj) & modes_mask;
128 0 : switch ((1U << jj) & modes_mask) {
129 0 : case 1:
130 0 : TRACE_CNTL("lvlclrM", 1LL << TLVL_INFO); // operate on the TLOG(TLVL_INFO) bit for M
131 0 : TRACE_CNTL("lvlclrS", 1LL << TLVL_INFO); // operate on the TLOG(TLVL_INFO) bit for S
132 0 : loops= (unsigned)opt_loops * 5;
133 0 : break;
134 0 : case 2:
135 0 : TRACE_CNTL("lvlsetM", 1LL << TLVL_INFO);
136 0 : TRACE_CNTL("lvlclrS", 1LL << TLVL_INFO);
137 0 : loops= (unsigned)opt_loops * 2;
138 0 : break;
139 0 : case 4:
140 0 : TRACE_CNTL("lvlsetM", 1LL << TLVL_INFO);
141 0 : TRACE_CNTL("lvlsetS", 1LL << TLVL_INFO);
142 : loops= (unsigned)opt_loops;
143 : break;
144 0 : case 8:
145 0 : TRACE_CNTL("lvlclrM", 1LL << TLVL_INFO);
146 0 : TRACE_CNTL("lvlsetS", 1LL << TLVL_INFO);
147 : loops= (unsigned)opt_loops;
148 : break;
149 0 : case 0: continue; // Should give/have "invalid modes spec" message
150 : }
151 :
152 0 : if (1 & tests_mask) {
153 : //STRT_PRN(" 0x001 -%s const short msg %s", "", (tstmod & 0xc) ? "(NO snprintf)" : "");
154 0 : TRACE_CNTL("reset");
155 0 : mark= gettimeofday_ns();
156 0 : for (unsigned uu= 0; uu < loops; ++uu) TLOG(TLVL_INFO) << "any msg";
157 0 : delta= (uint32_t)(gettimeofday_ns() - mark);
158 0 : fprintf(stderr, "%c %2u/%u\r", prop[test & 0x3], test + 1, total_tests);
159 0 : fflush(stderr);
160 0 : results_a[test++]= {delta, loops};
161 : }
162 :
163 0 : if (2 & tests_mask) {
164 : //STRT_PRN(" 0x002 - 1 arg%s%s", "", "");
165 0 : TRACE_CNTL("reset");
166 0 : mark= gettimeofday_ns();
167 0 : for (unsigned uu= 0; uu < loops; ++uu) TLOG(TLVL_INFO) << "this is one small param: " << 12345678;
168 : //TLOG(TLVL_INFO) << "this is one long long long long long long long long long longlong long long long long long long long long long message.";
169 0 : delta= (uint32_t)(gettimeofday_ns() - mark);
170 0 : fprintf(stderr, "%c %2u/%u\r", prop[test & 0x3], test + 1, total_tests);
171 0 : fflush(stderr);
172 0 : results_a[test++]= {delta, loops};
173 : }
174 :
175 0 : if (4 & tests_mask) {
176 : //STRT_PRN(" 0x004 - 2 args%s%s", "", "");
177 0 : TRACE_CNTL("reset");
178 0 : mark= gettimeofday_ns();
179 0 : for (unsigned uu= 0; uu < loops; ++uu) TLOG(TLVL_INFO) << "this is 2 params: " << 12345678 << " " << uu;
180 0 : delta= (uint32_t)(gettimeofday_ns() - mark);
181 0 : fprintf(stderr, "%c %2u/%u\r", prop[test & 0x3], test + 1, total_tests);
182 0 : fflush(stderr);
183 0 : results_a[test++]= {delta, loops};
184 : }
185 :
186 0 : if (8 & tests_mask) {
187 : //STRT_PRN(" 0x008 - 8 args (7 ints, 1 float)%s%s", "", "");
188 0 : TRACE_CNTL("reset");
189 0 : mark= gettimeofday_ns();
190 0 : for (unsigned uu= 0; uu < loops; ++uu)
191 0 : TLOG(TLVL_INFO) << "this is 8 params: " << 12345678 << " " << uu << " " << uu * 2 << " " << uu + 6 << " "
192 0 : << 12345679 << " " << uu << " " << uu - 7 << " " << (float)uu * 1.5;
193 0 : delta= (uint32_t)(gettimeofday_ns() - mark);
194 0 : fprintf(stderr, "%c %2u/%u\r", prop[test & 0x3], test + 1, total_tests);
195 0 : fflush(stderr);
196 0 : results_a[test++]= {delta, loops};
197 : }
198 :
199 0 : if (0x10 & tests_mask) {
200 : //STRT_PRN(" 0x010 - 8 args (1 ints, 7 float)%s%s", "", "");
201 0 : TRACE_CNTL("reset");
202 0 : mark= gettimeofday_ns();
203 0 : for (unsigned uu= 0; uu < loops; ++uu)
204 0 : TLOG(TLVL_INFO) << "this is 8 params: " << 12345678 << " " << (float)uu << " " << (float)uu * 2.5 << " "
205 0 : << (float)uu + 3.14 << " " << (float)12345679 << " " << (float)uu / .25 << " "
206 0 : << (float)uu - 2 * 3.14 << " " << (float)uu * 1.5;
207 0 : delta= (uint32_t)(gettimeofday_ns() - mark);
208 0 : fprintf(stderr, "%c %2u/%u\r", prop[test & 0x3], test + 1, total_tests);
209 0 : fflush(stderr);
210 0 : results_a[test++]= {delta, loops};
211 : }
212 :
213 0 : if (0x20 & tests_mask) {
214 : //STRT_PRN(" 0x020 - snprintf of same 8 args%s%s", "", "");
215 0 : TRACE_CNTL("reset");
216 0 : unsigned loops_sav= loops;
217 0 : loops/= 4;
218 0 : mark= gettimeofday_ns();
219 0 : for (unsigned uu= 0; uu < loops; ++uu) {
220 0 : snprintf(buffer, sizeof(buffer), "this is 8 params: %u %g %g %g %g %g %g %g", 12345678, (float)uu, (float)uu * 2.5,
221 0 : (float)uu + 3.14, (float)12345679, (float)uu / .25, (float)uu - 2 * 3.14, (float)uu * 1.5);
222 0 : TLOG(TLVL_INFO) << buffer;
223 : }
224 0 : delta= (uint32_t)(gettimeofday_ns() - mark);
225 0 : fprintf(stderr, "%c %2u/%u\r", prop[test & 0x3], test + 1, total_tests);
226 0 : fflush(stderr);
227 : // if (tstmod&0xc && normal.delta==0) {
228 : // normal = { delta, loops }; // normalize against slowest
229 : // fprintf(stderr, " tstmod=%u delta=%u loops=%u\n", tstmod, delta, loops );
230 : // }
231 0 : results_a[test++]= {delta, loops};
232 0 : loops= loops_sav;
233 : }
234 :
235 0 : if (0x40 & tests_mask) {
236 : //STRT_PRN(" 0x040 -%s const short msg %s", (1 & tests_mask) ? " (repeat)" : "", (tstmod & 0xc) ? "(NO snprintf)" : "");
237 0 : TRACE_CNTL("reset");
238 0 : mark= gettimeofday_ns();
239 0 : for (unsigned uu= 0; uu < loops; ++uu) TLOG(TLVL_INFO) << "any msg";
240 0 : delta= (uint32_t)(gettimeofday_ns() - mark);
241 0 : fprintf(stderr, "%c %2u/%u\r", prop[test & 0x3], test + 1, total_tests);
242 0 : fflush(stderr);
243 0 : results_a[test++]= {delta, loops};
244 : }
245 :
246 0 : if (0x80 & tests_mask) {
247 : //STRT_PRN(" 0x080 - 2 args%s%s traceTID=-1 - first TLOG", "", ""); //first TLOG (\"initialization\")
248 0 : TRACE_CNTL("reset");
249 0 : mark= gettimeofday_ns();
250 0 : for (unsigned uu= 0; uu < loops; ++uu) {
251 0 : TLOG(TLVL_INFO) << "this is 2 params: " << 12345678 << " " << uu;
252 0 : traceTID= -1;
253 : }
254 0 : delta= (uint32_t)(gettimeofday_ns() - mark);
255 0 : fprintf(stderr, "%c %2u/%u\r", prop[test & 0x3], test + 1, total_tests);
256 0 : fflush(stderr);
257 0 : results_a[test++]= {delta, loops};
258 : }
259 :
260 0 : if (0x100 & tests_mask) {
261 : //STRT_PRN(" 0x100 - 2 args%s%s TRACE macro", "", "");
262 0 : TRACE_CNTL("reset");
263 0 : mark= gettimeofday_ns();
264 0 : for (unsigned uu= 0; uu < loops; ++uu) { TRACE(TLVL_INFO, "this is 2 params: %d %u", 12345678, uu); }
265 0 : delta= (uint32_t)(gettimeofday_ns() - mark);
266 0 : fprintf(stderr, "%c %2u/%u\r", prop[test & 0x3], test + 1, total_tests);
267 0 : fflush(stderr);
268 0 : results_a[test++]= {delta, loops};
269 : }
270 :
271 0 : if (0x200 & tests_mask) {
272 : //STRT_PRN(" 0x200 - %s%s8 args (7 ints, 1 float) - TLOG_SCOPED() TLOG_ADD", "", "");
273 0 : TRACE_CNTL("reset");
274 0 : mark= gettimeofday_ns();
275 0 : for (unsigned uu= 0; uu < loops; ++uu) {
276 0 : TLOG_SCOPED(TLVL_INFO)
277 0 : TLOG_ADD << "this is 8 params: " << 12345678 << " " << uu << " " << uu * 2 << " " << uu + 6 << " " << 12345679
278 0 : << " " << uu << " " << uu - 7 << " " << (float)uu * 1.5;
279 : }
280 0 : delta= (uint32_t)(gettimeofday_ns() - mark);
281 0 : fprintf(stderr, "%c %2u/%u\r", prop[test & 0x3], test + 1, total_tests);
282 0 : fflush(stderr);
283 0 : results_a[test++]= {delta, loops};
284 : }
285 :
286 0 : if (0x400 & tests_mask) {
287 : //STRT_PRN(" 0x400 - %s%s8 args (7 ints, 1 float) - TLOG_SCOPED(){TLOG_ADD}", "", "");
288 0 : TRACE_CNTL("reset");
289 0 : mark= gettimeofday_ns();
290 0 : for (unsigned uu= 0; uu < loops; ++uu) {
291 0 : TLOG_SCOPED(TLVL_INFO)
292 : {
293 0 : TLOG_ADD << "this is 8 params: " << 12345678;
294 0 : TLOG_ADD << " " << uu;
295 0 : TLOG_ADD << " " << uu * 2;
296 0 : TLOG_ADD << " " << uu + 6;
297 0 : TLOG_ADD << " " << 12345679;
298 0 : TLOG_ADD << " " << uu;
299 0 : TLOG_ADD << " " << uu - 7;
300 0 : TLOG_ADD << " " << (float)uu * 1.5;
301 0 : }
302 : }
303 0 : delta= (uint32_t)(gettimeofday_ns() - mark);
304 0 : fprintf(stderr, "%c %2u/%u\r", prop[test & 0x3], test + 1, total_tests);
305 0 : fflush(stderr);
306 0 : results_a[test++]= {delta, loops};
307 : }
308 :
309 0 : if (0x800 & tests_mask) {
310 : #undef TLOG
311 : #undef TLOG_DEBUG_SCOPED
312 : #include <iostream>
313 : #define TLOG(...) \
314 : if (0) std::cout
315 : #define TLOG_DEBUG_SCOPED(...) for (struct { std::ostream *stmr__; } _trc_= {&std::cout}; 0;)
316 : #ifndef __OPTIMIZE__
317 : //STRT_PRN(" 0x800 - 2 args%s%s ", " - NoTLOG - ", "NOT Optimized.");
318 : #else
319 : //STRT_PRN(" 0x800 - 2 args%s%s ", " - NoTLOG - ", "OPTIMIZED out.");
320 : #endif // __OPTIMIZE__
321 0 : TRACE_CNTL("reset");
322 0 : unsigned total= 0;
323 0 : mark= gettimeofday_ns();
324 0 : for (unsigned uu= 0; uu < loops; ++uu) {
325 0 : TLOG(TLVL_INFO) << "this is 2 params: " << 12345678 << " " << uu;
326 0 : TLOG_DEBUG_SCOPED(TLVL_INFO) TLOG_ADD << "this is 2 params: " << 12345678 << " " << uu;
327 0 : total+= uu; // don't want to completely optimize out whole loop
328 : }
329 0 : delta= (uint32_t)(gettimeofday_ns() - mark);
330 0 : printf("%u\n", total); // use the value
331 0 : fprintf(stderr, "%c %2u/%u\r", prop[test & 0x3], test + 1, total_tests);
332 0 : fflush(stderr);
333 0 : results_a[test++]= {delta, loops};
334 : }
335 : } // for (jj<4)
336 :
337 : //===============================================================================
338 : double highest= 0.0;
339 0 : for (unsigned tt= 0; tt < test; ++tt) {
340 0 : double this_result= (double)results_a[tt].delta / results_a[tt].loops;
341 0 : if (this_result > highest) {
342 0 : highest= this_result;
343 0 : normal= results_a[tt];
344 : }
345 : }
346 : //fprintf(stderr, "\nnormal.delta=%u normal.loops=%u\n",normal.delta,normal.loops);
347 : //===============================================================================
348 :
349 : test= 0;
350 0 : for (int jj= 0; jj < 4; ++jj) {
351 0 : unsigned tstmod= (1U << jj) & modes_mask;
352 0 : switch ((1U << jj) & modes_mask) {
353 0 : case 1: fprintf(stderr, "0x1 M0S0 - Testing with M and S lvl disabled. loops=%u\n", loops); break;
354 0 : case 2: fprintf(stderr, "0x2 M1S0 - Testing with S lvl disabled (mem only). loops=%u\n", loops); break;
355 0 : case 4: fprintf(stderr, "0x4 M1S1 - Testing with M and S lvl enabled (stdout>/dev/null). loops=%u\n", loops); break;
356 0 : case 8: fprintf(stderr, "0x8 M0S1 - Testing with just S lvl enabled. Unusual (freeze). loops=%u\n", loops); break;
357 0 : case 0: continue; // Should give/have "invalid modes spec" message
358 : }
359 :
360 0 : if (1 & tests_mask) {
361 0 : STRT_PRN(" 0x001 -%s const short msg %s", "", (tstmod & 0xc) ? "(NO snprintf)" : "");
362 0 : loops= results_a[test].loops;
363 0 : delta= results_a[test++].delta;
364 0 : fprintf(stderr, END_FMT);
365 0 : if (opt_normalize)
366 0 : fprintf(stderr, " %13.3f\n", (double)loops * 1000 / delta / ((double)normal.loops * 1000 / normal.delta));
367 : else
368 0 : fprintf(stderr, "\n");
369 : }
370 :
371 0 : if (2 & tests_mask) {
372 0 : STRT_PRN(" 0x002 - 1 arg%s%s", "", "");
373 0 : loops= results_a[test].loops;
374 0 : delta= results_a[test++].delta;
375 0 : fprintf(stderr, END_FMT);
376 0 : if (opt_normalize)
377 0 : fprintf(stderr, " %13.3f\n", (double)loops * 1000 / delta / ((double)normal.loops * 1000 / normal.delta));
378 : else
379 0 : fprintf(stderr, "\n");
380 : }
381 :
382 0 : if (4 & tests_mask) {
383 0 : STRT_PRN(" 0x004 - 2 args%s%s", "", "");
384 0 : loops= results_a[test].loops;
385 0 : delta= results_a[test++].delta;
386 0 : fprintf(stderr, END_FMT);
387 0 : if (opt_normalize)
388 0 : fprintf(stderr, " %13.3f\n", (double)loops * 1000 / delta / ((double)normal.loops * 1000 / normal.delta));
389 : else
390 0 : fprintf(stderr, "\n");
391 : }
392 :
393 0 : if (8 & tests_mask) {
394 0 : STRT_PRN(" 0x008 - 8 args (7 ints, 1 float)%s%s", "", "");
395 0 : loops= results_a[test].loops;
396 0 : delta= results_a[test++].delta;
397 0 : fprintf(stderr, END_FMT);
398 0 : if (opt_normalize)
399 0 : fprintf(stderr, " %13.3f\n", (double)loops * 1000 / delta / ((double)normal.loops * 1000 / normal.delta));
400 : else
401 0 : fprintf(stderr, "\n");
402 : }
403 :
404 0 : if (0x10 & tests_mask) {
405 0 : STRT_PRN(" 0x010 - 8 args (1 ints, 7 float)%s%s", "", "");
406 0 : loops= results_a[test].loops;
407 0 : delta= results_a[test++].delta;
408 0 : fprintf(stderr, END_FMT);
409 0 : if (opt_normalize)
410 0 : fprintf(stderr, " %13.3f\n", (double)loops * 1000 / delta / ((double)normal.loops * 1000 / normal.delta));
411 : else
412 0 : fprintf(stderr, "\n");
413 : }
414 :
415 0 : if (0x20 & tests_mask) {
416 0 : STRT_PRN(" 0x020 - snprintf of same 8 args%s%s", "", "");
417 0 : loops= results_a[test].loops;
418 0 : delta= results_a[test++].delta;
419 0 : fprintf(stderr, END_FMT);
420 0 : if (opt_normalize)
421 0 : fprintf(stderr, " %13.3f\n", (double)loops * 1000 / delta / ((double)normal.loops * 1000 / normal.delta));
422 : else
423 0 : fprintf(stderr, "\n");
424 : }
425 :
426 0 : if (0x40 & tests_mask) {
427 0 : STRT_PRN(" 0x040 -%s const short msg %s", (1 & tests_mask) ? " (repeat)" : "", (tstmod & 0xc) ? "(NO snprintf)" : "");
428 0 : loops= results_a[test].loops;
429 0 : delta= results_a[test++].delta;
430 0 : fprintf(stderr, END_FMT);
431 0 : if (opt_normalize)
432 0 : fprintf(stderr, " %13.3f\n", (double)loops * 1000 / delta / ((double)normal.loops * 1000 / normal.delta));
433 : else
434 0 : fprintf(stderr, "\n");
435 : }
436 :
437 0 : if (0x80 & tests_mask) {
438 0 : STRT_PRN(" 0x080 - 2 args%s%s traceTID=-1 - first TLOG", "", ""); //first TLOG (\"initialization\")
439 0 : loops= results_a[test].loops;
440 0 : delta= results_a[test++].delta;
441 0 : fprintf(stderr, END_FMT);
442 0 : if (opt_normalize)
443 0 : fprintf(stderr, " %13.3f\n", (double)loops * 1000 / delta / ((double)normal.loops * 1000 / normal.delta));
444 : else
445 0 : fprintf(stderr, "\n");
446 : }
447 :
448 0 : if (0x100 & tests_mask) {
449 0 : STRT_PRN(" 0x100 - 2 args%s%s TRACE macro", "", "");
450 0 : loops= results_a[test].loops;
451 0 : delta= results_a[test++].delta;
452 0 : fprintf(stderr, END_FMT);
453 0 : if (opt_normalize)
454 0 : fprintf(stderr, " %13.3f\n", (double)loops * 1000 / delta / ((double)normal.loops * 1000 / normal.delta));
455 : else
456 0 : fprintf(stderr, "\n");
457 : }
458 :
459 0 : if (0x200 & tests_mask) {
460 0 : STRT_PRN(" 0x200 - %s%s8 args (7 ints, 1 float) - TLOG_SCOPED() TLOG_ADD", "", "");
461 0 : loops= results_a[test].loops;
462 0 : delta= results_a[test++].delta;
463 0 : fprintf(stderr, END_FMT);
464 0 : if (opt_normalize)
465 0 : fprintf(stderr, " %13.3f\n", (double)loops * 1000 / delta / ((double)normal.loops * 1000 / normal.delta));
466 : else
467 0 : fprintf(stderr, "\n");
468 : }
469 :
470 0 : if (0x400 & tests_mask) {
471 0 : STRT_PRN(" 0x400 - %s%s8 args (7 ints, 1 float) - TLOG_SCOPED(){TLOG_ADD}", "", "");
472 0 : loops= results_a[test].loops;
473 0 : delta= results_a[test++].delta; // NOLINT(runtime/increment_decrement)
474 0 : fprintf(stderr, END_FMT);
475 0 : if (opt_normalize)
476 0 : fprintf(stderr, " %13.3f\n", (double)loops * 1000 / delta / ((double)normal.loops * 1000 / normal.delta));
477 : else
478 0 : fprintf(stderr, "\n");
479 : }
480 :
481 0 : if (0x800 & tests_mask) {
482 : #ifndef __OPTIMIZE__
483 : STRT_PRN(" 0x800 - 2 args%s%s ", " - NoTLOG - ", "NOT Optimized.");
484 : #else
485 0 : STRT_PRN(" 0x800 - 2 args%s%s ", " - NoTLOG - ", "OPTIMIZED out.");
486 : #endif // __OPTIMIZE__
487 0 : loops= results_a[test].loops;
488 0 : delta= results_a[test++].delta;
489 0 : fprintf(stderr, END_FMT);
490 0 : if (opt_normalize)
491 0 : fprintf(stderr, " %13.3f\n", (double)loops * 1000 / delta / ((double)normal.loops * 1000 / normal.delta));
492 : else
493 0 : fprintf(stderr, "\n");
494 : }
495 : } // for (jj<4)
496 :
497 0 : return (0);
498 : } // main
|