From 4e11d56f8e5f409ea2476315c9d67116b213b738 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Thu, 4 Jun 2009 11:16:48 +0100 Subject: [PATCH] [perf] Update trace summary after each iteration Running the macro-benchmarks takes so long, feedback is important. --- perf/cairo-perf-trace.c | 29 ++++++++++++++++++++++++++++- perf/cairo-perf.h | 1 + 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/perf/cairo-perf-trace.c b/perf/cairo-perf-trace.c index 7114ae0f7..6ee63a3c8 100644 --- a/perf/cairo-perf-trace.c +++ b/perf/cairo-perf-trace.c @@ -200,7 +200,7 @@ execute (cairo_perf_t *perf, fprintf (perf->summary, "[ # ] %8s %28s %8s %5s %5s %s\n", "backend", "test", "min(s)", "median(s)", - "stddev.", "iterations"); + "stddev.", "count"); } first_run = FALSE; } @@ -256,11 +256,35 @@ execute (cairo_perf_t *perf, } } } + + if (perf->summary && perf->summary_continuous) { + _cairo_stats_compute (&stats, times, i+1); + + fprintf (perf->summary, + "\r[%3d] %8s %28s ", + perf->test_number, + perf->target->name, + name); + fprintf (perf->summary, + "%#8.3f %#8.3f %#5.2f%% %3d", + stats.min_ticks / (double) cairo_perf_ticks_per_second (), + stats.median_ticks / (double) cairo_perf_ticks_per_second (), + stats.std_dev * 100.0, + stats.iterations); + fflush (perf->summary); + } } user_interrupt = 0; if (perf->summary) { _cairo_stats_compute (&stats, times, i); + if (perf->summary_continuous) { + fprintf (perf->summary, + "\r[%3d] %8s %28s ", + perf->test_number, + perf->target->name, + name); + } fprintf (perf->summary, "%#8.3f %#8.3f %#5.2f%% %3d\n", stats.min_ticks / (double) cairo_perf_ticks_per_second (), @@ -319,6 +343,7 @@ parse_options (cairo_perf_t *perf, int argc, char *argv[]) perf->names = NULL; perf->num_names = 0; perf->summary = stdout; + perf->summary_continuous = FALSE; while (1) { c = _cairo_getopt (argc, argv, "i:lrv"); @@ -356,6 +381,8 @@ parse_options (cairo_perf_t *perf, int argc, char *argv[]) if (verbose && perf->summary == NULL) perf->summary = stderr; + if (perf->summary == stdout && isatty (fileno(stdout))) + perf->summary_continuous = TRUE; if (optind < argc) { perf->names = &argv[optind]; diff --git a/perf/cairo-perf.h b/perf/cairo-perf.h index 05447fba8..3ff3d7f04 100644 --- a/perf/cairo-perf.h +++ b/perf/cairo-perf.h @@ -70,6 +70,7 @@ cairo_perf_yield (void); /* running a test case */ typedef struct _cairo_perf { FILE *summary; + cairo_bool_t summary_continuous; /* Options from command-line */ unsigned int iterations;