diff options
author | Jiri Olsa <jolsa@kernel.org> | 2016-04-12 09:29:27 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2016-04-13 09:11:51 -0400 |
commit | 8cd91195e5efc5166fc48eec6cf83ef93133b7b6 (patch) | |
tree | b864c04b94aed3c2db95639a430ab3041f69ff5e | |
parent | 99623c628f5425f09b5321cf621af1da29c0c47d (diff) |
perf sched: Use color_fprintf for output
As preparation for next patch.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1460467771-26532-5-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r-- | tools/perf/builtin-sched.c | 18 |
1 files 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 @@ | |||
11 | #include "util/session.h" | 11 | #include "util/session.h" |
12 | #include "util/tool.h" | 12 | #include "util/tool.h" |
13 | #include "util/cloexec.h" | 13 | #include "util/cloexec.h" |
14 | #include "util/color.h" | ||
14 | 15 | ||
15 | #include <subcmd/parse-options.h> | 16 | #include <subcmd/parse-options.h> |
16 | #include "util/trace-event.h" | 17 | #include "util/trace-event.h" |
@@ -1357,6 +1358,7 @@ static int map_switch_event(struct perf_sched *sched, struct perf_evsel *evsel, | |||
1357 | int i, this_cpu = sample->cpu; | 1358 | int i, this_cpu = sample->cpu; |
1358 | int cpus_nr; | 1359 | int cpus_nr; |
1359 | bool new_cpu = false; | 1360 | bool new_cpu = false; |
1361 | const char *color = PERF_COLOR_NORMAL; | ||
1360 | 1362 | ||
1361 | BUG_ON(this_cpu >= MAX_CPUS || this_cpu < 0); | 1363 | BUG_ON(this_cpu >= MAX_CPUS || this_cpu < 0); |
1362 | 1364 | ||
@@ -1422,26 +1424,26 @@ static int map_switch_event(struct perf_sched *sched, struct perf_evsel *evsel, | |||
1422 | int cpu = sched->map.comp ? sched->map.comp_cpus[i] : i; | 1424 | int cpu = sched->map.comp ? sched->map.comp_cpus[i] : i; |
1423 | 1425 | ||
1424 | if (cpu != this_cpu) | 1426 | if (cpu != this_cpu) |
1425 | printf(" "); | 1427 | color_fprintf(stdout, color, " "); |
1426 | else | 1428 | else |
1427 | printf("*"); | 1429 | color_fprintf(stdout, color, "*"); |
1428 | 1430 | ||
1429 | if (sched->curr_thread[cpu]) | 1431 | if (sched->curr_thread[cpu]) |
1430 | printf("%2s ", sched->curr_thread[cpu]->shortname); | 1432 | color_fprintf(stdout, color, "%2s ", sched->curr_thread[cpu]->shortname); |
1431 | else | 1433 | else |
1432 | printf(" "); | 1434 | color_fprintf(stdout, color, " "); |
1433 | } | 1435 | } |
1434 | 1436 | ||
1435 | printf(" %12.6f secs ", (double)timestamp/1e9); | 1437 | color_fprintf(stdout, color, " %12.6f secs ", (double)timestamp/1e9); |
1436 | if (new_shortname) { | 1438 | if (new_shortname) { |
1437 | printf("%s => %s:%d", | 1439 | color_fprintf(stdout, color, "%s => %s:%d", |
1438 | sched_in->shortname, thread__comm_str(sched_in), sched_in->tid); | 1440 | sched_in->shortname, thread__comm_str(sched_in), sched_in->tid); |
1439 | } | 1441 | } |
1440 | 1442 | ||
1441 | if (sched->map.comp && new_cpu) | 1443 | if (sched->map.comp && new_cpu) |
1442 | printf(" (CPU %d)", this_cpu); | 1444 | color_fprintf(stdout, color, " (CPU %d)", this_cpu); |
1443 | 1445 | ||
1444 | printf("\n"); | 1446 | color_fprintf(stdout, color, "\n"); |
1445 | 1447 | ||
1446 | thread__put(sched_in); | 1448 | thread__put(sched_in); |
1447 | 1449 | ||