lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Wed, 13 Jul 2016 00:02:05 -0700
From:	tip-bot for Arnaldo Carvalho de Melo <tipbot@...or.com>
To:	linux-tip-commits@...r.kernel.org
Cc:	hpa@...or.com, tglx@...utronix.de, peterz@...radead.org,
	dsahern@...il.com, namhyung@...nel.org, wangnan0@...wei.com,
	mingo@...nel.org, jolsa@...nel.org, acme@...hat.com,
	adrian.hunter@...el.com, linux-kernel@...r.kernel.org
Subject: [tip:perf/core] perf ui stdio: Add way to setup the color output
 mode selection

Commit-ID:  c09615f29c70d4155986f55097a99ad8f2036ca1
Gitweb:     http://git.kernel.org/tip/c09615f29c70d4155986f55097a99ad8f2036ca1
Author:     Arnaldo Carvalho de Melo <acme@...hat.com>
AuthorDate: Tue, 5 Jul 2016 11:05:24 -0300
Committer:  Arnaldo Carvalho de Melo <acme@...hat.com>
CommitDate: Tue, 12 Jul 2016 00:00:39 -0300

perf ui stdio: Add way to setup the color output mode selection

In --stdio we turn off color output when the output is not a tty,
which is not always desirable, for instance, in:

  perf annotate | more

the 'more' tool is perfectly capable of processing the escape sequences
for colored output.

Allow using the existing logic for .perfconfig's "color.ui" to be used
from the command line by providing a stdio__config_color() helper, that
will be used by annotate and report in follow up patches.

Cc: Adrian Hunter <adrian.hunter@...el.com>
Cc: David Ahern <dsahern@...il.com>
Cc: Jiri Olsa <jolsa@...nel.org>
Cc: Namhyung Kim <namhyung@...nel.org>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Wang Nan <wangnan0@...wei.com>
Link: http://lkml.kernel.org/n/tip-1u4wjdbcc41dxndsb4klpa9y@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
 tools/perf/ui/setup.c | 7 +++++++
 tools/perf/ui/ui.h    | 4 ++++
 2 files changed, 11 insertions(+)

diff --git a/tools/perf/ui/setup.c b/tools/perf/ui/setup.c
index ba51fa8..1f6b099 100644
--- a/tools/perf/ui/setup.c
+++ b/tools/perf/ui/setup.c
@@ -60,6 +60,13 @@ static inline int setup_gtk_browser(void) { return -1; }
 static inline void exit_gtk_browser(bool wait_for_ok __maybe_unused) {}
 #endif
 
+int stdio__config_color(const struct option *opt __maybe_unused,
+			const char *mode, int unset __maybe_unused)
+{
+	perf_use_color_default = perf_config_colorbool("color.ui", mode, -1);
+	return 0;
+}
+
 void setup_browser(bool fallback_to_pager)
 {
 	if (use_browser < 2 && (!isatty(1) || dump_trace))
diff --git a/tools/perf/ui/ui.h b/tools/perf/ui/ui.h
index ab88383..4b6fb6c 100644
--- a/tools/perf/ui/ui.h
+++ b/tools/perf/ui/ui.h
@@ -26,4 +26,8 @@ static inline void ui__exit(bool wait_for_ok __maybe_unused) {}
 
 void ui__refresh_dimensions(bool force);
 
+struct option;
+
+int stdio__config_color(const struct option *opt, const char *mode, int unset);
+
 #endif /* _PERF_UI_H_ */

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ