[tip:perf/core] perf tools: Generalize percent_color_snprintf()

2014-01-14 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  f77c6e9c8f9c444cd44423df0c2708e86a06a696
Gitweb: http://git.kernel.org/tip/f77c6e9c8f9c444cd44423df0c2708e86a06a696
Author: Ramkumar Ramachandra 
AuthorDate: Mon, 30 Dec 2013 13:04:18 +0530
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Mon, 13 Jan 2014 10:46:39 -0300

perf tools: Generalize percent_color_snprintf()

Make percent_color_snprintf() handle negative values correctly.

Signed-off-by: Ramkumar Ramachandra 
Acked-by: Jiri Olsa 
Cc: Jiri Olsa 
Link: 
http://lkml.kernel.org/r/1388388861-7931-2-git-send-email-artag...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/util/color.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/color.c b/tools/perf/util/color.c
index 66e44a5..8cda46c 100644
--- a/tools/perf/util/color.c
+++ b/tools/perf/util/color.c
@@ -1,6 +1,7 @@
 #include 
 #include "cache.h"
 #include "color.h"
+#include 
 
 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;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf tools: Generalize percent_color_snprintf()

2014-01-14 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  f77c6e9c8f9c444cd44423df0c2708e86a06a696
Gitweb: http://git.kernel.org/tip/f77c6e9c8f9c444cd44423df0c2708e86a06a696
Author: Ramkumar Ramachandra artag...@gmail.com
AuthorDate: Mon, 30 Dec 2013 13:04:18 +0530
Committer:  Arnaldo Carvalho de Melo a...@redhat.com
CommitDate: Mon, 13 Jan 2014 10:46:39 -0300

perf tools: Generalize percent_color_snprintf()

Make percent_color_snprintf() handle negative values correctly.

Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
Acked-by: Jiri Olsa jo...@redhat.com
Cc: Jiri Olsa jo...@redhat.com
Link: 
http://lkml.kernel.org/r/1388388861-7931-2-git-send-email-artag...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo a...@redhat.com
---
 tools/perf/util/color.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/color.c b/tools/perf/util/color.c
index 66e44a5..8cda46c 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;
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/