From 177b3821c9859746760f2f5d06f3f0ac502c9927 Mon Sep 17 00:00:00 2001 From: Pedro Gonnet <gonnet@google.com> Date: Sun, 9 Apr 2017 22:43:31 +0200 Subject: [PATCH] add the option of dumping the timers in each time step. --- examples/main.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/examples/main.c b/examples/main.c index abda7c3515..e0f0c03767 100644 --- a/examples/main.c +++ b/examples/main.c @@ -165,12 +165,13 @@ int main(int argc, char *argv[]) { int with_drift_all = 0; int verbose = 0; int nr_threads = 1; + int with_verbose_timers = 0; char paramFileName[200] = ""; unsigned long long cpufreq = 0; /* Parse the parameters */ int c; - while ((c = getopt(argc, argv, "acCdDef:FgGhn:sSt:v:y:")) != -1) switch (c) { + while ((c = getopt(argc, argv, "acCdDef:FgGhn:sSt:Tv:y:")) != -1) switch (c) { case 'a': with_aff = 1; break; @@ -229,6 +230,9 @@ int main(int argc, char *argv[]) { return 1; } break; + case 'T': + with_verbose_timers = 1; + break; case 'v': if (sscanf(optarg, "%d", &verbose) != 1) { if (myrank == 0) printf("Error parsing verbosity level (-v).\n"); @@ -600,10 +604,11 @@ int main(int argc, char *argv[]) { printf("# %6s %14s %14s %10s %10s %10s %16s [%s]\n", "Step", "Time", "Time-step", "Updates", "g-Updates", "s-Updates", "Wall-clock time", clocks_getunit()); - printf("timers: "); - for (int k = 0; k < timer_count; k++) - printf("%s\t", timers_names[k]); - printf("\n"); + if (with_verbose_timers) { + printf("timers: "); + for (int k = 0; k < timer_count; k++) printf("%s\t", timers_names[k]); + printf("\n"); + } } /* Main simulation loop */ @@ -614,12 +619,14 @@ int main(int argc, char *argv[]) { /* Take a step. */ engine_step(&e); - + /* Print the timers. */ - printf("timers: "); - for (int k = 0; k < timer_count; k++) - printf("%.3f\t", clocks_from_ticks(timers[k])); - printf("\n"); + if (with_verbose_timers) { + printf("timers: "); + for (int k = 0; k < timer_count; k++) + printf("%.3f\t", clocks_from_ticks(timers[k])); + printf("\n"); + } #ifdef SWIFT_DEBUG_TASKS /* Dump the task data using the given frequency. */ -- GitLab