summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorRamkumar Ramachandra <artagnon@gmail.com>2013-12-30 08:34:18 +0100
committerArnaldo Carvalho de Melo <acme@redhat.com>2014-01-13 14:46:39 +0100
commitf77c6e9c8f9c444cd44423df0c2708e86a06a696 (patch)
treef159da4879b94073e30a40ad55844f531c862867 /tools
parenttools include: Include <linux/compiler.h> from asm/bug.h (diff)
downloadlinux-f77c6e9c8f9c444cd44423df0c2708e86a06a696.tar.xz
linux-f77c6e9c8f9c444cd44423df0c2708e86a06a696.zip
perf tools: Generalize percent_color_snprintf()
Make percent_color_snprintf() handle negative values correctly. Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com> Acked-by: Jiri Olsa <jolsa@redhat.com> Cc: Jiri Olsa <jolsa@redhat.com> Link: http://lkml.kernel.org/r/1388388861-7931-2-git-send-email-artagnon@gmail.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/util/color.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/perf/util/color.c b/tools/perf/util/color.c
index 66e44a5019d5..8cda46c43e74 100644
--- a/tools/perf/util/color.c
+++ b/tools/perf/util/color.c
@@ -1,6 +1,7 @@
#include <linux/kernel.h>
#include "cache.h"
#include "color.h"
+#include <math.h>
int perf_use_color_default = -1;
@@ -298,10 +299,10 @@ const char *get_percent_color(double percent)
* entries in green - and keep the low overhead places
* normal:
*/
- if (percent >= MIN_RED)
+ if (fabs(percent) >= MIN_RED)
color = PERF_COLOR_RED;
else {
- if (percent > MIN_GREEN)
+ if (fabs(percent) > MIN_GREEN)
color = PERF_COLOR_GREEN;
}
return color;