Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751832AbaANODt (ORCPT ); Tue, 14 Jan 2014 09:03:49 -0500 Received: from merlin.infradead.org ([205.233.59.134]:33331 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751587AbaANODk (ORCPT ); Tue, 14 Jan 2014 09:03:40 -0500 From: Arnaldo Carvalho de Melo To: Ingo Molnar Cc: linux-kernel@vger.kernel.org, Ramkumar Ramachandra , Jiri Olsa , Arnaldo Carvalho de Melo Subject: [PATCH 33/38] perf tools: Generalize percent_color_snprintf() Date: Mon, 13 Jan 2014 17:47:34 -0300 Message-Id: <1389646059-24881-34-git-send-email-acme@infradead.org> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1389646059-24881-1-git-send-email-acme@infradead.org> References: <1389646059-24881-1-git-send-email-acme@infradead.org> X-SRS-Rewrite: SMTP reverse-path rewritten from by merlin.infradead.org See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ramkumar Ramachandra 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-artagnon@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 66e44a5019d5..8cda46c43e74 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; -- 1.8.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/