aboutsummaryrefslogtreecommitdiff
path: root/benchtests/bench-skeleton.c
diff options
context:
space:
mode:
authorSiddhesh Poyarekar <siddhesh@redhat.com>2014-03-29 09:37:44 +0530
committerSiddhesh Poyarekar <siddhesh@redhat.com>2014-03-29 09:37:44 +0530
commitcb5e4aada7f044fc029dd64b31411a23bb09c287 (patch)
tree24f50d1418ef624707a8745737c89086944528a5 /benchtests/bench-skeleton.c
parentcf806aff6067273307d958f35c0a4cd0b0d40e80 (diff)
downloadglibc-cb5e4aada7f044fc029dd64b31411a23bb09c287.zip
glibc-cb5e4aada7f044fc029dd64b31411a23bb09c287.tar.gz
glibc-cb5e4aada7f044fc029dd64b31411a23bb09c287.tar.bz2
Make bench.out in json format
This patch changes the output format of the main benchmark output file (bench.out) to an extensible format. I chose JSON over XML because in addition to being extensible, it is also not too verbose. Additionally it has good support in python. The significant change I have made in terms of functionality is to put timing information as an attribute in JSON instead of a string and to do that, there is a separate program that prints out a JSON snippet mentioning the type of timing (hp_timing or clock_gettime). The mean timing has now changed from iterations per unit to actual timing per iteration.
Diffstat (limited to 'benchtests/bench-skeleton.c')
-rw-r--r--benchtests/bench-skeleton.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/benchtests/bench-skeleton.c b/benchtests/bench-skeleton.c
index 4290e76..faef7eb 100644
--- a/benchtests/bench-skeleton.c
+++ b/benchtests/bench-skeleton.c
@@ -59,8 +59,13 @@ main (int argc, char **argv)
iters = 1000 * res;
+ /* Begin function. */
+ printf ("\"%s\": {\n", FUNCNAME);
+
for (int v = 0; v < NUM_VARIANTS; v++)
{
+ if (v)
+ putc (',', stdout);
/* Run for approximately DURATION seconds. */
clock_gettime (CLOCK_MONOTONIC_RAW, &runtime);
runtime.tv_sec += DURATION;
@@ -86,7 +91,6 @@ main (int argc, char **argv)
min = cur;
TIMING_ACCUM (total, cur);
-
d_total_i += iters;
}
struct timespec curtime;
@@ -104,9 +108,17 @@ main (int argc, char **argv)
d_total_s = total;
d_iters = iters;
- TIMING_PRINT_STATS (VARIANT (v), d_total_s, d_iters, d_total_i, max,
- min);
+ printf ("\"%s\": {\n", VARIANT (v));
+ printf ("\"duration\": %g, \"iterations\": %g, "
+ "\"max\": %g, \"min\": %g, \"mean\": %g\n",
+ d_total_s, d_total_i, max / d_iters, min / d_iters,
+ d_total_s / d_total_i);
+
+ puts ("}");
}
+ /* End function. */
+ puts ("}");
+
return 0;
}