Commit 0eb6f71c by David Malcolm Committed by David Malcolm

jit.dg/test-benchmark.c: add a summary of timings

gcc/testsuite/ChangeLog:
	* jit.dg/test-benchmark.c (main): Record all elapsed times at each
	optimization level, and print a summary at the end.

From-SVN: r226697
parent 00ebbcbc
2015-08-06 David Malcolm <dmalcolm@redhat.com>
* jit.dg/test-benchmark.c (main): Record all elapsed times at each
optimization level, and print a summary at the end.
2015-08-06 Jiong Wang <jiong.wang@arm.com> 2015-08-06 Jiong Wang <jiong.wang@arm.com>
* gcc.target/aarch64/tlsdesc_hoist.c: New testcase. * gcc.target/aarch64/tlsdesc_hoist.c: New testcase.
......
...@@ -222,13 +222,14 @@ main (int argc, char **argv) ...@@ -222,13 +222,14 @@ main (int argc, char **argv)
{ {
int opt_level; int opt_level;
int num_iterations = 100; int num_iterations = 100;
double elapsed_time[4];
ticks_to_msec = TICKS_TO_MSEC; ticks_to_msec = TICKS_TO_MSEC;
for (opt_level = 0; opt_level < 4; opt_level++) for (opt_level = 0; opt_level < 4; opt_level++)
{ {
int i; int i;
double start_time, end_time, elapsed_time; double start_time, end_time;
start_time = get_wallclock_time (); start_time = get_wallclock_time ();
gcc_jit_timer *timer = gcc_jit_timer_new (); gcc_jit_timer *timer = gcc_jit_timer_new ();
for (i = 1; i <= num_iterations; i++) for (i = 1; i <= num_iterations; i++)
...@@ -240,7 +241,7 @@ main (int argc, char **argv) ...@@ -240,7 +241,7 @@ main (int argc, char **argv)
test_jit (argv[0], opt_level, timer); test_jit (argv[0], opt_level, timer);
} }
end_time = get_wallclock_time (); end_time = get_wallclock_time ();
elapsed_time = end_time - start_time; elapsed_time[opt_level] = end_time - start_time;
gcc_jit_timer_print (timer, stderr); gcc_jit_timer_print (timer, stderr);
gcc_jit_timer_release (timer); gcc_jit_timer_release (timer);
pass ("%s: survived %i iterations at optlevel %i", pass ("%s: survived %i iterations at optlevel %i",
...@@ -248,9 +249,20 @@ main (int argc, char **argv) ...@@ -248,9 +249,20 @@ main (int argc, char **argv)
note (("%s: %i iterations at optlevel %i" note (("%s: %i iterations at optlevel %i"
" took a total of %.3fs (%.3fs per iteration)"), " took a total of %.3fs (%.3fs per iteration)"),
argv[0], num_iterations, opt_level, argv[0], num_iterations, opt_level,
elapsed_time, elapsed_time / num_iterations); elapsed_time[opt_level],
elapsed_time[opt_level] / num_iterations);
} }
totals (); totals ();
/* Print a summary. */
printf ("%s: %i iterations: time taken (lower is better)\n",
argv[0], num_iterations);
for (opt_level = 0; opt_level < 4; opt_level++)
printf ("optlevel %i: %.3fs (%.3fs per iteration)\n",
opt_level,
elapsed_time[opt_level],
elapsed_time[opt_level] / num_iterations);
return 0; return 0;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment