From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753277AbcDNFox (ORCPT ); Thu, 14 Apr 2016 01:44:53 -0400 Received: from terminus.zytor.com ([198.137.202.10]:47556 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753090AbcDNFow (ORCPT ); Thu, 14 Apr 2016 01:44:52 -0400 Date: Wed, 13 Apr 2016 22:44:29 -0700 From: tip-bot for Jiri Olsa Message-ID: Cc: hpa@zytor.com, mingo@kernel.org, dsahern@gmail.com, jolsa@kernel.org, a.p.zijlstra@chello.nl, namhyung@kernel.org, tglx@linutronix.de, linux-kernel@vger.kernel.org, acme@redhat.com Reply-To: acme@redhat.com, linux-kernel@vger.kernel.org, namhyung@kernel.org, tglx@linutronix.de, a.p.zijlstra@chello.nl, jolsa@kernel.org, mingo@kernel.org, dsahern@gmail.com, hpa@zytor.com In-Reply-To: <1460467771-26532-5-git-send-email-jolsa@kernel.org> References: <1460467771-26532-5-git-send-email-jolsa@kernel.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf sched: Use color_fprintf for output Git-Commit-ID: 8cd91195e5efc5166fc48eec6cf83ef93133b7b6 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 8cd91195e5efc5166fc48eec6cf83ef93133b7b6 Gitweb: http://git.kernel.org/tip/8cd91195e5efc5166fc48eec6cf83ef93133b7b6 Author: Jiri Olsa AuthorDate: Tue, 12 Apr 2016 15:29:27 +0200 Committer: Arnaldo Carvalho de Melo CommitDate: Wed, 13 Apr 2016 10:11:51 -0300 perf sched: Use color_fprintf for output As preparation for next patch. Signed-off-by: Jiri Olsa Cc: David Ahern Cc: Namhyung Kim Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/1460467771-26532-5-git-send-email-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-sched.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c index 64dd946..9ef2897 100644 --- a/tools/perf/builtin-sched.c +++ b/tools/perf/builtin-sched.c @@ -11,6 +11,7 @@ #include "util/session.h" #include "util/tool.h" #include "util/cloexec.h" +#include "util/color.h" #include #include "util/trace-event.h" @@ -1357,6 +1358,7 @@ static int map_switch_event(struct perf_sched *sched, struct perf_evsel *evsel, int i, this_cpu = sample->cpu; int cpus_nr; bool new_cpu = false; + const char *color = PERF_COLOR_NORMAL; BUG_ON(this_cpu >= MAX_CPUS || this_cpu < 0); @@ -1422,26 +1424,26 @@ static int map_switch_event(struct perf_sched *sched, struct perf_evsel *evsel, int cpu = sched->map.comp ? sched->map.comp_cpus[i] : i; if (cpu != this_cpu) - printf(" "); + color_fprintf(stdout, color, " "); else - printf("*"); + color_fprintf(stdout, color, "*"); if (sched->curr_thread[cpu]) - printf("%2s ", sched->curr_thread[cpu]->shortname); + color_fprintf(stdout, color, "%2s ", sched->curr_thread[cpu]->shortname); else - printf(" "); + color_fprintf(stdout, color, " "); } - printf(" %12.6f secs ", (double)timestamp/1e9); + color_fprintf(stdout, color, " %12.6f secs ", (double)timestamp/1e9); if (new_shortname) { - printf("%s => %s:%d", + color_fprintf(stdout, color, "%s => %s:%d", sched_in->shortname, thread__comm_str(sched_in), sched_in->tid); } if (sched->map.comp && new_cpu) - printf(" (CPU %d)", this_cpu); + color_fprintf(stdout, color, " (CPU %d)", this_cpu); - printf("\n"); + color_fprintf(stdout, color, "\n"); thread__put(sched_in);