diff options
author | Namhyung Kim <namhyung@kernel.org> | 2014-03-03 19:06:42 -0500 |
---|---|---|
committer | Jiri Olsa <jolsa@kernel.org> | 2014-05-21 05:45:34 -0400 |
commit | a2ce067e55e328f1a6fe3dddf77a173381ffdfe1 (patch) | |
tree | b63fb28811cd81b4ae6559db7d648a0d143bd65c /tools/perf | |
parent | fb821c9e7135e324ff6d50d030352718a80364b4 (diff) |
perf tools: Allow hpp fields to be sort keys
Add overhead{,_sys,_us,_guest_sys,_guest_us}, sample and period sort
keys so that they can be selected with --sort/-s option.
$ perf report -s period,comm --stdio
...
# Overhead Period Command
# ........ ............ ...............
#
47.06% 152 swapper
13.93% 45 qemu-system-arm
12.38% 40 synergys
3.72% 12 firefox
2.48% 8 xchat
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Ingo Molnar <mingo@kernel.org>
Link: http://lkml.kernel.org/r/1400480762-22852-9-git-send-email-namhyung@kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Diffstat (limited to 'tools/perf')
-rw-r--r-- | tools/perf/Documentation/perf-diff.txt | 5 | ||||
-rw-r--r-- | tools/perf/Documentation/perf-report.txt | 9 | ||||
-rw-r--r-- | tools/perf/Documentation/perf-top.txt | 5 | ||||
-rw-r--r-- | tools/perf/builtin-diff.c | 3 | ||||
-rw-r--r-- | tools/perf/builtin-report.c | 6 | ||||
-rw-r--r-- | tools/perf/builtin-top.c | 4 | ||||
-rw-r--r-- | tools/perf/ui/hist.c | 9 | ||||
-rw-r--r-- | tools/perf/util/sort.c | 39 |
8 files changed, 67 insertions, 13 deletions
diff --git a/tools/perf/Documentation/perf-diff.txt b/tools/perf/Documentation/perf-diff.txt index fbfa1192923c..b3b8abae62b8 100644 --- a/tools/perf/Documentation/perf-diff.txt +++ b/tools/perf/Documentation/perf-diff.txt | |||
@@ -50,7 +50,8 @@ OPTIONS | |||
50 | 50 | ||
51 | -s:: | 51 | -s:: |
52 | --sort=:: | 52 | --sort=:: |
53 | Sort by key(s): pid, comm, dso, symbol. | 53 | Sort by key(s): pid, comm, dso, symbol, cpu, parent, srcline. |
54 | Please see description of --sort in the perf-report man page. | ||
54 | 55 | ||
55 | -t:: | 56 | -t:: |
56 | --field-separator=:: | 57 | --field-separator=:: |
@@ -202,4 +203,4 @@ If specified the 'Weighted diff' column is displayed with value 'd' computed as: | |||
202 | 203 | ||
203 | SEE ALSO | 204 | SEE ALSO |
204 | -------- | 205 | -------- |
205 | linkperf:perf-record[1] | 206 | linkperf:perf-record[1], linkperf:perf-report[1] |
diff --git a/tools/perf/Documentation/perf-report.txt b/tools/perf/Documentation/perf-report.txt index 09af66298564..9babe915b6c4 100644 --- a/tools/perf/Documentation/perf-report.txt +++ b/tools/perf/Documentation/perf-report.txt | |||
@@ -79,6 +79,15 @@ OPTIONS | |||
79 | abort cost. This is the global weight. | 79 | abort cost. This is the global weight. |
80 | - local_weight: Local weight version of the weight above. | 80 | - local_weight: Local weight version of the weight above. |
81 | - transaction: Transaction abort flags. | 81 | - transaction: Transaction abort flags. |
82 | - overhead: Overhead percentage of sample | ||
83 | - overhead_sys: Overhead percentage of sample running in system mode | ||
84 | - overhead_us: Overhead percentage of sample running in user mode | ||
85 | - overhead_guest_sys: Overhead percentage of sample running in system mode | ||
86 | on guest machine | ||
87 | - overhead_guest_us: Overhead percentage of sample running in user mode on | ||
88 | guest machine | ||
89 | - sample: Number of sample | ||
90 | - period: Raw number of event count of sample | ||
82 | 91 | ||
83 | By default, comm, dso and symbol keys are used. | 92 | By default, comm, dso and symbol keys are used. |
84 | (i.e. --sort comm,dso,symbol) | 93 | (i.e. --sort comm,dso,symbol) |
diff --git a/tools/perf/Documentation/perf-top.txt b/tools/perf/Documentation/perf-top.txt index 64ed79c43639..df863288752a 100644 --- a/tools/perf/Documentation/perf-top.txt +++ b/tools/perf/Documentation/perf-top.txt | |||
@@ -113,7 +113,8 @@ Default is to monitor all CPUS. | |||
113 | -s:: | 113 | -s:: |
114 | --sort:: | 114 | --sort:: |
115 | Sort by key(s): pid, comm, dso, symbol, parent, srcline, weight, | 115 | Sort by key(s): pid, comm, dso, symbol, parent, srcline, weight, |
116 | local_weight, abort, in_tx, transaction | 116 | local_weight, abort, in_tx, transaction, overhead, sample, period. |
117 | Please see description of --sort in the perf-report man page. | ||
117 | 118 | ||
118 | -n:: | 119 | -n:: |
119 | --show-nr-samples:: | 120 | --show-nr-samples:: |
@@ -212,4 +213,4 @@ Pressing any unmapped key displays a menu, and prompts for input. | |||
212 | 213 | ||
213 | SEE ALSO | 214 | SEE ALSO |
214 | -------- | 215 | -------- |
215 | linkperf:perf-stat[1], linkperf:perf-list[1] | 216 | linkperf:perf-stat[1], linkperf:perf-list[1], linkperf:perf-report[1] |
diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c index f3b10dcf6838..b60c711d4e72 100644 --- a/tools/perf/builtin-diff.c +++ b/tools/perf/builtin-diff.c | |||
@@ -741,7 +741,8 @@ static const struct option options[] = { | |||
741 | OPT_STRING('S', "symbols", &symbol_conf.sym_list_str, "symbol[,symbol...]", | 741 | OPT_STRING('S', "symbols", &symbol_conf.sym_list_str, "symbol[,symbol...]", |
742 | "only consider these symbols"), | 742 | "only consider these symbols"), |
743 | OPT_STRING('s', "sort", &sort_order, "key[,key2...]", | 743 | OPT_STRING('s', "sort", &sort_order, "key[,key2...]", |
744 | "sort by key(s): pid, comm, dso, symbol, parent"), | 744 | "sort by key(s): pid, comm, dso, symbol, parent, cpu, srcline, ..." |
745 | " Please refer the man page for the complete list."), | ||
745 | OPT_STRING('t', "field-separator", &symbol_conf.field_sep, "separator", | 746 | OPT_STRING('t', "field-separator", &symbol_conf.field_sep, "separator", |
746 | "separator for columns, no spaces will be added between " | 747 | "separator for columns, no spaces will be added between " |
747 | "columns '.' is reserved."), | 748 | "columns '.' is reserved."), |
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index 89c95289fd51..d0180d5de781 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c | |||
@@ -699,10 +699,8 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused) | |||
699 | OPT_BOOLEAN(0, "header-only", &report.header_only, | 699 | OPT_BOOLEAN(0, "header-only", &report.header_only, |
700 | "Show only data header."), | 700 | "Show only data header."), |
701 | OPT_STRING('s', "sort", &sort_order, "key[,key2...]", | 701 | OPT_STRING('s', "sort", &sort_order, "key[,key2...]", |
702 | "sort by key(s): pid, comm, dso, symbol, parent, cpu, srcline," | 702 | "sort by key(s): pid, comm, dso, symbol, parent, cpu, srcline, ..." |
703 | " dso_to, dso_from, symbol_to, symbol_from, mispredict," | 703 | " Please refer the man page for the complete list."), |
704 | " weight, local_weight, mem, symbol_daddr, dso_daddr, tlb, " | ||
705 | "snoop, locked, abort, in_tx, transaction"), | ||
706 | OPT_BOOLEAN(0, "showcpuutilization", &symbol_conf.show_cpu_utilization, | 704 | OPT_BOOLEAN(0, "showcpuutilization", &symbol_conf.show_cpu_utilization, |
707 | "Show sample percentage for different cpu modes"), | 705 | "Show sample percentage for different cpu modes"), |
708 | OPT_STRING('p', "parent", &parent_pattern, "regex", | 706 | OPT_STRING('p', "parent", &parent_pattern, "regex", |
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index 37d30460bada..4fef1e415129 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c | |||
@@ -1083,8 +1083,8 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused) | |||
1083 | OPT_INCR('v', "verbose", &verbose, | 1083 | OPT_INCR('v', "verbose", &verbose, |
1084 | "be more verbose (show counter open errors, etc)"), | 1084 | "be more verbose (show counter open errors, etc)"), |
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, weight, local_weight," | 1086 | "sort by key(s): pid, comm, dso, symbol, parent, cpu, srcline, ..." |
1087 | " abort, in_tx, transaction"), | 1087 | " Please refer the man page for the complete list."), |
1088 | OPT_BOOLEAN('n', "show-nr-samples", &symbol_conf.show_nr_samples, | 1088 | OPT_BOOLEAN('n', "show-nr-samples", &symbol_conf.show_nr_samples, |
1089 | "Show a column with the number of samples"), | 1089 | "Show a column with the number of samples"), |
1090 | OPT_CALLBACK_NOOPT('g', NULL, &top.record_opts, | 1090 | OPT_CALLBACK_NOOPT('g', NULL, &top.record_opts, |
diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c index e7ac794382c1..24116a48298f 100644 --- a/tools/perf/ui/hist.c +++ b/tools/perf/ui/hist.c | |||
@@ -346,8 +346,13 @@ void perf_hpp__init(void) | |||
346 | int i; | 346 | int i; |
347 | 347 | ||
348 | for (i = 0; i < PERF_HPP__MAX_INDEX; i++) { | 348 | for (i = 0; i < PERF_HPP__MAX_INDEX; i++) { |
349 | INIT_LIST_HEAD(&perf_hpp__format[i].list); | 349 | struct perf_hpp_fmt *fmt = &perf_hpp__format[i]; |
350 | INIT_LIST_HEAD(&perf_hpp__format[i].sort_list); | 350 | |
351 | INIT_LIST_HEAD(&fmt->list); | ||
352 | |||
353 | /* sort_list may be linked by setup_sorting() */ | ||
354 | if (fmt->sort_list.next == NULL) | ||
355 | INIT_LIST_HEAD(&fmt->sort_list); | ||
351 | } | 356 | } |
352 | 357 | ||
353 | perf_hpp__column_enable(PERF_HPP__OVERHEAD); | 358 | perf_hpp__column_enable(PERF_HPP__OVERHEAD); |
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c index b2829f947053..916652af8304 100644 --- a/tools/perf/util/sort.c +++ b/tools/perf/util/sort.c | |||
@@ -1028,6 +1028,26 @@ static struct sort_dimension memory_sort_dimensions[] = { | |||
1028 | 1028 | ||
1029 | #undef DIM | 1029 | #undef DIM |
1030 | 1030 | ||
1031 | struct hpp_dimension { | ||
1032 | const char *name; | ||
1033 | struct perf_hpp_fmt *fmt; | ||
1034 | int taken; | ||
1035 | }; | ||
1036 | |||
1037 | #define DIM(d, n) { .name = n, .fmt = &perf_hpp__format[d], } | ||
1038 | |||
1039 | static struct hpp_dimension hpp_sort_dimensions[] = { | ||
1040 | DIM(PERF_HPP__OVERHEAD, "overhead"), | ||
1041 | DIM(PERF_HPP__OVERHEAD_SYS, "overhead_sys"), | ||
1042 | DIM(PERF_HPP__OVERHEAD_US, "overhead_us"), | ||
1043 | DIM(PERF_HPP__OVERHEAD_GUEST_SYS, "overhead_guest_sys"), | ||
1044 | DIM(PERF_HPP__OVERHEAD_GUEST_US, "overhead_guest_us"), | ||
1045 | DIM(PERF_HPP__SAMPLES, "sample"), | ||
1046 | DIM(PERF_HPP__PERIOD, "period"), | ||
1047 | }; | ||
1048 | |||
1049 | #undef DIM | ||
1050 | |||
1031 | struct hpp_sort_entry { | 1051 | struct hpp_sort_entry { |
1032 | struct perf_hpp_fmt hpp; | 1052 | struct perf_hpp_fmt hpp; |
1033 | struct sort_entry *se; | 1053 | struct sort_entry *se; |
@@ -1115,6 +1135,16 @@ static int __sort_dimension__add(struct sort_dimension *sd, enum sort_type idx) | |||
1115 | return 0; | 1135 | return 0; |
1116 | } | 1136 | } |
1117 | 1137 | ||
1138 | static int __hpp_dimension__add(struct hpp_dimension *hd) | ||
1139 | { | ||
1140 | if (!hd->taken) { | ||
1141 | hd->taken = 1; | ||
1142 | |||
1143 | perf_hpp__register_sort_field(hd->fmt); | ||
1144 | } | ||
1145 | return 0; | ||
1146 | } | ||
1147 | |||
1118 | int sort_dimension__add(const char *tok) | 1148 | int sort_dimension__add(const char *tok) |
1119 | { | 1149 | { |
1120 | unsigned int i; | 1150 | unsigned int i; |
@@ -1144,6 +1174,15 @@ int sort_dimension__add(const char *tok) | |||
1144 | return __sort_dimension__add(sd, i); | 1174 | return __sort_dimension__add(sd, i); |
1145 | } | 1175 | } |
1146 | 1176 | ||
1177 | for (i = 0; i < ARRAY_SIZE(hpp_sort_dimensions); i++) { | ||
1178 | struct hpp_dimension *hd = &hpp_sort_dimensions[i]; | ||
1179 | |||
1180 | if (strncasecmp(tok, hd->name, strlen(tok))) | ||
1181 | continue; | ||
1182 | |||
1183 | return __hpp_dimension__add(hd); | ||
1184 | } | ||
1185 | |||
1147 | for (i = 0; i < ARRAY_SIZE(bstack_sort_dimensions); i++) { | 1186 | for (i = 0; i < ARRAY_SIZE(bstack_sort_dimensions); i++) { |
1148 | struct sort_dimension *sd = &bstack_sort_dimensions[i]; | 1187 | struct sort_dimension *sd = &bstack_sort_dimensions[i]; |
1149 | 1188 | ||