Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Jiri Olsa and committed by
Arnaldo Carvalho de Melo
8cd91195 99623c62

+10 -8
+10 -8
tools/perf/builtin-sched.c
··· 11 11 #include "util/session.h" 12 12 #include "util/tool.h" 13 13 #include "util/cloexec.h" 14 + #include "util/color.h" 14 15 15 16 #include <subcmd/parse-options.h> 16 17 #include "util/trace-event.h" ··· 1358 1357 int i, this_cpu = sample->cpu; 1359 1358 int cpus_nr; 1360 1359 bool new_cpu = false; 1360 + const char *color = PERF_COLOR_NORMAL; 1361 1361 1362 1362 BUG_ON(this_cpu >= MAX_CPUS || this_cpu < 0); 1363 1363 ··· 1424 1422 int cpu = sched->map.comp ? sched->map.comp_cpus[i] : i; 1425 1423 1426 1424 if (cpu != this_cpu) 1427 - printf(" "); 1425 + color_fprintf(stdout, color, " "); 1428 1426 else 1429 - printf("*"); 1427 + color_fprintf(stdout, color, "*"); 1430 1428 1431 1429 if (sched->curr_thread[cpu]) 1432 - printf("%2s ", sched->curr_thread[cpu]->shortname); 1430 + color_fprintf(stdout, color, "%2s ", sched->curr_thread[cpu]->shortname); 1433 1431 else 1434 - printf(" "); 1432 + color_fprintf(stdout, color, " "); 1435 1433 } 1436 1434 1437 - printf(" %12.6f secs ", (double)timestamp/1e9); 1435 + color_fprintf(stdout, color, " %12.6f secs ", (double)timestamp/1e9); 1438 1436 if (new_shortname) { 1439 - printf("%s => %s:%d", 1437 + color_fprintf(stdout, color, "%s => %s:%d", 1440 1438 sched_in->shortname, thread__comm_str(sched_in), sched_in->tid); 1441 1439 } 1442 1440 1443 1441 if (sched->map.comp && new_cpu) 1444 - printf(" (CPU %d)", this_cpu); 1442 + color_fprintf(stdout, color, " (CPU %d)", this_cpu); 1445 1443 1446 - printf("\n"); 1444 + color_fprintf(stdout, color, "\n"); 1447 1445 1448 1446 thread__put(sched_in); 1449 1447