diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2013-06-11 11:57:04 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2013-06-11 11:57:04 +0100 |
commit | 2c097e6e6b8375b7d488572cdb09b80dca06d42a (patch) | |
tree | d5b6eef2ac48d36c3e5a793fa19033ddd2d20944 /perf | |
parent | b9f0ef4496eca31b47296543f48078b2a7034750 (diff) | |
download | cairo-2c097e6e6b8375b7d488572cdb09b80dca06d42a.tar.gz |
perf: Avoid vertically stretching the histogram
If we have more rows than the max_count in any column, we end up
stretching the histogram vertically, which makes it harder to read.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'perf')
-rw-r--r-- | perf/cairo-stats.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/perf/cairo-stats.c b/perf/cairo-stats.c index c10c92192..aee9fe8b5 100644 --- a/perf/cairo-stats.c +++ b/perf/cairo-stats.c @@ -156,10 +156,13 @@ void _cairo_histogram_printf (cairo_histogram_t *h, FILE *file) { - int x, y; + int x, y, num_rows; - for (y = 0; y < h->num_rows; y++) { - int min_count = (h->num_rows - y - 1) * h->max_count / h->num_rows; + num_rows = h->num_rows; + if (h->max_count < num_rows) + num_rows = h->max_count; + for (y = 0; y < num_rows; y++) { + int min_count = ((num_rows - y - 1) * h->max_count) / num_rows + h->max_count / (2*num_rows); fprintf (file, "|"); for (x = 0; x < h->num_columns; x++) fprintf (file, "%c", h->columns[x] > min_count ? 'x' : ' '); |