]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
benchtests: Fix pthread-locks test to produce valid json
authorSiddhesh Poyarekar <siddhesh@sourceware.org>
Sun, 18 Apr 2021 07:19:54 +0000 (12:49 +0530)
committerSiddhesh Poyarekar <siddhesh@sourceware.org>
Sun, 18 Apr 2021 07:26:29 +0000 (12:56 +0530)
The benchtests json allows {function {variant}} categorization of
results whereas the pthread-locks tests had {function {variant
{subvariant}}}, which broke validation.  Fix that by serializing the
subvariants as variant-subvariant.  Also update the schema to
recognize the new benchmark attributes after fixing the naming
conventions.

benchtests/bench-pthread-locks.c
benchtests/scripts/benchout.schema.json

index 318c92bd8e84df6e56c0e0c5d2d5d7f268b78e29..5274246a4bd28f09e9b1b5bbb1d300566abec20f 100644 (file)
@@ -487,17 +487,20 @@ do_bench_2 (const char *name, test_t func, int filler, json_ctx_t *js)
     }
   stdev = sqrt (stdev / (RUN_COUNT - 1));
 
-  json_attr_object_begin (js, filler ? "filler" : "empty");
+  char buf[128];
+  snprintf (buf, sizeof buf, "%s-%s", name, filler ? "filler" : "empty");
+
+  json_attr_object_begin (js, buf);
 
   json_attr_double (js, "duration", (double) cur);
   json_attr_double (js, "iterations", (double) iters);
-  json_attr_double (js, "wall_sec", (double) td);
+  json_attr_double (js, "wall-sec", (double) td);
   json_attr_double (js, "mean", mean);
   json_attr_double (js, "stdev", stdev);
-  json_attr_double (js, "min_outlier", (double) curs[0] / (double) iters);
+  json_attr_double (js, "min-outlier", (double) curs[0] / (double) iters);
   json_attr_double (js, "min", (double) curs[1] / (double) iters);
   json_attr_double (js, "max", (double) curs[RUN_COUNT] / (double) iters);
-  json_attr_double (js, "max_outlier", (double) curs[RUN_COUNT + 1] / (double) iters);
+  json_attr_double (js, "max-outlier", (double) curs[RUN_COUNT + 1] / (double) iters);
 
   json_attr_object_end (js);
 
@@ -509,13 +512,9 @@ do_bench_1 (const char *name, test_t func, json_ctx_t *js)
 {
   int rv = 0;
 
-  json_attr_object_begin (js, name);
-
   rv += do_bench_2 (name, func, 0, js);
   rv += do_bench_2 (name, func, 1, js);
 
-  json_attr_object_end (js);
-
   return rv;
 }
 
index 8cfd6064972188cf711de1cbbf1bf5a1a8e7a40b..5f098e91c9740c973dc7b41c32c90e1cc1be7e06 100644 (file)
                 "min-throughput": {"type": "number"},
                 "max-throughput": {"type": "number"},
                 "reciprocal-throughput": {"type": "number"},
+                "min-outlier": {"type": "number"},
+                "max-outlier": {"type": "number"},
+                "wall-sec": {"type": "number"},
+                "stdev": {"type": "number"},
                 "timings": {
                   "type": "array",
                   "items": {"type": "number"}