public inbox for jit@gcc.gnu.org
 help / color / mirror / Atom feed
From: David Malcolm <dmalcolm@redhat.com>
To: jit@gcc.gnu.org, gcc-patches@gcc.gnu.org
Cc: David Malcolm <dmalcolm@redhat.com>
Subject: [PATCH, committed] jit.dg/test-benchmark.c: add a summary of timings
Date: Thu, 01 Jan 2015 00:00:00 -0000	[thread overview]
Message-ID: <1438890165-64291-1-git-send-email-dmalcolm@redhat.com> (raw)

Committed to trunk as r226697.
Backported to gcc-5-branch as r226698.

gcc/testsuite/ChangeLog:
	* jit.dg/test-benchmark.c (main): Record all elapsed times at each
	optimization level, and print a summary at the end.
---
 gcc/testsuite/jit.dg/test-benchmark.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/gcc/testsuite/jit.dg/test-benchmark.c b/gcc/testsuite/jit.dg/test-benchmark.c
index 4952fff..ca2984c 100644
--- a/gcc/testsuite/jit.dg/test-benchmark.c
+++ b/gcc/testsuite/jit.dg/test-benchmark.c
@@ -222,13 +222,14 @@ main (int argc, char **argv)
 {
   int opt_level;
   int num_iterations = 100;
+  double elapsed_time[4];
 
   ticks_to_msec = TICKS_TO_MSEC;
 
   for (opt_level = 0; opt_level < 4; opt_level++)
     {
       int i;
-      double start_time, end_time, elapsed_time;
+      double start_time, end_time;
       start_time = get_wallclock_time ();
       gcc_jit_timer *timer = gcc_jit_timer_new ();
       for (i = 1; i <= num_iterations; i++)
@@ -240,7 +241,7 @@ main (int argc, char **argv)
 	  test_jit (argv[0], opt_level, timer);
 	}
       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_release (timer);
       pass ("%s: survived %i iterations at optlevel %i",
@@ -248,9 +249,20 @@ main (int argc, char **argv)
       note (("%s: %i iterations at optlevel %i"
 	     " took a total of %.3fs (%.3fs per iteration)"),
 	    argv[0], num_iterations, opt_level,
-	    elapsed_time, elapsed_time / num_iterations);
+	    elapsed_time[opt_level],
+	    elapsed_time[opt_level] / num_iterations);
     }
+
   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;
 }
-- 
1.8.5.3

                 reply	other threads:[~2015-08-06 21:05 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1438890165-64291-1-git-send-email-dmalcolm@redhat.com \
    --to=dmalcolm@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jit@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).