summaryrefslogtreecommitdiff
path: root/perf
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2009-10-26 11:01:01 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2009-10-26 11:03:16 +0000
commit6911ba2f76d4ccdf228c029e2719461a72848824 (patch)
treebcbb21681f07321c2ac14aafb38cf98bd9085b36 /perf
parentf955a4cba7784f97ef1dd978158e98176e03baf0 (diff)
perf: Fix comparisons
The sort order was unstable resulting in incorrect ordering dependent upon libc version.
Diffstat (limited to 'perf')
-rw-r--r--perf/cairo-perf-diff-files.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/perf/cairo-perf-diff-files.c b/perf/cairo-perf-diff-files.c
index 2d3b0855..a04014ca 100644
--- a/perf/cairo-perf-diff-files.c
+++ b/perf/cairo-perf-diff-files.c
@@ -55,21 +55,29 @@ test_diff_cmp_speedup_before_slowdown (const void *a, const void *b)
const test_diff_t *b_diff = b;
/* First make all speedups come before all slowdowns. */
- if (a_diff->change > 1.0 && b_diff->change < 1.0)
+ if (a_diff->change > 0 && b_diff->change < 0)
return -1;
- if (a_diff->change < 1.0 && b_diff->change > 1.0)
+ if (a_diff->change < 0 && b_diff->change > 0)
return 1;
if (a_diff->change == b_diff->change)
return 0;
/* Large speedups come first. */
- if (a_diff->change > 1. && a_diff->change > b_diff->change)
- return -1;
+ if (a_diff->change > 0) {
+ if (a_diff->change > b_diff->change)
+ return -1;
+ else
+ return 1;
+ }
/* Large slowdowns come last. */
- if (a_diff->change < 1. && a_diff->change < b_diff->change)
- return 1;
+ if (a_diff->change < 0) {
+ if (a_diff->change < b_diff->change)
+ return 1;
+ else
+ return -1;
+ }
return 0;
}
@@ -95,7 +103,7 @@ test_diff_cmp (const void *a, const void *b)
static void
print_change_bar (double change, double max_change, int use_utf)
{
- int units_per_cell = (int) ceil (max_change / CHANGE_BAR_WIDTH);
+ int units_per_cell = ceil (max_change / CHANGE_BAR_WIDTH);
static char const *ascii_boxes[8] = {
"****","***" ,"***", "**",
"**", "*", "*", ""