diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2013-06-11 11:05:03 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2013-06-11 11:30:43 +0100 |
commit | 9a12c2e02369f0920c1f1f578eb8d228add77ea1 (patch) | |
tree | a8c0e8772c894d06f8030813ea9c7bd85577c5fd /perf/cairo-perf-print.c | |
parent | e519d6f9860c7f0bc51f1e8a17505f2dc372c938 (diff) | |
download | cairo-9a12c2e02369f0920c1f1f578eb8d228add77ea1.tar.gz |
perf: Rudimentary histogram printing for cairo-perf-print
If you call ./cairo-perf-print --histogram results.txt, it will then
print a histogram of the results, one per test. Ideally, you should see
a skewed distribution (with a negative skew representing that most results
run in optimal time), but random sampling errors (scheduling,
throttling, general inefficiency etc) will push it more towards a normal
distribution.
For example,
| x |
| x xx |
| x xx |
| x xx |
| xxxx |
| xxxx x |
| x xxxxxx |
| x xxxxxx |
| xxxxxxxxx |
| xxxxxxxxx |
| xxxxxxxxx |
| xxxxxxxxxxxx |
| xxxxxxxxxxxx |
| xxxxxxxxxxxx |
| xxxxxxxxxxxxxx |
|x xxxxxxxxxxxxxx |
|x x xxxxxxxxxxxxxxx |
|x x xxxxxxxxxxxxxxx |
|x x xxxxxxxxxxxxxxxxx |
|xxx x xxxxxxxxxxxxxxxxxxx |
|xxx xxxxxxxxxxxxxxxxxxxxxxxxx |
|xxxxxx xxxx x x x x xxx xx xxxxx xxx x xxx x xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx|
.------------------------------------------------------------------------------.
xlib firefox-fishtank 8298.44 1.53% (829/946)
Starts off reasonably, but quickly deteriorates as the integrated CPU/GPU
overheats and is forced to throttle.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'perf/cairo-perf-print.c')
-rw-r--r-- | perf/cairo-perf-print.c | 65 |
1 files changed, 49 insertions, 16 deletions
diff --git a/perf/cairo-perf-print.c b/perf/cairo-perf-print.c index 16a3ff4b9..b6cf4ca01 100644 --- a/perf/cairo-perf-print.c +++ b/perf/cairo-perf-print.c @@ -28,45 +28,78 @@ */ #include "cairo-perf.h" +#include "cairo-stats.h" #include <stdio.h> static void -report_print (const cairo_perf_report_t *report) +report_print (const cairo_perf_report_t *report, + int show_histogram) { - const test_report_t *tests; + const test_report_t *test; + cairo_histogram_t h; - tests = report->tests; - for (tests = report->tests; tests->name != NULL; tests++) { - if (tests->stats.iterations == 0) + if (show_histogram && !_cairo_histogram_init (&h, 80, 23)) + show_histogram = 0; + + for (test = report->tests; test->name != NULL; test++) { + if (test->stats.iterations == 0) continue; - if (tests->size) { - printf ("%5s-%-4s %26s-%-3d %6.2f %4.2f%%\n", - tests->backend, tests->content, - tests->name, tests->size, - tests->stats.median_ticks / tests->stats.ticks_per_ms, - tests->stats.std_dev * 100); + if (show_histogram) { + const cairo_time_t *values; + int num_values; + + if (show_histogram > 1) { + values = test->stats.values; + num_values = test->stats.iterations; + } else { + values = test->samples; + num_values = test->samples_count; + } + + if (_cairo_histogram_compute (&h, values, num_values)) + _cairo_histogram_printf (&h, stdout); + } + + if (test->size) { + printf ("%5s-%-4s %26s-%-3d ", + test->backend, test->content, + test->name, test->size); } else { - printf ("%5s %26s %6.2f %4.2f%%\n", - tests->backend, tests->name, - tests->stats.median_ticks / tests->stats.ticks_per_ms, - tests->stats.std_dev * 100); + printf ("%5s %26s ", test->backend, test->name); } + printf("%6.2f %4.2f%% (%d/%d)\n", + test->stats.median_ticks / test->stats.ticks_per_ms, + test->stats.std_dev * 100, + test->stats.iterations, test->samples_count); } + + _cairo_histogram_fini (&h); } int main (int argc, const char *argv[]) { + cairo_bool_t show_histogram = 0; int i; for (i = 1; i < argc; i++ ) { cairo_perf_report_t report; + if (strcmp(argv[i], "--histogram") == 0) { + show_histogram = 1; + continue; + } + + if (strcmp(argv[i], "--short-histogram") == 0) { + show_histogram = 2; + continue; + } + cairo_perf_report_load (&report, argv[i], i, NULL); - report_print (&report); + report_print (&report, show_histogram); } return 0; |