From: Jiri Olsa <jolsa@kernel.org>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: lkml <linux-kernel@vger.kernel.org>,
David Ahern <dsahern@gmail.com>, Ingo Molnar <mingo@kernel.org>,
Namhyung Kim <namhyung@kernel.org>,
Peter Zijlstra <a.p.zijlstra@chello.nl>
Subject: [PATCH 4/8] perf tools sched: Use color_fprintf for output
Date: Tue, 12 Apr 2016 15:29:27 +0200 [thread overview]
Message-ID: <1460467771-26532-5-git-send-email-jolsa@kernel.org> (raw)
In-Reply-To: <1460467771-26532-1-git-send-email-jolsa@kernel.org>
As preparation for next patch.
Link: http://lkml.kernel.org/n/tip-96g57gf3byte2tb7wgo9v0z1@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
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 64dd94667055..9ef28973f198 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 <subcmd/parse-options.h>
#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);
--
2.4.11
next prev parent reply other threads:[~2016-04-12 13:31 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-12 13:29 [PATCH 0/8] perf tools: Add sched map changes Jiri Olsa
2016-04-12 13:29 ` [PATCH 1/8] perf tools: Add thread_map__has function Jiri Olsa
2016-04-14 5:43 ` [tip:perf/core] perf thread_map: Add has() method tip-bot for Jiri Olsa
2016-04-12 13:29 ` [PATCH 2/8] perf tools: Add cpu_map__has function Jiri Olsa
2016-04-14 5:43 ` [tip:perf/core] perf cpu_map: Add has() method tip-bot for Jiri Olsa
2016-04-12 13:29 ` [PATCH 3/8] perf tools sched: Add compact display option Jiri Olsa
2016-04-12 14:09 ` Arnaldo Carvalho de Melo
2016-04-12 14:18 ` Arnaldo Carvalho de Melo
2016-04-14 5:44 ` [tip:perf/core] perf " tip-bot for Jiri Olsa
2016-04-12 13:29 ` Jiri Olsa [this message]
2016-04-14 5:44 ` [tip:perf/core] perf sched: Use color_fprintf for output tip-bot for Jiri Olsa
2016-04-12 13:29 ` [PATCH 5/8] perf tools sched: Make thread_map__new_by_tid_str global Jiri Olsa
2016-04-14 5:44 ` [tip:perf/core] perf thread_map: Make new_by_tid_str constructor public tip-bot for Jiri Olsa
2016-04-12 13:29 ` [PATCH 6/8] perf tools sched: Collor given pids Jiri Olsa
2016-04-14 5:45 ` [tip:perf/core] perf sched map: Color " tip-bot for Jiri Olsa
2016-04-12 13:29 ` [PATCH 7/8] perf tools sched: Collor given cpus Jiri Olsa
2016-04-14 5:45 ` [tip:perf/core] perf sched map: Color " tip-bot for Jiri Olsa
2016-04-12 13:29 ` [PATCH 8/8] perf tools sched: Display only " Jiri Olsa
2016-04-14 5:46 ` [tip:perf/core] perf sched map: " tip-bot for Jiri Olsa
2016-04-12 14:38 ` [PATCH 0/8] perf tools: Add sched map changes Arnaldo Carvalho de Melo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1460467771-26532-5-git-send-email-jolsa@kernel.org \
--to=jolsa@kernel.org \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@kernel.org \
--cc=dsahern@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox