aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/ui/stdio/hist.c
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@kernel.org>2015-11-09 00:45:41 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2015-11-19 11:19:23 -0500
commitf2af008695e0b54a58b76caecd52af7e6c97fb29 (patch)
treec6b9614583fb22f4a5100730d259915f00e320de /tools/perf/ui/stdio/hist.c
parent5e47f8ff406296bd078716d71283796ca5c6544b (diff)
perf report: Add callchain value option
Now -g/--call-graph option supports how to display callchain values. Possible values are 'percent', 'period' and 'count'. The percent is same as before and it's the default behavior. The period displays the raw period value rather than the percentage. The count displays the number of occurrences. $ perf report --no-children --stdio -g percent ... 39.93% swapper [kernel.vmlinux] [k] intel_idel | ---intel_idle cpuidle_enter_state cpuidle_enter call_cpuidle cpu_startup_entry | |--28.63%-- start_secondary | --11.30%-- rest_init $ perf report --no-children --show-total-period --stdio -g period ... 39.93% 13018705 swapper [kernel.vmlinux] [k] intel_idel | ---intel_idle cpuidle_enter_state cpuidle_enter call_cpuidle cpu_startup_entry | |--9334403-- start_secondary | --3684302-- rest_init $ perf report --no-children --show-nr-samples --stdio -g count ... 39.93% 80 swapper [kernel.vmlinux] [k] intel_idel | ---intel_idle cpuidle_enter_state cpuidle_enter call_cpuidle cpu_startup_entry | |--57-- start_secondary | --23-- rest_init Signed-off-by: Namhyung Kim <namhyung@kernel.org> Acked-by: Brendan Gregg <brendan.d.gregg@gmail.com> Cc: Andi Kleen <andi@firstfloor.org> Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Kan Liang <kan.liang@intel.com> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1447047946-1691-6-git-send-email-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/ui/stdio/hist.c')
-rw-r--r--tools/perf/ui/stdio/hist.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c
index f4de055cab9b..7ebc661be267 100644
--- a/tools/perf/ui/stdio/hist.c
+++ b/tools/perf/ui/stdio/hist.c
@@ -81,13 +81,14 @@ static size_t __callchain__fprintf_graph(FILE *fp, struct rb_root *root,
81 int depth_mask, int left_margin) 81 int depth_mask, int left_margin)
82{ 82{
83 struct rb_node *node, *next; 83 struct rb_node *node, *next;
84 struct callchain_node *child; 84 struct callchain_node *child = NULL;
85 struct callchain_list *chain; 85 struct callchain_list *chain;
86 int new_depth_mask = depth_mask; 86 int new_depth_mask = depth_mask;
87 u64 remaining; 87 u64 remaining;
88 size_t ret = 0; 88 size_t ret = 0;
89 int i; 89 int i;
90 uint entries_printed = 0; 90 uint entries_printed = 0;
91 int cumul_count = 0;
91 92
92 remaining = total_samples; 93 remaining = total_samples;
93 94
@@ -99,6 +100,7 @@ static size_t __callchain__fprintf_graph(FILE *fp, struct rb_root *root,
99 child = rb_entry(node, struct callchain_node, rb_node); 100 child = rb_entry(node, struct callchain_node, rb_node);
100 cumul = callchain_cumul_hits(child); 101 cumul = callchain_cumul_hits(child);
101 remaining -= cumul; 102 remaining -= cumul;
103 cumul_count += callchain_cumul_counts(child);
102 104
103 /* 105 /*
104 * The depth mask manages the output of pipes that show 106 * The depth mask manages the output of pipes that show
@@ -148,6 +150,12 @@ static size_t __callchain__fprintf_graph(FILE *fp, struct rb_root *root,
148 if (!rem_sq_bracket) 150 if (!rem_sq_bracket)
149 return ret; 151 return ret;
150 152
153 if (callchain_param.value == CCVAL_COUNT && child && child->parent) {
154 rem_node.count = child->parent->children_count - cumul_count;
155 if (rem_node.count <= 0)
156 return ret;
157 }
158
151 new_depth_mask &= ~(1 << (depth - 1)); 159 new_depth_mask &= ~(1 << (depth - 1));
152 ret += ipchain__fprintf_graph(fp, &rem_node, &rem_hits, depth, 160 ret += ipchain__fprintf_graph(fp, &rem_node, &rem_hits, depth,
153 new_depth_mask, 0, total_samples, 161 new_depth_mask, 0, total_samples,