From f782113fd6d5190a305335eb104333429c2c26f4 Mon Sep 17 00:00:00 2001 From: "Steven G. Johnson" Date: Wed, 19 Jun 2019 14:33:47 -0400 Subject: [PATCH 1/2] print more timing statistics --- src/time.cpp | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/time.cpp b/src/time.cpp index 6c5f36ea6..7a594d534 100644 --- a/src/time.cpp +++ b/src/time.cpp @@ -58,14 +58,32 @@ static const char *ts2n(time_sink s) { return "everything else"; } -static void pt(double ts[], time_sink s) { - if (ts[s]) master_printf(" %21s: %g s\n", ts2n(s), ts[s]); +static void pt(double mean[], double stddev[], time_sink s) { + if (mean[s] != 0) { + if (stddev[s] != 0) + master_printf(" %21s: %g s +/- %g s\n", ts2n(s), mean[s], stddev[s]); + else + master_printf(" %21s: %g s\n", ts2n(s), mean[s]); + } } void fields::print_times() { + double mean[Other + 1], square_times[Other + 1], stddev[Other + 1]; + int n = count_processors(); + + for (int i = 0; i <= Other; ++i) + square_times[i] = times_spent[i] * times_spent[i]; + sum_to_master(times_spent, mean, Other+1); + sum_to_master(square_times, stddev, Other+1); + for (int i = 0; i <= Other; ++i) { + mean[i] /= n; + stddev[i] -= n*mean[i]*mean[i] + stddev[i] = n == 1 || stddev[i] <= 0 ? 0.0 : sqrt(stddev[i] / (n-1)); + } + master_printf("\nField time usage:\n"); for (int i = 0; i <= Other; i++) - pt(times_spent, (time_sink)i); + pt(mean, stddev, (time_sink)i); master_printf("\n"); } From af641c15d3daf3a3256471d9ac7ad9f5827ac1d2 Mon Sep 17 00:00:00 2001 From: "Steven G. Johnson" Date: Wed, 19 Jun 2019 14:35:37 -0400 Subject: [PATCH 2/2] whoops --- src/time.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/time.cpp b/src/time.cpp index 7a594d534..54770b895 100644 --- a/src/time.cpp +++ b/src/time.cpp @@ -77,7 +77,7 @@ void fields::print_times() { sum_to_master(square_times, stddev, Other+1); for (int i = 0; i <= Other; ++i) { mean[i] /= n; - stddev[i] -= n*mean[i]*mean[i] + stddev[i] -= n*mean[i]*mean[i]; stddev[i] = n == 1 || stddev[i] <= 0 ? 0.0 : sqrt(stddev[i] / (n-1)); }