perf tools: Apply percent-limit to callchains
Namhyung Kim
maintainercover perf tools: Apply percent-limit to callchains
Hello,
This patchset tries to implement percent limit to callchains which was requested by Andi Kleen. For some reason, limiting callchains by (overhead) percentage didn't work well. This patch fixes it and make --percent-limit also works for callchains as well as hist entries.
This is available on 'perf/callchain-limit-v1' branch in my tree:
git://git.kernel.org/pub/scm/linux/kernel/git/namhyung/linux-perf.git
Any comments are welcome,
Thanks,
Namhyung
Namhyung Kim (12):
perf report: Apply --percent-limit to callchains also
perf report: Apply callchain percent limit on --stdio
perf report: Get rid of hist_entry__callchain_fprintf() perf report: Fix percent calculation on --stdio
perf report: Hide output pipe for percent-limited callchains on stdio perf hists browser: Fix dump to show correct callchain style perf hists browser: Fix callchain_node__count_rows()
perf hists browser: Apply callchain percent limit
perf hists browser: Fix callchain counting when press ENTER key perf hists browser: Fix counting callchains when expand/collapse all perf hists browser: Update percent base for fractal callchain mode perf report: Fix callchain percent limit on --gtk
tools/perf/builtin-report.c | 9 +- tools/perf/ui/browsers/hists.c | 221 ++++++++++++++++++++++++++++++----------- tools/perf/ui/gtk/hists.c | 15 +++ tools/perf/ui/stdio/hist.c | 74 ++++++++------ 4 files changed, 229 insertions(+), 90 deletions(-)
Signature · 1 line
2.6.4
Namhyung Kim
maintainerPATCH 1/12 perf report: Apply --percent-limit to callchains also
Currently --percent-limit option only works for hist entries. However it'd be better to have same effect to callchains as well
--- tools/perf/builtin-report.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
tools/perf/builtin-report.c +7 -2
@@ -75,7 +75,10 @@ static int report__config(const char *var, const char *value, void *cb)return 0 ; }if (!strcmp (var,"report.percent-limit" )) { - rep->min_percent =strtof (value,NULL ); +double pcnt =strtof (value,NULL ); + + rep->min_percent = pcnt; + callchain_param.min_percent = pcnt;return 0 ; }if (!strcmp (var,"report.children" )) {
@@ -641,8 +644,10 @@ parse_percent_limit(const struct option *opt, const char *str, int unset __maybe_unused) {struct report *rep = opt->value; +double pcnt =strtof (str,NULL ); - rep->min_percent =strtof (str,NULL ); + rep->min_percent = pcnt; + callchain_param.min_percent = pcnt;return 0 ; }
Signature · 1 line
2.6.4
Namhyung Kim
maintainerPATCH 3/12 perf report: Get rid of hist_entry__callchain_fprintf()
In reply to Namhyung KimIt's just a wrapper function to align the start position ofcallchains to 'comm' of each thread if it's a first sort key. But it doesn't not work with tracepoint events and also with upcoming hierarchy view.
--- tools/perf/ui/stdio/hist.c | 27 ++------------------------- 1 file changed, 2 insertions(+), 25 deletions(-)
tools/perf/ui/stdio/hist.c +2 -25
@@ -373,30 +373,6 @@ static size_t hist_entry_callchain__fprintf(struct hist_entry *he,return 0 ; } -static size_t hist_entry__callchain_fprintf (struct hist_entry *he, -struct hists *hists, -FILE *fp) -{ -int left_margin =0 ; -u64 total_period = hists->stats.total_period; - -if (field_order ==NULL && (sort_order ==NULL || - !prefixcmp (sort_order,"comm" ))) { -struct perf_hpp_fmt *fmt; - -perf_hpp__for_each_format (fmt) { -if (!perf_hpp__is_sort_entry (fmt)) -continue ; - -/* must be 'comm' sort entry */ - left_margin = fmt->width (fmt,NULL ,hists_to_evsel (hists)); - left_margin -=thread__comm_len (he->thread); -break ; - } - } -return hist_entry_callchain__fprintf (he, total_period, left_margin, fp); -} -static int hist_entry__snprintf (struct hist_entry *he,struct perf_hpp *hpp) {const char *sep = symbol_conf.field_sep;
@@ -442,6 +418,7 @@ static int hist_entry__fprintf(struct hist_entry *he, size_t size, .buf = bf, .size = size, }; +u64 total_period = hists->stats.total_period;if (size ==0 || size > bfsz) size = hpp.size = bfsz;
@@ -451,7 +428,7 @@ static int hist_entry__fprintf(struct hist_entry *he, size_t size, ret =fprintf (fp,"%s\n" , bf);if (symbol_conf.use_callchain) - ret +=hist_entry__callchain_fprintf (he, hists, fp); + ret +=hist_entry_callchain__fprintf (he, total_period,0 , fp);return ret; }
Signature · 1 line
2.6.4
Namhyung Kim
maintainerPATCH 4/12 perf report: Fix percent calculation on --stdio
In reply to Namhyung KimThe hists' total period should be calculated by hists__total_period() function in order to take account into filterings.
--- tools/perf/ui/stdio/hist.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/ui/stdio/hist.c +1 -1
@@ -418,7 +418,7 @@ static int hist_entry__fprintf(struct hist_entry *he, size_t size, .buf = bf, .size = size, }; -u64 total_period = hists->stats.total_period; +u64 total_period =hists__total_period (hists);if (size ==0 || size > bfsz) size = hpp.size = bfsz;
Signature · 1 line
2.6.4
Namhyung Kim
maintainerPATCH 6/12 perf hists browser: Fix dump to show correct callchain style
In reply to Namhyung KimThe commit 8c430a348699 ("perf hists browser: Support folded callchains") missed to update hist_browser__dump() so it always shows graph-style callchains regardless of current setting.
To fix that, factor out callchain printing code and renamethe existing function which prints graph-style callchain.
--- tools/perf/ui/browsers/hists.c | 73 ++++++++++++++++++++++++------------------ 1 file changed, 41 insertions(+), 32 deletions(-)
tools/perf/ui/browsers/hists.c +41 -32
@@ -844,7 +844,7 @@ next:return row - first_row; } -static int hist_browser__show_callchain(struct hist_browser *browser, +static int hist_browser__show_callchain_graph(struct hist_browser *browser, struct rb_root *root, int level, unsigned short row, u64 total, print_callchain_entry_fn print,
@@ -898,7 +898,7 @@ static int hist_browser__show_callchain(struct hist_browser *browser,else new_total = total; - row +=hist_browser__show_callchain (browser, &child->rb_root, + row +=hist_browser__show_callchain_graph (browser, &child->rb_root, new_level, row, new_total, print, arg, is_output_full); }
@@ -910,6 +910,43 @@ out:return row - first_row; } +static int hist_browser__show_callchain (struct hist_browser *browser, +struct hist_entry *entry,int level, +unsigned short row, +print_callchain_entry_fn print, +struct callchain_print_arg *arg, +check_output_full_fn is_output_full) +{ +u64 total =hists__total_period (entry->hists); +int printed; + +if (callchain_param.mode ==CHAIN_GRAPH_REL ) { +if (symbol_conf.cumulate_callchain) + total = entry->stat_acc->period; +else + total = entry->stat.period; + } + +if (callchain_param.mode ==CHAIN_FLAT ) { + printed =hist_browser__show_callchain_flat (browser, + &entry->sorted_chain, row, total, + print, arg, is_output_full); + }else if (callchain_param.mode ==CHAIN_FOLDED ) { + printed =hist_browser__show_callchain_folded (browser, + &entry->sorted_chain, row, total, + print, arg, is_output_full); + }else { + printed =hist_browser__show_callchain_graph (browser, + &entry->sorted_chain, level, row, total, + print, arg, is_output_full); + } + +if (arg->is_current_entry) + browser->he_selection = entry; + +return printed; +} +struct hpp_arg {struct ui_browser *b;char folded_sign;
@@ -1084,38 +1121,14 @@ static int hist_browser__show_entry(struct hist_browser *browser, --row_offset;if (folded_sign =='-' && row != browser->b.rows) { -u64 total =hists__total_period (entry->hists);struct callchain_print_arg arg = { .row_offset = row_offset, .is_current_entry = current_entry, }; -if (callchain_param.mode ==CHAIN_GRAPH_REL ) { -if (symbol_conf.cumulate_callchain) - total = entry->stat_acc->period; -else - total = entry->stat.period; - } - -if (callchain_param.mode ==CHAIN_FLAT ) { - printed +=hist_browser__show_callchain_flat (browser, - &entry->sorted_chain, row, total, + printed +=hist_browser__show_callchain (browser, entry,1 , row, hist_browser__show_callchain_entry, &arg, hist_browser__check_output_full); - }else if (callchain_param.mode ==CHAIN_FOLDED ) { - printed +=hist_browser__show_callchain_folded (browser, - &entry->sorted_chain, row, total, - hist_browser__show_callchain_entry, &arg, - hist_browser__check_output_full); - }else { - printed +=hist_browser__show_callchain (browser, - &entry->sorted_chain,1 , row, total, - hist_browser__show_callchain_entry, &arg, - hist_browser__check_output_full); - } - -if (arg.is_current_entry) - browser->he_selection = entry; }return printed;
@@ -1380,15 +1393,11 @@ do_offset:static int hist_browser__fprintf_callchain (struct hist_browser *browser,struct hist_entry *he,FILE *fp) { -u64 total =hists__total_period (he->hists);struct callchain_print_arg arg = { .fp = fp, }; -if (symbol_conf.cumulate_callchain) - total = he->stat_acc->period; - -hist_browser__show_callchain (browser, &he->sorted_chain,1 ,0 , total, +hist_browser__show_callchain (browser, he,1 ,0 , hist_browser__fprintf_callchain_entry, &arg, hist_browser__check_dump_full);return arg.printed;
Signature · 1 line
2.6.4
Namhyung Kim
maintainerPATCH 7/12 perf hists browser: Fix callchain_node__count_rows()
In reply to Namhyung KimLike other functions, it should stop counting if there's any folded callchain. Because of this it occasionally lose the cursor at the end.
--- tools/perf/ui/browsers/hists.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
tools/perf/ui/browsers/hists.c +6 -3
@@ -215,7 +215,7 @@ static int callchain_node__count_folded_rows(struct callchain_node *node __maybestatic int callchain_node__count_rows (struct callchain_node *node) {struct callchain_list *chain; -bool unfolded = false; +char folded_sign =' ' ;int n =0 ;if (callchain_param.mode ==CHAIN_FLAT )
@@ -225,10 +225,13 @@ static int callchain_node__count_rows(struct callchain_node *node)list_for_each_entry (chain, &node->val, list) { ++n; - unfolded = chain->unfolded; + + folded_sign =callchain_list__folded (chain); +if (folded_sign =='+' ) +break ; } -if (unfolded) +if (folded_sign =='-' ) n +=callchain_node__count_rows_rb_tree (node);return n;
Signature · 1 line
2.6.4
Namhyung Kim
maintainerPATCH 8/12 perf hists browser: Apply callchain percent limit
In reply to Namhyung KimCurrently 'perf report --tui' misses to check percent limit on callchains. Fix it.
--- tools/perf/ui/browsers/hists.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
tools/perf/ui/browsers/hists.c +25 -0
@@ -681,6 +681,14 @@ static int hist_browser__show_callchain_flat(struct hist_browser *browser,char folded_sign =' ' ;int first = true;int extra_offset =0 ; +double percent; +u64 hits; + + hits =callchain_cumul_hits (child); + percent =100.0 * hits / total; + +if (percent < callchain_param.min_percent) + goto next;list_for_each_entry (chain, &child->parent_val, list) {bool was_first = first;
@@ -784,12 +792,20 @@ static int hist_browser__show_callchain_folded(struct hist_browser *browser,int first = true;char *value_str =NULL , *value_str_alloc =NULL ;char *chain_str =NULL , *chain_str_alloc =NULL ; +double percent; +u64 hits;if (arg->row_offset !=0 ) { arg->row_offset--; goto next; } + hits =callchain_cumul_hits (child); + percent =100.0 * hits / total; + +if (percent < callchain_param.min_percent) + goto next; +if (need_percent) {char buf[64 ];
@@ -869,6 +885,14 @@ static int hist_browser__show_callchain_graph(struct hist_browser *browser,char folded_sign =' ' ;int first = true;int extra_offset =0 ; +double percent; +u64 hits; + + hits =callchain_cumul_hits (child); + percent =100.0 * hits / total; + +if (percent < callchain_param.min_percent) + goto next;list_for_each_entry (chain, &child->val, list) {bool was_first = first;
@@ -905,6 +929,7 @@ static int hist_browser__show_callchain_graph(struct hist_browser *browser, new_level, row, new_total, print, arg, is_output_full); } +next:if (is_output_full (browser, row))break ; node = next;
Signature · 1 line
2.6.4
Namhyung Kim
maintainerPATCH 11/12 perf hists browser: Update percent base for fractal callchain mode
In reply to Namhyung KimIn the fractal callchain mode (CHAIN_GRAPH_REL), the total period is the period of that node. Pass the correct value to calculate the percent when counting the number of callchain rows.
--- tools/perf/ui/browsers/hists.c | 45 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 39 insertions(+), 6 deletions(-)
tools/perf/ui/browsers/hists.c +39 -6
@@ -176,8 +176,15 @@ static int callchain_node__count_rows_rb_tree(struct callchain_node *node, u64 tbreak ; } -if (folded_sign =='-' )/* Have children and they're unfolded */ - n +=callchain_node__count_rows_rb_tree (child, total); +if (folded_sign =='-' ) { +/* Have children and they're unfolded */ +u64 new_total = total; + +if (callchain_param.mode ==CHAIN_GRAPH_REL ) + new_total = child->children_hit; + + n +=callchain_node__count_rows_rb_tree (child, new_total); + } }return n;
@@ -254,6 +261,13 @@ static int callchain__count_rows(struct hist_entry *he)int n =0 ;u64 total =hists__total_period (he->hists); +if (callchain_param.mode ==CHAIN_GRAPH_REL ) { +if (symbol_conf.cumulate_callchain) + total = he->stat_acc->period; +else + total = he->stat.period; + } + chain = &he->sorted_chain;for (nd =rb_first (chain); nd; nd =rb_next (nd)) { struct callchain_node *node = rb_entry(nd, struct callchain_node, rb_node);
@@ -408,9 +422,15 @@ static int callchain_node__set_folding_rb_tree(struct callchain_node *node, has_children = chain->has_children; } -if (has_children) +if (has_children) { +u64 new_total = total; + +if (callchain_param.mode ==CHAIN_GRAPH_REL ) + new_total = node->children_hit; + n +=callchain_node__set_folding_rb_tree (child, unfold, - total); + new_total); + } }return n;
@@ -432,9 +452,15 @@ static int callchain_node__set_folding(struct callchain_node *node, bool unfold, has_children = chain->has_children; } -if (has_children) +if (has_children) { +u64 new_total = total; + +if (callchain_param.mode ==CHAIN_GRAPH_REL ) + new_total = node->children_hit; + n +=callchain_node__set_folding_rb_tree (node, unfold, - total); + new_total); + }return n; }
@@ -457,6 +483,13 @@ static int callchain__set_folding(struct rb_root *chain, bool unfold, u64 total)static void hist_entry__set_folding (struct hist_entry *he,bool unfold,u64 total) { +if (callchain_param.mode ==CHAIN_GRAPH_REL ) { +if (symbol_conf.cumulate_callchain) + total = he->stat_acc->period; +else + total = he->stat.period; + } +hist_entry__init_have_children (he); he->unfolded = unfold ? he->has_children : false;
Signature · 1 line
2.6.4
Namhyung Kim
maintainerPATCH 12/12 perf report: Fix callchain percent limit on --gtk
In reply to Namhyung KimWhen a percent limit is given, it should take callchains into account.
--- tools/perf/ui/gtk/hists.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
tools/perf/ui/gtk/hists.c +15 -0
@@ -100,9 +100,14 @@ static void perf_gtk__add_callchain_flat(struct rb_root *root, GtkTreeStore *stostruct callchain_list *chain;GtkTreeIter iter, new_parent;bool need_new_parent; +double percent; node = rb_entry(nd, struct callchain_node, rb_node); + percent =100.0 *callchain_cumul_hits (node) / total; +if (percent < callchain_param.min_percent) +continue ; + new_parent = *parent; need_new_parent = !has_single_node;
@@ -164,9 +169,14 @@ static void perf_gtk__add_callchain_folded(struct rb_root *root, GtkTreeStore *schar buf[64 ];char *str, *str_alloc =NULL ;bool first = true; +double percent; node = rb_entry(nd, struct callchain_node, rb_node); + percent =100.0 *callchain_cumul_hits (node) / total; +if (percent < callchain_param.min_percent) +continue ; +callchain_node__make_parent_list (node);list_for_each_entry (chain, &node->parent_val, list) {
@@ -224,9 +234,14 @@ static void perf_gtk__add_callchain_graph(struct rb_root *root, GtkTreeStore *stGtkTreeIter iter, new_parent;bool need_new_parent;u64 child_total; +double percent; node = rb_entry(nd, struct callchain_node, rb_node); + percent =100.0 *callchain_cumul_hits (node) / total; +if (percent < callchain_param.min_percent) +continue ; + new_parent = *parent; need_new_parent = !has_single_node && (node->val_nr >1 );
Signature · 1 line
2.6.4
Namhyung Kim
maintainerPATCH 10/12 perf hists browser: Fix counting callchains when expand/collapse all
In reply to Namhyung KimLikely to toggle folding state, when expanding/collapsing all entries it should take into account percent limit of callchains.
--- tools/perf/ui/browsers/hists.c | 48 ++++++++++++++++++++++++++++++------------ 1 file changed, 34 insertions(+), 14 deletions(-)
tools/perf/ui/browsers/hists.c +34 -14
@@ -384,67 +384,85 @@ static bool hist_browser__toggle_fold(struct hist_browser *browser)return false; } -static int callchain_node__set_folding_rb_tree (struct callchain_node *node,bool unfold) +static int callchain_node__set_folding_rb_tree (struct callchain_node *node, +bool unfold,u64 total) {int n =0 ;struct rb_node *nd;for (nd =rb_first (&node->rb_root); nd; nd =rb_next (nd)) { - struct callchain_node *child = rb_entry(nd, struct callchain_node, rb_node); +struct callchain_node *child;struct callchain_list *chain;bool has_children = false; +double percent; +bool can_count; + + child = rb_entry(nd, struct callchain_node, rb_node); + percent =100.0 *callchain_cumul_hits (child) / total; + can_count = (percent >= callchain_param.min_percent);list_for_each_entry (chain, &child->val, list) { - ++n; +if (can_count) + ++n;callchain_list__set_folding (chain, unfold); has_children = chain->has_children; }if (has_children) - n +=callchain_node__set_folding_rb_tree (child, unfold); + n +=callchain_node__set_folding_rb_tree (child, unfold, + total); }return n; } -static int callchain_node__set_folding (struct callchain_node *node,bool unfold) +static int callchain_node__set_folding (struct callchain_node *node,bool unfold, +u64 total) {struct callchain_list *chain;bool has_children = false;int n =0 ; +double percent =100.0 *callchain_cumul_hits (node) / total; +bool can_count = (percent >= callchain_param.min_percent);list_for_each_entry (chain, &node->val, list) { - ++n; +if (can_count) + ++n;callchain_list__set_folding (chain, unfold); has_children = chain->has_children; }if (has_children) - n +=callchain_node__set_folding_rb_tree (node, unfold); + n +=callchain_node__set_folding_rb_tree (node, unfold, + total);return n; } -static int callchain__set_folding (struct rb_root *chain,bool unfold) +static int callchain__set_folding (struct rb_root *chain,bool unfold,u64 total) {struct rb_node *nd;int n =0 ;for (nd =rb_first (chain); nd; nd =rb_next (nd)) { - struct callchain_node *node = rb_entry(nd, struct callchain_node, rb_node); - n +=callchain_node__set_folding (node, unfold); +struct callchain_node *node; + + node = rb_entry(nd, struct callchain_node, rb_node); + n +=callchain_node__set_folding (node, unfold, total); }return n; } -static void hist_entry__set_folding (struct hist_entry *he,bool unfold) +static void hist_entry__set_folding (struct hist_entry *he,bool unfold, +u64 total) {hist_entry__init_have_children (he); he->unfolded = unfold ? he->has_children : false;if (he->has_children) { -int n =callchain__set_folding (&he->sorted_chain, unfold); +int n =callchain__set_folding (&he->sorted_chain, unfold, + total); he->nr_rows = unfold ? n :0 ; }else he->nr_rows =0 ;
@@ -455,12 +473,14 @@ __hist_browser__set_folding(struct hist_browser *browser, bool unfold) {struct rb_node *nd;struct hists *hists = browser->hists; +u64 total =hists__total_period (hists); +struct hist_entry *he;for (nd =rb_first (&hists->entries); (nd =hists__filter_entries (nd, browser->min_pcnt)) !=NULL ; nd =rb_next (nd)) { - struct hist_entry *he = rb_entry(nd, struct hist_entry, rb_node); -hist_entry__set_folding (he, unfold); + he = rb_entry(nd, struct hist_entry, rb_node); +hist_entry__set_folding (he, unfold, total); browser->nr_callchain_rows += he->nr_rows; } }
Signature · 1 line
2.6.4
Namhyung Kim
maintainerPATCH 9/12 perf hists browser: Fix callchain counting when press ENTER key
In reply to Namhyung KimWhen counting callchains of the selected entry it should consider percent limit also. Otherwise it'll cause hists browser misbehaviing due to the incorrect total pline count.
--- tools/perf/ui/browsers/hists.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-)
tools/perf/ui/browsers/hists.c +20 -7
@@ -153,7 +153,7 @@ static void callchain_list__set_folding(struct callchain_list *cl, bool unfold) cl->unfolded = unfold ? cl->has_children : false; } -static int callchain_node__count_rows_rb_tree (struct callchain_node *node) +static int callchain_node__count_rows_rb_tree (struct callchain_node *node,u64 total) {int n =0 ;struct rb_node *nd;
@@ -162,6 +162,11 @@ static int callchain_node__count_rows_rb_tree(struct callchain_node *node) struct callchain_node *child = rb_entry(nd, struct callchain_node, rb_node);struct callchain_list *chain;char folded_sign =' ' ;/* No children */ +double percent; + + percent =100.0 *callchain_cumul_hits (child) / total; +if (percent < callchain_param.min_percent) +continue ;list_for_each_entry (chain, &child->val, list) { ++n;
@@ -172,7 +177,7 @@ static int callchain_node__count_rows_rb_tree(struct callchain_node *node) }if (folded_sign =='-' )/* Have children and they're unfolded */ - n +=callchain_node__count_rows_rb_tree (child); + n +=callchain_node__count_rows_rb_tree (child, total); }return n;
@@ -212,11 +217,16 @@ static int callchain_node__count_folded_rows(struct callchain_node *node __maybereturn 1 ; } -static int callchain_node__count_rows (struct callchain_node *node) +static int callchain_node__count_rows (struct callchain_node *node,u64 total) {struct callchain_list *chain;char folded_sign =' ' ;int n =0 ; +double percent; + + percent =100.0 *callchain_cumul_hits (node) / total; +if (percent < callchain_param.min_percent) +return 0 ;if (callchain_param.mode ==CHAIN_FLAT )return callchain_node__count_flat_rows (node);
@@ -232,19 +242,22 @@ static int callchain_node__count_rows(struct callchain_node *node) }if (folded_sign =='-' ) - n +=callchain_node__count_rows_rb_tree (node); + n +=callchain_node__count_rows_rb_tree (node, total);return n; } -static int callchain__count_rows (struct rb_root *chain) +static int callchain__count_rows (struct hist_entry *he) { +struct rb_root *chain;struct rb_node *nd;int n =0 ; +u64 total =hists__total_period (he->hists); + chain = &he->sorted_chain;for (nd =rb_first (chain); nd; nd =rb_next (nd)) { struct callchain_node *node = rb_entry(nd, struct callchain_node, rb_node); - n +=callchain_node__count_rows (node); + n +=callchain_node__count_rows (node, total); }return n;
@@ -357,7 +370,7 @@ static bool hist_browser__toggle_fold(struct hist_browser *browser) browser->nr_callchain_rows -= he->nr_rows;if (he->unfolded) - he->nr_rows =callchain__count_rows (&he->sorted_chain); + he->nr_rows =callchain__count_rows (he);else he->nr_rows =0 ;
Signature · 1 line
2.6.4
Namhyung Kim
maintainerPATCH 5/12 perf report: Hide output pipe for percent-limited callchains on stdio
In reply to Namhyung KimThe output of callchains on stdio shows pipes to display callchain depth and continuation. But if --percent-limit option is given, it should take it into account so that it can omit unnecessary pipes on the last callchain node.
For example, when 0.03 percent limit is given:
Before)
$ perf report --stdio --percent-limit 0.03
...
0.06% sleep [kernel.vmlinux] [k] kmem_cache_alloc_trace
|
---kmem_cache_alloc_trace
perf_event_mmap
|
|--0.04%--mmap_region
| do_mmap_pgoff
| vm_mmap_pgoff^^^ here
It's because there's a node which has 0.02% of overhead but it's now shown due to the percent limit. After applying this patch,
After)
$ perf report --stdio --percent-limit 0.03
...
0.06% sleep [kernel.vmlinux] [k] kmem_cache_alloc_trace
|
---kmem_cache_alloc_trace
perf_event_mmap
|
--0.04%--mmap_region
do_mmap_pgoff
vm_mmap_pgoff--- tools/perf/ui/stdio/hist.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
tools/perf/ui/stdio/hist.c +15 -0
@@ -120,6 +120,21 @@ static size_t __callchain__fprintf_graph(FILE *fp, struct rb_root *root, new_depth_mask &= ~(1 << (depth -1 ));/* +* If the next node is under percent limit, remaining +* callchains won't be shown. So no need to keep the pipes. +*/ +if (next) { +struct callchain_node *next_child; + + next_child = rb_entry(next, struct callchain_node, rb_node); + cumul =callchain_cumul_counts (next_child); + percent =100.0 * cumul / total_samples; + +if (percent < callchain_param.min_percent) + new_depth_mask &= ~(1 << (depth -1 )); + } + +/* * But we keep the older depth mask for the line separator * to keep the level link until we reach the last child */
Signature · 1 line
2.6.4
Namhyung Kim
maintainerPATCH 2/12 perf report: Apply callchain percent limit on --stdio
In reply to Namhyung KimCurrently 'perf report --stdio' missed to check percent limit of callchains. Fix it.
--- tools/perf/ui/stdio/hist.c | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-)
tools/perf/ui/stdio/hist.c +28 -4
@@ -96,12 +96,19 @@ static size_t __callchain__fprintf_graph(FILE *fp, struct rb_root *root,while (node) {u64 new_total;u64 cumul; +double percent =0.0 ; child = rb_entry(node, struct callchain_node, rb_node); cumul =callchain_cumul_hits (child); remaining -= cumul; cumul_count +=callchain_cumul_counts (child); + next =rb_next (node); + + percent =100.0 * cumul / total_samples; +if (percent < callchain_param.min_percent) + goto next; +/* * The depth mask manages the output of pipes that show * the depth. We don't want to keep the pipes of the current
@@ -109,7 +116,6 @@ static size_t __callchain__fprintf_graph(FILE *fp, struct rb_root *root,* Except if we have remaining filtered hits. They will * supersede the last child */ - next =rb_next (node);if (!next && (callchain_param.mode !=CHAIN_GRAPH_REL || !remaining)) new_depth_mask &= ~(1 << (depth -1 ));
@@ -136,9 +142,11 @@ static size_t __callchain__fprintf_graph(FILE *fp, struct rb_root *root, depth +1 , new_depth_mask | (1 << depth), left_margin); - node = next; +if (++entries_printed == callchain_param.print_limit)break ; +next: + node = next; } if (callchain_param.mode == CHAIN_GRAPH_REL &&
@@ -250,10 +258,18 @@ static size_t callchain__fprintf_flat(FILE *fp, struct rb_root *tree,u32 entries_printed =0 ;struct callchain_node *chain;struct rb_node *rb_node =rb_first (tree); +double percent; +u64 hits;while (rb_node) { chain = rb_entry(rb_node, struct callchain_node, rb_node); + hits =callchain_cumul_hits (chain); + percent =100.0 * hits / total_samples; + +if (percent < callchain_param.min_percent) + goto next; + ret +=fprintf (fp," " ); ret +=callchain_node__fprintf_value (chain, fp, total_samples); ret +=fprintf (fp,"\n" );
@@ -261,7 +277,7 @@ static size_t callchain__fprintf_flat(FILE *fp, struct rb_root *tree, ret +=fprintf (fp,"\n" );if (++entries_printed == callchain_param.print_limit)break ; - +next: rb_node =rb_next (rb_node); }
@@ -301,18 +317,26 @@ static size_t callchain__fprintf_folded(FILE *fp, struct rb_root *tree,u32 entries_printed =0 ;struct callchain_node *chain;struct rb_node *rb_node =rb_first (tree); +double percent; +u64 hits;while (rb_node) { chain = rb_entry(rb_node, struct callchain_node, rb_node); + hits =callchain_cumul_hits (chain); + percent =100.0 * hits / total_samples; + +if (percent < callchain_param.min_percent) + goto next; + ret +=callchain_node__fprintf_value (chain, fp, total_samples); ret +=fprintf (fp," " ); ret +=__callchain__fprintf_folded (fp, chain); ret +=fprintf (fp,"\n" );if (++entries_printed == callchain_param.print_limit)break ; - +next: rb_node =rb_next (rb_node); }
Signature · 1 line
2.6.4
Quoted 7 lines · Namhyung Kim
Hello,
This patchset tries to implement percent limit to callchains which was requested by Andi Kleen. For some reason, limiting callchains by (overhead) percentage didn't work well. This patch fixes it and make --percent-limit also works for callchains as well as hist entries.
Quoted 5 lines
This is available on 'perf/callchain-limit-v1' branch in my tree:
git://git.kernel.org/pub/scm/linux/kernel/git/namhyung/linux-perf.gitAny comments are welcome,
Thanks! Looks good to me.
-Andi
Re: [PATCH 07/12] perf hists browser: Fix callchain_node__count_rows()
In reply to Namhyung KimQuoted 2 lines · Namhyung Kim
Like other functions, it should stop counting if there's any folded callchain. Because of this it occasionally lose the cursor at the end.
are you reffering to the case when the browser wouldn't jump to the last entry, but the cursor disappears instead, and then shows up after holding 'UP' arrow?
because I've seen that occasionaly ;-)
jirka
Quoted 17 lines · Namhyung Kim
Hello,
This patchset tries to implement percent limit to callchains which was requested by Andi Kleen. For some reason, limiting callchains by (overhead) percentage didn't work well. This patch fixes it and make --percent-limit also works for callchains as well as hist entries.
This is available on 'perf/callchain-limit-v1' branch in my tree:
git://git.kernel.org/pub/scm/linux/kernel/git/namhyung/linux-perf.gitAny comments are welcome,
Thanks,
Namhyung
Quoted 13 lines
Namhyung Kim (12):
perf report: Apply --percent-limit to callchains also
perf report: Apply callchain percent limit on --stdio
perf report: Get rid ofhist_entry__callchain_fprintf()perf report: Fix percent calculation on --stdio
perf report: Hide output pipe for percent-limited callchains on stdio perf hists browser: Fix dump to show correct callchain style perf hists browser: Fixcallchain_node__count_rows()
perf hists browser: Apply callchain percent limit
perf hists browser: Fix callchain counting when press ENTER key perf hists browser: Fix counting callchains when expand/collapse all perf hists browser: Update percent base for fractal callchain mode perf report: Fix callchain percent limit on --gtk
is 0.5 the default or one has to use the --percent-limit 0.5 for the limit to be effective?
without the option I'm getting empty callchains that are below 0.5 but only in TUI mode (attached).. --stdio shows them all unfolded
thanks,
jirka
---
+ 46.69% 46.69% ls [kernel.vmlinux] [k] intel_bts_enable_local ▒ + 0.08% 0.00% perf [kernel.vmlinux] [k] perf_pmu_enable.part.87 ▒ + 0.08% 0.00% perf [kernel.vmlinux] [k] perf_event_context_sched_in ▒ + 0.08% 0.00% perf [kernel.vmlinux] [k] perf_event_exec ▒ + 0.08% 0.00% perf [kernel.vmlinux] [k] setup_new_exec ▒ + 0.08% 0.00% perf [kernel.vmlinux] [k] load_elf_binary ▒ + 0.08% 0.00% perf [kernel.vmlinux] [k] search_binary_handler ▒ + 0.08% 0.00% perf [kernel.vmlinux] [k] do_execveat_common.isra.33 ▒ + 0.08% 0.00% perf [kernel.vmlinux] [k] sys_execve ▒ + 0.08% 0.00% perf [kernel.vmlinux] [k] return_from_execve ▒ - 0.08% 0.00% perf [unknown] [k] 0x00007f2175b35e07 ▒ - 0.04% 0.00% perf [kernel.vmlinux] [k] perf_event_nmi_handler ▒ - 0.04% 0.00% perf [kernel.vmlinux] [k] nmi_handle ▒ - 0.04% 0.00% perf [kernel.vmlinux] [k] default_do_nmi ▒ - 0.04% 0.00% perf [kernel.vmlinux] [k] do_nmi ▒ - 0.04% 0.00% perf [kernel.vmlinux] [k] end_repeat_nmi ▒ - 0.04% 0.04% perf [kernel.vmlinux] [k] x86_pmu_enable ▒ - 0.04% 0.04% perf [kernel.vmlinux] [k] native_apic_mem_write ▒
Namhyung Kim
maintainerRe: [PATCH 07/12] perf hists browser: Fix callchain_node__count_rows()
In reply to Jiri OlsaHi Jiri,
Quoted 7 lines · Jiri Olsa
Quoted 2 lines · Namhyung Kim
Like other functions, it should stop counting if there's any folded callchain. Because of this it occasionally lose the cursor at the end.
are you reffering to the case when the browser wouldn't jump to the last entry, but the cursor disappears instead, and then shows up after holding 'UP' arrow?
Right. Since it counts some of folded callchain nodes, the cursor went beyond the end so nothing was shown for them.
Quoted 2 lines
because I've seen that occasionaly ;-)
Me too.
Thanks,
Namhyung
Namhyung Kim
maintainerQuoted 32 lines · Jiri Olsa
Quoted 17 lines · Namhyung Kim
Hello,
This patchset tries to implement percent limit to callchains which was requested by Andi Kleen. For some reason, limiting callchains by (overhead) percentage didn't work well. This patch fixes it and make --percent-limit also works for callchains as well as hist entries.
This is available on 'perf/callchain-limit-v1' branch in my tree:
git://git.kernel.org/pub/scm/linux/kernel/git/namhyung/linux-perf.gitAny comments are welcome,
Thanks,
NamhyungQuoted 13 lines
Namhyung Kim (12):
perf report: Apply --percent-limit to callchains also
perf report: Apply callchain percent limit on --stdio
perf report: Get rid ofhist_entry__callchain_fprintf()perf report: Fix percent calculation on --stdio
perf report: Hide output pipe for percent-limited callchains on stdio perf hists browser: Fix dump to show correct callchain style perf hists browser: Fixcallchain_node__count_rows()
perf hists browser: Apply callchain percent limit
perf hists browser: Fix callchain counting when press ENTER key perf hists browser: Fix counting callchains when expand/collapse all perf hists browser: Update percent base for fractal callchain mode perf report: Fix callchain percent limit on --gtk
Quoted 2 lines
is 0.5 the default or one has to use the --percent-limit 0.5 for the limit to be effective?
Yes, it's effective now. I also think we need to change the default limit of 0.5. It was set for 'fractal' mode initially AFAIK so its percentage is relative to each node. In this case 0.5% of limit makes sense because it'll be a very small (absolute) value.
But With 'graph' mode (now default), there're many entries under 0.5 overhead and they silently won't show callchains anymore. Actually I was confused by it when working with this patchset.
What about 0.005% for the new default?
Quoted 3 lines
without the option I'm getting empty callchains that are below 0.5 but only in TUI mode (attached).. --stdio shows them all unfolded
It should not show them all. But I found that I missed a check for a stdio case. Could you please test below?
Quoted 1 line
From
9026b85537cf31af43124c957867f42b34262f2eMon Sep 17 00:00:00 2001
From: Namhyung Kim <[email protected]>
Date: Tue, 26 Jan 2016 21:40:39 +0900
Subject: [PATCH] perf report: Check percent limit of single callchain on stdio
While previous commit ("perf report: Apply callchain percent limit on --stdio") checked percent limit of callchain, it missed to check a single-path callchains. It resulted in showing callchains under the limit if an entry has only single path of call graph.
--- tools/perf/ui/stdio/hist.c | 6 ++++++ 1 file changed, 6 insertions(+)
tools/perf/ui/stdio/hist.c +6 -0
@@ -199,6 +199,7 @@ static size_t callchain__fprintf_graph(FILE *fp, struct rb_root *root,int i =0 ;int ret =0 ;char bf[1024 ]; +double percent;/* * If have one single callchain root, don't bother printing
@@ -208,6 +209,11 @@ static size_t callchain__fprintf_graph(FILE *fp, struct rb_root *root, node =rb_first (root);if (node && !rb_next (node)) { cnode = rb_entry(node, struct callchain_node, rb_node); + + percent =100.0 *callchain_cumul_hits (cnode) / total_samples; +if (percent < callchain_param.min_percent) +return 0 ; +list_for_each_entry (chain, &cnode->val, list) {/* * If we sort by symbol, the first entry is the same than
Signature · 1 line
2.6.4
Quoted 49 lines · Namhyung Kim
Quoted 32 lines · Jiri Olsa
Quoted 17 lines · Namhyung Kim
Hello,
This patchset tries to implement percent limit to callchains which was requested by Andi Kleen. For some reason, limiting callchains by (overhead) percentage didn't work well. This patch fixes it and make --percent-limit also works for callchains as well as hist entries.
This is available on 'perf/callchain-limit-v1' branch in my tree:
git://git.kernel.org/pub/scm/linux/kernel/git/namhyung/linux-perf.gitAny comments are welcome,
Thanks,
NamhyungQuoted 13 lines
Namhyung Kim (12):
perf report: Apply --percent-limit to callchains also
perf report: Apply callchain percent limit on --stdio
perf report: Get rid ofhist_entry__callchain_fprintf()perf report: Fix percent calculation on --stdio
perf report: Hide output pipe for percent-limited callchains on stdio perf hists browser: Fix dump to show correct callchain style perf hists browser: Fixcallchain_node__count_rows()
perf hists browser: Apply callchain percent limit
perf hists browser: Fix callchain counting when press ENTER key perf hists browser: Fix counting callchains when expand/collapse all perf hists browser: Update percent base for fractal callchain mode perf report: Fix callchain percent limit on --gtkQuoted 2 lines
is 0.5 the default or one has to use the --percent-limit 0.5 for the limit to be effective?
Yes, it's effective now. I also think we need to change the default limit of 0.5. It was set for 'fractal' mode initially AFAIK so its percentage is relative to each node. In this case 0.5% of limit makes sense because it'll be a very small (absolute) value.
But With 'graph' mode (now default), there're many entries under 0.5 overhead and they silently won't show callchains anymore. Actually I was confused by it when working with this patchset.
What about 0.005% for the new default?
Quoted 1 line
Quoted 5 lines
Quoted 2 lines
without the option I'm getting empty callchains that are below 0.5 but only in TUI mode (attached).. --stdio shows them all unfolded
It should not show them all. But I found that I missed a check for a stdio case. Could you please test below?
did not help, it's still there.. same output as before
jirka
Namhyung Kim
maintainerQuoted 50 lines · Jiri Olsa
Quoted 49 lines · Namhyung Kim
Quoted 32 lines · Jiri Olsa
Quoted 17 lines · Namhyung Kim
Hello,
This patchset tries to implement percent limit to callchains which was requested by Andi Kleen. For some reason, limiting callchains by (overhead) percentage didn't work well. This patch fixes it and make --percent-limit also works for callchains as well as hist entries.
This is available on 'perf/callchain-limit-v1' branch in my tree:
git://git.kernel.org/pub/scm/linux/kernel/git/namhyung/linux-perf.gitAny comments are welcome,
Thanks,
NamhyungQuoted 13 lines
Namhyung Kim (12):
perf report: Apply --percent-limit to callchains also
perf report: Apply callchain percent limit on --stdio
perf report: Get rid ofhist_entry__callchain_fprintf()perf report: Fix percent calculation on --stdio
perf report: Hide output pipe for percent-limited callchains on stdio perf hists browser: Fix dump to show correct callchain style perf hists browser: Fixcallchain_node__count_rows()
perf hists browser: Apply callchain percent limit
perf hists browser: Fix callchain counting when press ENTER key perf hists browser: Fix counting callchains when expand/collapse all perf hists browser: Update percent base for fractal callchain mode perf report: Fix callchain percent limit on --gtkQuoted 2 lines
is 0.5 the default or one has to use the --percent-limit 0.5 for the limit to be effective?
Yes, it's effective now. I also think we need to change the default limit of 0.5. It was set for 'fractal' mode initially AFAIK so its percentage is relative to each node. In this case 0.5% of limit makes sense because it'll be a very small (absolute) value.
But With 'graph' mode (now default), there're many entries under 0.5 overhead and they silently won't show callchains anymore. Actually I was confused by it when working with this patchset.
What about 0.005% for the new default?
Quoted 1 line
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
without the option I'm getting empty callchains that are below 0.5 but only in TUI mode (attached).. --stdio shows them all unfolded
It should not show them all. But I found that I missed a check for a stdio case. Could you please test below?
did not help, it's still there.. same output as before
Hmm.. strange, could you show me the (part of) stdio output?
Thanks,
Namhyung
Quoted 54 lines · Namhyung Kim
Quoted 53 lines · Jiri Olsa
Quoted 52 lines · Namhyung Kim
Quoted 32 lines · Jiri Olsa
Quoted 17 lines · Namhyung Kim
Hello,
This patchset tries to implement percent limit to callchains which was requested by Andi Kleen. For some reason, limiting callchains by (overhead) percentage didn't work well. This patch fixes it and make --percent-limit also works for callchains as well as hist entries.
This is available on 'perf/callchain-limit-v1' branch in my tree:
git://git.kernel.org/pub/scm/linux/kernel/git/namhyung/linux-perf.gitAny comments are welcome,
Thanks,
NamhyungQuoted 13 lines
Namhyung Kim (12):
perf report: Apply --percent-limit to callchains also
perf report: Apply callchain percent limit on --stdio
perf report: Get rid ofhist_entry__callchain_fprintf()perf report: Fix percent calculation on --stdio
perf report: Hide output pipe for percent-limited callchains on stdio perf hists browser: Fix dump to show correct callchain style perf hists browser: Fixcallchain_node__count_rows()
perf hists browser: Apply callchain percent limit
perf hists browser: Fix callchain counting when press ENTER key perf hists browser: Fix counting callchains when expand/collapse all perf hists browser: Update percent base for fractal callchain mode perf report: Fix callchain percent limit on --gtkQuoted 2 lines
is 0.5 the default or one has to use the --percent-limit 0.5 for the limit to be effective?
Yes, it's effective now. I also think we need to change the default limit of 0.5. It was set for 'fractal' mode initially AFAIK so its percentage is relative to each node. In this case 0.5% of limit makes sense because it'll be a very small (absolute) value.
But With 'graph' mode (now default), there're many entries under 0.5 overhead and they silently won't show callchains anymore. Actually I was confused by it when working with this patchset.
What about 0.005% for the new default?
Quoted 3 lines
without the option I'm getting empty callchains that are below 0.5 but only in TUI mode (attached).. --stdio shows them all unfolded
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
It should not show them all. But I found that I missed a check for a stdio case. Could you please test below?
did not help, it's still there.. same output as before
Hmm.. strange, could you show me the (part of) stdio output?
yea, that one changed as well.. no callchains now, attached
jirka
---
[jolsa@krava perf]$ ./perf report --stdio
...
46.69% 46.69% ls [kernel.vmlinux] [k] intel_bts_enable_local
|
---0x1000
__statfs
entry_SYSCALL_64_fastpath
sys_statfs
SYSC_statfs
user_statfs
user_path_at_empty
filename_lookup
path_lookupat
link_path_walk
inode_permission
__inode_permission
kernfs_iop_permission
kernfs_refresh_inode
security_inode_notifysecctx
selinux_inode_notifysecctx
selinux_inode_setsecurity
security_context_to_sid
security_context_to_sid_core
string_to_context_struct
hashtab_search
apic_timer_interrupt
smp_apic_timer_interrupt
local_apic_timer_interrupt
hrtimer_interrupt
__hrtimer_run_queues
tick_sched_timer
tick_sched_handle.isra.17
update_process_times
scheduler_tick
perf_event_task_tick
perf_pmu_enable.part.87
x86_pmu_enable
intel_pmu_enable_all
intel_bts_enable_local
0.08% 0.00% perf [kernel.vmlinux] [k] perf_pmu_enable.part.87
0.08% 0.00% perf [kernel.vmlinux] [k] perf_event_context_sched_in
0.08% 0.00% perf [kernel.vmlinux] [k] perf_event_exec
0.08% 0.00% perf [kernel.vmlinux] [k] setup_new_exec
0.08% 0.00% perf [kernel.vmlinux] [k] load_elf_binary
0.08% 0.00% perf [kernel.vmlinux] [k] search_binary_handler
0.08% 0.00% perf [kernel.vmlinux] [k] do_execveat_common.isra.33
0.08% 0.00% perf [kernel.vmlinux] [k] sys_execve
0.08% 0.00% perf [kernel.vmlinux] [k] return_from_execve
0.08% 0.00% perf [unknown] [k] 0x00007f2175b35e07
0.04% 0.00% perf [kernel.vmlinux] [k] perf_event_nmi_handler
0.04% 0.00% perf [kernel.vmlinux] [k] nmi_handle
0.04% 0.00% perf [kernel.vmlinux] [k] default_do_nmi
0.04% 0.00% perf [kernel.vmlinux] [k] do_nmi
0.04% 0.00% perf [kernel.vmlinux] [k] end_repeat_nmi
0.04% 0.04% perf [kernel.vmlinux] [k] x86_pmu_enable
0.04% 0.04% perf [kernel.vmlinux] [k] native_apic_mem_write Namhyung Kim
maintainerQuoted 121 lines · Jiri Olsa
Quoted 54 lines · Namhyung Kim
Quoted 53 lines · Jiri Olsa
Quoted 52 lines · Namhyung Kim
Quoted 32 lines · Jiri Olsa
Quoted 17 lines · Namhyung Kim
Hello,
This patchset tries to implement percent limit to callchains which was requested by Andi Kleen. For some reason, limiting callchains by (overhead) percentage didn't work well. This patch fixes it and make --percent-limit also works for callchains as well as hist entries.
This is available on 'perf/callchain-limit-v1' branch in my tree:
git://git.kernel.org/pub/scm/linux/kernel/git/namhyung/linux-perf.gitAny comments are welcome,
Thanks,
NamhyungQuoted 13 lines
Namhyung Kim (12):
perf report: Apply --percent-limit to callchains also
perf report: Apply callchain percent limit on --stdio
perf report: Get rid ofhist_entry__callchain_fprintf()perf report: Fix percent calculation on --stdio
perf report: Hide output pipe for percent-limited callchains on stdio perf hists browser: Fix dump to show correct callchain style perf hists browser: Fixcallchain_node__count_rows()
perf hists browser: Apply callchain percent limit
perf hists browser: Fix callchain counting when press ENTER key perf hists browser: Fix counting callchains when expand/collapse all perf hists browser: Update percent base for fractal callchain mode perf report: Fix callchain percent limit on --gtkQuoted 2 lines
is 0.5 the default or one has to use the --percent-limit 0.5 for the limit to be effective?
Yes, it's effective now. I also think we need to change the default limit of 0.5. It was set for 'fractal' mode initially AFAIK so its percentage is relative to each node. In this case 0.5% of limit makes sense because it'll be a very small (absolute) value.
But With 'graph' mode (now default), there're many entries under 0.5 overhead and they silently won't show callchains anymore. Actually I was confused by it when working with this patchset.
What about 0.005% for the new default?
Quoted 3 lines
without the option I'm getting empty callchains that are below 0.5 but only in TUI mode (attached).. --stdio shows them all unfolded
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
It should not show them all. But I found that I missed a check for a stdio case. Could you please test below?
did not help, it's still there.. same output as before
Hmm.. strange, could you show me the (part of) stdio output?
yea, that one changed as well.. no callchains now, attached
jirka
---
[jolsa@krava perf]$ ./perf report --stdio...
46.69% 46.69% ls [kernel.vmlinux] [k] intel_bts_enable_local | ---0x1000 __statfs entry_SYSCALL_64_fastpath sys_statfs SYSC_statfs user_statfs user_path_at_empty filename_lookup path_lookupat link_path_walk inode_permission __inode_permission kernfs_iop_permission kernfs_refresh_inode security_inode_notifysecctx selinux_inode_notifysecctx selinux_inode_setsecurity security_context_to_sid security_context_to_sid_core string_to_context_struct hashtab_search apic_timer_interrupt smp_apic_timer_interrupt local_apic_timer_interrupt hrtimer_interrupt __hrtimer_run_queues tick_sched_timer tick_sched_handle.isra.17 update_process_times scheduler_tick perf_event_task_tick perf_pmu_enable.part.87 x86_pmu_enable intel_pmu_enable_all intel_bts_enable_local 0.08% 0.00% perf [kernel.vmlinux] [k] perf_pmu_enable.part.87 0.08% 0.00% perf [kernel.vmlinux] [k] perf_event_context_sched_in 0.08% 0.00% perf [kernel.vmlinux] [k] perf_event_exec 0.08% 0.00% perf [kernel.vmlinux] [k] setup_new_exec 0.08% 0.00% perf [kernel.vmlinux] [k] load_elf_binary 0.08% 0.00% perf [kernel.vmlinux] [k] search_binary_handler 0.08% 0.00% perf [kernel.vmlinux] [k] do_execveat_common.isra.33 0.08% 0.00% perf [kernel.vmlinux] [k] sys_execve 0.08% 0.00% perf [kernel.vmlinux] [k] return_from_execve
Quoted 9 lines
0.08% 0.00% perf [unknown] [k] 0x00007f2175b35e07
0.04% 0.00% perf [kernel.vmlinux] [k] perf_event_nmi_handler
0.04% 0.00% perf [kernel.vmlinux] [k] nmi_handle
0.04% 0.00% perf [kernel.vmlinux] [k] default_do_nmi
0.04% 0.00% perf [kernel.vmlinux] [k] do_nmi
0.04% 0.00% perf [kernel.vmlinux] [k] end_repeat_nmi
0.04% 0.04% perf [kernel.vmlinux] [k] x86_pmu_enable
0.04% 0.04% perf [kernel.vmlinux] [k] native_apic_mem_write What's the problem? Now by default callchains under 0.5% (absolute) will not be shown. I think this is intended output, and we need to consider changing the default percent limit.
Thanks,
Namhyung
On Tue, Jan 26, 2016 at 11:49:07PM +0900, Namhyung Kim wrote:
SNIP
Quoted 30 lines
Quoted 20 lines
__hrtimer_run_queues tick_sched_timer tick_sched_handle.isra.17 update_process_times scheduler_tick perf_event_task_tick perf_pmu_enable.part.87 x86_pmu_enable intel_pmu_enable_all intel_bts_enable_local 0.08% 0.00% perf [kernel.vmlinux] [k] perf_pmu_enable.part.87 0.08% 0.00% perf [kernel.vmlinux] [k] perf_event_context_sched_in 0.08% 0.00% perf [kernel.vmlinux] [k] perf_event_exec 0.08% 0.00% perf [kernel.vmlinux] [k] setup_new_exec 0.08% 0.00% perf [kernel.vmlinux] [k] load_elf_binary 0.08% 0.00% perf [kernel.vmlinux] [k] search_binary_handler 0.08% 0.00% perf [kernel.vmlinux] [k] do_execveat_common.isra.33 0.08% 0.00% perf [kernel.vmlinux] [k] sys_execve 0.08% 0.00% perf [kernel.vmlinux] [k] return_from_execveQuoted 9 lines
0.08% 0.00% perf [unknown] [k] 0x00007f2175b35e07 0.04% 0.00% perf [kernel.vmlinux] [k] perf_event_nmi_handler 0.04% 0.00% perf [kernel.vmlinux] [k] nmi_handle 0.04% 0.00% perf [kernel.vmlinux] [k] default_do_nmi 0.04% 0.00% perf [kernel.vmlinux] [k] do_nmi 0.04% 0.00% perf [kernel.vmlinux] [k] end_repeat_nmi 0.04% 0.04% perf [kernel.vmlinux] [k] x86_pmu_enable 0.04% 0.04% perf [kernel.vmlinux] [k] native_apic_mem_write
Quoted 3 lines
What's the problem? Now by default callchains under 0.5% (absolute) will not be shown. I think this is intended output, and we need to consider changing the default percent limit.
hm, just the TUI shows +- for entries with no callchain
jirka
Arnaldo Carvalho de Melo
maintainerEm Tue, Jan 26, 2016 at 04:18:00PM +0100, Jiri Olsa escreveu:
Quoted 34 lines · Namhyung Kim
SNIP
Quoted 30 lines
Quoted 29 lines
__hrtimer_run_queues tick_sched_timer tick_sched_handle.isra.17 update_process_times scheduler_tick perf_event_task_tick perf_pmu_enable.part.87 x86_pmu_enable intel_pmu_enable_all intel_bts_enable_local 0.08% 0.00% perf [kernel.vmlinux] [k] perf_pmu_enable.part.87 0.08% 0.00% perf [kernel.vmlinux] [k] perf_event_context_sched_in 0.08% 0.00% perf [kernel.vmlinux] [k] perf_event_exec 0.08% 0.00% perf [kernel.vmlinux] [k] setup_new_exec 0.08% 0.00% perf [kernel.vmlinux] [k] load_elf_binary 0.08% 0.00% perf [kernel.vmlinux] [k] search_binary_handler 0.08% 0.00% perf [kernel.vmlinux] [k] do_execveat_common.isra.33 0.08% 0.00% perf [kernel.vmlinux] [k] sys_execve 0.08% 0.00% perf [kernel.vmlinux] [k] return_from_execve 0.08% 0.00% perf [unknown] [k] 0x00007f2175b35e07 0.04% 0.00% perf [kernel.vmlinux] [k] perf_event_nmi_handler 0.04% 0.00% perf [kernel.vmlinux] [k] nmi_handle 0.04% 0.00% perf [kernel.vmlinux] [k] default_do_nmi 0.04% 0.00% perf [kernel.vmlinux] [k] do_nmi 0.04% 0.00% perf [kernel.vmlinux] [k] end_repeat_nmi 0.04% 0.04% perf [kernel.vmlinux] [k] x86_pmu_enable 0.04% 0.04% perf [kernel.vmlinux] [k] native_apic_mem_write
Quoted 5 lines
Quoted 3 lines
What's the problem? Now by default callchains under 0.5% (absolute) will not be shown. I think this is intended output, and we need to consider changing the default percent limit.
hm, just the TUI shows +- for entries with no callchain
Humm, this is an old bug, never got around to try to fix it, or is this something you were not experiencing before this patchkit from Namhyung?
- Arnaldo
Quoted 35 lines · Arnaldo Carvalho de Melo
Em Tue, Jan 26, 2016 at 04:18:00PM +0100, Jiri Olsa escreveu:
Quoted 34 lines · Namhyung Kim
SNIP
Quoted 30 lines
Quoted 29 lines
__hrtimer_run_queues tick_sched_timer tick_sched_handle.isra.17 update_process_times scheduler_tick perf_event_task_tick perf_pmu_enable.part.87 x86_pmu_enable intel_pmu_enable_all intel_bts_enable_local 0.08% 0.00% perf [kernel.vmlinux] [k] perf_pmu_enable.part.87 0.08% 0.00% perf [kernel.vmlinux] [k] perf_event_context_sched_in 0.08% 0.00% perf [kernel.vmlinux] [k] perf_event_exec 0.08% 0.00% perf [kernel.vmlinux] [k] setup_new_exec 0.08% 0.00% perf [kernel.vmlinux] [k] load_elf_binary 0.08% 0.00% perf [kernel.vmlinux] [k] search_binary_handler 0.08% 0.00% perf [kernel.vmlinux] [k] do_execveat_common.isra.33 0.08% 0.00% perf [kernel.vmlinux] [k] sys_execve 0.08% 0.00% perf [kernel.vmlinux] [k] return_from_execve 0.08% 0.00% perf [unknown] [k] 0x00007f2175b35e07 0.04% 0.00% perf [kernel.vmlinux] [k] perf_event_nmi_handler 0.04% 0.00% perf [kernel.vmlinux] [k] nmi_handle 0.04% 0.00% perf [kernel.vmlinux] [k] default_do_nmi 0.04% 0.00% perf [kernel.vmlinux] [k] do_nmi 0.04% 0.00% perf [kernel.vmlinux] [k] end_repeat_nmi 0.04% 0.04% perf [kernel.vmlinux] [k] x86_pmu_enable 0.04% 0.04% perf [kernel.vmlinux] [k] native_apic_mem_write
Quoted 9 lines
Quoted 5 lines
Quoted 3 lines
What's the problem? Now by default callchains under 0.5% (absolute) will not be shown. I think this is intended output, and we need to consider changing the default percent limit.
hm, just the TUI shows +- for entries with no callchain
Humm, this is an old bug, never got around to try to fix it, or is this something you were not experiencing before this patchkit from Namhyung?
well, there were callchains present before this patchset ;-)
jirka
Namhyung Kim
maintainerQuoted 40 lines · Jiri Olsa
Quoted 39 lines · Arnaldo Carvalho de Melo
Em Tue, Jan 26, 2016 at 04:18:00PM +0100, Jiri Olsa escreveu:
Quoted 38 lines · Namhyung Kim
SNIP
Quoted 33 lines
Quoted 20 lines
__hrtimer_run_queues tick_sched_timer tick_sched_handle.isra.17 update_process_times scheduler_tick perf_event_task_tick perf_pmu_enable.part.87 x86_pmu_enable intel_pmu_enable_all intel_bts_enable_local 0.08% 0.00% perf [kernel.vmlinux] [k] perf_pmu_enable.part.87 0.08% 0.00% perf [kernel.vmlinux] [k] perf_event_context_sched_in 0.08% 0.00% perf [kernel.vmlinux] [k] perf_event_exec 0.08% 0.00% perf [kernel.vmlinux] [k] setup_new_exec 0.08% 0.00% perf [kernel.vmlinux] [k] load_elf_binary 0.08% 0.00% perf [kernel.vmlinux] [k] search_binary_handler 0.08% 0.00% perf [kernel.vmlinux] [k] do_execveat_common.isra.33 0.08% 0.00% perf [kernel.vmlinux] [k] sys_execve 0.08% 0.00% perf [kernel.vmlinux] [k] return_from_execveQuoted 9 lines
0.08% 0.00% perf [unknown] [k] 0x00007f2175b35e07 0.04% 0.00% perf [kernel.vmlinux] [k] perf_event_nmi_handler 0.04% 0.00% perf [kernel.vmlinux] [k] nmi_handle 0.04% 0.00% perf [kernel.vmlinux] [k] default_do_nmi 0.04% 0.00% perf [kernel.vmlinux] [k] do_nmi 0.04% 0.00% perf [kernel.vmlinux] [k] end_repeat_nmi 0.04% 0.04% perf [kernel.vmlinux] [k] x86_pmu_enable 0.04% 0.04% perf [kernel.vmlinux] [k] native_apic_mem_writeWhat's the problem? Now by default callchains under 0.5% (absolute) will not be shown. I think this is intended output, and we need to consider changing the default percent limit.
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
hm, just the TUI shows +- for entries with no callchain
Humm, this is an old bug, never got around to try to fix it, or is this something you were not experiencing before this patchkit from Namhyung?
well, there were callchains present before this patchset ;-)
That is because we apply percent limit to callchains now, and the default is 0.5%. Before this patchset percent limit seems not applied so you saw the callchains under the limit.
Thanks,
Namhyung
On Wed, Jan 27, 2016 at 12:54:17AM +0900, Namhyung Kim wrote:
SNIP
Quoted 14 lines
Quoted 14 lines
Quoted 13 lines
Quoted 9 lines
Quoted 7 lines
Quoted 3 lines
0.04% 0.04% perf [kernel.vmlinux] [k] x86_pmu_enable 0.04% 0.04% perf [kernel.vmlinux] [k] native_apic_mem_writeWhat's the problem? Now by default callchains under 0.5% (absolute) will not be shown. I think this is intended output, and we need to consider changing the default percent limit.
hm, just the TUI shows +- for entries with no callchain
Humm, this is an old bug, never got around to try to fix it, or is this something you were not experiencing before this patchkit from Namhyung?
Quoted 5 lines
Quoted 1 line
well, there were callchains present before this patchset ;-)
That is because we apply percent limit to callchains now, and the default is 0.5%. Before this patchset percent limit seems not applied so you saw the callchains under the limit.
I'm just saying that in TUI I see entries without callcains (which are filtered out) but those entries are still marked with +- ... I dont know if that's some old issue
thanks,
jirka
---
+ 0.08% 0.00% perf [kernel.vmlinux] [k] perf_pmu_enable.part.87 ▒ + 0.08% 0.00% perf [kernel.vmlinux] [k] perf_event_context_sched_in ▒ + 0.08% 0.00% perf [kernel.vmlinux] [k] perf_event_exec ▒ + 0.08% 0.00% perf [kernel.vmlinux] [k] setup_new_exec ▒ + 0.08% 0.00% perf [kernel.vmlinux] [k] load_elf_binary ▒ + 0.08% 0.00% perf [kernel.vmlinux] [k] search_binary_handler ▒ + 0.08% 0.00% perf [kernel.vmlinux] [k] do_execveat_common.isra.33 ▒ + 0.08% 0.00% perf [kernel.vmlinux] [k] sys_execve ▒ - 0.08% 0.00% perf [kernel.vmlinux] [k] return_from_execve ▒ - 0.08% 0.00% perf [unknown] [k] 0x00007f2175b35e07 ▒ - 0.04% 0.00% perf [kernel.vmlinux] [k] perf_event_nmi_handler ▒ - 0.04% 0.00% perf [kernel.vmlinux] [k] nmi_handle ▒ - 0.04% 0.00% perf [kernel.vmlinux] [k] default_do_nmi ▒ - 0.04% 0.00% perf [kernel.vmlinux] [k] do_nmi ▒ - 0.04% 0.00% perf [kernel.vmlinux] [k] end_repeat_nmi ▒ - 0.04% 0.04% perf [kernel.vmlinux] [k] x86_pmu_enable ▒ - 0.04% 0.04% perf [kernel.vmlinux] [k] native_apic_mem_write ▒
Namhyung Kim
maintainerHi Jiri,
Quoted 18 lines · Jiri Olsa
On Wed, Jan 27, 2016 at 12:54:17AM +0900, Namhyung Kim wrote:
SNIP
Quoted 14 lines
Quoted 14 lines
Quoted 13 lines
Quoted 9 lines
Quoted 7 lines
Quoted 3 lines
0.04% 0.04% perf [kernel.vmlinux] [k] x86_pmu_enable 0.04% 0.04% perf [kernel.vmlinux] [k] native_apic_mem_writeWhat's the problem? Now by default callchains under 0.5% (absolute) will not be shown. I think this is intended output, and we need to consider changing the default percent limit.
hm, just the TUI shows +- for entries with no callchain
Humm, this is an old bug, never got around to try to fix it, or is this something you were not experiencing before this patchkit from Namhyung?
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
well, there were callchains present before this patchset ;-)
That is because we apply percent limit to callchains now, and the default is 0.5%. Before this patchset percent limit seems not applied so you saw the callchains under the limit.
I'm just saying that in TUI I see entries without callcains (which are filtered out) but those entries are still marked with +- ... I dont know if that's some old issue
Ah, ok. So you don't like the spurious folded signs..
Anyway, on second thoughts, it should be checked when sorting callchains instead of print time. This way we can reduce the duplicated code here and there, and it won't show spurious signs anymore IMHO.
Looking at the source it already have the logic indeed! But it didn't work for some reason. It seems that it's because we don't have hists' total period at the time of hists__output_resort() called. So the min_callchain_hits always set to 0 and no limit was applied.
I'll send a fix for the problem along with others soon.
Thanks,
Namhyung