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

perf report: Introduce --stdio-color to setup the color output mode selection

'perf report --stdio' will colorize entries with most hits and possibly
some other aspects of its output, but those colors gets suppressed if we
redirect the output to a non-tty, allow keeping the colors by adding a
new option, --stdio-color, now this use case will also output escape
sequences for colors:

$ perf annotate --stdio-color | more

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-3iuawqjldu4i8gziot7e3d5n@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

+10
+7
tools/perf/Documentation/perf-report.txt
··· 265 265 266 266 --stdio:: Use the stdio interface. 267 267 268 + --stdio-color:: 269 + 'always', 'never' or 'auto', allowing configuring color output 270 + via the command line, in addition to via "color.ui" .perfconfig. 271 + Use '--stdio-color always' to generate color even when redirecting 272 + to a pipe or file. Using just '--stdio-color' is equivalent to 273 + using 'always'. 274 + 268 275 --tui:: Use the TUI interface, that is integrated with annotate and allows 269 276 zooming into DSOs or threads, among other features. Use of --tui 270 277 requires a tty, if one is not present, as when piping to other
+3
tools/perf/builtin-report.c
··· 817 817 "Show raw trace event output (do not use print fmt or plugins)"), 818 818 OPT_BOOLEAN(0, "hierarchy", &symbol_conf.report_hierarchy, 819 819 "Show entries in a hierarchy"), 820 + OPT_CALLBACK_DEFAULT(0, "stdio-color", NULL, "mode", 821 + "'always' (default), 'never' or 'auto' only applicable to --stdio mode", 822 + stdio__config_color, "always"), 820 823 OPT_END() 821 824 }; 822 825 struct perf_data_file file = {