Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1304797
| From | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 13/59] perf tools: Add 'trace_fields' dynamic sort key |
| Date | 2016-01-08 19:10 +0100 |
| Message-ID | <qOJE7-21e-29@gated-at.bofh.it> (permalink) |
| References | <qOJE5-21e-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Namhyung Kim <namhyung@kernel.org>
The 'trace_fields' sort key is similar as 'trace' sort key, but it shows
each fields separately. Each event will get different columns as their
fields.
$ perf report -s trace_fields --stdio
# To display the perf.data header info, please use --header/--header-only options.
#
#
# Total Lost Samples: 0
#
# Samples: 20K of event 'kmem:kmalloc'
# Event count (approx.): 20533
#
# Overhead Command call_site ptr bytes_req bytes_alloc gfp_flags
# ........ ....... .................. .................. ......... ........... ...................
#
99.89% perf ffffffffa01d4396 0xffff8803ffb79720 96 96 GFP_NOFS|GFP_ZERO
0.06% sleep ffffffff8114e1cd 0xffff8803d228a000 4096 4096 GFP_KERNEL
0.03% perf ffffffff811d6ae6 0xffff8803f7678f00 240 256 GFP_KERNEL|GFP_ZERO
0.00% perf ffffffff812263c1 0xffff880406172380 128 128 GFP_KERNEL
0.00% perf ffffffff812264b9 0xffff8803ffac1600 504 512 GFP_KERNEL
0.00% perf ffffffff81226634 0xffff880401dc5280 28 32 GFP_KERNEL
0.00% sleep ffffffff81226da9 0xffff8803ffac3a00 392 512 GFP_KERNEL
# Samples: 20K of event 'kmem:kfree'
# Event count (approx.): 20597
#
# Overhead call_site ptr
# ........ .................. ..................
#
99.58% ffffffffa01d85ad 0xffff8803ffb79720
0.07% ffffffff81443f5c 0xffff8803f7669400
0.02% ffffffff811d5753 0xffff8803f7678f00
0.01% ffffffff81443f5c 0xffff8803f766be00
0.01% ffffffff8114e359 0xffff8803d228a000
0.01% ffffffff81443f5c 0xffff8800d156dc00
0.01% ffffffff81443f5c 0xffff8803f7669400
0.01% ffffffff8114e359 0xffff8803d228a000
0.01% ffffffff8114e359 0xffff8803d228a000
0.01% ffffffff8114e359 0xffff8803d228a000
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1450804030-29193-13-git-send-email-namhyung@kernel.org
[ Combined with "perf tools: Fix segfault when using -s trace_fields" ]
Link: http://lkml.kernel.org/r/1451991518-25673-1-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/sort.c | 47 ++++++++++++++++++++++++++++++++++++++---------
1 file changed, 38 insertions(+), 9 deletions(-)
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index fd56223793a8..79aa71d26d9f 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -1932,6 +1932,38 @@ static int __dynamic_dimension__add(struct perf_evsel *evsel,
return 0;
}
+static int add_evsel_fields(struct perf_evsel *evsel, bool raw_trace)
+{
+ int ret;
+ struct format_field *field;
+
+ field = evsel->tp_format->format.fields;
+ while (field) {
+ ret = __dynamic_dimension__add(evsel, field, raw_trace);
+ if (ret < 0)
+ return ret;
+
+ field = field->next;
+ }
+ return 0;
+}
+
+static int add_all_dynamic_fields(struct perf_evlist *evlist, bool raw_trace)
+{
+ int ret;
+ struct perf_evsel *evsel;
+
+ evlist__for_each(evlist, evsel) {
+ if (evsel->attr.type != PERF_TYPE_TRACEPOINT)
+ continue;
+
+ ret = add_evsel_fields(evsel, raw_trace);
+ if (ret < 0)
+ return ret;
+ }
+ return 0;
+}
+
static int add_dynamic_entry(struct perf_evlist *evlist, const char *tok)
{
char *str, *event_name, *field_name, *opt_name;
@@ -1961,6 +1993,11 @@ static int add_dynamic_entry(struct perf_evlist *evlist, const char *tok)
raw_trace = true;
}
+ if (!strcmp(field_name, "trace_fields")) {
+ ret = add_all_dynamic_fields(evlist, raw_trace);
+ goto out;
+ }
+
evsel = find_evsel(evlist, event_name);
if (evsel == NULL) {
pr_debug("Cannot find event: %s\n", event_name);
@@ -1975,15 +2012,7 @@ static int add_dynamic_entry(struct perf_evlist *evlist, const char *tok)
}
if (!strcmp(field_name, "*")) {
- field = evsel->tp_format->format.fields;
-
- while (field) {
- ret = __dynamic_dimension__add(evsel, field, raw_trace);
- if (ret < 0)
- goto out;
-
- field = field->next;
- }
+ ret = add_evsel_fields(evsel, raw_trace);
} else {
field = pevent_find_any_field(evsel->tp_format, field_name);
if (field == NULL) {
--
2.1.0
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[GIT PULL 00/59] perf/core improvements and fixes Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-08 19:10 +0100
[PATCH 24/59] perf script: Process stat config event Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-08 19:10 +0100
[PATCH 40/59] tools lib: Sync tools/lib/find_bit.c with the kernel Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-08 19:10 +0100
[PATCH 49/59] perf tools: Add overhead/overhead_children keys defaults via string Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-08 19:10 +0100
[PATCH 39/59] tools lib: Move find_next_bit.c to tools/lib/ Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-08 19:10 +0100
[PATCH 42/59] perf top: Decay periods in callchains Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-08 19:10 +0100
[PATCH 15/59] tools build feature: Fix feature_check_display_code typo Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-08 19:10 +0100
[PATCH 23/59] perf script: Process cpu/threads maps Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-08 19:10 +0100
[PATCH 43/59] perf report: Change default to use event group view Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-08 19:10 +0100
[PATCH 05/59] perf tools: Pass evlist to setup_sorting() Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-08 19:10 +0100
[PATCH 10/59] perf tools: Support shortcuts for events in dynamic sort keys Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-08 19:10 +0100
[PATCH 13/59] perf tools: Add 'trace_fields' dynamic sort key Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-08 19:10 +0100
[PATCH 59/59] perf evlist: Add --trace-fields option to show trace fields Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-08 19:10 +0100
[PATCH 52/59] perf report: Show random usage tip on the help line Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-08 19:10 +0100
[PATCH 48/59] perf tools: Remove list entry from struct sort_entry Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-08 19:10 +0100
[PATCH 14/59] perf tools: Make 'trace' or 'trace_fields' sort key default for tracepoint events Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-08 19:10 +0100
[PATCH 25/59] perf script: Add process_stat/process_stat_interval scripting interface Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-08 19:10 +0100
[PATCH 41/59] tools lib: Move bitmap.[ch] from tools/perf/ to tools/{lib,include}/ Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-08 19:10 +0100
[PATCH 02/59] perf hist: Save raw_data/size for tracepoint events Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-08 19:10 +0100
[PATCH 08/59] perf tools: Add 'trace' sort key Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-08 19:10 +0100
[PATCH 09/59] perf report/top: Add --raw-trace option Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-08 19:10 +0100
[PATCH 45/59] perf tools: Add missing headers in perf's MANIFEST Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-08 19:10 +0100
[PATCH 57/59] perf libdw: Check for mmaps also in MAP__VARIABLE tree Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-08 19:20 +0100
[PATCH 56/59] perf unwind: Check for mmaps also in MAP__VARIABLE tree Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-08 19:20 +0100
[PATCH 53/59] perf evlist: Make perf_evlist__open() open evsels with their cpus and threads (like perf record does) Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-08 19:20 +0100
[PATCH 58/59] perf record: Store data mmaps for dwarf unwind Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-08 19:20 +0100
[PATCH 47/59] perf tools: Include all tools/lib directory for tags/cscope/TAGS targets Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-08 19:20 +0100
[PATCH 54/59] perf evlist: Remove perf_evlist__(enable|disable)_event functions Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-08 19:20 +0100
[PATCH 51/59] perf hists: Export a couple of hist functions Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-08 19:20 +0100
[PATCH 12/59] perf tools: Skip dynamic fields not defined for current event Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-08 19:20 +0100
[PATCH 03/59] tools lib traceevent: Factor out and export print_event_field[s]() Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-08 19:20 +0100
[PATCH 38/59] perf tests: Give a bit more information on the CQM test failure path Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-08 19:20 +0100
[PATCH 37/59] perf tests: No need to set attr.sample_freq for tracking !PERF_RECORD_SAMPLE Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-08 19:20 +0100
[PATCH 11/59] perf tools: Support '<event>.*' dynamic sort key Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-08 19:20 +0100
[PATCH 04/59] perf top: Create the evlist sooner Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-08 19:20 +0100
[PATCH 46/59] perf script: Align event name properly Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-08 19:20 +0100
[PATCH 50/59] perf diff: Use perf_hpp__register_sort_field interface Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-08 19:20 +0100
[PATCH 18/59] tools build feature: Use value assignment form for FEATURE-DUMP file Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-08 19:20 +0100
[PATCH 35/59] perf test: No need for setting attr.sample_freq on the RECORD test Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-08 19:20 +0100
[PATCH 33/59] perf evlist: Introduce perf_evlist__new_dummy constructor Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-08 19:20 +0100
[PATCH 36/59] perf python: Add missing files to binding link list Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-08 19:20 +0100
[PATCH 55/59] perf unwind: Use find_map function in access_dso_mem Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-08 19:20 +0100
[PATCH 19/59] perf build: Use FEATURE-DUMP in bpf subproject Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-08 19:30 +0100
[PATCH 28/59] perf cpumap: Fix cpu conversion in cpu_map__from_entries Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-08 19:30 +0100
[PATCH 29/59] perf script: Display stat events by default Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-08 19:30 +0100
[PATCH 07/59] perf tools: Try to show pretty printed output for dynamic sort keys Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-08 19:30 +0100
[PATCH 16/59] tools build feature: Move dwarf post unwind choice output into perf Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-08 19:30 +0100
[PATCH 20/59] perf tools: Add all matching dynamic sort keys for field name Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-08 19:30 +0100
[PATCH 26/59] perf script: Add stat default handlers Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-08 19:30 +0100
[PATCH 44/59] perf tools: Do not show trace command if it's not compiled in Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-08 19:30 +0100
[PATCH 27/59] perf script: Add python support for stat events Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-08 19:30 +0100
[PATCH 21/59] perf report: Add documentation for dynamic sort keys Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-08 19:30 +0100
[PATCH 30/59] perf script: Add stat-cpi.py script Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-08 19:30 +0100
[PATCH 34/59] perf test: Use "dummy" events in the PERF_RECORD_ test Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-08 19:30 +0100
[PATCH 17/59] tools build feature: Introduce feature_assign macro Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-08 19:30 +0100
[PATCH 31/59] perf pmu: fix alias->snapshot missing initialization bug Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-08 19:30 +0100
[PATCH 32/59] perf tests: No need to set attr.sample_freq in the perf time to TSC test Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-08 19:30 +0100
[PATCH 01/59] perf hist: Pass struct sample to __hists__add_entry() Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-08 19:30 +0100
[PATCH 06/59] perf tools: Add dynamic sort key for tracepoint events Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-08 19:30 +0100
[PATCH 22/59] perf stat record: Keep sample_type 0 for pipe session Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-08 19:30 +0100
Re: [GIT PULL 00/59] perf/core improvements and fixes Ingo Molnar <mingo@kernel.org> - 2016-01-09 17:30 +0100
csiph-web