aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@kernel.org>2014-03-03 21:01:41 -0500
committerJiri Olsa <jolsa@kernel.org>2014-05-21 05:45:36 -0400
commit6fe8c26d7ab9fbd6748fc40ca5fea1e3131e7236 (patch)
tree84e7c5148554942c89cd16c223d612dc7c3299cd /tools
parentc0f1527b7e004f9a91e488f05c251213d16ad7ac (diff)
perf top: Add --fields option to specify output fields
The --fields option is to allow user setup output field in any order. It can receive any sort keys and following (hpp) fields: overhead, overhead_sys, overhead_us, sample and period If guest profiling is enabled, overhead_guest_{sys,us} will be available too. More more information, please see previous patch "perf report: Add -F option to specify output fields" Signed-off-by: Namhyung Kim <namhyung@kernel.org> Link: http://lkml.kernel.org/r/1400480762-22852-15-git-send-email-namhyung@kernel.org Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/Documentation/perf-top.txt9
-rw-r--r--tools/perf/builtin-top.c15
2 files changed, 18 insertions, 6 deletions
diff --git a/tools/perf/Documentation/perf-top.txt b/tools/perf/Documentation/perf-top.txt
index df863288752a..dcfa54c851e9 100644
--- a/tools/perf/Documentation/perf-top.txt
+++ b/tools/perf/Documentation/perf-top.txt
@@ -116,6 +116,15 @@ Default is to monitor all CPUS.
116 local_weight, abort, in_tx, transaction, overhead, sample, period. 116 local_weight, abort, in_tx, transaction, overhead, sample, period.
117 Please see description of --sort in the perf-report man page. 117 Please see description of --sort in the perf-report man page.
118 118
119--fields=::
120 Specify output field - multiple keys can be specified in CSV format.
121 Following fields are available:
122 overhead, overhead_sys, overhead_us, sample and period.
123 Also it can contain any sort key(s).
124
125 By default, every sort keys not specified in --field will be appended
126 automatically.
127
119-n:: 128-n::
120--show-nr-samples:: 129--show-nr-samples::
121 Show a column with the number of samples. 130 Show a column with the number of samples.
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 280945bab66d..5b389ce4cd15 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -1085,6 +1085,8 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused)
1085 OPT_STRING('s', "sort", &sort_order, "key[,key2...]", 1085 OPT_STRING('s', "sort", &sort_order, "key[,key2...]",
1086 "sort by key(s): pid, comm, dso, symbol, parent, cpu, srcline, ..." 1086 "sort by key(s): pid, comm, dso, symbol, parent, cpu, srcline, ..."
1087 " Please refer the man page for the complete list."), 1087 " Please refer the man page for the complete list."),
1088 OPT_STRING(0, "fields", &field_order, "key[,keys...]",
1089 "output field(s): overhead, period, sample plus all of sort keys"),
1088 OPT_BOOLEAN('n', "show-nr-samples", &symbol_conf.show_nr_samples, 1090 OPT_BOOLEAN('n', "show-nr-samples", &symbol_conf.show_nr_samples,
1089 "Show a column with the number of samples"), 1091 "Show a column with the number of samples"),
1090 OPT_CALLBACK_NOOPT('g', NULL, &top.record_opts, 1092 OPT_CALLBACK_NOOPT('g', NULL, &top.record_opts,
@@ -1138,17 +1140,18 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused)
1138 usage_with_options(top_usage, options); 1140 usage_with_options(top_usage, options);
1139 1141
1140 sort__mode = SORT_MODE__TOP; 1142 sort__mode = SORT_MODE__TOP;
1143 /* display thread wants entries to be collapsed in a different tree */
1144 sort__need_collapse = 1;
1141 1145
1142 if (setup_sorting() < 0) { 1146 if (setup_sorting() < 0) {
1143 parse_options_usage(top_usage, options, "s", 1); 1147 if (sort_order)
1148 parse_options_usage(top_usage, options, "s", 1);
1149 if (field_order)
1150 parse_options_usage(sort_order ? NULL : top_usage,
1151 options, "fields", 0);
1144 goto out_delete_evlist; 1152 goto out_delete_evlist;
1145 } 1153 }
1146 1154
1147 /* display thread wants entries to be collapsed in a different tree */
1148 sort__need_collapse = 1;
1149
1150 perf_hpp__init();
1151
1152 if (top.use_stdio) 1155 if (top.use_stdio)
1153 use_browser = 0; 1156 use_browser = 0;
1154 else if (top.use_tui) 1157 else if (top.use_tui)