perf tools: Various fixes
Jiri Olsa
reviewercover perf tools: Various fixes
hi,
got bunch of generic enough fixes
to submit separately.
Available also in:
git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
perf/fixes
thanks,
jirka
---
Jiri Olsa (11):
perf mem: Add --ldlat option
perf tools: Fix Data Object sort entry width index perf tools tui: Separate hierarchy and standard headers output perf tools stdio: Separate headers output
perf tools stdio: Separate hierarchy headers output perf tools stdio: Separate standard headers output perf tools stdio: Do not pass hists in hist_entry__fprintf perf tools stdio: Add use_callchain parameter to hists__fprintf perf tools: Replace perf_evsel arg perf_hpp_fmt's header callback perf tools: Replace perf_evsel arg perf_hpp_fmt's width callback perf tools: Rename __hists__add_entry to hists__add_entry
tools/perf/Documentation/perf-mem.txt | 3 ++ tools/perf/builtin-annotate.c | 2 +- tools/perf/builtin-diff.c | 19 ++++-------- tools/perf/builtin-mem.c | 1 + tools/perf/builtin-report.c | 3 +- tools/perf/builtin-top.c | 2 +- tools/perf/tests/hists_link.c | 4 +-- tools/perf/ui/browsers/hists.c | 39 ++++++++++++++++++------- tools/perf/ui/gtk/hists.c | 2 +- tools/perf/ui/hist.c | 11 +++---- tools/perf/ui/stdio/hist.c | 133 +++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------- tools/perf/util/hist.c | 36 +++++++++++------------ tools/perf/util/hist.h | 21 +++++++------- tools/perf/util/mem-events.c | 17 ++++++++++- tools/perf/util/mem-events.h | 1 + tools/perf/util/sort.c | 14 ++++----- 16 files changed, 181 insertions(+), 127 deletions(-)
Jiri Olsa
reviewerPATCH 1/11 perf mem: Add --ldlat option
Adding --ldlat option to specify desired latency
for loads event.
Specify 50 as loads event latency:
$ perf mem record -e ldlat-loads -v --ldlat 50 true calling: record -W -d -e cpu/mem-loads,ldlat=50/P true
--- tools/perf/Documentation/perf-mem.txt | 3 +++ tools/perf/builtin-mem.c | 1 + tools/perf/util/mem-events.c | 17 ++++++++++++++++- tools/perf/util/mem-events.h | 1 + 4 files changed, 21 insertions(+), 1 deletion(-)
tools/perf/Documentation/perf-mem.txt +3 -0
@@ -56,6 +56,9 @@ OPTIONS --all-user:: Configure all used events to run in user space. +--ldload:: + Specify desired latency for loads event. + SEE ALSO -------- linkperf:perf-record[1], linkperf:perf-report[1]
tools/perf/builtin-mem.c +1 -0
@@ -67,6 +67,7 @@ static int __cmd_record(int argc, const char **argv, struct perf_mem *mem)OPT_CALLBACK ('e' ,"event" , &mem,"event" ,"event selector. use 'perf mem record -e list' to list available events" , parse_record_events), +OPT_UINTEGER (0 ,"ldlat" , &perf_mem_events__loads_ldlat,"mem-loads latency" ),OPT_INCR ('v' ,"verbose" , &verbose,"be more verbose (show counter open errors, etc)" ), OPT_BOOLEAN('U', "--all-user", &all_user, "collect only user level data"),
tools/perf/util/mem-events.c +16 -1
@@ -10,18 +10,33 @@#include "debug.h" #include "symbol.h" +unsigned int perf_mem_events__loads_ldlat =30 ; +#define E (t, n, s) { .tag = t, .name = n, .sysfs_name = s }struct perf_mem_event perf_mem_events[PERF_MEM_EVENTS__MAX ] = { -E ("ldlat-loads" ,"cpu/mem-loads,ldlat=30/P" ,"mem-loads" ), +E ("ldlat-loads" ,"cpu/mem-loads,ldlat=%u/P" ,"mem-loads" ),E ("ldlat-stores" ,"cpu/mem-stores/P" ,"mem-stores" ), };#undef E#undef E +static char mem_loads_name[100 ]; +static bool mem_loads_name__init; +char *perf_mem_events__name (int i) { +if (i ==PERF_MEM_EVENTS__LOAD ) { +if (!mem_loads_name__init) { + mem_loads_name__init = true; +scnprintf (mem_loads_name,sizeof (mem_loads_name), + perf_mem_events[i].name, + perf_mem_events__loads_ldlat); + } +return mem_loads_name; + } +return (char *)perf_mem_events[i].name; }
tools/perf/util/mem-events.h +1 -0
@@ -18,6 +18,7 @@ enum { };extern struct perf_mem_event perf_mem_events[PERF_MEM_EVENTS__MAX ]; +extern unsigned int perf_mem_events__loads_ldlat;int perf_mem_events__parse (const char *str);int perf_mem_events__init (void );
Signature · 1 line
2.4.11
tip-bot for Jiri Olsa
merge bot[tip:perf/core] perf mem: Add --ldlat option
perf mem: Add --ldlat option
Commit-ID: b0d745b3c34a7fd9ee0b78b929b94c706f84e341 Gitweb: http://git.kernel.org/tip/b0d745b3c34a7fd9ee0b78b929b94c706f84e341 Author: Jiri Olsa <[email protected]> AuthorDate: Tue, 14 Jun 2016 20:19:11 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Wed, 15 Jun 2016 10:35:27 -0300
perf mem: Add --ldlat option
Adding --ldlat option to specify desired latency for loads event.
Specify 50 as loads event latency:
$ perf mem record -e ldlat-loads -v --ldlat 50 true calling: record -W -d -e cpu/mem-loads,ldlat=50/P true
--- tools/perf/Documentation/perf-mem.txt | 3 +++ tools/perf/builtin-mem.c | 1 + tools/perf/util/mem-events.c | 17 ++++++++++++++++- tools/perf/util/mem-events.h | 1 + 4 files changed, 21 insertions(+), 1 deletion(-)
tools/perf/Documentation/perf-mem.txt +3 -0
@@ -56,6 +56,9 @@ OPTIONS --all-user:: Configure all used events to run in user space. +--ldload:: + Specify desired latency for loads event. + SEE ALSO -------- linkperf:perf-record[1], linkperf:perf-report[1]
tools/perf/builtin-mem.c +1 -0
@@ -67,6 +67,7 @@ static int __cmd_record(int argc, const char **argv, struct perf_mem *mem)OPT_CALLBACK ('e' ,"event" , &mem,"event" ,"event selector. use 'perf mem record -e list' to list available events" , parse_record_events), +OPT_UINTEGER (0 ,"ldlat" , &perf_mem_events__loads_ldlat,"mem-loads latency" ),OPT_INCR ('v' ,"verbose" , &verbose,"be more verbose (show counter open errors, etc)" ), OPT_BOOLEAN('U', "--all-user", &all_user, "collect only user level data"),
tools/perf/util/mem-events.c +16 -1
@@ -10,18 +10,33 @@#include "debug.h" #include "symbol.h" +unsigned int perf_mem_events__loads_ldlat =30 ; +#define E (t, n, s) { .tag = t, .name = n, .sysfs_name = s }struct perf_mem_event perf_mem_events[PERF_MEM_EVENTS__MAX ] = { -E ("ldlat-loads" ,"cpu/mem-loads,ldlat=30/P" ,"mem-loads" ), +E ("ldlat-loads" ,"cpu/mem-loads,ldlat=%u/P" ,"mem-loads" ),E ("ldlat-stores" ,"cpu/mem-stores/P" ,"mem-stores" ), };#undef E#undef E +static char mem_loads_name[100 ]; +static bool mem_loads_name__init; +char *perf_mem_events__name (int i) { +if (i ==PERF_MEM_EVENTS__LOAD ) { +if (!mem_loads_name__init) { + mem_loads_name__init = true; +scnprintf (mem_loads_name,sizeof (mem_loads_name), + perf_mem_events[i].name, + perf_mem_events__loads_ldlat); + } +return mem_loads_name; + } +return (char *)perf_mem_events[i].name; }
tools/perf/util/mem-events.h +1 -0
@@ -18,6 +18,7 @@ enum { };extern struct perf_mem_event perf_mem_events[PERF_MEM_EVENTS__MAX ]; +extern unsigned int perf_mem_events__loads_ldlat;int perf_mem_events__parse (const char *str);int perf_mem_events__init (void );
Jiri Olsa
reviewerPATCH 2/11 perf tools: Fix Data Object sort entry width index
In reply to Jiri OlsaPutting correct HISTC_MEM_DADDR_DSO index
to Data Object sort entry.
--- tools/perf/util/sort.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/sort.c +1 -1
@@ -1218,7 +1218,7 @@ struct sort_entry sort_mem_daddr_dso = { .se_header = "Data Object", .se_cmp = sort__dso_daddr_cmp, .se_snprintf = hist_entry__dso_daddr_snprintf, - .se_width_idx = HISTC_MEM_DADDR_SYMBOL, + .se_width_idx = HISTC_MEM_DADDR_DSO, };struct sort_entry sort_mem_locked = {
Signature · 1 line
2.4.11
tip-bot for Jiri Olsa
merge bot[tip:perf/core] perf tools: Fix Data Object sort entry width index
perf tools: Fix Data Object sort entry width index
Commit-ID: 94c39988995d34f3de1b1763cc32141c67c0340c Gitweb: http://git.kernel.org/tip/94c39988995d34f3de1b1763cc32141c67c0340c Author: Jiri Olsa <[email protected]> AuthorDate: Tue, 14 Jun 2016 20:19:12 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Wed, 15 Jun 2016 10:41:56 -0300
perf tools: Fix Data Object sort entry width index
Putting correct HISTC_MEM_DADDR_DSO index to Data Object sort entry.
--- tools/perf/util/sort.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/sort.c +1 -1
@@ -1218,7 +1218,7 @@ struct sort_entry sort_mem_daddr_dso = { .se_header = "Data Object", .se_cmp = sort__dso_daddr_cmp, .se_snprintf = hist_entry__dso_daddr_snprintf, - .se_width_idx = HISTC_MEM_DADDR_SYMBOL, + .se_width_idx = HISTC_MEM_DADDR_DSO, };struct sort_entry sort_mem_locked = {
Jiri Olsa
reviewerPATCH 3/11 perf tools tui: Separate hierarchy and standard headers output
In reply to Jiri OlsaIt will be useful for future changes that enhance headers with multiple lines and span columns, which don't affect hierarchy headers.
--- tools/perf/ui/browsers/hists.c | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-)
tools/perf/ui/browsers/hists.c +24 -7
@@ -1622,21 +1622,38 @@ static int hists_browser__scnprintf_hierarchy_headers(struct hist_browser *browsreturn ret; } -static void hist_browser__show_headers (struct hist_browser *browser) +static void hists_browser__hierarchy_headers (struct hist_browser *browser) {char headers[1024 ]; -if (symbol_conf.report_hierarchy) -hists_browser__scnprintf_hierarchy_headers (browser, headers, -sizeof (headers)); -else -hists_browser__scnprintf_headers (browser, headers, -sizeof (headers)); +hists_browser__scnprintf_hierarchy_headers (browser, headers, +sizeof (headers)); +ui_browser__gotorc (&browser->b,0 ,0 );ui_browser__set_color (&browser->b,HE_COLORSET_ROOT );ui_browser__write_nstring (&browser->b, headers, browser->b.width +1 ); } +static void hists_browser__headers (struct hist_browser *browser) +{ +char headers[1024 ]; + +hists_browser__scnprintf_headers (browser, headers, +sizeof (headers)); + +ui_browser__gotorc (&browser->b,0 ,0 ); +ui_browser__set_color (&browser->b,HE_COLORSET_ROOT ); +ui_browser__write_nstring (&browser->b, headers, browser->b.width +1 ); +} + +static void hist_browser__show_headers (struct hist_browser *browser) +{ +if (symbol_conf.report_hierarchy) +hists_browser__hierarchy_headers (browser); +else +hists_browser__headers (browser); +} +static void ui_browser__hists_init_top (struct ui_browser *browser) {if (browser->top ==NULL ) {
Signature · 1 line
2.4.11
tip-bot for Jiri Olsa
merge bot[tip:perf/core] perf tui: Separate hierarchy and standard headers output
perf tui: Separate hierarchy and standard headers output
Commit-ID: 01b4770d5654fcb71645a1ee095759c255048466 Gitweb: http://git.kernel.org/tip/01b4770d5654fcb71645a1ee095759c255048466 Author: Jiri Olsa <[email protected]> AuthorDate: Tue, 14 Jun 2016 20:19:13 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Wed, 15 Jun 2016 10:44:22 -0300
perf tui: Separate hierarchy and standard headers output
It will be useful for future changes that enhance headers with multiple lines and span columns, which don't affect hierarchy headers.
--- tools/perf/ui/browsers/hists.c | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-)
tools/perf/ui/browsers/hists.c +24 -7
@@ -1622,21 +1622,38 @@ static int hists_browser__scnprintf_hierarchy_headers(struct hist_browser *browsreturn ret; } -static void hist_browser__show_headers (struct hist_browser *browser) +static void hists_browser__hierarchy_headers (struct hist_browser *browser) {char headers[1024 ]; -if (symbol_conf.report_hierarchy) -hists_browser__scnprintf_hierarchy_headers (browser, headers, -sizeof (headers)); -else -hists_browser__scnprintf_headers (browser, headers, -sizeof (headers)); +hists_browser__scnprintf_hierarchy_headers (browser, headers, +sizeof (headers)); +ui_browser__gotorc (&browser->b,0 ,0 );ui_browser__set_color (&browser->b,HE_COLORSET_ROOT );ui_browser__write_nstring (&browser->b, headers, browser->b.width +1 ); } +static void hists_browser__headers (struct hist_browser *browser) +{ +char headers[1024 ]; + +hists_browser__scnprintf_headers (browser, headers, +sizeof (headers)); + +ui_browser__gotorc (&browser->b,0 ,0 ); +ui_browser__set_color (&browser->b,HE_COLORSET_ROOT ); +ui_browser__write_nstring (&browser->b, headers, browser->b.width +1 ); +} + +static void hist_browser__show_headers (struct hist_browser *browser) +{ +if (symbol_conf.report_hierarchy) +hists_browser__hierarchy_headers (browser); +else +hists_browser__headers (browser); +} +static void ui_browser__hists_init_top (struct ui_browser *browser) {if (browser->top ==NULL ) {
Jiri Olsa
reviewerPATCH 4/11 perf tools stdio: Separate headers output
In reply to Jiri OlsaIntroducing hists__fprintf_headers function
to separate the code that displays headers.
--- tools/perf/ui/stdio/hist.c | 59 +++++++++++++++++++++++----------------------- 1 file changed, 30 insertions(+), 29 deletions(-)
tools/perf/ui/stdio/hist.c +30 -29
@@ -622,36 +622,18 @@ static int print_hierarchy_header(struct hists *hists, struct perf_hpp *hpp,return 2 ; } -size_t hists__fprintf (struct hists *hists,bool show_header,int max_rows, -int max_cols,float min_pcnt,FILE *fp) +static int hists__fprintf_headers (struct hists *hists,FILE *fp) {struct perf_hpp_fmt *fmt;struct perf_hpp_list_node *fmt_node; -struct rb_node *nd; -size_t ret =0 ;unsigned int width;const char *sep = symbol_conf.field_sep; -int nr_rows =0 ;char bf[96 ];struct perf_hpp dummy_hpp = { .buf = bf, .size =sizeof (bf), };bool first = true; -size_t linesz; -char *line =NULL ; -unsigned indent; - -init_rem_hits (); - -hists__for_each_format (hists, fmt) -perf_hpp__reset_width (fmt, hists); - -if (symbol_conf.col_width_list_str) -perf_hpp__set_user_width (symbol_conf.col_width_list_str); - -if (!show_header) - goto print_entries;fprintf (fp,"# " );
@@ -660,8 +642,7 @@ size_t hists__fprintf(struct hists *hists, bool show_header, int max_rows,perf_hpp_list__for_each_format (&fmt_node->hpp, fmt)perf_hpp__reset_width (fmt, hists); } - nr_rows +=print_hierarchy_header (hists, &dummy_hpp, sep, fp); - goto print_entries; +return print_hierarchy_header (hists, &dummy_hpp, sep, fp); }hists__for_each_format (hists, fmt) {
@@ -678,11 +659,9 @@ size_t hists__fprintf(struct hists *hists, bool show_header, int max_rows, }fprintf (fp,"\n" ); -if (max_rows && ++nr_rows >= max_rows) - goto out;if (sep) - goto print_entries; +return 1 ; first = true;
@@ -705,14 +684,36 @@ size_t hists__fprintf(struct hists *hists, bool show_header, int max_rows, }fprintf (fp,"\n" ); -if (max_rows && ++nr_rows >= max_rows) - goto out; -fprintf (fp,"#\n" ); -if (max_rows && ++nr_rows >= max_rows) +return 3 ; +} + +size_t hists__fprintf (struct hists *hists,bool show_header,int max_rows, +int max_cols,float min_pcnt,FILE *fp) +{ +struct perf_hpp_fmt *fmt; +struct rb_node *nd; +size_t ret =0 ; +const char *sep = symbol_conf.field_sep; +int nr_rows =0 ; +size_t linesz; +char *line =NULL ; +unsigned indent; + +init_rem_hits (); + +hists__for_each_format (hists, fmt) +perf_hpp__reset_width (fmt, hists); + +if (symbol_conf.col_width_list_str) +perf_hpp__set_user_width (symbol_conf.col_width_list_str); + +if (show_header) + nr_rows +=hists__fprintf_headers (hists, fp); + +if (max_rows && nr_rows >= max_rows) goto out; -print_entries: linesz =hists__sort_list_width (hists) +3 +1 ; linesz +=perf_hpp__color_overhead (); line =malloc (linesz);
Signature · 1 line
2.4.11
tip-bot for Jiri Olsa
merge bot[tip:perf/core] perf stdio: Separate headers output
perf stdio: Separate headers output
Commit-ID: 36592ebb73782aa2304a71f9a3b586566c2892ee Gitweb: http://git.kernel.org/tip/36592ebb73782aa2304a71f9a3b586566c2892ee Author: Jiri Olsa <[email protected]> AuthorDate: Tue, 14 Jun 2016 20:19:14 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Wed, 15 Jun 2016 10:44:26 -0300
perf stdio: Separate headers output
Introducing hists__fprintf_headers function to separate the code that displays headers.
--- tools/perf/ui/stdio/hist.c | 59 +++++++++++++++++++++++----------------------- 1 file changed, 30 insertions(+), 29 deletions(-)
tools/perf/ui/stdio/hist.c +30 -29
@@ -622,36 +622,18 @@ static int print_hierarchy_header(struct hists *hists, struct perf_hpp *hpp,return 2 ; } -size_t hists__fprintf (struct hists *hists,bool show_header,int max_rows, -int max_cols,float min_pcnt,FILE *fp) +static int hists__fprintf_headers (struct hists *hists,FILE *fp) {struct perf_hpp_fmt *fmt;struct perf_hpp_list_node *fmt_node; -struct rb_node *nd; -size_t ret =0 ;unsigned int width;const char *sep = symbol_conf.field_sep; -int nr_rows =0 ;char bf[96 ];struct perf_hpp dummy_hpp = { .buf = bf, .size =sizeof (bf), };bool first = true; -size_t linesz; -char *line =NULL ; -unsigned indent; - -init_rem_hits (); - -hists__for_each_format (hists, fmt) -perf_hpp__reset_width (fmt, hists); - -if (symbol_conf.col_width_list_str) -perf_hpp__set_user_width (symbol_conf.col_width_list_str); - -if (!show_header) - goto print_entries;fprintf (fp,"# " );
@@ -660,8 +642,7 @@ size_t hists__fprintf(struct hists *hists, bool show_header, int max_rows,perf_hpp_list__for_each_format (&fmt_node->hpp, fmt)perf_hpp__reset_width (fmt, hists); } - nr_rows +=print_hierarchy_header (hists, &dummy_hpp, sep, fp); - goto print_entries; +return print_hierarchy_header (hists, &dummy_hpp, sep, fp); }hists__for_each_format (hists, fmt) {
@@ -678,11 +659,9 @@ size_t hists__fprintf(struct hists *hists, bool show_header, int max_rows, }fprintf (fp,"\n" ); -if (max_rows && ++nr_rows >= max_rows) - goto out;if (sep) - goto print_entries; +return 1 ; first = true;
@@ -705,14 +684,36 @@ size_t hists__fprintf(struct hists *hists, bool show_header, int max_rows, }fprintf (fp,"\n" ); -if (max_rows && ++nr_rows >= max_rows) - goto out; -fprintf (fp,"#\n" ); -if (max_rows && ++nr_rows >= max_rows) +return 3 ; +} + +size_t hists__fprintf (struct hists *hists,bool show_header,int max_rows, +int max_cols,float min_pcnt,FILE *fp) +{ +struct perf_hpp_fmt *fmt; +struct rb_node *nd; +size_t ret =0 ; +const char *sep = symbol_conf.field_sep; +int nr_rows =0 ; +size_t linesz; +char *line =NULL ; +unsigned indent; + +init_rem_hits (); + +hists__for_each_format (hists, fmt) +perf_hpp__reset_width (fmt, hists); + +if (symbol_conf.col_width_list_str) +perf_hpp__set_user_width (symbol_conf.col_width_list_str); + +if (show_header) + nr_rows +=hists__fprintf_headers (hists, fp); + +if (max_rows && nr_rows >= max_rows) goto out; -print_entries: linesz =hists__sort_list_width (hists) +3 +1 ; linesz +=perf_hpp__color_overhead (); line =malloc (linesz);
Jiri Olsa
reviewerPATCH 5/11 perf tools stdio: Separate hierarchy headers output
In reply to Jiri OlsaIntroducing hists__fprintf_hierarchy_headers function to separate hierarchy headers display code.
--- tools/perf/ui/stdio/hist.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-)
tools/perf/ui/stdio/hist.c +18 -8
@@ -622,10 +622,25 @@ static int print_hierarchy_header(struct hists *hists, struct perf_hpp *hpp,return 2 ; } +static int +hists__fprintf_hierarchy_headers (struct hists *hists, +struct perf_hpp *hpp, +FILE *fp) +{ +struct perf_hpp_list_node *fmt_node; +struct perf_hpp_fmt *fmt; + +list_for_each_entry (fmt_node, &hists->hpp_formats, list) { +perf_hpp_list__for_each_format (&fmt_node->hpp, fmt) +perf_hpp__reset_width (fmt, hists); + } + +return print_hierarchy_header (hists, hpp, symbol_conf.field_sep, fp); +} +static int hists__fprintf_headers (struct hists *hists,FILE *fp) {struct perf_hpp_fmt *fmt; -struct perf_hpp_list_node *fmt_node;unsigned int width;const char *sep = symbol_conf.field_sep;char bf[96 ];
@@ -637,13 +652,8 @@ static int hists__fprintf_headers(struct hists *hists, FILE *fp)fprintf (fp,"# " ); -if (symbol_conf.report_hierarchy) { -list_for_each_entry (fmt_node, &hists->hpp_formats, list) { -perf_hpp_list__for_each_format (&fmt_node->hpp, fmt) -perf_hpp__reset_width (fmt, hists); - } -return print_hierarchy_header (hists, &dummy_hpp, sep, fp); - } +if (symbol_conf.report_hierarchy) +return hists__fprintf_hierarchy_headers (hists, &dummy_hpp, fp);hists__for_each_format (hists, fmt) {if (perf_hpp__should_skip (fmt, hists))
Signature · 1 line
2.4.11
tip-bot for Jiri Olsa
merge bot[tip:perf/core] perf stdio: Separate hierarchy headers output
perf stdio: Separate hierarchy headers output
Commit-ID: 5c854f3793c03539dcca48d8a89da9267127e436 Gitweb: http://git.kernel.org/tip/5c854f3793c03539dcca48d8a89da9267127e436 Author: Jiri Olsa <[email protected]> AuthorDate: Tue, 14 Jun 2016 20:19:15 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Wed, 15 Jun 2016 10:46:02 -0300
perf stdio: Separate hierarchy headers output
Introducing hists__fprintf_hierarchy_headers function to separate hierarchy headers display code.
--- tools/perf/ui/stdio/hist.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-)
tools/perf/ui/stdio/hist.c +18 -8
@@ -622,10 +622,25 @@ static int print_hierarchy_header(struct hists *hists, struct perf_hpp *hpp,return 2 ; } +static int +hists__fprintf_hierarchy_headers (struct hists *hists, +struct perf_hpp *hpp, +FILE *fp) +{ +struct perf_hpp_list_node *fmt_node; +struct perf_hpp_fmt *fmt; + +list_for_each_entry (fmt_node, &hists->hpp_formats, list) { +perf_hpp_list__for_each_format (&fmt_node->hpp, fmt) +perf_hpp__reset_width (fmt, hists); + } + +return print_hierarchy_header (hists, hpp, symbol_conf.field_sep, fp); +} +static int hists__fprintf_headers (struct hists *hists,FILE *fp) {struct perf_hpp_fmt *fmt; -struct perf_hpp_list_node *fmt_node;unsigned int width;const char *sep = symbol_conf.field_sep;char bf[96 ];
@@ -637,13 +652,8 @@ static int hists__fprintf_headers(struct hists *hists, FILE *fp)fprintf (fp,"# " ); -if (symbol_conf.report_hierarchy) { -list_for_each_entry (fmt_node, &hists->hpp_formats, list) { -perf_hpp_list__for_each_format (&fmt_node->hpp, fmt) -perf_hpp__reset_width (fmt, hists); - } -return print_hierarchy_header (hists, &dummy_hpp, sep, fp); - } +if (symbol_conf.report_hierarchy) +return hists__fprintf_hierarchy_headers (hists, &dummy_hpp, fp);hists__for_each_format (hists, fmt) {if (perf_hpp__should_skip (fmt, hists))
Jiri Olsa
reviewerPATCH 6/11 perf tools stdio: Separate standard headers output
In reply to Jiri OlsaIntroducing hists__fprintf_standard_headers function to separate standard headers display code.
--- tools/perf/ui/stdio/hist.c | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-)
tools/perf/ui/stdio/hist.c +24 -14
@@ -638,23 +638,16 @@ hists__fprintf_hierarchy_headers(struct hists *hists,return print_hierarchy_header (hists, hpp, symbol_conf.field_sep, fp); } -static int hists__fprintf_headers (struct hists *hists,FILE *fp) +static int +hists__fprintf_standard_headers (struct hists *hists, +struct perf_hpp *hpp, +FILE *fp) {struct perf_hpp_fmt *fmt;unsigned int width;const char *sep = symbol_conf.field_sep; -char bf[96 ]; -struct perf_hpp dummy_hpp = { - .buf = bf, - .size =sizeof (bf), - };bool first = true; -fprintf (fp,"# " ); - -if (symbol_conf.report_hierarchy) -return hists__fprintf_hierarchy_headers (hists, &dummy_hpp, fp); -hists__for_each_format (hists, fmt) {if (perf_hpp__should_skip (fmt, hists))continue ;
@@ -664,8 +657,8 @@ static int hists__fprintf_headers(struct hists *hists, FILE *fp)else first = false; - fmt->header (fmt, &dummy_hpp,hists_to_evsel (hists)); -fprintf (fp,"%s" , bf); + fmt->header (fmt, hpp,hists_to_evsel (hists)); +fprintf (fp,"%s" , hpp->buf); }fprintf (fp,"\n" );
@@ -688,7 +681,7 @@ static int hists__fprintf_headers(struct hists *hists, FILE *fp)else first = false; - width = fmt->width (fmt, &dummy_hpp,hists_to_evsel (hists)); + width = fmt->width (fmt, hpp,hists_to_evsel (hists));for (i =0 ; i < width; i++)fprintf (fp,"." ); }
@@ -698,6 +691,23 @@ static int hists__fprintf_headers(struct hists *hists, FILE *fp)return 3 ; } +static int hists__fprintf_headers (struct hists *hists,FILE *fp) +{ +char bf[96 ]; +struct perf_hpp dummy_hpp = { + .buf = bf, + .size =sizeof (bf), + }; + +fprintf (fp,"# " ); + +if (symbol_conf.report_hierarchy) +return hists__fprintf_hierarchy_headers (hists, &dummy_hpp, fp); +else +return hists__fprintf_standard_headers (hists, &dummy_hpp, fp); + +} +size_t hists__fprintf (struct hists *hists,bool show_header,int max_rows,int max_cols,float min_pcnt,FILE *fp) {
Signature · 1 line
2.4.11
tip-bot for Jiri Olsa
merge bot[tip:perf/core] perf stdio: Separate standard headers output
perf stdio: Separate standard headers output
Commit-ID: 7a72a2e5e6e06172ae26a3c5c8c89a5578f28432 Gitweb: http://git.kernel.org/tip/7a72a2e5e6e06172ae26a3c5c8c89a5578f28432 Author: Jiri Olsa <[email protected]> AuthorDate: Tue, 14 Jun 2016 20:19:16 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Wed, 15 Jun 2016 10:46:39 -0300
perf stdio: Separate standard headers output
Introducing hists__fprintf_standard_headers function to separate standard headers display code.
--- tools/perf/ui/stdio/hist.c | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-)
tools/perf/ui/stdio/hist.c +24 -14
@@ -638,23 +638,16 @@ hists__fprintf_hierarchy_headers(struct hists *hists,return print_hierarchy_header (hists, hpp, symbol_conf.field_sep, fp); } -static int hists__fprintf_headers (struct hists *hists,FILE *fp) +static int +hists__fprintf_standard_headers (struct hists *hists, +struct perf_hpp *hpp, +FILE *fp) {struct perf_hpp_fmt *fmt;unsigned int width;const char *sep = symbol_conf.field_sep; -char bf[96 ]; -struct perf_hpp dummy_hpp = { - .buf = bf, - .size =sizeof (bf), - };bool first = true; -fprintf (fp,"# " ); - -if (symbol_conf.report_hierarchy) -return hists__fprintf_hierarchy_headers (hists, &dummy_hpp, fp); -hists__for_each_format (hists, fmt) {if (perf_hpp__should_skip (fmt, hists))continue ;
@@ -664,8 +657,8 @@ static int hists__fprintf_headers(struct hists *hists, FILE *fp)else first = false; - fmt->header (fmt, &dummy_hpp,hists_to_evsel (hists)); -fprintf (fp,"%s" , bf); + fmt->header (fmt, hpp,hists_to_evsel (hists)); +fprintf (fp,"%s" , hpp->buf); }fprintf (fp,"\n" );
@@ -688,7 +681,7 @@ static int hists__fprintf_headers(struct hists *hists, FILE *fp)else first = false; - width = fmt->width (fmt, &dummy_hpp,hists_to_evsel (hists)); + width = fmt->width (fmt, hpp,hists_to_evsel (hists));for (i =0 ; i < width; i++)fprintf (fp,"." ); }
@@ -698,6 +691,23 @@ static int hists__fprintf_headers(struct hists *hists, FILE *fp)return 3 ; } +static int hists__fprintf_headers (struct hists *hists,FILE *fp) +{ +char bf[96 ]; +struct perf_hpp dummy_hpp = { + .buf = bf, + .size =sizeof (bf), + }; + +fprintf (fp,"# " ); + +if (symbol_conf.report_hierarchy) +return hists__fprintf_hierarchy_headers (hists, &dummy_hpp, fp); +else +return hists__fprintf_standard_headers (hists, &dummy_hpp, fp); + +} +size_t hists__fprintf (struct hists *hists,bool show_header,int max_rows,int max_cols,float min_pcnt,FILE *fp) {
Jiri Olsa
reviewerPATCH 7/11 perf tools stdio: Do not pass hists in hist_entry__fprintf
In reply to Jiri OlsaThere's no need, we have the hists pointer
in struct hist_entry.
--- tools/perf/ui/stdio/hist.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/ui/stdio/hist.c +2 -2
@@ -492,7 +492,6 @@ out: }static int hist_entry__fprintf (struct hist_entry *he,size_t size, -struct hists *hists,char *bf,size_t bfsz,FILE *fp) {int ret;
@@ -500,6 +499,7 @@ static int hist_entry__fprintf(struct hist_entry *he, size_t size, .buf = bf, .size = size, }; +struct hists *hists = he->hists;u64 total_period = hists->stats.total_period;if (size ==0 || size > bfsz)
@@ -755,7 +755,7 @@ size_t hists__fprintf(struct hists *hists, bool show_header, int max_rows,if (percent < min_pcnt)continue ; - ret +=hist_entry__fprintf (h, max_cols, hists, line, linesz, fp); + ret +=hist_entry__fprintf (h, max_cols, line, linesz, fp);if (max_rows && ++nr_rows >= max_rows)break ;
Signature · 1 line
2.4.11
tip-bot for Jiri Olsa
merge bot[tip:perf/core] perf stdio: Do not pass hists in hist_entry__fprintf
perf stdio: Do not pass hists in hist_entry__fprintf
Commit-ID: 8f1d1b4452ce71a231d1a22e6357285fb773c551 Gitweb: http://git.kernel.org/tip/8f1d1b4452ce71a231d1a22e6357285fb773c551 Author: Jiri Olsa <[email protected]> AuthorDate: Tue, 14 Jun 2016 20:19:17 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Wed, 15 Jun 2016 10:47:11 -0300
perf stdio: Do not pass hists in hist_entry__fprintf
There's no need, we have the hists pointer in struct hist_entry.
--- tools/perf/ui/stdio/hist.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/ui/stdio/hist.c +2 -2
@@ -492,7 +492,6 @@ out: }static int hist_entry__fprintf (struct hist_entry *he,size_t size, -struct hists *hists,char *bf,size_t bfsz,FILE *fp) {int ret;
@@ -500,6 +499,7 @@ static int hist_entry__fprintf(struct hist_entry *he, size_t size, .buf = bf, .size = size, }; +struct hists *hists = he->hists;u64 total_period = hists->stats.total_period;if (size ==0 || size > bfsz)
@@ -755,7 +755,7 @@ size_t hists__fprintf(struct hists *hists, bool show_header, int max_rows,if (percent < min_pcnt)continue ; - ret +=hist_entry__fprintf (h, max_cols, hists, line, linesz, fp); + ret +=hist_entry__fprintf (h, max_cols, line, linesz, fp);if (max_rows && ++nr_rows >= max_rows)break ;
Jiri Olsa
reviewerPATCH 8/11 perf tools stdio: Add use_callchain parameter to hists__fprintf
In reply to Jiri OlsaIt will be convenient in following patches to display hists entries without callchains even if they are defined.
--- tools/perf/builtin-diff.c | 3 ++- tools/perf/builtin-report.c | 3 ++- tools/perf/builtin-top.c | 2 +- tools/perf/ui/stdio/hist.c | 10 ++++++---- tools/perf/util/hist.h | 3 ++- 5 files changed, 13 insertions(+), 8 deletions(-)
tools/perf/builtin-diff.c +2 -1
@@ -666,7 +666,8 @@ static void hists__process(struct hists *hists)hists__precompute (hists);hists__output_resort (hists,NULL ); -hists__fprintf (hists, true,0 ,0 ,0 , stdout); +hists__fprintf (hists, true,0 ,0 ,0 , stdout, + symbol_conf.use_callchain); }static void data__fprintf (void )
tools/perf/builtin-report.c +2 -1
@@ -370,7 +370,8 @@ static int perf_evlist__tty_browse_hists(struct perf_evlist *evlist,continue ;hists__fprintf_nr_sample_events (hists, rep, evname, stdout); -hists__fprintf (hists, true,0 ,0 , rep->min_percent, stdout); +hists__fprintf (hists, true,0 ,0 , rep->min_percent, stdout, + symbol_conf.use_callchain);fprintf (stdout,"\n\n" ); }
tools/perf/builtin-top.c +1 -1
@@ -295,7 +295,7 @@ static void perf_top__print_sym_table(struct perf_top *top)hists__output_recalc_col_len (hists, top->print_entries - printed);putchar ('\n' );hists__fprintf (hists, false, top->print_entries - printed, win_width, - top->min_percent, stdout); + top->min_percent, stdout, symbol_conf.use_callchain); }static void prompt_integer (int *target,const char *msg)
tools/perf/ui/stdio/hist.c +6 -4
@@ -492,7 +492,8 @@ out: }static int hist_entry__fprintf (struct hist_entry *he,size_t size, -char *bf,size_t bfsz,FILE *fp) +char *bf,size_t bfsz,FILE *fp, +bool use_callchain) {int ret;struct perf_hpp hpp = {
@@ -512,7 +513,7 @@ static int hist_entry__fprintf(struct hist_entry *he, size_t size, ret =fprintf (fp,"%s\n" , bf); -if (symbol_conf.use_callchain) +if (use_callchain) ret +=hist_entry_callchain__fprintf (he, total_period,0 , fp);return ret;
@@ -709,7 +710,8 @@ static int hists__fprintf_headers(struct hists *hists, FILE *fp) }size_t hists__fprintf (struct hists *hists,bool show_header,int max_rows, -int max_cols,float min_pcnt,FILE *fp) +int max_cols,float min_pcnt,FILE *fp, +bool use_callchain) {struct perf_hpp_fmt *fmt;struct rb_node *nd;
@@ -755,7 +757,7 @@ size_t hists__fprintf(struct hists *hists, bool show_header, int max_rows,if (percent < min_pcnt)continue ; - ret +=hist_entry__fprintf (h, max_cols, line, linesz, fp); + ret +=hist_entry__fprintf (h, max_cols, line, linesz, fp, use_callchain);if (max_rows && ++nr_rows >= max_rows)break ;
tools/perf/util/hist.h +2 -1
@@ -159,7 +159,8 @@ void events_stats__inc(struct events_stats *stats, u32 type);size_t events_stats__fprintf (struct events_stats *stats,FILE *fp);size_t hists__fprintf (struct hists *hists,bool show_header,int max_rows, -int max_cols,float min_pcnt,FILE *fp); +int max_cols,float min_pcnt,FILE *fp, +bool use_callchain);size_t perf_evlist__fprintf_nr_events (struct perf_evlist *evlist,FILE *fp);void hists__filter_by_dso (struct hists *hists);
Signature · 1 line
2.4.11
tip-bot for Jiri Olsa
merge bot[tip:perf/core] perf stdio: Add use_callchain parameter to hists__fprintf
perf stdio: Add use_callchain parameter to hists__fprintf
Commit-ID: d05e3aaeea56d7cd23976cb1fa626faf1a8bfbed Gitweb: http://git.kernel.org/tip/d05e3aaeea56d7cd23976cb1fa626faf1a8bfbed Author: Jiri Olsa <[email protected]> AuthorDate: Tue, 14 Jun 2016 20:19:18 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Wed, 15 Jun 2016 10:48:02 -0300
perf stdio: Add use_callchain parameter to hists__fprintf
It will be convenient in following patches to display hists entries without callchains even if they are defined.
--- tools/perf/builtin-diff.c | 3 ++- tools/perf/builtin-report.c | 3 ++- tools/perf/builtin-top.c | 2 +- tools/perf/ui/stdio/hist.c | 10 ++++++---- tools/perf/util/hist.h | 3 ++- 5 files changed, 13 insertions(+), 8 deletions(-)
tools/perf/builtin-diff.c +2 -1
@@ -666,7 +666,8 @@ static void hists__process(struct hists *hists)hists__precompute (hists);hists__output_resort (hists,NULL ); -hists__fprintf (hists, true,0 ,0 ,0 , stdout); +hists__fprintf (hists, true,0 ,0 ,0 , stdout, + symbol_conf.use_callchain); }static void data__fprintf (void )
tools/perf/builtin-report.c +2 -1
@@ -370,7 +370,8 @@ static int perf_evlist__tty_browse_hists(struct perf_evlist *evlist,continue ;hists__fprintf_nr_sample_events (hists, rep, evname, stdout); -hists__fprintf (hists, true,0 ,0 , rep->min_percent, stdout); +hists__fprintf (hists, true,0 ,0 , rep->min_percent, stdout, + symbol_conf.use_callchain);fprintf (stdout,"\n\n" ); }
tools/perf/builtin-top.c +1 -1
@@ -295,7 +295,7 @@ static void perf_top__print_sym_table(struct perf_top *top)hists__output_recalc_col_len (hists, top->print_entries - printed);putchar ('\n' );hists__fprintf (hists, false, top->print_entries - printed, win_width, - top->min_percent, stdout); + top->min_percent, stdout, symbol_conf.use_callchain); }static void prompt_integer (int *target,const char *msg)
tools/perf/ui/stdio/hist.c +6 -4
@@ -492,7 +492,8 @@ out: }static int hist_entry__fprintf (struct hist_entry *he,size_t size, -char *bf,size_t bfsz,FILE *fp) +char *bf,size_t bfsz,FILE *fp, +bool use_callchain) {int ret;struct perf_hpp hpp = {
@@ -512,7 +513,7 @@ static int hist_entry__fprintf(struct hist_entry *he, size_t size, ret =fprintf (fp,"%s\n" , bf); -if (symbol_conf.use_callchain) +if (use_callchain) ret +=hist_entry_callchain__fprintf (he, total_period,0 , fp);return ret;
@@ -709,7 +710,8 @@ static int hists__fprintf_headers(struct hists *hists, FILE *fp) }size_t hists__fprintf (struct hists *hists,bool show_header,int max_rows, -int max_cols,float min_pcnt,FILE *fp) +int max_cols,float min_pcnt,FILE *fp, +bool use_callchain) {struct perf_hpp_fmt *fmt;struct rb_node *nd;
@@ -755,7 +757,7 @@ size_t hists__fprintf(struct hists *hists, bool show_header, int max_rows,if (percent < min_pcnt)continue ; - ret +=hist_entry__fprintf (h, max_cols, line, linesz, fp); + ret +=hist_entry__fprintf (h, max_cols, line, linesz, fp, use_callchain);if (max_rows && ++nr_rows >= max_rows)break ;
tools/perf/util/hist.h +2 -1
@@ -159,7 +159,8 @@ void events_stats__inc(struct events_stats *stats, u32 type);size_t events_stats__fprintf (struct events_stats *stats,FILE *fp);size_t hists__fprintf (struct hists *hists,bool show_header,int max_rows, -int max_cols,float min_pcnt,FILE *fp); +int max_cols,float min_pcnt,FILE *fp, +bool use_callchain);size_t perf_evlist__fprintf_nr_events (struct perf_evlist *evlist,FILE *fp);void hists__filter_by_dso (struct hists *hists);
Jiri Olsa
reviewerPATCH 9/11 perf tools: Replace perf_evsel arg perf_hpp_fmt's header callback
In reply to Jiri OlsaReplacing perf_evsel arg perf_hpp_fmt's header
callback with hists object.
No of actual callbacks actually use evsel object,
also this will be helpful in future for non evsel
related hist browsers.
--- tools/perf/builtin-diff.c | 2 +- tools/perf/ui/browsers/hists.c | 6 +++--- tools/perf/ui/gtk/hists.c | 2 +- tools/perf/ui/hist.c | 4 ++-- tools/perf/ui/stdio/hist.c | 6 +++--- tools/perf/util/hist.h | 2 +- tools/perf/util/sort.c | 6 +++--- 7 files changed, 14 insertions(+), 14 deletions(-)
tools/perf/builtin-diff.c +1 -1
@@ -1045,7 +1045,7 @@ static int hpp__entry_global(struct perf_hpp_fmt *_fmt, struct perf_hpp *hpp, }static int hpp__header (struct perf_hpp_fmt *fmt,struct perf_hpp *hpp, -struct perf_evsel *evsel__maybe_unused ) +struct hists *hists__maybe_unused ) {struct diff_hpp_fmt *dfmt = container_of(fmt, struct diff_hpp_fmt, fmt);
tools/perf/ui/browsers/hists.c +3 -3
@@ -1531,7 +1531,7 @@ static int hists_browser__scnprintf_headers(struct hist_browser *browser, char *if (perf_hpp__should_skip (fmt, hists) || column++ < browser->b.horiz_scroll)continue ; - ret = fmt->header (fmt, &dummy_hpp,hists_to_evsel (hists)); + ret = fmt->header (fmt, &dummy_hpp, hists);if (advance_hpp_check (&dummy_hpp, ret))break ;
@@ -1568,7 +1568,7 @@ static int hists_browser__scnprintf_hierarchy_headers(struct hist_browser *browsif (column++ < browser->b.horiz_scroll)continue ; - ret = fmt->header (fmt, &dummy_hpp,hists_to_evsel (hists)); + ret = fmt->header (fmt, &dummy_hpp, hists);if (advance_hpp_check (&dummy_hpp, ret))break ;
@@ -1605,7 +1605,7 @@ static int hists_browser__scnprintf_hierarchy_headers(struct hist_browser *brows } first_col = false; - ret = fmt->header (fmt, &dummy_hpp,hists_to_evsel (hists)); + ret = fmt->header (fmt, &dummy_hpp, hists); dummy_hpp.buf[ret] ='\0' ; start =trim (dummy_hpp.buf);
tools/perf/ui/gtk/hists.c +1 -1
@@ -549,7 +549,7 @@ static void perf_gtk__show_hierarchy(GtkWidget *window, struct hists *hists,strcat (buf,"+" ); first_col = false; - fmt->header (fmt, &hpp,hists_to_evsel (hists)); + fmt->header (fmt, &hpp, hists);strcat (buf,ltrim (rtrim (hpp.buf))); } }
tools/perf/ui/hist.c +2 -2
@@ -229,9 +229,9 @@ static int hpp__width_fn(struct perf_hpp_fmt *fmt, }static int hpp__header_fn (struct perf_hpp_fmt *fmt,struct perf_hpp *hpp, -struct perf_evsel *evsel) +struct hists *hists) { -int len =hpp__width_fn (fmt, hpp, evsel); +int len =hpp__width_fn (fmt, hpp,hists_to_evsel (hists));return scnprintf (hpp->buf, hpp->size,"%*s" , len, fmt->name); }
tools/perf/ui/stdio/hist.c +3 -3
@@ -549,7 +549,7 @@ static int print_hierarchy_header(struct hists *hists, struct perf_hpp *hpp, struct perf_hpp_list_node, list);perf_hpp_list__for_each_format (&fmt_node->hpp, fmt) { - fmt->header (fmt, hpp,hists_to_evsel (hists)); + fmt->header (fmt, hpp, hists);fprintf (fp,"%s%s" , hpp->buf, sep ?:" " ); }
@@ -569,7 +569,7 @@ static int print_hierarchy_header(struct hists *hists, struct perf_hpp *hpp, header_width +=fprintf (fp,"+" ); first_col = false; - fmt->header (fmt, hpp,hists_to_evsel (hists)); + fmt->header (fmt, hpp, hists); header_width +=fprintf (fp,"%s" ,trim (hpp->buf)); }
@@ -658,7 +658,7 @@ hists__fprintf_standard_headers(struct hists *hists,else first = false; - fmt->header (fmt, hpp,hists_to_evsel (hists)); + fmt->header (fmt, hpp, hists);fprintf (fp,"%s" , hpp->buf); }
tools/perf/util/hist.h +1 -1
@@ -215,7 +215,7 @@ struct perf_hpp {struct perf_hpp_fmt {const char *name;int (*header)(struct perf_hpp_fmt *fmt,struct perf_hpp *hpp, -struct perf_evsel *evsel); +struct hists *hists);int (*width)(struct perf_hpp_fmt *fmt,struct perf_hpp *hpp,struct perf_evsel *evsel); int (*color)(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
tools/perf/util/sort.c +3 -3
@@ -1488,7 +1488,7 @@ void perf_hpp__reset_sort_width(struct perf_hpp_fmt *fmt, struct hists *hists) }static int __sort__hpp_header (struct perf_hpp_fmt *fmt,struct perf_hpp *hpp, -struct perf_evsel *evsel) +struct hists *hists) {struct hpp_sort_entry *hse;size_t len = fmt->user_len;
@@ -1496,7 +1496,7 @@ static int __sort__hpp_header(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp, hse = container_of(fmt, struct hpp_sort_entry, hpp);if (!len) - len =hists__col_len (evsel__hists (evsel), hse->se->se_width_idx); + len =hists__col_len (hists, hse->se->se_width_idx);return scnprintf (hpp->buf, hpp->size,"%-*.*s" , len, len, fmt->name); }
@@ -1793,7 +1793,7 @@ static void update_dynamic_len(struct hpp_dynamic_entry *hde, }static int __sort__hde_header (struct perf_hpp_fmt *fmt,struct perf_hpp *hpp, -struct perf_evsel *evsel__maybe_unused ) +struct hists *hists__maybe_unused ) {struct hpp_dynamic_entry *hde;size_t len = fmt->user_len;
Signature · 1 line
2.4.11
tip-bot for Jiri Olsa
merge bot[tip:perf/core] perf hists: Replace perf_evsel arg perf_hpp_fmt's header callback
perf hists: Replace perf_evsel arg perf_hpp_fmt's header callback
Commit-ID: 053721736011ee52e83b8e8794d922d1c511a4d3 Gitweb: http://git.kernel.org/tip/053721736011ee52e83b8e8794d922d1c511a4d3 Author: Jiri Olsa <[email protected]> AuthorDate: Tue, 14 Jun 2016 20:19:19 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Wed, 15 Jun 2016 10:49:18 -0300
perf hists: Replace perf_evsel arg perf_hpp_fmt's header callback
Replacing perf_evsel arg perf_hpp_fmt's header callback with hists object.
None of the actual callbacks actually use evsel object, also this will be helpful in future for non evsel related hist browsers.
--- tools/perf/builtin-diff.c | 2 +- tools/perf/ui/browsers/hists.c | 6 +++--- tools/perf/ui/gtk/hists.c | 2 +- tools/perf/ui/hist.c | 4 ++-- tools/perf/ui/stdio/hist.c | 6 +++--- tools/perf/util/hist.h | 2 +- tools/perf/util/sort.c | 6 +++--- 7 files changed, 14 insertions(+), 14 deletions(-)
tools/perf/builtin-diff.c +1 -1
@@ -1045,7 +1045,7 @@ static int hpp__entry_global(struct perf_hpp_fmt *_fmt, struct perf_hpp *hpp, }static int hpp__header (struct perf_hpp_fmt *fmt,struct perf_hpp *hpp, -struct perf_evsel *evsel__maybe_unused ) +struct hists *hists__maybe_unused ) {struct diff_hpp_fmt *dfmt = container_of(fmt, struct diff_hpp_fmt, fmt);
tools/perf/ui/browsers/hists.c +3 -3
@@ -1531,7 +1531,7 @@ static int hists_browser__scnprintf_headers(struct hist_browser *browser, char *if (perf_hpp__should_skip (fmt, hists) || column++ < browser->b.horiz_scroll)continue ; - ret = fmt->header (fmt, &dummy_hpp,hists_to_evsel (hists)); + ret = fmt->header (fmt, &dummy_hpp, hists);if (advance_hpp_check (&dummy_hpp, ret))break ;
@@ -1568,7 +1568,7 @@ static int hists_browser__scnprintf_hierarchy_headers(struct hist_browser *browsif (column++ < browser->b.horiz_scroll)continue ; - ret = fmt->header (fmt, &dummy_hpp,hists_to_evsel (hists)); + ret = fmt->header (fmt, &dummy_hpp, hists);if (advance_hpp_check (&dummy_hpp, ret))break ;
@@ -1605,7 +1605,7 @@ static int hists_browser__scnprintf_hierarchy_headers(struct hist_browser *brows } first_col = false; - ret = fmt->header (fmt, &dummy_hpp,hists_to_evsel (hists)); + ret = fmt->header (fmt, &dummy_hpp, hists); dummy_hpp.buf[ret] ='\0' ; start =trim (dummy_hpp.buf);
tools/perf/ui/gtk/hists.c +1 -1
@@ -549,7 +549,7 @@ static void perf_gtk__show_hierarchy(GtkWidget *window, struct hists *hists,strcat (buf,"+" ); first_col = false; - fmt->header (fmt, &hpp,hists_to_evsel (hists)); + fmt->header (fmt, &hpp, hists);strcat (buf,ltrim (rtrim (hpp.buf))); } }
tools/perf/ui/hist.c +2 -2
@@ -229,9 +229,9 @@ static int hpp__width_fn(struct perf_hpp_fmt *fmt, }static int hpp__header_fn (struct perf_hpp_fmt *fmt,struct perf_hpp *hpp, -struct perf_evsel *evsel) +struct hists *hists) { -int len =hpp__width_fn (fmt, hpp, evsel); +int len =hpp__width_fn (fmt, hpp,hists_to_evsel (hists));return scnprintf (hpp->buf, hpp->size,"%*s" , len, fmt->name); }
tools/perf/ui/stdio/hist.c +3 -3
@@ -549,7 +549,7 @@ static int print_hierarchy_header(struct hists *hists, struct perf_hpp *hpp, struct perf_hpp_list_node, list);perf_hpp_list__for_each_format (&fmt_node->hpp, fmt) { - fmt->header (fmt, hpp,hists_to_evsel (hists)); + fmt->header (fmt, hpp, hists);fprintf (fp,"%s%s" , hpp->buf, sep ?:" " ); }
@@ -569,7 +569,7 @@ static int print_hierarchy_header(struct hists *hists, struct perf_hpp *hpp, header_width +=fprintf (fp,"+" ); first_col = false; - fmt->header (fmt, hpp,hists_to_evsel (hists)); + fmt->header (fmt, hpp, hists); header_width +=fprintf (fp,"%s" ,trim (hpp->buf)); }
@@ -658,7 +658,7 @@ hists__fprintf_standard_headers(struct hists *hists,else first = false; - fmt->header (fmt, hpp,hists_to_evsel (hists)); + fmt->header (fmt, hpp, hists);fprintf (fp,"%s" , hpp->buf); }
tools/perf/util/hist.h +1 -1
@@ -215,7 +215,7 @@ struct perf_hpp {struct perf_hpp_fmt {const char *name;int (*header)(struct perf_hpp_fmt *fmt,struct perf_hpp *hpp, -struct perf_evsel *evsel); +struct hists *hists);int (*width)(struct perf_hpp_fmt *fmt,struct perf_hpp *hpp,struct perf_evsel *evsel); int (*color)(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
tools/perf/util/sort.c +3 -3
@@ -1488,7 +1488,7 @@ void perf_hpp__reset_sort_width(struct perf_hpp_fmt *fmt, struct hists *hists) }static int __sort__hpp_header (struct perf_hpp_fmt *fmt,struct perf_hpp *hpp, -struct perf_evsel *evsel) +struct hists *hists) {struct hpp_sort_entry *hse;size_t len = fmt->user_len;
@@ -1496,7 +1496,7 @@ static int __sort__hpp_header(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp, hse = container_of(fmt, struct hpp_sort_entry, hpp);if (!len) - len =hists__col_len (evsel__hists (evsel), hse->se->se_width_idx); + len =hists__col_len (hists, hse->se->se_width_idx);return scnprintf (hpp->buf, hpp->size,"%-*.*s" , len, len, fmt->name); }
@@ -1793,7 +1793,7 @@ static void update_dynamic_len(struct hpp_dynamic_entry *hde, }static int __sort__hde_header (struct perf_hpp_fmt *fmt,struct perf_hpp *hpp, -struct perf_evsel *evsel__maybe_unused ) +struct hists *hists__maybe_unused ) {struct hpp_dynamic_entry *hde;size_t len = fmt->user_len;
Jiri Olsa
reviewerPATCH 10/11 perf tools: Replace perf_evsel arg perf_hpp_fmt's width callback
In reply to Jiri OlsaReplacing perf_evsel arg perf_hpp_fmt's width
callback with hists object.
This will be helpful in future for non
evsel related hist browsers.
--- tools/perf/builtin-diff.c | 2 +- tools/perf/ui/browsers/hists.c | 2 +- tools/perf/ui/hist.c | 9 +++++---- tools/perf/ui/stdio/hist.c | 6 +++--- tools/perf/util/hist.c | 2 +- tools/perf/util/hist.h | 2 +- tools/perf/util/sort.c | 6 +++--- 7 files changed, 15 insertions(+), 14 deletions(-)
tools/perf/builtin-diff.c +1 -1
@@ -1056,7 +1056,7 @@ static int hpp__header(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,static int hpp__width (struct perf_hpp_fmt *fmt,struct perf_hpp *hpp__maybe_unused , -struct perf_evsel *evsel__maybe_unused ) +struct hists *hists__maybe_unused ) {struct diff_hpp_fmt *dfmt = container_of(fmt, struct diff_hpp_fmt, fmt);
tools/perf/ui/browsers/hists.c +1 -1
@@ -1470,7 +1470,7 @@ static int hist_browser__show_no_entry(struct hist_browser *browser, column++ < browser->b.horiz_scroll)continue ; - ret = fmt->width (fmt,NULL ,hists_to_evsel (browser->hists)); + ret = fmt->width (fmt,NULL , browser->hists);if (first) {/* for folded sign */
tools/perf/ui/hist.c +5 -4
@@ -215,9 +215,10 @@ static int __hpp__sort_acc(struct hist_entry *a, struct hist_entry *b,static int hpp__width_fn (struct perf_hpp_fmt *fmt,struct perf_hpp *hpp__maybe_unused , -struct perf_evsel *evsel) +struct hists *hists) {int len = fmt->user_len ?: fmt->len; +struct perf_evsel *evsel =hists_to_evsel (hists);if (symbol_conf.event_group) len =max (len, evsel->nr_members * fmt->len);
@@ -231,7 +232,7 @@ static int hpp__width_fn(struct perf_hpp_fmt *fmt,static int hpp__header_fn (struct perf_hpp_fmt *fmt,struct perf_hpp *hpp,struct hists *hists) { -int len =hpp__width_fn (fmt, hpp,hists_to_evsel (hists)); +int len =hpp__width_fn (fmt, hpp, hists);return scnprintf (hpp->buf, hpp->size,"%*s" , len, fmt->name); }
@@ -632,7 +633,7 @@ unsigned int hists__sort_list_width(struct hists *hists)else ret +=2 ; - ret += fmt->width (fmt, &dummy_hpp,hists_to_evsel (hists)); + ret += fmt->width (fmt, &dummy_hpp, hists); }if (verbose &&hists__has (hists, sym))/* Addr + origin */
@@ -657,7 +658,7 @@ unsigned int hists__overhead_width(struct hists *hists)else ret +=2 ; - ret += fmt->width (fmt, &dummy_hpp,hists_to_evsel (hists)); + ret += fmt->width (fmt, &dummy_hpp, hists); }return ret;
tools/perf/ui/stdio/hist.c +3 -3
@@ -590,7 +590,7 @@ static int print_hierarchy_header(struct hists *hists, struct perf_hpp *hpp,fprintf (fp,"%s" , sep ?:".." ); first_col = false; - width = fmt->width (fmt, hpp,hists_to_evsel (hists)); + width = fmt->width (fmt, hpp, hists);fprintf (fp,"%.*s" , width, dots); }
@@ -607,7 +607,7 @@ static int print_hierarchy_header(struct hists *hists, struct perf_hpp *hpp, width++;/* for '+' sign between column header */ first_col = false; - width += fmt->width (fmt, hpp,hists_to_evsel (hists)); + width += fmt->width (fmt, hpp, hists); }if (width > header_width)
@@ -682,7 +682,7 @@ hists__fprintf_standard_headers(struct hists *hists,else first = false; - width = fmt->width (fmt, hpp,hists_to_evsel (hists)); + width = fmt->width (fmt, hpp, hists);for (i =0 ; i < width; i++)fprintf (fp,"." ); }
tools/perf/util/hist.c +1 -1
@@ -1081,7 +1081,7 @@ int hist_entry__snprintf_alignment(struct hist_entry *he, struct perf_hpp *hpp, struct perf_hpp_fmt *fmt, int printed) {if (!list_is_last (&fmt->list, &he->hists->hpp_list->fields)) { -const int width = fmt->width (fmt, hpp,hists_to_evsel (he->hists)); +const int width = fmt->width (fmt, hpp, he->hists);if (printed < width) {advance_hpp (hpp, printed); printed =scnprintf (hpp->buf, hpp->size,"%-*s" , width - printed," " );
tools/perf/util/hist.h +1 -1
@@ -217,7 +217,7 @@ struct perf_hpp_fmt {int (*header)(struct perf_hpp_fmt *fmt,struct perf_hpp *hpp,struct hists *hists);int (*width)(struct perf_hpp_fmt *fmt,struct perf_hpp *hpp, -struct perf_evsel *evsel); +struct hists *hists);int (*color)(struct perf_hpp_fmt *fmt,struct perf_hpp *hpp,struct hist_entry *he); int (*entry)(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
tools/perf/util/sort.c +3 -3
@@ -1503,7 +1503,7 @@ static int __sort__hpp_header(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,static int __sort__hpp_width (struct perf_hpp_fmt *fmt,struct perf_hpp *hpp__maybe_unused , -struct perf_evsel *evsel) +struct hists *hists) {struct hpp_sort_entry *hse;size_t len = fmt->user_len;
@@ -1511,7 +1511,7 @@ static int __sort__hpp_width(struct perf_hpp_fmt *fmt, hse = container_of(fmt, struct hpp_sort_entry, hpp);if (!len) - len =hists__col_len (evsel__hists (evsel), hse->se->se_width_idx); + len =hists__col_len (hists, hse->se->se_width_idx);return len; }
@@ -1808,7 +1808,7 @@ static int __sort__hde_header(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,static int __sort__hde_width (struct perf_hpp_fmt *fmt,struct perf_hpp *hpp__maybe_unused , -struct perf_evsel *evsel__maybe_unused ) +struct hists *hists__maybe_unused ) {struct hpp_dynamic_entry *hde;size_t len = fmt->user_len;
Signature · 1 line
2.4.11
tip-bot for Jiri Olsa
merge bot[tip:perf/core] perf hists: Replace perf_evsel arg perf_hpp_fmt's width callback
perf hists: Replace perf_evsel arg perf_hpp_fmt's width callback
Commit-ID: da1b0407c866e7a8679cd3b64b35d83825c58a14 Gitweb: http://git.kernel.org/tip/da1b0407c866e7a8679cd3b64b35d83825c58a14 Author: Jiri Olsa <[email protected]> AuthorDate: Tue, 14 Jun 2016 20:19:20 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Wed, 15 Jun 2016 10:50:04 -0300
perf hists: Replace perf_evsel arg perf_hpp_fmt's width callback
Replacing perf_evsel arg perf_hpp_fmt's width callback with hists object.
This will be helpful in future for non evsel related hist browsers.
--- tools/perf/builtin-diff.c | 2 +- tools/perf/ui/browsers/hists.c | 2 +- tools/perf/ui/hist.c | 9 +++++---- tools/perf/ui/stdio/hist.c | 6 +++--- tools/perf/util/hist.c | 2 +- tools/perf/util/hist.h | 2 +- tools/perf/util/sort.c | 6 +++--- 7 files changed, 15 insertions(+), 14 deletions(-)
tools/perf/builtin-diff.c +1 -1
@@ -1056,7 +1056,7 @@ static int hpp__header(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,static int hpp__width (struct perf_hpp_fmt *fmt,struct perf_hpp *hpp__maybe_unused , -struct perf_evsel *evsel__maybe_unused ) +struct hists *hists__maybe_unused ) {struct diff_hpp_fmt *dfmt = container_of(fmt, struct diff_hpp_fmt, fmt);
tools/perf/ui/browsers/hists.c +1 -1
@@ -1470,7 +1470,7 @@ static int hist_browser__show_no_entry(struct hist_browser *browser, column++ < browser->b.horiz_scroll)continue ; - ret = fmt->width (fmt,NULL ,hists_to_evsel (browser->hists)); + ret = fmt->width (fmt,NULL , browser->hists);if (first) {/* for folded sign */
tools/perf/ui/hist.c +5 -4
@@ -215,9 +215,10 @@ static int __hpp__sort_acc(struct hist_entry *a, struct hist_entry *b,static int hpp__width_fn (struct perf_hpp_fmt *fmt,struct perf_hpp *hpp__maybe_unused , -struct perf_evsel *evsel) +struct hists *hists) {int len = fmt->user_len ?: fmt->len; +struct perf_evsel *evsel =hists_to_evsel (hists);if (symbol_conf.event_group) len =max (len, evsel->nr_members * fmt->len);
@@ -231,7 +232,7 @@ static int hpp__width_fn(struct perf_hpp_fmt *fmt,static int hpp__header_fn (struct perf_hpp_fmt *fmt,struct perf_hpp *hpp,struct hists *hists) { -int len =hpp__width_fn (fmt, hpp,hists_to_evsel (hists)); +int len =hpp__width_fn (fmt, hpp, hists);return scnprintf (hpp->buf, hpp->size,"%*s" , len, fmt->name); }
@@ -632,7 +633,7 @@ unsigned int hists__sort_list_width(struct hists *hists)else ret +=2 ; - ret += fmt->width (fmt, &dummy_hpp,hists_to_evsel (hists)); + ret += fmt->width (fmt, &dummy_hpp, hists); }if (verbose &&hists__has (hists, sym))/* Addr + origin */
@@ -657,7 +658,7 @@ unsigned int hists__overhead_width(struct hists *hists)else ret +=2 ; - ret += fmt->width (fmt, &dummy_hpp,hists_to_evsel (hists)); + ret += fmt->width (fmt, &dummy_hpp, hists); }return ret;
tools/perf/ui/stdio/hist.c +3 -3
@@ -590,7 +590,7 @@ static int print_hierarchy_header(struct hists *hists, struct perf_hpp *hpp,fprintf (fp,"%s" , sep ?:".." ); first_col = false; - width = fmt->width (fmt, hpp,hists_to_evsel (hists)); + width = fmt->width (fmt, hpp, hists);fprintf (fp,"%.*s" , width, dots); }
@@ -607,7 +607,7 @@ static int print_hierarchy_header(struct hists *hists, struct perf_hpp *hpp, width++;/* for '+' sign between column header */ first_col = false; - width += fmt->width (fmt, hpp,hists_to_evsel (hists)); + width += fmt->width (fmt, hpp, hists); }if (width > header_width)
@@ -682,7 +682,7 @@ hists__fprintf_standard_headers(struct hists *hists,else first = false; - width = fmt->width (fmt, hpp,hists_to_evsel (hists)); + width = fmt->width (fmt, hpp, hists);for (i =0 ; i < width; i++)fprintf (fp,"." ); }
tools/perf/util/hist.c +1 -1
@@ -1081,7 +1081,7 @@ int hist_entry__snprintf_alignment(struct hist_entry *he, struct perf_hpp *hpp, struct perf_hpp_fmt *fmt, int printed) {if (!list_is_last (&fmt->list, &he->hists->hpp_list->fields)) { -const int width = fmt->width (fmt, hpp,hists_to_evsel (he->hists)); +const int width = fmt->width (fmt, hpp, he->hists);if (printed < width) {advance_hpp (hpp, printed); printed =scnprintf (hpp->buf, hpp->size,"%-*s" , width - printed," " );
tools/perf/util/hist.h +1 -1
@@ -217,7 +217,7 @@ struct perf_hpp_fmt {int (*header)(struct perf_hpp_fmt *fmt,struct perf_hpp *hpp,struct hists *hists);int (*width)(struct perf_hpp_fmt *fmt,struct perf_hpp *hpp, -struct perf_evsel *evsel); +struct hists *hists);int (*color)(struct perf_hpp_fmt *fmt,struct perf_hpp *hpp,struct hist_entry *he); int (*entry)(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
tools/perf/util/sort.c +3 -3
@@ -1503,7 +1503,7 @@ static int __sort__hpp_header(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,static int __sort__hpp_width (struct perf_hpp_fmt *fmt,struct perf_hpp *hpp__maybe_unused , -struct perf_evsel *evsel) +struct hists *hists) {struct hpp_sort_entry *hse;size_t len = fmt->user_len;
@@ -1511,7 +1511,7 @@ static int __sort__hpp_width(struct perf_hpp_fmt *fmt, hse = container_of(fmt, struct hpp_sort_entry, hpp);if (!len) - len =hists__col_len (evsel__hists (evsel), hse->se->se_width_idx); + len =hists__col_len (hists, hse->se->se_width_idx);return len; }
@@ -1808,7 +1808,7 @@ static int __sort__hde_header(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,static int __sort__hde_width (struct perf_hpp_fmt *fmt,struct perf_hpp *hpp__maybe_unused , -struct perf_evsel *evsel__maybe_unused ) +struct hists *hists__maybe_unused ) {struct hpp_dynamic_entry *hde;size_t len = fmt->user_len;
Jiri Olsa
reviewerPATCH 11/11 perf tools: Rename __hists__add_entry to hists__add_entry
In reply to Jiri OlsaThere's no reason we should suffer the '__' prefix for the base global function.
--- tools/perf/builtin-annotate.c | 2 +- tools/perf/builtin-diff.c | 12 +----------- tools/perf/tests/hists_link.c | 4 ++-- tools/perf/util/hist.c | 34 +++++++++++++++++----------------- tools/perf/util/hist.h | 14 +++++++------- 5 files changed, 28 insertions(+), 38 deletions(-)
tools/perf/builtin-annotate.c +1 -1
@@ -75,7 +75,7 @@ static int perf_evsel__add_sample(struct perf_evsel *evsel, sample->period =1 ; sample->weight =1 ; - he =__hists__add_entry (hists, al,NULL ,NULL ,NULL , sample, true); + he =hists__add_entry (hists, al,NULL ,NULL ,NULL , sample, true);if (he ==NULL )return -ENOMEM ;
tools/perf/builtin-diff.c +1 -11
@@ -310,16 +310,6 @@ static int formula_fprintf(struct hist_entry *he, struct hist_entry *pair,return -1 ; } -static int hists__add_entry (struct hists *hists, -struct addr_location *al, -struct perf_sample *sample) -{ -if (__hists__add_entry (hists, al,NULL ,NULL ,NULL , - sample, true) !=NULL ) -return 0 ; -return -ENOMEM ; -} - static int diff__process_sample_event(struct perf_tool *tool __maybe_unused, union perf_event *event, struct perf_sample *sample,
@@ -336,7 +326,7 @@ static int diff__process_sample_event(struct perf_tool *tool __maybe_unused,return -1 ; } -if (hists__add_entry (hists, &al, sample)) { +if (!hists__add_entry (hists, &al,NULL ,NULL ,NULL , sample, true)) {pr_warning ("problem incrementing symbol period, skipping event\n" ); goto out_put; }
tools/perf/tests/hists_link.c +2 -2
@@ -84,7 +84,7 @@ static int add_hist_entries(struct perf_evlist *evlist, struct machine *machine)if (machine__resolve (machine, &al, &sample) <0 ) goto out; - he =__hists__add_entry (hists, &al,NULL , + he =hists__add_entry (hists, &al,NULL ,NULL ,NULL , &sample, true);if (he ==NULL ) {addr_location__put (&al);
@@ -103,7 +103,7 @@ static int add_hist_entries(struct perf_evlist *evlist, struct machine *machine)if (machine__resolve (machine, &al, &sample) <0 ) goto out; - he =__hists__add_entry (hists, &al,NULL , + he =hists__add_entry (hists, &al,NULL ,NULL ,NULL , &sample, true);if (he ==NULL ) {addr_location__put (&al);
tools/perf/util/hist.c +17 -17
@@ -531,13 +531,13 @@ out:return he; } -struct hist_entry *__hists__add_entry (struct hists *hists, -struct addr_location *al, -struct symbol *sym_parent, -struct branch_info *bi, -struct mem_info *mi, -struct perf_sample *sample, -bool sample_self) +struct hist_entry *hists__add_entry (struct hists *hists, +struct addr_location *al, +struct symbol *sym_parent, +struct branch_info *bi, +struct mem_info *mi, +struct perf_sample *sample, +bool sample_self) {struct hist_entry entry = { .thread = al->thread,
@@ -622,8 +622,8 @@ iter_add_single_mem_entry(struct hist_entry_iter *iter, struct addr_location *al*/ sample->period = cost; - he =__hists__add_entry (hists, al, iter->parent,NULL , mi, - sample, true); + he =hists__add_entry (hists, al, iter->parent,NULL , mi, + sample, true);if (!he)return -ENOMEM ;
@@ -727,8 +727,8 @@ iter_add_next_branch_entry(struct hist_entry_iter *iter, struct addr_location *a sample->period =1 ; sample->weight = bi->flags.cycles ? bi->flags.cycles :1 ; - he =__hists__add_entry (hists, al, iter->parent, &bi[i],NULL , - sample, true); + he =hists__add_entry (hists, al, iter->parent, &bi[i],NULL , + sample, true);if (he ==NULL )return -ENOMEM ;
@@ -764,8 +764,8 @@ iter_add_single_normal_entry(struct hist_entry_iter *iter, struct addr_locationstruct perf_sample *sample = iter->sample;struct hist_entry *he; - he =__hists__add_entry (evsel__hists (evsel), al, iter->parent,NULL ,NULL , - sample, true); + he =hists__add_entry (evsel__hists (evsel), al, iter->parent,NULL ,NULL , + sample, true);if (he ==NULL )return -ENOMEM ;
@@ -825,8 +825,8 @@ iter_add_single_cumulative_entry(struct hist_entry_iter *iter,struct hist_entry *he;int err =0 ; - he =__hists__add_entry (hists, al, iter->parent,NULL ,NULL , - sample, true); + he =hists__add_entry (hists, al, iter->parent,NULL ,NULL , + sample, true);if (he ==NULL )return -ENOMEM ;
@@ -900,8 +900,8 @@ iter_add_next_cumulative_entry(struct hist_entry_iter *iter, } } - he =__hists__add_entry (evsel__hists (evsel), al, iter->parent,NULL ,NULL , - sample, false); + he =hists__add_entry (evsel__hists (evsel), al, iter->parent,NULL ,NULL , + sample, false);if (he ==NULL )return -ENOMEM ;
tools/perf/util/hist.h +7 -7
@@ -120,13 +120,13 @@ extern const struct hist_iter_ops hist_iter_branch;extern const struct hist_iter_ops hist_iter_mem;extern const struct hist_iter_ops hist_iter_cumulative; -struct hist_entry *__hists__add_entry (struct hists *hists, -struct addr_location *al, -struct symbol *parent, -struct branch_info *bi, -struct mem_info *mi, -struct perf_sample *sample, -bool sample_self); +struct hist_entry *hists__add_entry (struct hists *hists, +struct addr_location *al, +struct symbol *parent, +struct branch_info *bi, +struct mem_info *mi, +struct perf_sample *sample, +bool sample_self);int hist_entry_iter__add (struct hist_entry_iter *iter,struct addr_location *al,int max_stack_depth,void *arg);
Signature · 1 line
2.4.11
tip-bot for Jiri Olsa
merge bot[tip:perf/core] perf hists: Rename __hists__add_entry to hists__add_entry
perf hists: Rename __hists__add_entry to hists__add_entry
Commit-ID: 0102ef3ec940e8a68aa94125cd4b40569b24e6be Gitweb: http://git.kernel.org/tip/0102ef3ec940e8a68aa94125cd4b40569b24e6be Author: Jiri Olsa <[email protected]> AuthorDate: Tue, 14 Jun 2016 20:19:21 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Tue, 21 Jun 2016 13:18:33 -0300
perf hists: Rename __hists__add_entry to hists__add_entry
There's no reason we should suffer the '__' prefix for the base global function.
--- tools/perf/builtin-annotate.c | 2 +- tools/perf/builtin-diff.c | 12 +----------- tools/perf/tests/hists_link.c | 4 ++-- tools/perf/util/hist.c | 34 +++++++++++++++++----------------- tools/perf/util/hist.h | 14 +++++++------- 5 files changed, 28 insertions(+), 38 deletions(-)
tools/perf/builtin-annotate.c +1 -1
@@ -75,7 +75,7 @@ static int perf_evsel__add_sample(struct perf_evsel *evsel, sample->period =1 ; sample->weight =1 ; - he =__hists__add_entry (hists, al,NULL ,NULL ,NULL , sample, true); + he =hists__add_entry (hists, al,NULL ,NULL ,NULL , sample, true);if (he ==NULL )return -ENOMEM ;
tools/perf/builtin-diff.c +1 -11
@@ -310,16 +310,6 @@ static int formula_fprintf(struct hist_entry *he, struct hist_entry *pair,return -1 ; } -static int hists__add_entry (struct hists *hists, -struct addr_location *al, -struct perf_sample *sample) -{ -if (__hists__add_entry (hists, al,NULL ,NULL ,NULL , - sample, true) !=NULL ) -return 0 ; -return -ENOMEM ; -} - static int diff__process_sample_event(struct perf_tool *tool __maybe_unused, union perf_event *event, struct perf_sample *sample,
@@ -336,7 +326,7 @@ static int diff__process_sample_event(struct perf_tool *tool __maybe_unused,return -1 ; } -if (hists__add_entry (hists, &al, sample)) { +if (!hists__add_entry (hists, &al,NULL ,NULL ,NULL , sample, true)) {pr_warning ("problem incrementing symbol period, skipping event\n" ); goto out_put; }
tools/perf/tests/hists_link.c +2 -2
@@ -84,7 +84,7 @@ static int add_hist_entries(struct perf_evlist *evlist, struct machine *machine)if (machine__resolve (machine, &al, &sample) <0 ) goto out; - he =__hists__add_entry (hists, &al,NULL , + he =hists__add_entry (hists, &al,NULL ,NULL ,NULL , &sample, true);if (he ==NULL ) {addr_location__put (&al);
@@ -103,7 +103,7 @@ static int add_hist_entries(struct perf_evlist *evlist, struct machine *machine)if (machine__resolve (machine, &al, &sample) <0 ) goto out; - he =__hists__add_entry (hists, &al,NULL , + he =hists__add_entry (hists, &al,NULL ,NULL ,NULL , &sample, true);if (he ==NULL ) {addr_location__put (&al);
tools/perf/util/hist.c +17 -17
@@ -531,13 +531,13 @@ out:return he; } -struct hist_entry *__hists__add_entry (struct hists *hists, -struct addr_location *al, -struct symbol *sym_parent, -struct branch_info *bi, -struct mem_info *mi, -struct perf_sample *sample, -bool sample_self) +struct hist_entry *hists__add_entry (struct hists *hists, +struct addr_location *al, +struct symbol *sym_parent, +struct branch_info *bi, +struct mem_info *mi, +struct perf_sample *sample, +bool sample_self) {struct hist_entry entry = { .thread = al->thread,
@@ -622,8 +622,8 @@ iter_add_single_mem_entry(struct hist_entry_iter *iter, struct addr_location *al*/ sample->period = cost; - he =__hists__add_entry (hists, al, iter->parent,NULL , mi, - sample, true); + he =hists__add_entry (hists, al, iter->parent,NULL , mi, + sample, true);if (!he)return -ENOMEM ;
@@ -727,8 +727,8 @@ iter_add_next_branch_entry(struct hist_entry_iter *iter, struct addr_location *a sample->period =1 ; sample->weight = bi->flags.cycles ? bi->flags.cycles :1 ; - he =__hists__add_entry (hists, al, iter->parent, &bi[i],NULL , - sample, true); + he =hists__add_entry (hists, al, iter->parent, &bi[i],NULL , + sample, true);if (he ==NULL )return -ENOMEM ;
@@ -764,8 +764,8 @@ iter_add_single_normal_entry(struct hist_entry_iter *iter, struct addr_locationstruct perf_sample *sample = iter->sample;struct hist_entry *he; - he =__hists__add_entry (evsel__hists (evsel), al, iter->parent,NULL ,NULL , - sample, true); + he =hists__add_entry (evsel__hists (evsel), al, iter->parent,NULL ,NULL , + sample, true);if (he ==NULL )return -ENOMEM ;
@@ -825,8 +825,8 @@ iter_add_single_cumulative_entry(struct hist_entry_iter *iter,struct hist_entry *he;int err =0 ; - he =__hists__add_entry (hists, al, iter->parent,NULL ,NULL , - sample, true); + he =hists__add_entry (hists, al, iter->parent,NULL ,NULL , + sample, true);if (he ==NULL )return -ENOMEM ;
@@ -900,8 +900,8 @@ iter_add_next_cumulative_entry(struct hist_entry_iter *iter, } } - he =__hists__add_entry (evsel__hists (evsel), al, iter->parent,NULL ,NULL , - sample, false); + he =hists__add_entry (evsel__hists (evsel), al, iter->parent,NULL ,NULL , + sample, false);if (he ==NULL )return -ENOMEM ;
tools/perf/util/hist.h +7 -7
@@ -120,13 +120,13 @@ extern const struct hist_iter_ops hist_iter_branch;extern const struct hist_iter_ops hist_iter_mem;extern const struct hist_iter_ops hist_iter_cumulative; -struct hist_entry *__hists__add_entry (struct hists *hists, -struct addr_location *al, -struct symbol *parent, -struct branch_info *bi, -struct mem_info *mi, -struct perf_sample *sample, -bool sample_self); +struct hist_entry *hists__add_entry (struct hists *hists, +struct addr_location *al, +struct symbol *parent, +struct branch_info *bi, +struct mem_info *mi, +struct perf_sample *sample, +bool sample_self);int hist_entry_iter__add (struct hist_entry_iter *iter,struct addr_location *al,int max_stack_depth,void *arg);