perf tools: Various fixes
Jiri Olsa
reviewercover perf tools: Various fixes
hi,
another 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 (8):
perf tools: Rename __hists__add_entry to hists__add_entry perf tools: Move hist_browser into header file
perf tools: Make hist_browser__(new|delete|run) public perf tools: Introduce struct hist_browser title callback perf tools: Move horizontal scroll init into hist_browser__new perf tools: Introduce perf_evsel_browser_new function perf tools: Introduce hist_browser__init
perf tools: Enlarge pid sort entry size
tools/perf/builtin-annotate.c | 2 +- tools/perf/builtin-diff.c | 12 +----------- tools/perf/tests/hists_link.c | 4 ++-- tools/perf/ui/browsers/hists.c | 105 +++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------ tools/perf/ui/browsers/hists.h | 32 ++++++++++++++++++++++++++++++++ tools/perf/util/hist.c | 36 ++++++++++++++++++------------------ tools/perf/util/hist.h | 14 +++++++------- tools/perf/util/sort.c | 6 +++--- 8 files changed, 115 insertions(+), 96 deletions(-)
Jiri Olsa
reviewerPATCH 1/8 perf tools: 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);
Signature · 1 line
2.4.11
Jiri Olsa
reviewerPATCH 2/8 perf tools: Move hist_browser into header file
In reply to Jiri OlsaThis way we can use it outside of ui/browsers/hists.c and extend it in following patches.
--- tools/perf/ui/browsers/hists.c | 19 +------------------ tools/perf/ui/browsers/hists.h | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 18 deletions(-) create mode 100644 tools/perf/ui/browsers/hists.h
tools/perf/ui/browsers/hists.c +1 -18
@@ -12,30 +12,13 @@#include "../../util/top.h" #include "../../arch/common.h" -#include "../browser.h" +#include "../browsers/hists.h" #include "../helpline.h" #include "../util.h" #include "../ui.h" #include "map.h" #include "annotate.h" -struct hist_browser { -struct ui_browser b; -struct hists *hists; -struct hist_entry *he_selection; -struct map_symbol *selection; -struct hist_browser_timer *hbt; -struct pstack *pstack; -struct perf_env *env; -int print_seq; -bool show_dso; -bool show_headers; -float min_pcnt; -u64 nr_non_filtered_entries; -u64 nr_hierarchy_entries; -u64 nr_callchain_rows; -}; -extern void hist_browser__init_hpp (void ); static int hists__browser_title(struct hists *hists,
tools/perf/ui/browsers/hists.h new file +23 -0
@@ -0,0 +1,23 @@ +#ifndef _PERF_UI_BROWSER_HISTS_H_ +#define _PERF_UI_BROWSER_HISTS_H_ 1 + +#include "ui/browser.h" + +struct hist_browser { +struct ui_browser b; +struct hists *hists; +struct hist_entry *he_selection; +struct map_symbol *selection; +struct hist_browser_timer *hbt; +struct pstack *pstack; +struct perf_env *env; +int print_seq; +bool show_dso; +bool show_headers; +float min_pcnt; +u64 nr_non_filtered_entries; +u64 nr_hierarchy_entries; +u64 nr_callchain_rows; +}; + +#endif /* _PERF_UI_BROWSER_HISTS_H_ */
Signature · 1 line
2.4.11
tip-bot for Jiri Olsa
merge bot[tip:perf/core] perf hists browser: Move hist_browser into header file
perf hists browser: Move hist_browser into header file
Commit-ID: f758990f25d159c067f31ded52b298a4f15cb08e Gitweb: http://git.kernel.org/tip/f758990f25d159c067f31ded52b298a4f15cb08e Author: Jiri Olsa <[email protected]> AuthorDate: Mon, 20 Jun 2016 23:58:13 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Wed, 22 Jun 2016 09:56:34 -0300
perf hists browser: Move hist_browser into header file
This way we can use it outside of ui/browsers/hists.c and extend it in following patches.
--- tools/perf/ui/browsers/hists.c | 19 +------------------ tools/perf/ui/browsers/hists.h | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 18 deletions(-)
tools/perf/ui/browsers/hists.c +1 -18
@@ -12,30 +12,13 @@#include "../../util/top.h" #include "../../arch/common.h" -#include "../browser.h" +#include "../browsers/hists.h" #include "../helpline.h" #include "../util.h" #include "../ui.h" #include "map.h" #include "annotate.h" -struct hist_browser { -struct ui_browser b; -struct hists *hists; -struct hist_entry *he_selection; -struct map_symbol *selection; -struct hist_browser_timer *hbt; -struct pstack *pstack; -struct perf_env *env; -int print_seq; -bool show_dso; -bool show_headers; -float min_pcnt; -u64 nr_non_filtered_entries; -u64 nr_hierarchy_entries; -u64 nr_callchain_rows; -}; -extern void hist_browser__init_hpp (void ); static int hists__browser_title(struct hists *hists,
tools/perf/ui/browsers/hists.h new file +23 -0
@@ -0,0 +1,23 @@ +#ifndef _PERF_UI_BROWSER_HISTS_H_ +#define _PERF_UI_BROWSER_HISTS_H_ 1 + +#include "ui/browser.h" + +struct hist_browser { +struct ui_browser b; +struct hists *hists; +struct hist_entry *he_selection; +struct map_symbol *selection; +struct hist_browser_timer *hbt; +struct pstack *pstack; +struct perf_env *env; +int print_seq; +bool show_dso; +bool show_headers; +float min_pcnt; +u64 nr_non_filtered_entries; +u64 nr_hierarchy_entries; +u64 nr_callchain_rows; +}; + +#endif /* _PERF_UI_BROWSER_HISTS_H_ */
Jiri Olsa
reviewerPATCH 3/8 perf tools: Make hist_browser__(new|delete|run) public
In reply to Jiri OlsaThis way we can use it outside of ui/browsers/hists.c and extend it in following patches.
--- tools/perf/ui/browsers/hists.c | 10 +++++----- tools/perf/ui/browsers/hists.h | 5 +++++ 2 files changed, 10 insertions(+), 5 deletions(-)
tools/perf/ui/browsers/hists.c +5 -5
@@ -568,7 +568,7 @@ static void ui_browser__warn_lost_events(struct ui_browser *browser) "Or reduce the sampling frequency."); } -static int hist_browser__run (struct hist_browser *browser,const char *help) +int hist_browser__run (struct hist_browser *browser,const char *help) {int key;char title[160 ];
@@ -2039,9 +2039,9 @@ static int hist_browser__dump(struct hist_browser *browser)return 0 ; } -static struct hist_browser *hist_browser__new (struct hists *hists, -struct hist_browser_timer *hbt, -struct perf_env *env) +struct hist_browser *hist_browser__new (struct hists *hists, +struct hist_browser_timer *hbt, +struct perf_env *env) {struct hist_browser *browser =zalloc (sizeof (*browser));
@@ -2059,7 +2059,7 @@ static struct hist_browser *hist_browser__new(struct hists *hists,return browser; } -static void hist_browser__delete (struct hist_browser *browser) +void hist_browser__delete (struct hist_browser *browser) {free (browser); }
tools/perf/ui/browsers/hists.h +5 -0
@@ -20,4 +20,9 @@ struct hist_browser { u64 nr_callchain_rows; }; +struct hist_browser *hist_browser__new (struct hists *hists, +struct hist_browser_timer *hbt, +struct perf_env *env); +void hist_browser__delete (struct hist_browser *browser); +int hist_browser__run (struct hist_browser *browser,const char *help);#endif /* _PERF_UI_BROWSER_HISTS_H_ */
Signature · 1 line
2.4.11
tip-bot for Jiri Olsa
merge bot[tip:perf/core] perf hists browser: Make (new|delete|run) public
perf hists browser: Make (new|delete|run) public
Commit-ID: dabd201239b5a521c3a5406c86dd273f47f37f1a Gitweb: http://git.kernel.org/tip/dabd201239b5a521c3a5406c86dd273f47f37f1a Author: Jiri Olsa <[email protected]> AuthorDate: Mon, 20 Jun 2016 23:58:14 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Wed, 22 Jun 2016 09:56:34 -0300
perf hists browser: Make (new|delete|run) public
This way we can use it outside of ui/browsers/hists.c and extend it in following patches.
--- tools/perf/ui/browsers/hists.c | 10 +++++----- tools/perf/ui/browsers/hists.h | 5 +++++ 2 files changed, 10 insertions(+), 5 deletions(-)
tools/perf/ui/browsers/hists.c +5 -5
@@ -568,7 +568,7 @@ static void ui_browser__warn_lost_events(struct ui_browser *browser) "Or reduce the sampling frequency."); } -static int hist_browser__run (struct hist_browser *browser,const char *help) +int hist_browser__run (struct hist_browser *browser,const char *help) {int key;char title[160 ];
@@ -2039,9 +2039,9 @@ static int hist_browser__dump(struct hist_browser *browser)return 0 ; } -static struct hist_browser *hist_browser__new (struct hists *hists, -struct hist_browser_timer *hbt, -struct perf_env *env) +struct hist_browser *hist_browser__new (struct hists *hists, +struct hist_browser_timer *hbt, +struct perf_env *env) {struct hist_browser *browser =zalloc (sizeof (*browser));
@@ -2059,7 +2059,7 @@ static struct hist_browser *hist_browser__new(struct hists *hists,return browser; } -static void hist_browser__delete (struct hist_browser *browser) +void hist_browser__delete (struct hist_browser *browser) {free (browser); }
tools/perf/ui/browsers/hists.h +5 -0
@@ -20,4 +20,9 @@ struct hist_browser { u64 nr_callchain_rows; }; +struct hist_browser *hist_browser__new (struct hists *hists, +struct hist_browser_timer *hbt, +struct perf_env *env); +void hist_browser__delete (struct hist_browser *browser); +int hist_browser__run (struct hist_browser *browser,const char *help);#endif /* _PERF_UI_BROWSER_HISTS_H_ */
Jiri Olsa
reviewerPATCH 4/8 perf tools: Introduce struct hist_browser title callback
In reply to Jiri OlsaWe can now setup title callback for hist_browser,
which will be useful in following changes to
create customized hist_browsers.
This also separates struct perf_evsel dependency
out of hist_browser basic code.
--- tools/perf/ui/browsers/hists.c | 21 +++++++++++++-------- tools/perf/ui/browsers/hists.h | 4 ++++ 2 files changed, 17 insertions(+), 8 deletions(-)
tools/perf/ui/browsers/hists.c +13 -8
@@ -21,9 +21,8 @@extern void hist_browser__init_hpp (void ); -static int hists__browser_title (struct hists *hists, -struct hist_browser_timer *hbt, -char *bf,size_t size); +static int perf_evsel_browser_title (struct hist_browser *browser, +char *bf,size_t size);static void hist_browser__update_nr_entries (struct hist_browser *hb); static struct rb_node *hists__filter_entries(struct rb_node *nd,
@@ -568,6 +567,11 @@ static void ui_browser__warn_lost_events(struct ui_browser *browser) "Or reduce the sampling frequency."); } +static int hist_browser__title (struct hist_browser *browser,char *bf,size_t size) +{ +return browser->title ? browser->title (browser, bf, size) :0 ; +} +int hist_browser__run (struct hist_browser *browser,const char *help) {int key;
@@ -578,7 +582,7 @@ int hist_browser__run(struct hist_browser *browser, const char *help) browser->b.entries = &browser->hists->entries; browser->b.nr_entries =hist_browser__nr_entries (browser); -hists__browser_title (browser->hists, hbt, title,sizeof (title)); +hist_browser__title (browser, title,sizeof (title));if (ui_browser__show (&browser->b, title,"%s" , help) <0 )return -1 ;
@@ -604,8 +608,7 @@ int hist_browser__run(struct hist_browser *browser, const char *help)ui_browser__warn_lost_events (&browser->b); } -hists__browser_title (browser->hists, - hbt, title,sizeof (title)); +hist_browser__title (browser, title,sizeof (title));ui_browser__show_title (&browser->b, title);continue ; }
@@ -2054,6 +2057,7 @@ struct hist_browser *hist_browser__new(struct hists *hists, browser->show_headers = symbol_conf.show_hist_headers; browser->hbt = hbt; browser->env = env; + browser->title = perf_evsel_browser_title; }return browser;
@@ -2080,10 +2084,11 @@ static inline bool is_report_browser(void *timer)return timer ==NULL ; } -static int hists__browser_title (struct hists *hists, -struct hist_browser_timer *hbt, +static int perf_evsel_browser_title (struct hist_browser *browser,char *bf,size_t size) { +struct hist_browser_timer *hbt = browser->hbt; +struct hists *hists = browser->hists;char unit;int printed;const struct dso *dso = hists->dso_filter;
tools/perf/ui/browsers/hists.h +4 -0
@@ -18,6 +18,10 @@ struct hist_browser {u64 nr_non_filtered_entries;u64 nr_hierarchy_entries;u64 nr_callchain_rows; + +/* Get title string. */ +int (*title)(struct hist_browser *browser, +char *bf,size_t size); }; struct hist_browser *hist_browser__new(struct hists *hists,
Signature · 1 line
2.4.11
tip-bot for Jiri Olsa
merge bot[tip:perf/core] perf hists browser: Introduce struct hist_browser title callback
perf hists browser: Introduce struct hist_browser title callback
Commit-ID: 5b91a86f47669898d6f2fe625844ab65cf258c34 Gitweb: http://git.kernel.org/tip/5b91a86f47669898d6f2fe625844ab65cf258c34 Author: Jiri Olsa <[email protected]> AuthorDate: Mon, 20 Jun 2016 23:58:15 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Wed, 22 Jun 2016 09:56:34 -0300
perf hists browser: Introduce struct hist_browser title callback
We can now setup title callback for hist_browser, which will be useful in following changes to create customized hist_browsers.
This also separates struct perf_evsel dependency out of hist_browser basic code.
--- tools/perf/ui/browsers/hists.c | 21 +++++++++++++-------- tools/perf/ui/browsers/hists.h | 4 ++++ 2 files changed, 17 insertions(+), 8 deletions(-)
tools/perf/ui/browsers/hists.c +13 -8
@@ -21,9 +21,8 @@extern void hist_browser__init_hpp (void ); -static int hists__browser_title (struct hists *hists, -struct hist_browser_timer *hbt, -char *bf,size_t size); +static int perf_evsel_browser_title (struct hist_browser *browser, +char *bf,size_t size);static void hist_browser__update_nr_entries (struct hist_browser *hb); static struct rb_node *hists__filter_entries(struct rb_node *nd,
@@ -568,6 +567,11 @@ static void ui_browser__warn_lost_events(struct ui_browser *browser) "Or reduce the sampling frequency."); } +static int hist_browser__title (struct hist_browser *browser,char *bf,size_t size) +{ +return browser->title ? browser->title (browser, bf, size) :0 ; +} +int hist_browser__run (struct hist_browser *browser,const char *help) {int key;
@@ -578,7 +582,7 @@ int hist_browser__run(struct hist_browser *browser, const char *help) browser->b.entries = &browser->hists->entries; browser->b.nr_entries =hist_browser__nr_entries (browser); -hists__browser_title (browser->hists, hbt, title,sizeof (title)); +hist_browser__title (browser, title,sizeof (title));if (ui_browser__show (&browser->b, title,"%s" , help) <0 )return -1 ;
@@ -604,8 +608,7 @@ int hist_browser__run(struct hist_browser *browser, const char *help)ui_browser__warn_lost_events (&browser->b); } -hists__browser_title (browser->hists, - hbt, title,sizeof (title)); +hist_browser__title (browser, title,sizeof (title));ui_browser__show_title (&browser->b, title);continue ; }
@@ -2054,6 +2057,7 @@ struct hist_browser *hist_browser__new(struct hists *hists, browser->show_headers = symbol_conf.show_hist_headers; browser->hbt = hbt; browser->env = env; + browser->title = perf_evsel_browser_title; }return browser;
@@ -2080,10 +2084,11 @@ static inline bool is_report_browser(void *timer)return timer ==NULL ; } -static int hists__browser_title (struct hists *hists, -struct hist_browser_timer *hbt, +static int perf_evsel_browser_title (struct hist_browser *browser,char *bf,size_t size) { +struct hist_browser_timer *hbt = browser->hbt; +struct hists *hists = browser->hists;char unit;int printed;const struct dso *dso = hists->dso_filter;
tools/perf/ui/browsers/hists.h +4 -0
@@ -18,6 +18,10 @@ struct hist_browser {u64 nr_non_filtered_entries;u64 nr_hierarchy_entries;u64 nr_callchain_rows; + +/* Get title string. */ +int (*title)(struct hist_browser *browser, +char *bf,size_t size); }; struct hist_browser *hist_browser__new(struct hists *hists,
Jiri Olsa
reviewerPATCH 5/8 perf tools: Move horizontal scroll init into hist_browser__new
In reply to Jiri OlsaMoving horizontal scroll init into initialization
function as already intended.
--- tools/perf/ui/browsers/hists.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-)
tools/perf/ui/browsers/hists.c +7 -13
@@ -2049,6 +2049,8 @@ struct hist_browser *hist_browser__new(struct hists *hists,struct hist_browser *browser =zalloc (sizeof (*browser));if (browser) { +struct perf_hpp_fmt *fmt; + browser->hists = hists; browser->b.refresh = hist_browser__refresh; browser->b.refresh_dimensions = hist_browser__refresh_dimensions;
@@ -2058,6 +2060,11 @@ struct hist_browser *hist_browser__new(struct hists *hists, browser->hbt = hbt; browser->env = env; browser->title = perf_evsel_browser_title; + +hists__for_each_format (hists, fmt) { +perf_hpp__reset_width (fmt, hists); + ++browser->b.columns; + } }return browser;
@@ -2654,7 +2661,6 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,int key =-1 ;char buf[64 ];int delay_secs = hbt ? hbt->refresh :0 ; -struct perf_hpp_fmt *fmt;#define HIST_BROWSER_HELP_COMMON \ "h/?/F1 Show this window\n" \
@@ -2713,18 +2719,6 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,memset (options,0 ,sizeof (options));memset (actions,0 ,sizeof (actions)); -hists__for_each_format (browser->hists, fmt) { -perf_hpp__reset_width (fmt, hists); -/* -* This is done just once, and activates the horizontal scrolling -* code in the ui_browser code, it would be better to have a the -* counter in the perf_hpp code, but I couldn't find doing it here -* works, FIXME by setting this in hist_browser__new, for now, be -* clever 8-) -*/ - ++browser->b.columns; - } -if (symbol_conf.col_width_list_str)perf_hpp__set_user_width (symbol_conf.col_width_list_str);
Signature · 1 line
2.4.11
tip-bot for Jiri Olsa
merge bot[tip:perf/core] perf hists browser: Move horizontal scroll init to new()
perf hists browser: Move horizontal scroll init to new()
Commit-ID: b1c7a8f7a1dad1aa46ec26cdfa487598634c5267 Gitweb: http://git.kernel.org/tip/b1c7a8f7a1dad1aa46ec26cdfa487598634c5267 Author: Jiri Olsa <[email protected]> AuthorDate: Mon, 20 Jun 2016 23:58:16 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Wed, 22 Jun 2016 09:56:35 -0300
perf hists browser: Move horizontal scroll init to new()
Moving horizontal scroll init to initialization function as already intended.
--- tools/perf/ui/browsers/hists.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-)
tools/perf/ui/browsers/hists.c +7 -13
@@ -2049,6 +2049,8 @@ struct hist_browser *hist_browser__new(struct hists *hists,struct hist_browser *browser =zalloc (sizeof (*browser));if (browser) { +struct perf_hpp_fmt *fmt; + browser->hists = hists; browser->b.refresh = hist_browser__refresh; browser->b.refresh_dimensions = hist_browser__refresh_dimensions;
@@ -2058,6 +2060,11 @@ struct hist_browser *hist_browser__new(struct hists *hists, browser->hbt = hbt; browser->env = env; browser->title = perf_evsel_browser_title; + +hists__for_each_format (hists, fmt) { +perf_hpp__reset_width (fmt, hists); + ++browser->b.columns; + } }return browser;
@@ -2654,7 +2661,6 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,int key =-1 ;char buf[64 ];int delay_secs = hbt ? hbt->refresh :0 ; -struct perf_hpp_fmt *fmt;#define HIST_BROWSER_HELP_COMMON \ "h/?/F1 Show this window\n" \
@@ -2713,18 +2719,6 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,memset (options,0 ,sizeof (options));memset (actions,0 ,sizeof (actions)); -hists__for_each_format (browser->hists, fmt) { -perf_hpp__reset_width (fmt, hists); -/* -* This is done just once, and activates the horizontal scrolling -* code in the ui_browser code, it would be better to have a the -* counter in the perf_hpp code, but I couldn't find doing it here -* works, FIXME by setting this in hist_browser__new, for now, be -* clever 8-) -*/ - ++browser->b.columns; - } -if (symbol_conf.col_width_list_str)perf_hpp__set_user_width (symbol_conf.col_width_list_str);
Jiri Olsa
reviewerPATCH 6/8 perf tools: Introduce perf_evsel_browser_new function
In reply to Jiri OlsaSo we could use hist_browser__new for generic hist browser in following patches.
--- tools/perf/ui/browsers/hists.c | 24 +++++++++++++++++------- tools/perf/ui/browsers/hists.h | 4 +--- 2 files changed, 18 insertions(+), 10 deletions(-)
tools/perf/ui/browsers/hists.c +17 -7
@@ -2042,9 +2042,7 @@ static int hist_browser__dump(struct hist_browser *browser)return 0 ; } -struct hist_browser *hist_browser__new (struct hists *hists, -struct hist_browser_timer *hbt, -struct perf_env *env) +struct hist_browser *hist_browser__new (struct hists *hists) {struct hist_browser *browser =zalloc (sizeof (*browser));
@@ -2057,9 +2055,6 @@ struct hist_browser *hist_browser__new(struct hists *hists, browser->b.seek = ui_browser__hists_seek; browser->b.use_navkeypressed = true; browser->show_headers = symbol_conf.show_hist_headers; - browser->hbt = hbt; - browser->env = env; - browser->title = perf_evsel_browser_title;hists__for_each_format (hists, fmt) {perf_hpp__reset_width (fmt, hists);
@@ -2070,6 +2065,21 @@ struct hist_browser *hist_browser__new(struct hists *hists,return browser; } +static struct hist_browser * +perf_evsel_browser_new (struct perf_evsel *evsel, +struct hist_browser_timer *hbt, +struct perf_env *env) +{ +struct hist_browser *browser =hist_browser__new (evsel__hists (evsel)); + +if (browser) { + browser->hbt = hbt; + browser->env = env; + browser->title = perf_evsel_browser_title; + } +return browser; +} +void hist_browser__delete (struct hist_browser *browser) {free (browser);
@@ -2652,7 +2662,7 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events, struct perf_env *env) {struct hists *hists =evsel__hists (evsel); -struct hist_browser *browser =hist_browser__new (hists, hbt, env); +struct hist_browser *browser =perf_evsel_browser_new (evsel, hbt, env);struct branch_info *bi;#define MAX_OPTIONS 16char *options[MAX_OPTIONS ];
tools/perf/ui/browsers/hists.h +1 -3
@@ -24,9 +24,7 @@ struct hist_browser { char *bf, size_t size); }; -struct hist_browser *hist_browser__new (struct hists *hists, -struct hist_browser_timer *hbt, -struct perf_env *env); +struct hist_browser *hist_browser__new (struct hists *hists);void hist_browser__delete (struct hist_browser *browser);int hist_browser__run (struct hist_browser *browser,const char *help);#endif /* _PERF_UI_BROWSER_HISTS_H_ */
Signature · 1 line
2.4.11
tip-bot for Jiri Olsa
merge bot[tip:perf/core] perf hists browser: Introduce perf_evsel_browser constructor
perf hists browser: Introduce perf_evsel_browser constructor
Commit-ID: a6ec894dea730bdc5568289898d27311e4031da0 Gitweb: http://git.kernel.org/tip/a6ec894dea730bdc5568289898d27311e4031da0 Author: Jiri Olsa <[email protected]> AuthorDate: Mon, 20 Jun 2016 23:58:17 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Wed, 22 Jun 2016 09:56:35 -0300
perf hists browser: Introduce perf_evsel_browser constructor
So we could use hist_browser__new for generic hist browser in following patches.
--- tools/perf/ui/browsers/hists.c | 24 +++++++++++++++++------- tools/perf/ui/browsers/hists.h | 4 +--- 2 files changed, 18 insertions(+), 10 deletions(-)
tools/perf/ui/browsers/hists.c +17 -7
@@ -2042,9 +2042,7 @@ static int hist_browser__dump(struct hist_browser *browser)return 0 ; } -struct hist_browser *hist_browser__new (struct hists *hists, -struct hist_browser_timer *hbt, -struct perf_env *env) +struct hist_browser *hist_browser__new (struct hists *hists) {struct hist_browser *browser =zalloc (sizeof (*browser));
@@ -2057,9 +2055,6 @@ struct hist_browser *hist_browser__new(struct hists *hists, browser->b.seek = ui_browser__hists_seek; browser->b.use_navkeypressed = true; browser->show_headers = symbol_conf.show_hist_headers; - browser->hbt = hbt; - browser->env = env; - browser->title = perf_evsel_browser_title;hists__for_each_format (hists, fmt) {perf_hpp__reset_width (fmt, hists);
@@ -2070,6 +2065,21 @@ struct hist_browser *hist_browser__new(struct hists *hists,return browser; } +static struct hist_browser * +perf_evsel_browser__new (struct perf_evsel *evsel, +struct hist_browser_timer *hbt, +struct perf_env *env) +{ +struct hist_browser *browser =hist_browser__new (evsel__hists (evsel)); + +if (browser) { + browser->hbt = hbt; + browser->env = env; + browser->title = perf_evsel_browser_title; + } +return browser; +} +void hist_browser__delete (struct hist_browser *browser) {free (browser);
@@ -2652,7 +2662,7 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events, struct perf_env *env) {struct hists *hists =evsel__hists (evsel); -struct hist_browser *browser =hist_browser__new (hists, hbt, env); +struct hist_browser *browser =perf_evsel_browser__new (evsel, hbt, env);struct branch_info *bi;#define MAX_OPTIONS 16char *options[MAX_OPTIONS ];
tools/perf/ui/browsers/hists.h +1 -3
@@ -24,9 +24,7 @@ struct hist_browser { char *bf, size_t size); }; -struct hist_browser *hist_browser__new (struct hists *hists, -struct hist_browser_timer *hbt, -struct perf_env *env); +struct hist_browser *hist_browser__new (struct hists *hists);void hist_browser__delete (struct hist_browser *browser);int hist_browser__run (struct hist_browser *browser,const char *help);#endif /* _PERF_UI_BROWSER_HISTS_H_ */
Jiri Olsa
reviewerPATCH 7/8 perf tools: Introduce hist_browser__init
In reply to Jiri OlsaFactoring out the hist_browser initialization code, so it could be used from other parts in following patches.
--- tools/perf/ui/browsers/hists.c | 35 ++++++++++++++++++++--------------- tools/perf/ui/browsers/hists.h | 2 ++ 2 files changed, 22 insertions(+), 15 deletions(-)
tools/perf/ui/browsers/hists.c +20 -15
@@ -2042,25 +2042,30 @@ static int hist_browser__dump(struct hist_browser *browser)return 0 ; } +void hist_browser__init (struct hist_browser *browser, +struct hists *hists) +{ +struct perf_hpp_fmt *fmt; + + browser->hists = hists; + browser->b.refresh = hist_browser__refresh; + browser->b.refresh_dimensions = hist_browser__refresh_dimensions; + browser->b.seek = ui_browser__hists_seek; + browser->b.use_navkeypressed = true; + browser->show_headers = symbol_conf.show_hist_headers; + +hists__for_each_format (hists, fmt) { +perf_hpp__reset_width (fmt, hists); + ++browser->b.columns; + } +} +struct hist_browser *hist_browser__new (struct hists *hists) {struct hist_browser *browser =zalloc (sizeof (*browser)); -if (browser) { -struct perf_hpp_fmt *fmt; - - browser->hists = hists; - browser->b.refresh = hist_browser__refresh; - browser->b.refresh_dimensions = hist_browser__refresh_dimensions; - browser->b.seek = ui_browser__hists_seek; - browser->b.use_navkeypressed = true; - browser->show_headers = symbol_conf.show_hist_headers; - -hists__for_each_format (hists, fmt) { -perf_hpp__reset_width (fmt, hists); - ++browser->b.columns; - } - } +if (browser) +hist_browser__init (browser, hists);return browser; }
tools/perf/ui/browsers/hists.h +2 -0
@@ -27,4 +27,6 @@ struct hist_browser {struct hist_browser *hist_browser__new (struct hists *hists);void hist_browser__delete (struct hist_browser *browser);int hist_browser__run (struct hist_browser *browser,const char *help); +void hist_browser__init (struct hist_browser *browser, +struct hists *hists);#endif /* _PERF_UI_BROWSER_HISTS_H_ */
Signature · 1 line
2.4.11
tip-bot for Jiri Olsa
merge bot[tip:perf/core] perf hists browser: Introduce init()
perf hists browser: Introduce init()
Commit-ID: fcd864265028b65bf154f35fe5a17591ffd49cb9 Gitweb: http://git.kernel.org/tip/fcd864265028b65bf154f35fe5a17591ffd49cb9 Author: Jiri Olsa <[email protected]> AuthorDate: Mon, 20 Jun 2016 23:58:18 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Wed, 22 Jun 2016 09:56:35 -0300
perf hists browser: Introduce init()
Factoring out the hist_browser initialization code, so it could be used from other parts in following patches.
--- tools/perf/ui/browsers/hists.c | 35 ++++++++++++++++++++--------------- tools/perf/ui/browsers/hists.h | 2 ++ 2 files changed, 22 insertions(+), 15 deletions(-)
tools/perf/ui/browsers/hists.c +20 -15
@@ -2042,25 +2042,30 @@ static int hist_browser__dump(struct hist_browser *browser)return 0 ; } +void hist_browser__init (struct hist_browser *browser, +struct hists *hists) +{ +struct perf_hpp_fmt *fmt; + + browser->hists = hists; + browser->b.refresh = hist_browser__refresh; + browser->b.refresh_dimensions = hist_browser__refresh_dimensions; + browser->b.seek = ui_browser__hists_seek; + browser->b.use_navkeypressed = true; + browser->show_headers = symbol_conf.show_hist_headers; + +hists__for_each_format (hists, fmt) { +perf_hpp__reset_width (fmt, hists); + ++browser->b.columns; + } +} +struct hist_browser *hist_browser__new (struct hists *hists) {struct hist_browser *browser =zalloc (sizeof (*browser)); -if (browser) { -struct perf_hpp_fmt *fmt; - - browser->hists = hists; - browser->b.refresh = hist_browser__refresh; - browser->b.refresh_dimensions = hist_browser__refresh_dimensions; - browser->b.seek = ui_browser__hists_seek; - browser->b.use_navkeypressed = true; - browser->show_headers = symbol_conf.show_hist_headers; - -hists__for_each_format (hists, fmt) { -perf_hpp__reset_width (fmt, hists); - ++browser->b.columns; - } - } +if (browser) +hist_browser__init (browser, hists);return browser; }
tools/perf/ui/browsers/hists.h +2 -0
@@ -27,4 +27,6 @@ struct hist_browser {struct hist_browser *hist_browser__new (struct hists *hists);void hist_browser__delete (struct hist_browser *browser);int hist_browser__run (struct hist_browser *browser,const char *help); +void hist_browser__init (struct hist_browser *browser, +struct hists *hists);#endif /* _PERF_UI_BROWSER_HISTS_H_ */
Jiri Olsa
reviewerPATCH 8/8 perf tools: Enlarge pid sort entry size
In reply to Jiri OlsaThe pid sort entry currently aligns pids with 5 digits, which is not enough for current 4 million pids limit.
This leads to unaligned ':' header-data output when we display 7 digits pid:
# Children Self Symbol Pid:Command
# ........ ........ ...................... .....................
#
0.12% 0.12% [.] 0x0000000000147e0f 2052894:krava
...Adding 2 more digit to properly align the pid limit:
# Children Self Symbol Pid:Command
# ........ ........ ...................... .......................
#
0.12% 0.12% [.] 0x0000000000147e0f 2052894:krava--- tools/perf/util/hist.c | 2 +- tools/perf/util/sort.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-)
tools/perf/util/hist.c +1 -1
@@ -79,7 +79,7 @@ void hists__calc_col_len(struct hists *hists, struct hist_entry *h) len =thread__comm_len (h->thread);if (hists__new_col_len (hists,HISTC_COMM , len)) -hists__set_col_len (hists,HISTC_THREAD , len +6 ); +hists__set_col_len (hists,HISTC_THREAD , len +8 );if (h->ms.map) { len =dso__name_len (h->ms.map->dso);
tools/perf/util/sort.c +3 -3
@@ -79,8 +79,8 @@ static int hist_entry__thread_snprintf(struct hist_entry *he, char *bf, {const char *comm =thread__comm_str (he->thread); - width =max (7U , width) -6 ; -return repsep_snprintf (bf, size,"%5d:%-*.*s" , he->thread->tid, + width =max (7U , width) -8 ; +return repsep_snprintf (bf, size,"%7d:%-*.*s" , he->thread->tid, width, width, comm ?:"" ); }
@@ -95,7 +95,7 @@ static int hist_entry__thread_filter(struct hist_entry *he, int type, const void }struct sort_entry sort_thread = { - .se_header =" Pid:Command" , + .se_header =" Pid:Command" , .se_cmp = sort__thread_cmp, .se_snprintf = hist_entry__thread_snprintf, .se_filter = hist_entry__thread_filter,
Signature · 1 line
2.4.11
tip-bot for Jiri Olsa
merge bot[tip:perf/core] perf hists: Enlarge pid sort entry size
perf hists: Enlarge pid sort entry size
Commit-ID: 89c7cb2cad5e5e3675df3ba1c12fe2f64dc691d6 Gitweb: http://git.kernel.org/tip/89c7cb2cad5e5e3675df3ba1c12fe2f64dc691d6 Author: Jiri Olsa <[email protected]> AuthorDate: Mon, 20 Jun 2016 23:58:19 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Wed, 22 Jun 2016 09:56:35 -0300
perf hists: Enlarge pid sort entry size
The pid sort entry currently aligns pids with 5 digits, which is not enough for current 4 million pids limit.
This leads to unaligned ':' header-data output when we display 7 digits pid:
# Children Self Symbol Pid:Command
# ........ ........ ...................... .....................
#
0.12% 0.12% [.] 0x0000000000147e0f 2052894:krava
...Adding 2 more digit to properly align the pid limit:
# Children Self Symbol Pid:Command
# ........ ........ ...................... .......................
#
0.12% 0.12% [.] 0x0000000000147e0f 2052894:krava--- tools/perf/util/hist.c | 2 +- tools/perf/util/sort.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-)
tools/perf/util/hist.c +1 -1
@@ -79,7 +79,7 @@ void hists__calc_col_len(struct hists *hists, struct hist_entry *h) len =thread__comm_len (h->thread);if (hists__new_col_len (hists,HISTC_COMM , len)) -hists__set_col_len (hists,HISTC_THREAD , len +6 ); +hists__set_col_len (hists,HISTC_THREAD , len +8 );if (h->ms.map) { len =dso__name_len (h->ms.map->dso);
tools/perf/util/sort.c +3 -3
@@ -79,8 +79,8 @@ static int hist_entry__thread_snprintf(struct hist_entry *he, char *bf, {const char *comm =thread__comm_str (he->thread); - width =max (7U , width) -6 ; -return repsep_snprintf (bf, size,"%5d:%-*.*s" , he->thread->tid, + width =max (7U , width) -8 ; +return repsep_snprintf (bf, size,"%7d:%-*.*s" , he->thread->tid, width, width, comm ?:"" ); }
@@ -95,7 +95,7 @@ static int hist_entry__thread_filter(struct hist_entry *he, int type, const void }struct sort_entry sort_thread = { - .se_header =" Pid:Command" , + .se_header =" Pid:Command" , .se_cmp = sort__thread_cmp, .se_snprintf = hist_entry__thread_snprintf, .se_filter = hist_entry__thread_filter,