perf tools: Add --tui and --stdio to choose the UI

Relying just on ~/.perfconfig or rebuilding the tool disabling support
for the TUI is too cumbersome, so allow specifying which UI to use and
make the command line switch override whatever is in ~/.perfconfig.
Suggested-by: NChristoph Hellwig <hch@infradead.org>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
LKML-Reference: <new-submission>
Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
上级 ed805261
...@@ -8,7 +8,7 @@ perf-annotate - Read perf.data (created by perf record) and display annotated co ...@@ -8,7 +8,7 @@ perf-annotate - Read perf.data (created by perf record) and display annotated co
SYNOPSIS SYNOPSIS
-------- --------
[verse] [verse]
'perf annotate' [-i <file> | --input=file] symbol_name 'perf annotate' [-i <file> | --input=file] [symbol_name]
DESCRIPTION DESCRIPTION
----------- -----------
...@@ -24,6 +24,13 @@ OPTIONS ...@@ -24,6 +24,13 @@ OPTIONS
--input=:: --input=::
Input file name. (default: perf.data) Input file name. (default: perf.data)
--stdio:: Use the stdio interface.
--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
samples, TAB/UNTAB cycles thru the lines with more samples.
SEE ALSO SEE ALSO
-------- --------
linkperf:perf-record[1] linkperf:perf-record[1], linkperf:perf-report[1]
...@@ -65,6 +65,13 @@ OPTIONS ...@@ -65,6 +65,13 @@ OPTIONS
the tree is considered as a new profiled object. + the tree is considered as a new profiled object. +
Default: fractal,0.5. Default: fractal,0.5.
--stdio:: Use the stdio interface.
--tui:: Use the TUI interface, that is integrated with annotate and allows
zooming into DSOs or threads, among other features. Use of --tui
requires a tty, if one is not present, as when piping to other
commands, the stdio interface is used.
SEE ALSO SEE ALSO
-------- --------
linkperf:perf-stat[1] linkperf:perf-stat[1]
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
static char const *input_name = "perf.data"; static char const *input_name = "perf.data";
static bool force; static bool force, use_tui, use_stdio;
static bool full_paths; static bool full_paths;
...@@ -427,6 +427,8 @@ static const struct option options[] = { ...@@ -427,6 +427,8 @@ static const struct option options[] = {
"be more verbose (show symbol address, etc)"), "be more verbose (show symbol address, etc)"),
OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace, OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace,
"dump raw trace in ASCII"), "dump raw trace in ASCII"),
OPT_BOOLEAN(0, "tui", &use_tui, "Use the TUI interface"),
OPT_BOOLEAN(0, "stdio", &use_stdio, "Use the stdio interface"),
OPT_STRING('k', "vmlinux", &symbol_conf.vmlinux_name, OPT_STRING('k', "vmlinux", &symbol_conf.vmlinux_name,
"file", "vmlinux pathname"), "file", "vmlinux pathname"),
OPT_BOOLEAN('m', "modules", &symbol_conf.use_modules, OPT_BOOLEAN('m', "modules", &symbol_conf.use_modules,
...@@ -442,6 +444,11 @@ int cmd_annotate(int argc, const char **argv, const char *prefix __used) ...@@ -442,6 +444,11 @@ int cmd_annotate(int argc, const char **argv, const char *prefix __used)
{ {
argc = parse_options(argc, argv, options, annotate_usage, 0); argc = parse_options(argc, argv, options, annotate_usage, 0);
if (use_stdio)
use_browser = 0;
else if (use_tui)
use_browser = 1;
setup_browser(); setup_browser();
symbol_conf.priv_size = sizeof(struct sym_priv); symbol_conf.priv_size = sizeof(struct sym_priv);
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
static char const *input_name = "perf.data"; static char const *input_name = "perf.data";
static bool force; static bool force, use_tui, use_stdio;
static bool hide_unresolved; static bool hide_unresolved;
static bool dont_use_callchains; static bool dont_use_callchains;
...@@ -450,6 +450,8 @@ static const struct option options[] = { ...@@ -450,6 +450,8 @@ static const struct option options[] = {
"Show per-thread event counters"), "Show per-thread event counters"),
OPT_STRING(0, "pretty", &pretty_printing_style, "key", OPT_STRING(0, "pretty", &pretty_printing_style, "key",
"pretty printing style key: normal raw"), "pretty printing style key: normal raw"),
OPT_BOOLEAN(0, "tui", &use_tui, "Use the TUI interface"),
OPT_BOOLEAN(0, "stdio", &use_stdio, "Use the stdio interface"),
OPT_STRING('s', "sort", &sort_order, "key[,key2...]", OPT_STRING('s', "sort", &sort_order, "key[,key2...]",
"sort by key(s): pid, comm, dso, symbol, parent"), "sort by key(s): pid, comm, dso, symbol, parent"),
OPT_BOOLEAN(0, "showcpuutilization", &symbol_conf.show_cpu_utilization, OPT_BOOLEAN(0, "showcpuutilization", &symbol_conf.show_cpu_utilization,
...@@ -482,8 +484,15 @@ int cmd_report(int argc, const char **argv, const char *prefix __used) ...@@ -482,8 +484,15 @@ int cmd_report(int argc, const char **argv, const char *prefix __used)
{ {
argc = parse_options(argc, argv, options, report_usage, 0); argc = parse_options(argc, argv, options, report_usage, 0);
if (use_stdio)
use_browser = 0;
else if (use_tui)
use_browser = 1;
if (strcmp(input_name, "-") != 0) if (strcmp(input_name, "-") != 0)
setup_browser(); setup_browser();
else
use_browser = 0;
/* /*
* Only in the newt browser we are doing integrated annotation, * Only in the newt browser we are doing integrated annotation,
* so don't allocate extra space that won't be used in the stdio * so don't allocate extra space that won't be used in the stdio
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册