Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 53fe4ba1 authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo
Browse files

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



'perf annotate --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

Based-on-a-patch-by: default avatarPeter Zijlstra <peterz@infradead.org>
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: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-sjrnixani5pg6qez640gaxhf@git.kernel.org


Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent c09615f2
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -61,6 +61,13 @@ OPTIONS

--stdio:: Use the stdio interface.

--stdio-color::
	'always', 'never' or 'auto', allowing configuring color output
	via the command line, in addition to via "color.ui" .perfconfig.
	Use '--stdio-color always' to generate color even when redirecting
	to a pipe or file. Using just '--stdio-color' is equivalent to
	using 'always'.

--tui:: Use the TUI interface. Use of --tui requires a tty, if one is not
	present, as when piping to other commands, the stdio interface is
	used. This interfaces starts by centering on the line with more
+3 −0
Original line number Diff line number Diff line
@@ -339,6 +339,9 @@ int cmd_annotate(int argc, const char **argv, const char *prefix __maybe_unused)
		    "Show event group information together"),
	OPT_BOOLEAN(0, "show-total-period", &symbol_conf.show_total_period,
		    "Show a column with the sum of periods"),
	OPT_CALLBACK_DEFAULT(0, "stdio-color", NULL, "mode",
			     "'always' (default), 'never' or 'auto' only applicable to --stdio mode",
			     stdio__config_color, "always"),
	OPT_END()
	};
	int ret = hists__init();