Commit 8cd91195 authored by Jiri Olsa's avatar Jiri Olsa Committed by Arnaldo Carvalho de Melo

perf sched: Use color_fprintf for output

As preparation for next patch.
Signed-off-by: default avatarJiri 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.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 99623c62
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "util/session.h" #include "util/session.h"
#include "util/tool.h" #include "util/tool.h"
#include "util/cloexec.h" #include "util/cloexec.h"
#include "util/color.h"
#include <subcmd/parse-options.h> #include <subcmd/parse-options.h>
#include "util/trace-event.h" #include "util/trace-event.h"
...@@ -1357,6 +1358,7 @@ static int map_switch_event(struct perf_sched *sched, struct perf_evsel *evsel, ...@@ -1357,6 +1358,7 @@ static int map_switch_event(struct perf_sched *sched, struct perf_evsel *evsel,
int i, this_cpu = sample->cpu; int i, this_cpu = sample->cpu;
int cpus_nr; int cpus_nr;
bool new_cpu = false; bool new_cpu = false;
const char *color = PERF_COLOR_NORMAL;
BUG_ON(this_cpu >= MAX_CPUS || this_cpu < 0); 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, ...@@ -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; int cpu = sched->map.comp ? sched->map.comp_cpus[i] : i;
if (cpu != this_cpu) if (cpu != this_cpu)
printf(" "); color_fprintf(stdout, color, " ");
else else
printf("*"); color_fprintf(stdout, color, "*");
if (sched->curr_thread[cpu]) if (sched->curr_thread[cpu])
printf("%2s ", sched->curr_thread[cpu]->shortname); color_fprintf(stdout, color, "%2s ", sched->curr_thread[cpu]->shortname);
else 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) { 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); sched_in->shortname, thread__comm_str(sched_in), sched_in->tid);
} }
if (sched->map.comp && new_cpu) 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); thread__put(sched_in);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment