aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-script.c
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@kernel.org>2016-02-15 03:34:51 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2016-02-23 10:20:02 -0500
commit94ddddfab521423d94d6066879b514b9431e5cae (patch)
tree12a2ba9535138a1144714d65a72e98ef46c38b6b /tools/perf/builtin-script.c
parentb19a1b6a233ede3ffc379b49e3653d6ce80dd743 (diff)
perf script: Add data_src and weight column definitions
Adding data_src and weight column definitions, so it's displayed for related sample types. Signed-off-by: Jiri Olsa <jolsa@kernel.org> Cc: Andi Kleen <ak@linux.intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/r/1455525293-8671-22-git-send-email-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-script.c')
-rw-r--r--tools/perf/builtin-script.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index c691214d820f..b7f1e8e22dcf 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -58,6 +58,8 @@ enum perf_output_field {
58 PERF_OUTPUT_IREGS = 1U << 14, 58 PERF_OUTPUT_IREGS = 1U << 14,
59 PERF_OUTPUT_BRSTACK = 1U << 15, 59 PERF_OUTPUT_BRSTACK = 1U << 15,
60 PERF_OUTPUT_BRSTACKSYM = 1U << 16, 60 PERF_OUTPUT_BRSTACKSYM = 1U << 16,
61 PERF_OUTPUT_DATA_SRC = 1U << 17,
62 PERF_OUTPUT_WEIGHT = 1U << 18,
61}; 63};
62 64
63struct output_option { 65struct output_option {
@@ -81,6 +83,8 @@ struct output_option {
81 {.str = "iregs", .field = PERF_OUTPUT_IREGS}, 83 {.str = "iregs", .field = PERF_OUTPUT_IREGS},
82 {.str = "brstack", .field = PERF_OUTPUT_BRSTACK}, 84 {.str = "brstack", .field = PERF_OUTPUT_BRSTACK},
83 {.str = "brstacksym", .field = PERF_OUTPUT_BRSTACKSYM}, 85 {.str = "brstacksym", .field = PERF_OUTPUT_BRSTACKSYM},
86 {.str = "data_src", .field = PERF_OUTPUT_DATA_SRC},
87 {.str = "weight", .field = PERF_OUTPUT_WEIGHT},
84}; 88};
85 89
86/* default set to maintain compatibility with current format */ 90/* default set to maintain compatibility with current format */
@@ -242,6 +246,16 @@ static int perf_evsel__check_attr(struct perf_evsel *evsel,
242 PERF_OUTPUT_ADDR, allow_user_set)) 246 PERF_OUTPUT_ADDR, allow_user_set))
243 return -EINVAL; 247 return -EINVAL;
244 248
249 if (PRINT_FIELD(DATA_SRC) &&
250 perf_evsel__check_stype(evsel, PERF_SAMPLE_DATA_SRC, "DATA_SRC",
251 PERF_OUTPUT_DATA_SRC))
252 return -EINVAL;
253
254 if (PRINT_FIELD(WEIGHT) &&
255 perf_evsel__check_stype(evsel, PERF_SAMPLE_WEIGHT, "WEIGHT",
256 PERF_OUTPUT_WEIGHT))
257 return -EINVAL;
258
245 if (PRINT_FIELD(SYM) && !PRINT_FIELD(IP) && !PRINT_FIELD(ADDR)) { 259 if (PRINT_FIELD(SYM) && !PRINT_FIELD(IP) && !PRINT_FIELD(ADDR)) {
246 pr_err("Display of symbols requested but neither sample IP nor " 260 pr_err("Display of symbols requested but neither sample IP nor "
247 "sample address\nis selected. Hence, no addresses to convert " 261 "sample address\nis selected. Hence, no addresses to convert "
@@ -673,6 +687,12 @@ static void process_event(struct perf_script *script, union perf_event *event,
673 if (PRINT_FIELD(ADDR)) 687 if (PRINT_FIELD(ADDR))
674 print_sample_addr(event, sample, thread, attr); 688 print_sample_addr(event, sample, thread, attr);
675 689
690 if (PRINT_FIELD(DATA_SRC))
691 printf("%16" PRIx64, sample->data_src);
692
693 if (PRINT_FIELD(WEIGHT))
694 printf("%16" PRIu64, sample->weight);
695
676 if (PRINT_FIELD(IP)) { 696 if (PRINT_FIELD(IP)) {
677 if (!symbol_conf.use_callchain) 697 if (!symbol_conf.use_callchain)
678 printf(" "); 698 printf(" ");