|
@@ -1764,19 +1764,37 @@ static void print_header(int argc, const char **argv)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+static int get_precision(double num)
|
|
|
|
+{
|
|
|
|
+ if (num > 1)
|
|
|
|
+ return 0;
|
|
|
|
+
|
|
|
|
+ return lround(ceil(-log10(num)));
|
|
|
|
+}
|
|
|
|
+
|
|
static void print_footer(void)
|
|
static void print_footer(void)
|
|
{
|
|
{
|
|
|
|
+ double avg = avg_stats(&walltime_nsecs_stats) / NSEC_PER_SEC;
|
|
FILE *output = stat_config.output;
|
|
FILE *output = stat_config.output;
|
|
int n;
|
|
int n;
|
|
|
|
|
|
if (!null_run)
|
|
if (!null_run)
|
|
fprintf(output, "\n");
|
|
fprintf(output, "\n");
|
|
- fprintf(output, " %17.9f seconds time elapsed",
|
|
|
|
- avg_stats(&walltime_nsecs_stats) / NSEC_PER_SEC);
|
|
|
|
- if (run_count > 1) {
|
|
|
|
- fprintf(output, " ");
|
|
|
|
- print_noise_pct(stddev_stats(&walltime_nsecs_stats),
|
|
|
|
- avg_stats(&walltime_nsecs_stats));
|
|
|
|
|
|
+
|
|
|
|
+ if (run_count == 1) {
|
|
|
|
+ fprintf(output, " %17.9f seconds time elapsed", avg);
|
|
|
|
+ } else {
|
|
|
|
+ double sd = stddev_stats(&walltime_nsecs_stats) / NSEC_PER_SEC;
|
|
|
|
+ /*
|
|
|
|
+ * Display at most 2 more significant
|
|
|
|
+ * digits than the stddev inaccuracy.
|
|
|
|
+ */
|
|
|
|
+ int precision = get_precision(sd) + 2;
|
|
|
|
+
|
|
|
|
+ fprintf(output, " %17.*f +- %.*f seconds time elapsed",
|
|
|
|
+ precision, avg, precision, sd);
|
|
|
|
+
|
|
|
|
+ print_noise_pct(sd, avg);
|
|
}
|
|
}
|
|
fprintf(output, "\n\n");
|
|
fprintf(output, "\n\n");
|
|
|
|
|