perf annotate: Make symbol__annotate_fprintf2 local
Jiri Olsa
reviewercover perf annotate: Make symbol__annotate_fprintf2 local
hi,
Stephane asked for key/option switch between local/global percentage in annotation output/browser [1]. Local means % within symbol, global within the whole perf data.
Adding the support to specify this by new --precent-type option added for perf annotate and report.
Also adding 'p' key binding to annotation browser to change between local/global percentages.
Also available in:
git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
perf/fixes
thanks,
jirka
[1] https://marc.info/?l=linux-kernel&m=153195093118669&w=2
---
Jiri Olsa (20):
perf annotate: Make symbol__annotate_fprintf2 local
perf annotate: Make annotation_line__max_percent static
perf annotate: Get rid of annotation__scnprintf_samples_period perf annotate: Rename struct annotation_line::samples* to data* perf annotate: Rename local sample variables to data
perf annotate: Rename hist to sym_hist in annotation__calc_percent perf annotate: Loop group events directly in annotation__calc_percent perf annotate: Switch struct annotation_data::percent to array perf annotate: Add PERCENT_HITS_GLOBAL percent value
perf annotate: Add PERCENT_PERIOD_LOCAL percent value
perf annotate: Add PERCENT_PERIOD_GLOBAL percent value
perf annotate: Add percent_type to struct annotation_options perf annotate: Pass struct annotation_options to symbol__calc_lines perf annotate: Pass struct annotation_options to map_symbol__annotation_dump perf annotate: Pass browser percent_type in annotate_browser__calc_percent perf annotate: Add support to togle percent type
perf annotate: Make local period the default percent type
perf annotate: Display percent type in stdio output
perf annotate: Add --percent-type option
perf report: Add --percent-type option
tools/perf/Documentation/perf-annotate.txt | 9 ++++ tools/perf/Documentation/perf-report.txt | 9 ++++ tools/perf/builtin-annotate.c | 4 ++ tools/perf/builtin-report.c | 3 ++ tools/perf/ui/browsers/annotate.c | 81 +++++++++++++++++++++++++------- tools/perf/util/annotate.c | 302 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------- tools/perf/util/annotate.h | 55 ++++++++++++++++------ tools/perf/util/evsel.h | 7 +++ 8 files changed, 319 insertions(+), 151 deletions(-)
Jiri Olsa
reviewerPATCH 1/20 perf annotate: Make symbol__annotate_fprintf2 local
There's no outside user of it.
--- tools/perf/util/annotate.c | 2 +- tools/perf/util/annotate.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-)
tools/perf/util/annotate.c +1 -1
@@ -2129,7 +2129,7 @@ static void FILE__write_graph(void *fp, int graph)fputs (s, fp); } -int symbol__annotate_fprintf2 (struct symbol *sym,FILE *fp) +static int symbol__annotate_fprintf2 (struct symbol *sym,FILE *fp) {struct annotation *notes =symbol__annotation (sym);struct annotation_write_ops ops = {
tools/perf/util/annotate.h +0 -1
@@ -340,7 +340,6 @@ int symbol__strerror_disassemble(struct symbol *sym, struct map *map,int symbol__annotate_printf (struct symbol *sym,struct map *map,struct perf_evsel *evsel,struct annotation_options *options); -int symbol__annotate_fprintf2 (struct symbol *sym,FILE *fp);void symbol__annotate_zero_histogram (struct symbol *sym,int evidx);void symbol__annotate_decay_histogram (struct symbol *sym,int evidx);void annotated_source__purge (struct annotated_source *as);
Signature · 1 line
2.17.1
Em Sat, Aug 04, 2018 at 03:05:02PM +0200, Jiri Olsa escreveu:
Quoted 1 line
There's no outside user of it.
Thanks, applied.
- Arnaldo
tip-bot for Jiri Olsa
merge bot[tip:perf/urgent] perf annotate: Make symbol__annotate_fprintf2() local
In reply to Jiri Olsaperf annotate: Make symbol__annotate_fprintf2() local
Commit-ID: 7a3e71e0d806070071f53271705b0c511c0359fc Gitweb: https://git.kernel.org/tip/7a3e71e0d806070071f53271705b0c511c0359fc Author: Jiri Olsa <[email protected]> AuthorDate: Sat, 4 Aug 2018 15:05:02 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Wed, 8 Aug 2018 15:55:45 -0300
perf annotate: Make symbol__annotate_fprintf2() local
There's no outside user of it.
--- tools/perf/util/annotate.c | 2 +- tools/perf/util/annotate.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-)
tools/perf/util/annotate.c +1 -1
@@ -2129,7 +2129,7 @@ static void FILE__write_graph(void *fp, int graph)fputs (s, fp); } -int symbol__annotate_fprintf2 (struct symbol *sym,FILE *fp) +static int symbol__annotate_fprintf2 (struct symbol *sym,FILE *fp) {struct annotation *notes =symbol__annotation (sym);struct annotation_write_ops ops = {
tools/perf/util/annotate.h +0 -1
@@ -340,7 +340,6 @@ int symbol__strerror_disassemble(struct symbol *sym, struct map *map,int symbol__annotate_printf (struct symbol *sym,struct map *map,struct perf_evsel *evsel,struct annotation_options *options); -int symbol__annotate_fprintf2 (struct symbol *sym,FILE *fp);void symbol__annotate_zero_histogram (struct symbol *sym,int evidx);void symbol__annotate_decay_histogram (struct symbol *sym,int evidx);void annotated_source__purge (struct annotated_source *as);
Jiri Olsa
reviewerPATCH 2/20 perf annotate: Make annotation_line__max_percent static
In reply to Jiri OlsaThere's no outside user of it.
--- tools/perf/util/annotate.c | 3 ++- tools/perf/util/annotate.h | 1 - 2 files changed, 2 insertions(+), 2 deletions(-)
tools/perf/util/annotate.c +2 -1
@@ -2441,7 +2441,8 @@ bool ui__has_annotation(void) } -double annotation_line__max_percent (struct annotation_line *al,struct annotation *notes) +static double annotation_line__max_percent (struct annotation_line *al, +struct annotation *notes) {double percent_max =0.0 ;int i;
tools/perf/util/annotate.h +0 -1
@@ -169,7 +169,6 @@ struct annotation_write_ops {void (*write_graph)(void *obj,int graph); }; -double annotation_line__max_percent (struct annotation_line *al,struct annotation *notes);void annotation_line__write (struct annotation_line *al,struct annotation *notes,struct annotation_write_ops *ops);
Signature · 1 line
2.17.1
Re: [PATCH 02/20] perf annotate: Make annotation_line__max_percent static
Em Sat, Aug 04, 2018 at 03:05:03PM +0200, Jiri Olsa escreveu:
Quoted 1 line
There's no outside user of it.
Applied
tip-bot for Jiri Olsa
merge bot[tip:perf/urgent] perf annotate: Make annotation_line__max_percent static
In reply to Jiri Olsaperf annotate: Make annotation_line__max_percent static
Commit-ID: 5ecf7d30eb4f9c046f5284f20133d7b69729c315 Gitweb: https://git.kernel.org/tip/5ecf7d30eb4f9c046f5284f20133d7b69729c315 Author: Jiri Olsa <[email protected]> AuthorDate: Sat, 4 Aug 2018 15:05:03 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Wed, 8 Aug 2018 15:55:45 -0300
perf annotate: Make annotation_line__max_percent static
There's no outside user of it.
--- tools/perf/util/annotate.c | 3 ++- tools/perf/util/annotate.h | 1 - 2 files changed, 2 insertions(+), 2 deletions(-)
tools/perf/util/annotate.c +2 -1
@@ -2441,7 +2441,8 @@ bool ui__has_annotation(void) } -double annotation_line__max_percent (struct annotation_line *al,struct annotation *notes) +static double annotation_line__max_percent (struct annotation_line *al, +struct annotation *notes) {double percent_max =0.0 ;int i;
tools/perf/util/annotate.h +0 -1
@@ -169,7 +169,6 @@ struct annotation_write_ops {void (*write_graph)(void *obj,int graph); }; -double annotation_line__max_percent (struct annotation_line *al,struct annotation *notes);void annotation_line__write (struct annotation_line *al,struct annotation *notes,struct annotation_write_ops *ops);
Jiri Olsa
reviewerPATCH 3/20 perf annotate: Get rid of annotation__scnprintf_samples_period
In reply to Jiri OlsaWe have more current function tto get the title for annotation, which is hists__scnprintf_title. They both have same output as far as the annotation's header line goes.
They differ in counting of the nr_samples, hists__scnprintf_title provides more accurate number based on the setup of the symbol_conf.filter_relative variable.
Plus it also displays any uid/thread/dso/socket filters/zooms if there are set any, which annotation__scnprintf_samples_period does not.
--- tools/perf/ui/browsers/annotate.c | 3 +-- tools/perf/util/annotate.c | 44 ++----------------------------- tools/perf/util/annotate.h | 7 ----- 3 files changed, 3 insertions(+), 51 deletions(-)
tools/perf/ui/browsers/annotate.c +1 -2
@@ -624,8 +624,7 @@ static int annotate_browser__run(struct annotate_browser *browser,char title[256 ];int key; -annotation__scnprintf_samples_period (notes, title,sizeof (title), evsel); - +hists__scnprintf_title (hists, title,sizeof (title));if (annotate_browser__show (&browser->b, title, help) <0 )return -1 ;
tools/perf/util/annotate.c +2 -42
62 lines not on this page · raw message
tools/perf/util/annotate.h +0 -7
@@ -177,13 +177,6 @@ int __annotation__scnprintf_samples_period(struct annotation *notes,struct perf_evsel *evsel, bool show_freq); -static inline int annotation__scnprintf_samples_period (struct annotation *notes, -char *bf,size_t size, -struct perf_evsel *evsel) -{ -return __annotation__scnprintf_samples_period (notes, bf, size, evsel, true); -} -int disasm_line__scnprintf (struct disasm_line *dl,char *bf,size_t size,bool raw);size_t disasm__fprintf (struct list_head *head,FILE *fp);void symbol__calc_percent (struct symbol *sym,struct perf_evsel *evsel);
Signature · 1 line
2.17.1
Arnaldo Carvalho de Melo
maintainerRe: [PATCH 03/20] perf annotate: Get rid of annotation__scnprintf_samples_period
Em Sat, Aug 04, 2018 at 03:05:04PM +0200, Jiri Olsa escreveu:
Quoted 11 lines
We have more current function tto get the title for annotation, which is
hists__scnprintf_title. They both have same output as far as the annotation's header line goes.They differ in counting of the
nr_samples,hists__scnprintf_titleprovides more accurate number based on the setup of the symbol_conf.filter_relative variable.Plus it also displays any uid/thread/dso/socket filters/zooms if there are set any, which
annotation__scnprintf_samples_perioddoes not.
Thanks, tested and applied.
- Arnaldo
tip-bot for Jiri Olsa
merge bot[tip:perf/urgent] perf annotate: Get rid of annotation__scnprintf_samples_period()
In reply to Jiri Olsaperf annotate: Get rid of annotation__scnprintf_samples_period()
Commit-ID: 0683d13c1afbf5cca147b6f578d1463be132b11b Gitweb: https://git.kernel.org/tip/0683d13c1afbf5cca147b6f578d1463be132b11b Author: Jiri Olsa <[email protected]> AuthorDate: Sat, 4 Aug 2018 15:05:04 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Wed, 8 Aug 2018 15:55:46 -0300
perf annotate: Get rid of annotation__scnprintf_samples_period()
We have more current function tto get the title for annotation, which is hists__scnprintf_title. They both have same output as far as the annotation's header line goes.
They differ in counting of the nr_samples, hists__scnprintf_title provides more accurate number based on the setup of the symbol_conf.filter_relative variable.
Plus it also displays any uid/thread/dso/socket filters/zooms if there are set any, which annotation__scnprintf_samples_period does not.
--- tools/perf/ui/browsers/annotate.c | 3 +-- tools/perf/util/annotate.c | 44 ++------------------------------------- tools/perf/util/annotate.h | 7 ------- 3 files changed, 3 insertions(+), 51 deletions(-)
tools/perf/ui/browsers/annotate.c +1 -2
@@ -624,8 +624,7 @@ static int annotate_browser__run(struct annotate_browser *browser,char title[256 ];int key; -annotation__scnprintf_samples_period (notes, title,sizeof (title), evsel); - +hists__scnprintf_title (hists, title,sizeof (title));if (annotate_browser__show (&browser->b, title, help) <0 )return -1 ;
tools/perf/util/annotate.c +2 -42
62 lines not on this page · raw message
tools/perf/util/annotate.h +0 -7
@@ -177,13 +177,6 @@ int __annotation__scnprintf_samples_period(struct annotation *notes,struct perf_evsel *evsel, bool show_freq); -static inline int annotation__scnprintf_samples_period (struct annotation *notes, -char *bf,size_t size, -struct perf_evsel *evsel) -{ -return __annotation__scnprintf_samples_period (notes, bf, size, evsel, true); -} -int disasm_line__scnprintf (struct disasm_line *dl,char *bf,size_t size,bool raw);size_t disasm__fprintf (struct list_head *head,FILE *fp);void symbol__calc_percent (struct symbol *sym,struct perf_evsel *evsel);
Jiri Olsa
reviewerPATCH 4/20 perf annotate: Rename struct annotation_line::samples* to data*
In reply to Jiri OlsaThe name 'samples*' is little confusing because we have nested 'struct sym_hist_entry' under annotation_line struct, which holds 'nr_samples' as well.
Also the holding struct name is 'annotation_data' so the 'data' name fits better.
--- tools/perf/ui/browsers/annotate.c | 10 +++--- tools/perf/util/annotate.c | 52 +++++++++++++++---------------- tools/perf/util/annotate.h | 4 +-- 3 files changed, 33 insertions(+), 33 deletions(-)
tools/perf/ui/browsers/annotate.c +5 -5
@@ -227,10 +227,10 @@ static int disasm__cmp(struct annotation_line *a, struct annotation_line *b) {int i; -for (i =0 ; i < a->samples_nr; i++) { -if (a->samples[i].percent == b->samples[i].percent) +for (i =0 ; i < a->data_nr; i++) { +if (a->data[i].percent == b->data[i].percent)continue ; -return a->samples[i].percent < b->samples[i].percent; +return a->data[i].percent < b->data[i].percent; }return 0 ; }
@@ -314,8 +314,8 @@ static void annotate_browser__calc_percent(struct annotate_browser *browser,continue ; } -for (i =0 ; i < pos->al.samples_nr; i++) { -struct annotation_data *sample = &pos->al.samples[i]; +for (i =0 ; i < pos->al.data_nr; i++) { +struct annotation_data *sample = &pos->al.data[i];if (max_percent < sample->percent) max_percent = sample->percent;
tools/perf/util/annotate.c +26 -26
141 lines not on this page · raw message
tools/perf/util/annotate.h +2 -2
@@ -122,8 +122,8 @@ struct annotation_line {char *path;u32 idx;int idx_asm; -int samples_nr; -struct annotation_data samples[0 ]; +int data_nr; +struct annotation_data data[0 ]; };struct disasm_line {
Signature · 1 line
2.17.1
Re: [PATCH 04/20] perf annotate: Rename struct annotation_line::samples* to data*
Em Sat, Aug 04, 2018 at 03:05:05PM +0200, Jiri Olsa escreveu:
Quoted 6 lines
The name 'samples*' is little confusing because we have nested 'struct
sym_hist_entry' underannotation_linestruct, which holds 'nr_samples' as well.Also the holding struct name is '
annotation_data' so the 'data' name fits better.
Applied,
- Arnaldo
tip-bot for Jiri Olsa
merge bot[tip:perf/urgent] perf annotate: Rename struct annotation_line::samples* to data*
In reply to Jiri Olsaperf annotate: Rename struct annotation_line::samples* to data*
Commit-ID: c2f938ba5aa61ba60e9217848e666c783cbcce1c Gitweb: https://git.kernel.org/tip/c2f938ba5aa61ba60e9217848e666c783cbcce1c Author: Jiri Olsa <[email protected]> AuthorDate: Sat, 4 Aug 2018 15:05:05 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Wed, 8 Aug 2018 15:55:46 -0300
perf annotate: Rename struct annotation_line::samples* to data*
The name 'samples*' is little confusing because we have nested 'struct sym_hist_entry' under annotation_line struct, which holds 'nr_samples' as well.
Also the holding struct name is 'annotation_data' so the 'data' name fits better.
--- tools/perf/ui/browsers/annotate.c | 10 ++++---- tools/perf/util/annotate.c | 52 +++++++++++++++++++-------------------- tools/perf/util/annotate.h | 4 +-- 3 files changed, 33 insertions(+), 33 deletions(-)
tools/perf/ui/browsers/annotate.c +5 -5
@@ -227,10 +227,10 @@ static int disasm__cmp(struct annotation_line *a, struct annotation_line *b) {int i; -for (i =0 ; i < a->samples_nr; i++) { -if (a->samples[i].percent == b->samples[i].percent) +for (i =0 ; i < a->data_nr; i++) { +if (a->data[i].percent == b->data[i].percent)continue ; -return a->samples[i].percent < b->samples[i].percent; +return a->data[i].percent < b->data[i].percent; }return 0 ; }
@@ -314,8 +314,8 @@ static void annotate_browser__calc_percent(struct annotate_browser *browser,continue ; } -for (i =0 ; i < pos->al.samples_nr; i++) { -struct annotation_data *sample = &pos->al.samples[i]; +for (i =0 ; i < pos->al.data_nr; i++) { +struct annotation_data *sample = &pos->al.data[i];if (max_percent < sample->percent) max_percent = sample->percent;
tools/perf/util/annotate.c +26 -26
141 lines not on this page · raw message
tools/perf/util/annotate.h +2 -2
@@ -122,8 +122,8 @@ struct annotation_line {char *path;u32 idx;int idx_asm; -int samples_nr; -struct annotation_data samples[0 ]; +int data_nr; +struct annotation_data data[0 ]; };struct disasm_line {
Jiri Olsa
reviewerPATCH 5/20 perf annotate: Rename local sample variables to data
In reply to Jiri OlsaBased on previous rename, changing also the local
variable names to fit properly.
--- tools/perf/util/annotate.c | 40 +++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 20 deletions(-)
tools/perf/util/annotate.c +20 -20
@@ -1310,10 +1310,10 @@ annotation_line__print(struct annotation_line *al, struct symbol *sym, u64 startstruct annotation *notes =symbol__annotation (sym);for (i =0 ; i < al->data_nr; i++) { -struct annotation_data *sample = &al->data[i]; +struct annotation_data *data = &al->data[i]; -if (sample->percent > max_percent) - max_percent = sample->percent; +if (data->percent > max_percent) + max_percent = data->percent; }if (al->data_nr > nr_percent)
@@ -1351,18 +1351,18 @@ annotation_line__print(struct annotation_line *al, struct symbol *sym, u64 start }for (i =0 ; i < nr_percent; i++) { -struct annotation_data *sample = &al->data[i]; +struct annotation_data *data = &al->data[i]; - color =get_percent_color (sample->percent); + color =get_percent_color (data->percent);if (symbol_conf.show_total_period)color_fprintf (stdout, color," %11" PRIu64, - sample->he.period); + data->he.period);else if (symbol_conf.show_nr_samples)color_fprintf (stdout, color," %7" PRIu64, - sample->he.nr_samples); + data->he.nr_samples);else -color_fprintf (stdout, color," %7.2f" , sample->percent); +color_fprintf (stdout, color," %7.2f" , data->percent); }printf (" : " );
@@ -1754,7 +1754,7 @@ static int symbol__disassemble(struct symbol *sym, struct annotate_args *args) }static void calc_percent (struct sym_hist *hist, -struct annotation_data *sample, +struct annotation_data *data,s64 offset,s64 end) {unsigned int hits =0 ;
@@ -1767,9 +1767,9 @@ static void calc_percent(struct sym_hist *hist, }if (hist->nr_samples) { - sample->he.period = period; - sample->he.nr_samples = hits; - sample->percent =100.0 * hits / hist->nr_samples; + data->he.period = period; + data->he.nr_samples = hits; + data->percent =100.0 * hits / hist->nr_samples; } }
@@ -1789,13 +1789,13 @@ static void annotation__calc_percent(struct annotation *notes, end = next ? next->offset : len;for (i =0 ; i < al->data_nr; i++) { -struct annotation_data *sample; +struct annotation_data *data;struct sym_hist *hist; - hist =annotation__histogram (notes, evsel->idx + i); - sample = &al->data[i]; + hist =annotation__histogram (notes, evsel->idx + i); + data = &al->data[i]; -calc_percent (hist, sample, al->offset, end); +calc_percent (hist, data, al->offset, end); } } }
@@ -2356,12 +2356,12 @@ static void annotation__calc_lines(struct annotation *notes, struct map *map,int i;for (i =0 ; i < al->data_nr; i++) { -struct annotation_data *sample; +struct annotation_data *data; - sample = &al->data[i]; + data = &al->data[i]; -if (sample->percent > percent_max) - percent_max = sample->percent; +if (data->percent > percent_max) + percent_max = data->percent; }if (percent_max <=0.5 )
Signature · 1 line
2.17.1
Re: [PATCH 05/20] perf annotate: Rename local sample variables to data
Em Sat, Aug 04, 2018 at 03:05:06PM +0200, Jiri Olsa escreveu:
Quoted 2 lines
Based on previous rename, changing also the local
variable names to fit properly.
Applied.
tip-bot for Jiri Olsa
merge bot[tip:perf/urgent] perf annotate: Rename local sample variables to data
In reply to Jiri Olsaperf annotate: Rename local sample variables to data
Commit-ID: 0440af74dcd0f32b134b1c4d47dc25f0bb539ded Gitweb: https://git.kernel.org/tip/0440af74dcd0f32b134b1c4d47dc25f0bb539ded Author: Jiri Olsa <[email protected]> AuthorDate: Sat, 4 Aug 2018 15:05:06 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Wed, 8 Aug 2018 15:55:47 -0300
perf annotate: Rename local sample variables to data
Based on previous rename, changing also the local variable names to fit properly.
--- tools/perf/util/annotate.c | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-)
tools/perf/util/annotate.c +20 -20
@@ -1310,10 +1310,10 @@ annotation_line__print(struct annotation_line *al, struct symbol *sym, u64 startstruct annotation *notes =symbol__annotation (sym);for (i =0 ; i < al->data_nr; i++) { -struct annotation_data *sample = &al->data[i]; +struct annotation_data *data = &al->data[i]; -if (sample->percent > max_percent) - max_percent = sample->percent; +if (data->percent > max_percent) + max_percent = data->percent; }if (al->data_nr > nr_percent)
@@ -1351,18 +1351,18 @@ annotation_line__print(struct annotation_line *al, struct symbol *sym, u64 start }for (i =0 ; i < nr_percent; i++) { -struct annotation_data *sample = &al->data[i]; +struct annotation_data *data = &al->data[i]; - color =get_percent_color (sample->percent); + color =get_percent_color (data->percent);if (symbol_conf.show_total_period)color_fprintf (stdout, color," %11" PRIu64, - sample->he.period); + data->he.period);else if (symbol_conf.show_nr_samples)color_fprintf (stdout, color," %7" PRIu64, - sample->he.nr_samples); + data->he.nr_samples);else -color_fprintf (stdout, color," %7.2f" , sample->percent); +color_fprintf (stdout, color," %7.2f" , data->percent); }printf (" : " );
@@ -1754,7 +1754,7 @@ out_close_stdout: }static void calc_percent (struct sym_hist *hist, -struct annotation_data *sample, +struct annotation_data *data,s64 offset,s64 end) {unsigned int hits =0 ;
@@ -1767,9 +1767,9 @@ static void calc_percent(struct sym_hist *hist, }if (hist->nr_samples) { - sample->he.period = period; - sample->he.nr_samples = hits; - sample->percent =100.0 * hits / hist->nr_samples; + data->he.period = period; + data->he.nr_samples = hits; + data->percent =100.0 * hits / hist->nr_samples; } }
@@ -1789,13 +1789,13 @@ static void annotation__calc_percent(struct annotation *notes, end = next ? next->offset : len;for (i =0 ; i < al->data_nr; i++) { -struct annotation_data *sample; +struct annotation_data *data;struct sym_hist *hist; - hist =annotation__histogram (notes, evsel->idx + i); - sample = &al->data[i]; + hist =annotation__histogram (notes, evsel->idx + i); + data = &al->data[i]; -calc_percent (hist, sample, al->offset, end); +calc_percent (hist, data, al->offset, end); } } }
@@ -2356,12 +2356,12 @@ static void annotation__calc_lines(struct annotation *notes, struct map *map,int i;for (i =0 ; i < al->data_nr; i++) { -struct annotation_data *sample; +struct annotation_data *data; - sample = &al->data[i]; + data = &al->data[i]; -if (sample->percent > percent_max) - percent_max = sample->percent; +if (data->percent > percent_max) + percent_max = data->percent; }if (percent_max <=0.5 )
Jiri Olsa
reviewerPATCH 6/20 perf annotate: Rename hist to sym_hist in annotation__calc_percent
In reply to Jiri OlsaWe will need to bring in 'struct hists' variable in this scope, so it's better we do this rename first.
--- tools/perf/util/annotate.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
tools/perf/util/annotate.c +8 -8
@@ -1753,7 +1753,7 @@ static int symbol__disassemble(struct symbol *sym, struct annotate_args *args) goto out_free_command; } -static void calc_percent (struct sym_hist *hist, +static void calc_percent (struct sym_hist *sym_hist,struct annotation_data *data,s64 offset,s64 end) {
@@ -1761,15 +1761,15 @@ static void calc_percent(struct sym_hist *hist,u64 period =0 ;while (offset < end) { - hits += hist->addr[offset].nr_samples; - period += hist->addr[offset].period; + hits += sym_hist->addr[offset].nr_samples; + period += sym_hist->addr[offset].period; ++offset; } -if (hist->nr_samples) { +if (sym_hist->nr_samples) { data->he.period = period; data->he.nr_samples = hits; - data->percent =100.0 * hits / hist->nr_samples; + data->percent =100.0 * hits / sym_hist->nr_samples; } }
@@ -1790,12 +1790,12 @@ static void annotation__calc_percent(struct annotation *notes,for (i =0 ; i < al->data_nr; i++) {struct annotation_data *data; -struct sym_hist *hist; +struct sym_hist *sym_hist; - hist =annotation__histogram (notes, evsel->idx + i); + sym_hist =annotation__histogram (notes, evsel->idx + i); data = &al->data[i]; -calc_percent (hist, data, al->offset, end); +calc_percent (sym_hist, data, al->offset, end); } } }
Signature · 1 line
2.17.1
Re: [PATCH 06/20] perf annotate: Rename hist to sym_hist in annotation__calc_percent
Em Sat, Aug 04, 2018 at 03:05:07PM +0200, Jiri Olsa escreveu:
Quoted 2 lines
We will need to bring in 'struct hists' variable in this scope, so it's better we do this rename first.
Applied.
tip-bot for Jiri Olsa
merge bot[tip:perf/urgent] perf annotate: Rename hist to sym_hist in annotation__calc_percent
In reply to Jiri Olsaperf annotate: Rename hist to sym_hist in annotation__calc_percent
Commit-ID: 48a1e4f2381387a097ea9f7897c5c32e9aaa708d Gitweb: https://git.kernel.org/tip/48a1e4f2381387a097ea9f7897c5c32e9aaa708d Author: Jiri Olsa <[email protected]> AuthorDate: Sat, 4 Aug 2018 15:05:07 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Wed, 8 Aug 2018 15:55:47 -0300
perf annotate: Rename hist to sym_hist in annotation__calc_percent
We will need to bring in 'struct hists' variable in this scope, so it's better we do this rename first.
--- tools/perf/util/annotate.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
tools/perf/util/annotate.c +8 -8
@@ -1753,7 +1753,7 @@ out_close_stdout: goto out_free_command; } -static void calc_percent (struct sym_hist *hist, +static void calc_percent (struct sym_hist *sym_hist,struct annotation_data *data,s64 offset,s64 end) {
@@ -1761,15 +1761,15 @@ static void calc_percent(struct sym_hist *hist,u64 period =0 ;while (offset < end) { - hits += hist->addr[offset].nr_samples; - period += hist->addr[offset].period; + hits += sym_hist->addr[offset].nr_samples; + period += sym_hist->addr[offset].period; ++offset; } -if (hist->nr_samples) { +if (sym_hist->nr_samples) { data->he.period = period; data->he.nr_samples = hits; - data->percent =100.0 * hits / hist->nr_samples; + data->percent =100.0 * hits / sym_hist->nr_samples; } }
@@ -1790,12 +1790,12 @@ static void annotation__calc_percent(struct annotation *notes,for (i =0 ; i < al->data_nr; i++) {struct annotation_data *data; -struct sym_hist *hist; +struct sym_hist *sym_hist; - hist =annotation__histogram (notes, evsel->idx + i); + sym_hist =annotation__histogram (notes, evsel->idx + i); data = &al->data[i]; -calc_percent (hist, data, al->offset, end); +calc_percent (sym_hist, data, al->offset, end); } } }
Jiri Olsa
reviewerPATCH 7/20 perf annotate: Loop group events directly in annotation__calc_percent
In reply to Jiri OlsaWe need to bring in 'struct hists' object and for that we need 'struct perf_evsel' object in the scope.
Switching the group data loop with the evsel group loop. It does the same thing, but it brings evsel object, that we can use later get the 'struct hists' object.
--- tools/perf/util/annotate.c | 13 ++++++++----- tools/perf/util/evsel.h | 7 +++++++ 2 files changed, 15 insertions(+), 5 deletions(-)
tools/perf/util/annotate.c +8 -5
@@ -1774,13 +1774,14 @@ static void calc_percent(struct sym_hist *sym_hist, }static void annotation__calc_percent (struct annotation *notes, -struct perf_evsel *evsel,s64 len) +struct perf_evsel *leader,s64 len) {struct annotation_line *al, *next; +struct perf_evsel *evsel;list_for_each_entry (al, ¬es->src->source, node) {s64 end; -int i; +int i =0 ;if (al->offset ==-1 )continue ;
@@ -1788,12 +1789,14 @@ static void annotation__calc_percent(struct annotation *notes, next =annotation_line__next (al, ¬es->src->source); end = next ? next->offset : len; -for (i =0 ; i < al->data_nr; i++) { +for_each_group_evsel (evsel, leader) {struct annotation_data *data;struct sym_hist *sym_hist; - sym_hist =annotation__histogram (notes, evsel->idx + i); - data = &al->data[i]; +BUG_ON (i >= al->data_nr); + + sym_hist =annotation__histogram (notes, evsel->idx); + data = &al->data[i++];calc_percent (sym_hist, data, al->offset, end); }
tools/perf/util/evsel.h +7 -0
@@ -452,11 +452,18 @@ static inline int perf_evsel__group_idx(struct perf_evsel *evsel)return evsel->idx - evsel->leader->idx; } +/* Iterates group WITHOUT the leader. */ #define for_each_group_member (_evsel, _leader) \ for ((_evsel) = list_entry((_leader)->node.next, struct perf_evsel, node); \ (_evsel) && (_evsel)->leader == (_leader); \ (_evsel) = list_entry((_evsel)->node.next, struct perf_evsel, node)) +/* Iterates group WITH the leader. */ +#define for_each_group_evsel (_evsel, _leader) \ +for ((_evsel) = _leader; \ + (_evsel) && (_evsel)->leader == (_leader); \ + (_evsel) = list_entry((_evsel)->node.next, struct perf_evsel, node)) +static inline bool perf_evsel__has_branch_callstack (const struct perf_evsel *evsel) {return evsel->attr.branch_sample_type &PERF_SAMPLE_BRANCH_CALL_STACK ;
Signature · 1 line
2.17.1
Re: [PATCH 07/20] perf annotate: Loop group events directly in annotation__calc_percent
Em Sat, Aug 04, 2018 at 03:05:08PM +0200, Jiri Olsa escreveu:
Quoted 6 lines
We need to bring in 'struct hists' object and for that we need 'struct
perf_evsel' object in the scope.Switching the group data loop with the evsel group loop. It does the same thing, but it brings evsel object, that we can use later get the 'struct hists' object.
Applied.
- Arnaldo
tip-bot for Jiri Olsa
merge bot[tip:perf/urgent] perf annotate: Loop group events directly in annotation__calc_percent()
In reply to Jiri Olsaperf annotate: Loop group events directly in annotation__calc_percent()
Commit-ID: 2bcf73069b0722c92a84c0fd57df542890a74904 Gitweb: https://git.kernel.org/tip/2bcf73069b0722c92a84c0fd57df542890a74904 Author: Jiri Olsa <[email protected]> AuthorDate: Sat, 4 Aug 2018 15:05:08 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Wed, 8 Aug 2018 15:55:47 -0300
perf annotate: Loop group events directly in annotation__calc_percent()
We need to bring in 'struct hists' object and for that we need 'struct perf_evsel' object in the scope.
Switching the group data loop with the evsel group loop. It does the same thing, but it brings evsel object, that we can use later get the 'struct hists' object.
--- tools/perf/util/annotate.c | 13 ++++++++----- tools/perf/util/evsel.h | 7 +++++++ 2 files changed, 15 insertions(+), 5 deletions(-)
tools/perf/util/annotate.c +8 -5
@@ -1774,13 +1774,14 @@ static void calc_percent(struct sym_hist *sym_hist, }static void annotation__calc_percent (struct annotation *notes, -struct perf_evsel *evsel,s64 len) +struct perf_evsel *leader,s64 len) {struct annotation_line *al, *next; +struct perf_evsel *evsel;list_for_each_entry (al, ¬es->src->source, node) {s64 end; -int i; +int i =0 ;if (al->offset ==-1 )continue ;
@@ -1788,12 +1789,14 @@ static void annotation__calc_percent(struct annotation *notes, next =annotation_line__next (al, ¬es->src->source); end = next ? next->offset : len; -for (i =0 ; i < al->data_nr; i++) { +for_each_group_evsel (evsel, leader) {struct annotation_data *data;struct sym_hist *sym_hist; - sym_hist =annotation__histogram (notes, evsel->idx + i); - data = &al->data[i]; +BUG_ON (i >= al->data_nr); + + sym_hist =annotation__histogram (notes, evsel->idx); + data = &al->data[i++];calc_percent (sym_hist, data, al->offset, end); }
tools/perf/util/evsel.h +7 -0
@@ -452,11 +452,18 @@ static inline int perf_evsel__group_idx(struct perf_evsel *evsel)return evsel->idx - evsel->leader->idx; } +/* Iterates group WITHOUT the leader. */ #define for_each_group_member (_evsel, _leader) \ for ((_evsel) = list_entry((_leader)->node.next, struct perf_evsel, node); \ (_evsel) && (_evsel)->leader == (_leader); \ (_evsel) = list_entry((_evsel)->node.next, struct perf_evsel, node)) +/* Iterates group WITH the leader. */ +#define for_each_group_evsel (_evsel, _leader) \ +for ((_evsel) = _leader; \ + (_evsel) && (_evsel)->leader == (_leader); \ + (_evsel) = list_entry((_evsel)->node.next, struct perf_evsel, node)) +static inline bool perf_evsel__has_branch_callstack (const struct perf_evsel *evsel) {return evsel->attr.branch_sample_type &PERF_SAMPLE_BRANCH_CALL_STACK ;
Jiri Olsa
reviewerPATCH 8/20 perf annotate: Switch struct annotation_data::percent to array
In reply to Jiri OlsaSo we can hold multiple percent values for annotation line.
The first member of this array is current local hits percent value (PERCENT_HITS_LOCAL index), so no functional change is expected.
Adding annotation_data__percent function to return requested percent value from struct annotation_data.
--- tools/perf/ui/browsers/annotate.c | 9 +++-- tools/perf/util/annotate.c | 57 ++++++++++++++++++++----------- tools/perf/util/annotate.h | 13 ++++++- 3 files changed, 56 insertions(+), 23 deletions(-)
tools/perf/ui/browsers/annotate.c +6 -3
@@ -315,10 +315,13 @@ static void annotate_browser__calc_percent(struct annotate_browser *browser, }for (i =0 ; i < pos->al.data_nr; i++) { -struct annotation_data *sample = &pos->al.data[i]; +double percent; -if (max_percent < sample->percent) - max_percent = sample->percent; + percent =annotation_data__percent (&pos->al.data[i], +PERCENT_HITS_LOCAL ); + +if (max_percent < percent) + max_percent = percent; }if (max_percent <0.01 && pos->al.ipc ==0 ) {
tools/perf/util/annotate.c +38 -19
121 lines not on this page · raw message
tools/perf/util/annotate.h +12 -1
@@ -101,8 +101,13 @@ struct sym_hist_entry {u64 period; }; +enum { +PERCENT_HITS_LOCAL , +PERCENT_MAX , +}; +struct annotation_data { -double percent; +double percent[PERCENT_MAX ];double percent_sum;struct sym_hist_entry he; };
@@ -134,6 +139,12 @@ struct disasm_line {struct annotation_line al; }; +static inline double annotation_data__percent (struct annotation_data *data, +unsigned int which) +{ +return which <PERCENT_MAX ? data->percent[which] :-1 ; +} +static inline struct disasm_line *disasm_line (struct annotation_line *al) { return al ? container_of(al, struct disasm_line, al) : NULL;
Signature · 1 line
2.17.1
Re: [PATCH 08/20] perf annotate: Switch struct annotation_data::percent to array
Em Sat, Aug 04, 2018 at 03:05:09PM +0200, Jiri Olsa escreveu:
Quoted 8 lines
So we can hold multiple percent values for annotation line.
The first member of this array is current local hits percent value (
PERCENT_HITS_LOCALindex), so no functional change is expected.Adding
annotation_data__percentfunction to return requested percent value from structannotation_data.
thanks, applied.
- Arnaldo
tip-bot for Jiri Olsa
merge bot[tip:perf/urgent] perf annotate: Switch struct annotation_data::percent to array
In reply to Jiri Olsaperf annotate: Switch struct annotation_data::percent to array
Commit-ID: 6d9f0c2d5ef7568c29fa5927748c4915a9c7760a Gitweb: https://git.kernel.org/tip/6d9f0c2d5ef7568c29fa5927748c4915a9c7760a Author: Jiri Olsa <[email protected]> AuthorDate: Sat, 4 Aug 2018 15:05:09 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Wed, 8 Aug 2018 15:55:48 -0300
perf annotate: Switch struct annotation_data::percent to array
So we can hold multiple percent values for annotation line.
The first member of this array is current local hits percent value (PERCENT_HITS_LOCAL index), so no functional change is expected.
Adding annotation_data__percent function to return requested percent value from struct annotation_data.
--- tools/perf/ui/browsers/annotate.c | 9 ++++--- tools/perf/util/annotate.c | 57 ++++++++++++++++++++++++++------------- tools/perf/util/annotate.h | 13 ++++++++- 3 files changed, 56 insertions(+), 23 deletions(-)
tools/perf/ui/browsers/annotate.c +6 -3
@@ -315,10 +315,13 @@ static void annotate_browser__calc_percent(struct annotate_browser *browser, }for (i =0 ; i < pos->al.data_nr; i++) { -struct annotation_data *sample = &pos->al.data[i]; +double percent; -if (max_percent < sample->percent) - max_percent = sample->percent; + percent =annotation_data__percent (&pos->al.data[i], +PERCENT_HITS_LOCAL ); + +if (max_percent < percent) + max_percent = percent; }if (max_percent <0.01 && pos->al.ipc ==0 ) {
tools/perf/util/annotate.c +38 -19
121 lines not on this page · raw message
tools/perf/util/annotate.h +12 -1
@@ -101,8 +101,13 @@ struct sym_hist_entry {u64 period; }; +enum { +PERCENT_HITS_LOCAL , +PERCENT_MAX , +}; +struct annotation_data { -double percent; +double percent[PERCENT_MAX ];double percent_sum;struct sym_hist_entry he; };
@@ -134,6 +139,12 @@ struct disasm_line {struct annotation_line al; }; +static inline double annotation_data__percent (struct annotation_data *data, +unsigned int which) +{ +return which <PERCENT_MAX ? data->percent[which] :-1 ; +} +static inline struct disasm_line *disasm_line (struct annotation_line *al) { return al ? container_of(al, struct disasm_line, al) : NULL;
Jiri Olsa
reviewerPATCH 9/20 perf annotate: Add PERCENT_HITS_GLOBAL percent value
In reply to Jiri OlsaAdding and computing global hits percent value for annotation line. Storing it in struct annotation_data percent array under new PERCENT_HITS_GLOBAL index.
At the moment it's not displayed, it's coming in
following patches.
--- tools/perf/util/annotate.c | 8 +++++++- tools/perf/util/annotate.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-)
tools/perf/util/annotate.c +7 -1
@@ -1759,6 +1759,7 @@ static int symbol__disassemble(struct symbol *sym, struct annotate_args *args) }static void calc_percent (struct sym_hist *sym_hist, +struct hists *hists,struct annotation_data *data,s64 offset,s64 end) {
@@ -1776,6 +1777,10 @@ static void calc_percent(struct sym_hist *sym_hist, data->he.nr_samples = hits; data->percent[PERCENT_HITS_LOCAL ] =100.0 * hits / sym_hist->nr_samples; } + +if (hists->stats.nr_non_filtered_samples) + data->percent[PERCENT_HITS_GLOBAL ] =100.0 * hits / hists->stats.nr_non_filtered_samples; + } static void annotation__calc_percent(struct annotation *notes,
@@ -1795,6 +1800,7 @@ static void annotation__calc_percent(struct annotation *notes, end = next ? next->offset : len;for_each_group_evsel (evsel, leader) { +struct hists *hists =evsel__hists (evsel);struct annotation_data *data;struct sym_hist *sym_hist;
@@ -1803,7 +1809,7 @@ static void annotation__calc_percent(struct annotation *notes, sym_hist =annotation__histogram (notes, evsel->idx); data = &al->data[i++]; -calc_percent (sym_hist, data, al->offset, end); +calc_percent (sym_hist, hists, data, al->offset, end); } } }
tools/perf/util/annotate.h +1 -0
@@ -103,6 +103,7 @@ struct sym_hist_entry {enum {PERCENT_HITS_LOCAL , +PERCENT_HITS_GLOBAL ,PERCENT_MAX , };
Signature · 1 line
2.17.1
Re: [PATCH 09/20] perf annotate: Add PERCENT_HITS_GLOBAL percent value
Em Sat, Aug 04, 2018 at 03:05:10PM +0200, Jiri Olsa escreveu:
Quoted 6 lines
Adding and computing global hits percent value for annotation line. Storing it in struct
annotation_datapercent array under newPERCENT_HITS_GLOBALindex.At the moment it's not displayed, it's coming in
following patches.
Applied.
tip-bot for Jiri Olsa
merge bot[tip:perf/urgent] perf annotate: Add PERCENT_HITS_GLOBAL percent value
In reply to Jiri Olsaperf annotate: Add PERCENT_HITS_GLOBAL percent value
Commit-ID: 75a8c1ff287b2a949b50c1c1e58a6492e21a3ac5 Gitweb: https://git.kernel.org/tip/75a8c1ff287b2a949b50c1c1e58a6492e21a3ac5 Author: Jiri Olsa <[email protected]> AuthorDate: Sat, 4 Aug 2018 15:05:10 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Wed, 8 Aug 2018 15:55:48 -0300
perf annotate: Add PERCENT_HITS_GLOBAL percent value
Adding and computing global hits percent value for annotation line. Storing it in struct annotation_data percent array under new PERCENT_HITS_GLOBAL index.
At the moment it's not displayed, it's coming in following patches.
--- tools/perf/util/annotate.c | 8 +++++++- tools/perf/util/annotate.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-)
tools/perf/util/annotate.c +7 -1
@@ -1759,6 +1759,7 @@ out_close_stdout: }static void calc_percent (struct sym_hist *sym_hist, +struct hists *hists,struct annotation_data *data,s64 offset,s64 end) {
@@ -1776,6 +1777,10 @@ static void calc_percent(struct sym_hist *sym_hist, data->he.nr_samples = hits; data->percent[PERCENT_HITS_LOCAL ] =100.0 * hits / sym_hist->nr_samples; } + +if (hists->stats.nr_non_filtered_samples) + data->percent[PERCENT_HITS_GLOBAL ] =100.0 * hits / hists->stats.nr_non_filtered_samples; + } static void annotation__calc_percent(struct annotation *notes,
@@ -1795,6 +1800,7 @@ static void annotation__calc_percent(struct annotation *notes, end = next ? next->offset : len;for_each_group_evsel (evsel, leader) { +struct hists *hists =evsel__hists (evsel);struct annotation_data *data;struct sym_hist *sym_hist;
@@ -1803,7 +1809,7 @@ static void annotation__calc_percent(struct annotation *notes, sym_hist =annotation__histogram (notes, evsel->idx); data = &al->data[i++]; -calc_percent (sym_hist, data, al->offset, end); +calc_percent (sym_hist, hists, data, al->offset, end); } } }
tools/perf/util/annotate.h +1 -0
@@ -103,6 +103,7 @@ struct sym_hist_entry {enum {PERCENT_HITS_LOCAL , +PERCENT_HITS_GLOBAL ,PERCENT_MAX , };
Jiri Olsa
reviewerPATCH 10/20 perf annotate: Add PERCENT_PERIOD_LOCAL percent value
In reply to Jiri OlsaAdding and computing local period percent value for annotation line. Storing it in struct annotation_data percent array under new PERCENT_PERIOD_LOCAL index.
At the moment it's not displayed, it's coming in
following patches.
--- tools/perf/util/annotate.c | 2 ++ tools/perf/util/annotate.h | 1 + 2 files changed, 3 insertions(+)
tools/perf/util/annotate.c +2 -0
@@ -1781,6 +1781,8 @@ static void calc_percent(struct sym_hist *sym_hist,if (hists->stats.nr_non_filtered_samples) data->percent[PERCENT_HITS_GLOBAL ] =100.0 * hits / hists->stats.nr_non_filtered_samples; +if (sym_hist->period) + data->percent[PERCENT_PERIOD_LOCAL ] =100.0 * period / sym_hist->period; } static void annotation__calc_percent(struct annotation *notes,
tools/perf/util/annotate.h +1 -0
@@ -104,6 +104,7 @@ struct sym_hist_entry {enum {PERCENT_HITS_LOCAL ,PERCENT_HITS_GLOBAL , +PERCENT_PERIOD_LOCAL ,PERCENT_MAX , };
Signature · 1 line
2.17.1
Re: [PATCH 10/20] perf annotate: Add PERCENT_PERIOD_LOCAL percent value
Em Sat, Aug 04, 2018 at 03:05:11PM +0200, Jiri Olsa escreveu:
Quoted 6 lines
Adding and computing local period percent value for annotation line. Storing it in struct
annotation_datapercent array under newPERCENT_PERIOD_LOCALindex.At the moment it's not displayed, it's coming in
following patches.
Applied
tip-bot for Jiri Olsa
merge bot[tip:perf/urgent] perf annotate: Add PERCENT_PERIOD_LOCAL percent value
In reply to Jiri Olsaperf annotate: Add PERCENT_PERIOD_LOCAL percent value
Commit-ID: ab371169fb7db9587f09137e93a49c6afeab16f7 Gitweb: https://git.kernel.org/tip/ab371169fb7db9587f09137e93a49c6afeab16f7 Author: Jiri Olsa <[email protected]> AuthorDate: Sat, 4 Aug 2018 15:05:11 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Wed, 8 Aug 2018 15:55:49 -0300
perf annotate: Add PERCENT_PERIOD_LOCAL percent value
Adding and computing local period percent value for annotation line. Storing it in struct annotation_data percent array under new PERCENT_PERIOD_LOCAL index.
At the moment it's not displayed, it's coming in following patches.
--- tools/perf/util/annotate.c | 2 ++ tools/perf/util/annotate.h | 1 + 2 files changed, 3 insertions(+)
tools/perf/util/annotate.c +2 -0
@@ -1781,6 +1781,8 @@ static void calc_percent(struct sym_hist *sym_hist,if (hists->stats.nr_non_filtered_samples) data->percent[PERCENT_HITS_GLOBAL ] =100.0 * hits / hists->stats.nr_non_filtered_samples; +if (sym_hist->period) + data->percent[PERCENT_PERIOD_LOCAL ] =100.0 * period / sym_hist->period; } static void annotation__calc_percent(struct annotation *notes,
tools/perf/util/annotate.h +1 -0
@@ -104,6 +104,7 @@ struct sym_hist_entry {enum {PERCENT_HITS_LOCAL ,PERCENT_HITS_GLOBAL , +PERCENT_PERIOD_LOCAL ,PERCENT_MAX , };
Jiri Olsa
reviewerPATCH 11/20 perf annotate: Add PERCENT_PERIOD_GLOBAL percent value
In reply to Jiri OlsaAdding and computing global period percent value for annotation line. Storing it in struct annotation_data percent array under new PERCENT_PERIOD_GLOBAL index.
At the moment it's not displayed, it's coming in
following patches.
--- tools/perf/util/annotate.c | 3 +++ tools/perf/util/annotate.h | 1 + 2 files changed, 4 insertions(+)
tools/perf/util/annotate.c +3 -0
@@ -1783,6 +1783,9 @@ static void calc_percent(struct sym_hist *sym_hist,if (sym_hist->period) data->percent[PERCENT_PERIOD_LOCAL ] =100.0 * period / sym_hist->period; + +if (hists->stats.total_period) + data->percent[PERCENT_PERIOD_GLOBAL ] =100.0 * period / hists->stats.total_period; } static void annotation__calc_percent(struct annotation *notes,
tools/perf/util/annotate.h +1 -0
@@ -105,6 +105,7 @@ enum {PERCENT_HITS_LOCAL ,PERCENT_HITS_GLOBAL ,PERCENT_PERIOD_LOCAL , +PERCENT_PERIOD_GLOBAL , PERCENT_MAX, };
Signature · 1 line
2.17.1
Re: [PATCH 11/20] perf annotate: Add PERCENT_PERIOD_GLOBAL percent value
Em Sat, Aug 04, 2018 at 03:05:12PM +0200, Jiri Olsa escreveu:
Quoted 6 lines
Adding and computing global period percent value for annotation line. Storing it in struct
annotation_datapercent array under newPERCENT_PERIOD_GLOBALindex.At the moment it's not displayed, it's coming in
following patches.
applied
tip-bot for Jiri Olsa
merge bot[tip:perf/urgent] perf annotate: Add PERCENT_PERIOD_GLOBAL percent value
In reply to Jiri Olsaperf annotate: Add PERCENT_PERIOD_GLOBAL percent value
Commit-ID: e58684df912906d944967e2ce0f3ed5d5140d1e5 Gitweb: https://git.kernel.org/tip/e58684df912906d944967e2ce0f3ed5d5140d1e5 Author: Jiri Olsa <[email protected]> AuthorDate: Sat, 4 Aug 2018 15:05:12 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Wed, 8 Aug 2018 15:55:49 -0300
perf annotate: Add PERCENT_PERIOD_GLOBAL percent value
Adding and computing global period percent value for annotation line. Storing it in struct annotation_data percent array under new PERCENT_PERIOD_GLOBAL index.
At the moment it's not displayed, it's coming in following patches.
--- tools/perf/util/annotate.c | 3 +++ tools/perf/util/annotate.h | 1 + 2 files changed, 4 insertions(+)
tools/perf/util/annotate.c +3 -0
@@ -1783,6 +1783,9 @@ static void calc_percent(struct sym_hist *sym_hist,if (sym_hist->period) data->percent[PERCENT_PERIOD_LOCAL ] =100.0 * period / sym_hist->period; + +if (hists->stats.total_period) + data->percent[PERCENT_PERIOD_GLOBAL ] =100.0 * period / hists->stats.total_period; } static void annotation__calc_percent(struct annotation *notes,
tools/perf/util/annotate.h +1 -0
@@ -105,6 +105,7 @@ enum {PERCENT_HITS_LOCAL ,PERCENT_HITS_GLOBAL ,PERCENT_PERIOD_LOCAL , +PERCENT_PERIOD_GLOBAL , PERCENT_MAX, };
Jiri Olsa
reviewerPATCH 12/20 perf annotate: Add percent_type to struct annotation_options
In reply to Jiri OlsaIt will be used to carry user selection of percent type for annotation output.
Passing the percent_type to the annotation_line__print function as the first step and making it default to current percentage type (PERCENT_HITS_LOCAL) value.
--- tools/perf/util/annotate.c | 13 ++++++++----- tools/perf/util/annotate.h | 1 + 2 files changed, 9 insertions(+), 5 deletions(-)
tools/perf/util/annotate.c +8 -5
@@ -49,6 +49,7 @@ struct annotation_options annotation__default_options = { .jump_arrows = true, .annotate_src = true, .offset_level = ANNOTATION__OFFSET_JUMP_TARGETS, + .percent_type = PERCENT_HITS_LOCAL, };static regex_t file_lineno;
@@ -1297,7 +1298,8 @@ static int disasm_line__print(struct disasm_line *dl, u64 start, int addr_fmt_wistatic int annotation_line__print (struct annotation_line *al,struct symbol *sym,u64 start,struct perf_evsel *evsel,u64 len,int min_pcnt,int printed, -int max_lines,struct annotation_line *queue,int addr_fmt_width) +int max_lines,struct annotation_line *queue,int addr_fmt_width, +int percent_type) { struct disasm_line *dl = container_of(al, struct disasm_line, al);static const char *prev_line;
@@ -1313,7 +1315,7 @@ annotation_line__print(struct annotation_line *al, struct symbol *sym, u64 startdouble percent; percent =annotation_data__percent (&al->data[i], -PERCENT_HITS_LOCAL ); + percent_type);if (percent > max_percent) max_percent = percent;
@@ -1333,7 +1335,8 @@ annotation_line__print(struct annotation_line *al, struct symbol *sym, u64 startif (queue == al)break ;annotation_line__print (queue, sym, start, evsel, len, -0 ,0 ,1 ,NULL , addr_fmt_width); +0 ,0 ,1 ,NULL , addr_fmt_width, + percent_type); } }
@@ -1357,7 +1360,7 @@ annotation_line__print(struct annotation_line *al, struct symbol *sym, u64 startstruct annotation_data *data = &al->data[i];double percent; - percent =annotation_data__percent (data,PERCENT_HITS_LOCAL ); + percent =annotation_data__percent (data, percent_type); color =get_percent_color (percent);if (symbol_conf.show_total_period)
@@ -2075,7 +2078,7 @@ int symbol__annotate_printf(struct symbol *sym, struct map *map, err =annotation_line__print (pos, sym, start, evsel, len, opts->min_pcnt, printed, opts->max_lines, - queue, addr_fmt_width); + queue, addr_fmt_width, opts->percent_type);switch (err) {case 0 :
tools/perf/util/annotate.h +1 -0
@@ -82,6 +82,7 @@ struct annotation_options {int context;const char *objdump_path;const char *disassembler_style; +unsigned int percent_type; };enum {
Signature · 1 line
2.17.1
Re: [PATCH 12/20] perf annotate: Add percent_type to struct annotation_options
Em Sat, Aug 04, 2018 at 03:05:13PM +0200, Jiri Olsa escreveu:
Quoted 6 lines
It will be used to carry user selection of percent type for annotation output.
Passing the
percent_typeto theannotation_line__printfunction as the first step and making it default to current percentage type (PERCENT_HITS_LOCAL) value.
Applied.
tip-bot for Jiri Olsa
merge bot[tip:perf/urgent] perf annotate: Add percent_type to struct annotation_options
In reply to Jiri Olsaperf annotate: Add percent_type to struct annotation_options
Commit-ID: 796ca33d5ceb621f238021c34cff8cfaa1100623 Gitweb: https://git.kernel.org/tip/796ca33d5ceb621f238021c34cff8cfaa1100623 Author: Jiri Olsa <[email protected]> AuthorDate: Sat, 4 Aug 2018 15:05:13 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Wed, 8 Aug 2018 15:55:50 -0300
perf annotate: Add percent_type to struct annotation_options
It will be used to carry user selection of percent type for annotation output.
Passing the percent_type to the annotation_line__print function as the first step and making it default to current percentage type (PERCENT_HITS_LOCAL) value.
--- tools/perf/util/annotate.c | 13 ++++++++----- tools/perf/util/annotate.h | 1 + 2 files changed, 9 insertions(+), 5 deletions(-)
tools/perf/util/annotate.c +8 -5
@@ -49,6 +49,7 @@ struct annotation_options annotation__default_options = { .jump_arrows = true, .annotate_src = true, .offset_level = ANNOTATION__OFFSET_JUMP_TARGETS, + .percent_type = PERCENT_HITS_LOCAL, };static regex_t file_lineno;
@@ -1297,7 +1298,8 @@ static int disasm_line__print(struct disasm_line *dl, u64 start, int addr_fmt_wistatic int annotation_line__print (struct annotation_line *al,struct symbol *sym,u64 start,struct perf_evsel *evsel,u64 len,int min_pcnt,int printed, -int max_lines,struct annotation_line *queue,int addr_fmt_width) +int max_lines,struct annotation_line *queue,int addr_fmt_width, +int percent_type) { struct disasm_line *dl = container_of(al, struct disasm_line, al);static const char *prev_line;
@@ -1313,7 +1315,7 @@ annotation_line__print(struct annotation_line *al, struct symbol *sym, u64 startdouble percent; percent =annotation_data__percent (&al->data[i], -PERCENT_HITS_LOCAL ); + percent_type);if (percent > max_percent) max_percent = percent;
@@ -1333,7 +1335,8 @@ annotation_line__print(struct annotation_line *al, struct symbol *sym, u64 startif (queue == al)break ;annotation_line__print (queue, sym, start, evsel, len, -0 ,0 ,1 ,NULL , addr_fmt_width); +0 ,0 ,1 ,NULL , addr_fmt_width, + percent_type); } }
@@ -1357,7 +1360,7 @@ annotation_line__print(struct annotation_line *al, struct symbol *sym, u64 startstruct annotation_data *data = &al->data[i];double percent; - percent =annotation_data__percent (data,PERCENT_HITS_LOCAL ); + percent =annotation_data__percent (data, percent_type); color =get_percent_color (percent);if (symbol_conf.show_total_period)
@@ -2075,7 +2078,7 @@ int symbol__annotate_printf(struct symbol *sym, struct map *map, err =annotation_line__print (pos, sym, start, evsel, len, opts->min_pcnt, printed, opts->max_lines, - queue, addr_fmt_width); + queue, addr_fmt_width, opts->percent_type);switch (err) {case 0 :
tools/perf/util/annotate.h +1 -0
@@ -82,6 +82,7 @@ struct annotation_options {int context;const char *objdump_path;const char *disassembler_style; +unsigned int percent_type; };enum {
Jiri Olsa
reviewerPATCH 13/20 perf annotate: Pass struct annotation_options to symbol__calc_lines
In reply to Jiri OlsaPassing struct annotation_options to symbol__calc_lines, to carry on and pass the percent_type value.
--- tools/perf/util/annotate.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-)
tools/perf/util/annotate.c +13 -10
@@ -1868,7 +1868,8 @@ int symbol__annotate(struct symbol *sym, struct map *map,return symbol__disassemble (sym, &args); } -static void insert_source_line (struct rb_root *root,struct annotation_line *al) +static void insert_source_line (struct rb_root *root,struct annotation_line *al, +struct annotation_options *opts) {struct annotation_line *iter;struct rb_node **p = &root->rb_node;
@@ -1883,7 +1884,7 @@ static void insert_source_line(struct rb_root *root, struct annotation_line *al)if (ret ==0 ) {for (i =0 ; i < al->data_nr; i++) { iter->data[i].percent_sum +=annotation_data__percent (&al->data[i], -PERCENT_HITS_LOCAL ); + opts->percent_type); }return ; }
@@ -1896,7 +1897,7 @@ static void insert_source_line(struct rb_root *root, struct annotation_line *al)for (i =0 ; i < al->data_nr; i++) { al->data[i].percent_sum =annotation_data__percent (&al->data[i], -PERCENT_HITS_LOCAL ); + opts->percent_type); }rb_link_node (&al->rb_node, parent, p);
@@ -2372,7 +2373,8 @@ void annotation__update_column_widths(struct annotation *notes) }static void annotation__calc_lines (struct annotation *notes,struct map *map, -struct rb_root *root) +struct rb_root *root, +struct annotation_options *opts) {struct annotation_line *al;struct rb_root tmp_root =RB_ROOT ;
@@ -2385,7 +2387,7 @@ static void annotation__calc_lines(struct annotation *notes, struct map *map,double percent; percent =annotation_data__percent (&al->data[i], -PERCENT_HITS_LOCAL ); + opts->percent_type);if (percent > percent_max) percent_max = percent;
@@ -2396,18 +2398,19 @@ static void annotation__calc_lines(struct annotation *notes, struct map *map, al->path =get_srcline (map->dso, notes->start + al->offset,NULL , false, true, notes->start + al->offset); -insert_source_line (&tmp_root, al); +insert_source_line (&tmp_root, al, opts); }resort_source_line (root, &tmp_root); }static void symbol__calc_lines (struct symbol *sym,struct map *map, -struct rb_root *root) +struct rb_root *root, +struct annotation_options *opts) {struct annotation *notes =symbol__annotation (sym); -annotation__calc_lines (notes, map, root); +annotation__calc_lines (notes, map, root, opts); } int symbol__tty_annotate2(struct symbol *sym, struct map *map,
@@ -2424,7 +2427,7 @@ int symbol__tty_annotate2(struct symbol *sym, struct map *map,if (opts->print_lines) { srcline_full_filename = opts->full_path; -symbol__calc_lines (sym, map, &source_line); +symbol__calc_lines (sym, map, &source_line, opts);print_summary (&source_line, dso->long_name); }
@@ -2451,7 +2454,7 @@ int symbol__tty_annotate(struct symbol *sym, struct map *map,if (opts->print_lines) { srcline_full_filename = opts->full_path; -symbol__calc_lines (sym, map, &source_line); +symbol__calc_lines (sym, map, &source_line, opts);print_summary (&source_line, dso->long_name); }
Signature · 1 line
2.17.1
Re: [PATCH 13/20] perf annotate: Pass struct annotation_options to symbol__calc_lines
Em Sat, Aug 04, 2018 at 03:05:14PM +0200, Jiri Olsa escreveu:
Quoted 2 lines
Passing struct
annotation_optionstosymbol__calc_lines, to carry on and pass thepercent_typevalue.
Applied.
tip-bot for Jiri Olsa
merge bot[tip:perf/urgent] perf annotate: Pass struct annotation_options to symbol__calc_lines()
In reply to Jiri Olsaperf annotate: Pass struct annotation_options to symbol__calc_lines()
Commit-ID: c849c12cf344e4b99dbf98df642b622b6c91bbfd Gitweb: https://git.kernel.org/tip/c849c12cf344e4b99dbf98df642b622b6c91bbfd Author: Jiri Olsa <[email protected]> AuthorDate: Sat, 4 Aug 2018 15:05:14 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Wed, 8 Aug 2018 15:55:50 -0300
perf annotate: Pass struct annotation_options to symbol__calc_lines()
Pass struct annotation_options to symbol__calc_lines(), to carry on and pass the percent_type value.
--- tools/perf/util/annotate.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-)
tools/perf/util/annotate.c +13 -10
@@ -1868,7 +1868,8 @@ int symbol__annotate(struct symbol *sym, struct map *map,return symbol__disassemble (sym, &args); } -static void insert_source_line (struct rb_root *root,struct annotation_line *al) +static void insert_source_line (struct rb_root *root,struct annotation_line *al, +struct annotation_options *opts) {struct annotation_line *iter;struct rb_node **p = &root->rb_node;
@@ -1883,7 +1884,7 @@ static void insert_source_line(struct rb_root *root, struct annotation_line *al)if (ret ==0 ) {for (i =0 ; i < al->data_nr; i++) { iter->data[i].percent_sum +=annotation_data__percent (&al->data[i], -PERCENT_HITS_LOCAL ); + opts->percent_type); }return ; }
@@ -1896,7 +1897,7 @@ static void insert_source_line(struct rb_root *root, struct annotation_line *al)for (i =0 ; i < al->data_nr; i++) { al->data[i].percent_sum =annotation_data__percent (&al->data[i], -PERCENT_HITS_LOCAL ); + opts->percent_type); }rb_link_node (&al->rb_node, parent, p);
@@ -2372,7 +2373,8 @@ void annotation__update_column_widths(struct annotation *notes) }static void annotation__calc_lines (struct annotation *notes,struct map *map, -struct rb_root *root) +struct rb_root *root, +struct annotation_options *opts) {struct annotation_line *al;struct rb_root tmp_root =RB_ROOT ;
@@ -2385,7 +2387,7 @@ static void annotation__calc_lines(struct annotation *notes, struct map *map,double percent; percent =annotation_data__percent (&al->data[i], -PERCENT_HITS_LOCAL ); + opts->percent_type);if (percent > percent_max) percent_max = percent;
@@ -2396,18 +2398,19 @@ static void annotation__calc_lines(struct annotation *notes, struct map *map, al->path =get_srcline (map->dso, notes->start + al->offset,NULL , false, true, notes->start + al->offset); -insert_source_line (&tmp_root, al); +insert_source_line (&tmp_root, al, opts); }resort_source_line (root, &tmp_root); }static void symbol__calc_lines (struct symbol *sym,struct map *map, -struct rb_root *root) +struct rb_root *root, +struct annotation_options *opts) {struct annotation *notes =symbol__annotation (sym); -annotation__calc_lines (notes, map, root); +annotation__calc_lines (notes, map, root, opts); } int symbol__tty_annotate2(struct symbol *sym, struct map *map,
@@ -2424,7 +2427,7 @@ int symbol__tty_annotate2(struct symbol *sym, struct map *map,if (opts->print_lines) { srcline_full_filename = opts->full_path; -symbol__calc_lines (sym, map, &source_line); +symbol__calc_lines (sym, map, &source_line, opts);print_summary (&source_line, dso->long_name); }
@@ -2451,7 +2454,7 @@ int symbol__tty_annotate(struct symbol *sym, struct map *map,if (opts->print_lines) { srcline_full_filename = opts->full_path; -symbol__calc_lines (sym, map, &source_line); +symbol__calc_lines (sym, map, &source_line, opts);print_summary (&source_line, dso->long_name); }
Jiri Olsa
reviewerPATCH 14/20 perf annotate: Pass struct annotation_options to map_symbol__annotation_dump
In reply to Jiri OlsaPassing struct annotation_options to map_symbol__annotation_dump, to carry on and pass the percent_type value.
--- tools/perf/ui/browsers/annotate.c | 4 +-- tools/perf/util/annotate.c | 42 +++++++++++++++++-------------- tools/perf/util/annotate.h | 6 +++-- 3 files changed, 29 insertions(+), 23 deletions(-)
tools/perf/ui/browsers/annotate.c +2 -2
@@ -115,7 +115,7 @@ static void annotate_browser__write(struct ui_browser *browser, void *entry, intif (!browser->navkeypressed) ops.width +=1 ; -annotation_line__write (al, notes, &ops); +annotation_line__write (al, notes, &ops, ab->opts);if (ops.current_entry) ab->selection = al;
@@ -783,7 +783,7 @@ static int annotate_browser__run(struct annotate_browser *browser,continue ; }case 'P' : -map_symbol__annotation_dump (ms, evsel); +map_symbol__annotation_dump (ms, evsel, browser->opts);continue ;case 't' :if (notes->options->show_total_period) {
tools/perf/util/annotate.c +23 -19
111 lines not on this page · raw message
tools/perf/util/annotate.h +4 -2
@@ -185,7 +185,8 @@ struct annotation_write_ops { };void annotation_line__write (struct annotation_line *al,struct annotation *notes, -struct annotation_write_ops *ops); +struct annotation_write_ops *ops, +struct annotation_options *opts); int __annotation__scnprintf_samples_period(struct annotation *notes, char *bf, size_t size,
@@ -351,7 +352,8 @@ void symbol__annotate_zero_histogram(struct symbol *sym, int evidx);void symbol__annotate_decay_histogram (struct symbol *sym,int evidx);void annotated_source__purge (struct annotated_source *as); -int map_symbol__annotation_dump (struct map_symbol *ms,struct perf_evsel *evsel); +int map_symbol__annotation_dump (struct map_symbol *ms,struct perf_evsel *evsel, +struct annotation_options *opts);bool ui__has_annotation (void );
Signature · 1 line
2.17.1
Namhyung Kim
maintainerRe: [PATCH 14/20] perf annotate: Pass struct annotation_options to map_symbol__annotation_dump
Hi Jiri,
Quoted 6 lines · Jiri Olsa
Passing struct
annotation_optionstomap_symbol__annotation_dump, to carry on and pass thepercent_typevalue.Signed-off-by Jiri Olsa <[email protected]>---
[SNIP]
Quoted 37 lines
tools/perf/util/annotate.c +5
-6@@ -2523,7 +2526,7 @@ static void disasm_line__write(struct disasm_line *dl, struct annotation *notes, static void __annotation_line__write(struct annotation_line *al, struct annotation *notes, bool first_line, bool current_entry, bool change_color, int width, - void *obj, + void *obj, unsigned int percent_type, int (*obj__set_color)(void *obj, int color), void (*obj__set_percent_color)(void *obj, double percent, bool current), int (*obj__set_jumps_percent_color)(void *obj, int nr, bool current),@@ -2531,7 +2534,7 @@ static void __annotation_line__write(struct annotation_line *al, struct annotati void (*obj__write_graph)(void *obj, int graph)) { -double percent_max =annotation_line__max_percent (al, notes); +double percent_max =annotation_line__max_percent (al, notes, percent_type);int pcnt_width =annotation__pcnt_width (notes), cycles_width =annotation__cycles_width (notes);bool show_title = false;@@ -2552,8 +2555,7 @@ static void __annotation_line__write(struct annotation_line *al, struct annotatifor (i =0 ; i < notes->nr_events; i++) {double percent; - percent =annotation_data__percent (&al->data[i], -PERCENT_HITS_LOCAL ); + percent =annotation_data__percent (&al->data[i], percent_type);obj__set_percent_color (obj, percent, current_entry);if (notes->options->show_total_period) {@@ -2680,13 +2682,15 @@ static void __annotation_line__write(struct annotation_line *al, struct annotati }void annotation_line__write (struct annotation_line *al,struct annotation *notes, -struct annotation_write_ops *ops) +struct annotation_write_ops *wops, +struct annotation_options *opts) { - __annotation_line__write(al, notes, ops->first_line, ops->current_entry,
tools/perf/util/annotate.c static void __annotation_line__write(struct annotation_line *al, struct annotati · line 2693
Quoted 10 lines
tools/perf/util/annotate.c +6
-4- ops->change_color, ops->width, ops->obj, - ops->set_color, ops->set_percent_color, - ops->set_jumps_percent_color, ops->printf, - ops->write_graph); +__annotation_line__write (al, notes, wops->first_line, wops->current_entry, + wops->change_color, wops->width, wops->obj, + opts->percent_type, + wops->set_color, wops->set_percent_color, + wops->set_jumps_percent_color, wops->printf, + wops->write_graph);
This doesn't look good. Why not just passing a pointer to wops instead of each fields separately?
Thanks,
Namhyung
Quoted 30 lines
tools/perf/util/annotate.c +0
-0} int symbol__annotate2(struct symbol *sym, struct map *map, struct perf_evsel *evsel,tools/perf/util/annotate.h +4
-2@@ -185,7 +185,8 @@ struct annotation_write_ops { };void annotation_line__write (struct annotation_line *al,struct annotation *notes, -struct annotation_write_ops *ops); +struct annotation_write_ops *ops, +struct annotation_options *opts); int __annotation__scnprintf_samples_period(struct annotation *notes, char *bf, size_t size,@@ -351,7 +352,8 @@ void symbol__annotate_zero_histogram(struct symbol *sym, int evidx);void symbol__annotate_decay_histogram (struct symbol *sym,int evidx);void annotated_source__purge (struct annotated_source *as); -int map_symbol__annotation_dump (struct map_symbol *ms,struct perf_evsel *evsel); +int map_symbol__annotation_dump (struct map_symbol *ms,struct perf_evsel *evsel, +struct annotation_options *opts);bool ui__has_annotation (void );Signature · 1 line
2.17.1
Re: [PATCH 14/20] perf annotate: Pass struct annotation_options to map_symbol__annotation_dump
Quoted 53 lines · Namhyung Kim
Hi Jiri,
Quoted 6 lines · Jiri Olsa
Passing struct
annotation_optionstomap_symbol__annotation_dump, to carry on and pass thepercent_typevalue.Signed-off-by Jiri Olsa <[email protected]>---
[SNIP]
Quoted 42 lines
tools/perf/util/annotate.c +6
-10@@ -2523,7 +2526,7 @@ static void disasm_line__write(struct disasm_line *dl, struct annotation *notes, static void __annotation_line__write(struct annotation_line *al, struct annotation *notes, bool first_line, bool current_entry, bool change_color, int width, - void *obj, + void *obj, unsigned int percent_type, int (*obj__set_color)(void *obj, int color), void (*obj__set_percent_color)(void *obj, double percent, bool current), int (*obj__set_jumps_percent_color)(void *obj, int nr, bool current),@@ -2531,7 +2534,7 @@ static void __annotation_line__write(struct annotation_line *al, struct annotati void (*obj__write_graph)(void *obj, int graph)) { -double percent_max =annotation_line__max_percent (al, notes); +double percent_max =annotation_line__max_percent (al, notes, percent_type);int pcnt_width =annotation__pcnt_width (notes), cycles_width =annotation__cycles_width (notes);bool show_title = false;@@ -2552,8 +2555,7 @@ static void __annotation_line__write(struct annotation_line *al, struct annotatifor (i =0 ; i < notes->nr_events; i++) {double percent; - percent =annotation_data__percent (&al->data[i], -PERCENT_HITS_LOCAL ); + percent =annotation_data__percent (&al->data[i], percent_type);obj__set_percent_color (obj, percent, current_entry);if (notes->options->show_total_period) {@@ -2680,13 +2682,15 @@ static void __annotation_line__write(struct annotation_line *al, struct annotati }void annotation_line__write (struct annotation_line *al,struct annotation *notes, -struct annotation_write_ops *ops) +struct annotation_write_ops *wops, +struct annotation_options *opts) { -__annotation_line__write (al, notes, ops->first_line, ops->current_entry, - ops->change_color, ops->width, ops->obj, - ops->set_color, ops->set_percent_color, - ops->set_jumps_percent_color, ops->printf, - ops->write_graph); + __annotation_line__write(al, notes, wops->first_line, wops->current_entry,
Quoted 8 lines
tools/perf/util/annotate.c static void __annotation_line__write(struct annotation_line *al, struct annotati · line 2693
Quoted 5 lines
tools/perf/util/annotate.c +5
-0+ wops->change_color, wops->width, wops->obj, + opts->percent_type, + wops->set_color, wops->set_percent_color, + wops->set_jumps_percent_color, wops->printf, + wops->write_graph);This doesn't look good. Why not just passing a pointer to wops instead of each fields separately?
yep, my thoughts exactly when I saw this ;-) we probably had some other caller.. however I only wanted to add one more param ;-)
I'll check what we can do with this in v2
jirka
Arnaldo Carvalho de Melo
maintainerRe: [PATCH 14/20] perf annotate: Pass struct annotation_options to map_symbol__annotation_dump
Em Mon, Aug 06, 2018 at 04:24:47PM +0200, Jiri Olsa escreveu:
Quoted 63 lines · Namhyung Kim
Quoted 53 lines
Hi Jiri,
Quoted 6 lines · Jiri Olsa
Passing struct
annotation_optionstomap_symbol__annotation_dump, to carry on and pass thepercent_typevalue.Signed-off-by Jiri Olsa <[email protected]>---
[SNIP]
Quoted 42 lines
tools/perf/util/annotate.c +6
-10@@ -2523,7 +2526,7 @@ static void disasm_line__write(struct disasm_line *dl, struct annotation *notes, static void __annotation_line__write(struct annotation_line *al, struct annotation *notes, bool first_line, bool current_entry, bool change_color, int width, - void *obj, + void *obj, unsigned int percent_type, int (*obj__set_color)(void *obj, int color), void (*obj__set_percent_color)(void *obj, double percent, bool current), int (*obj__set_jumps_percent_color)(void *obj, int nr, bool current),@@ -2531,7 +2534,7 @@ static void __annotation_line__write(struct annotation_line *al, struct annotati void (*obj__write_graph)(void *obj, int graph)) { -double percent_max =annotation_line__max_percent (al, notes); +double percent_max =annotation_line__max_percent (al, notes, percent_type);int pcnt_width =annotation__pcnt_width (notes), cycles_width =annotation__cycles_width (notes);bool show_title = false;@@ -2552,8 +2555,7 @@ static void __annotation_line__write(struct annotation_line *al, struct annotatifor (i =0 ; i < notes->nr_events; i++) {double percent; - percent =annotation_data__percent (&al->data[i], -PERCENT_HITS_LOCAL ); + percent =annotation_data__percent (&al->data[i], percent_type);obj__set_percent_color (obj, percent, current_entry);if (notes->options->show_total_period) {@@ -2680,13 +2682,15 @@ static void __annotation_line__write(struct annotation_line *al, struct annotati }void annotation_line__write (struct annotation_line *al,struct annotation *notes, -struct annotation_write_ops *ops) +struct annotation_write_ops *wops, +struct annotation_options *opts) { -__annotation_line__write (al, notes, ops->first_line, ops->current_entry, - ops->change_color, ops->width, ops->obj, - ops->set_color, ops->set_percent_color, - ops->set_jumps_percent_color, ops->printf, - ops->write_graph); + __annotation_line__write(al, notes, wops->first_line, wops->current_entry,Quoted 8 lines
tools/perf/util/annotate.c static void __annotation_line__write(struct annotation_line *al, struct annotati · line 2693
Quoted 5 lines
tools/perf/util/annotate.c +5
-0+ wops->change_color, wops->width, wops->obj, + opts->percent_type, + wops->set_color, wops->set_percent_color, + wops->set_jumps_percent_color, wops->printf, + wops->write_graph);This doesn't look good. Why not just passing a pointer to wops instead of each fields separately?
Quoted 1 line
yep, my thoughts exactly when I saw this ;-) we probably had some
But then, while this is a valid observation, it is not related to this patchkit, that is just adding an extra config variable, percent_type, at some point one can try to shorten that function signature, looking at why it was done this way originally to see if there was any reason or if its just something to improve by shortening the function signature.
Applying Jiri's patch,
Quoted 1 line
other caller.. however I only wanted to add one more param ;-)
Right
Quoted 1 line
I'll check what we can do with this in v2
I'm going thru v2 already, so far its an uncontrovertial, trivial, so I think you better just wait a teeny bit for this to be applied and then get on over with followup patches, ok?
- Arnaldo
Re: [PATCH 14/20] perf annotate: Pass struct annotation_options to map_symbol__annotation_dump
On Mon, Aug 06, 2018 at 12:22:19PM -0300, Arnaldo Carvalho de Melo wrote:
SNIP
Quoted 24 lines
Quoted 12 lines
Quoted 11 lines
tools/perf/util/annotate.c static void __annotation_line__write(struct annotation_line *al, struct annotati · line 2693
Quoted 8 lines
tools/perf/util/annotate.c +6
-2- ops->set_jumps_percent_color, ops->printf, - ops->write_graph); +__annotation_line__write (al, notes, wops->first_line, wops->current_entry, + wops->change_color, wops->width, wops->obj, + opts->percent_type, + wops->set_color, wops->set_percent_color, + wops->set_jumps_percent_color, wops->printf, + wops->write_graph);This doesn't look good. Why not just passing a pointer to wops instead of each fields separately?
Quoted 1 line
yep, my thoughts exactly when I saw this ;-) we probably had some
But then, while this is a valid observation, it is not related to this patchkit, that is just adding an extra config variable,
percent_type, at some point one can try to shorten that function signature, looking at why it was done this way originally to see if there was any reason or if its just something to improve by shortening the function signature.Applying Jiri's patch,
Quoted 1 line
other caller.. however I only wanted to add one more param ;-)
Quoted 7 lines
Right
Quoted 1 line
I'll check what we can do with this in v2
I'm going thru v2 already, so far its an uncontrovertial, trivial, so I think you better just wait a teeny bit for this to be applied and then get on over with followup patches, ok?
sure, np
jirka
tip-bot for Jiri Olsa
merge bot[tip:perf/urgent] perf annotate: Pass 'struct annotation_options' to map_symbol__annotation_dump()
In reply to Jiri Olsaperf annotate: Pass 'struct annotation_options' to map_symbol__annotation_dump()
Commit-ID: 4c650ddc2e9e8f1d8dc46f13b30b1b9a6017fb02 Gitweb: https://git.kernel.org/tip/4c650ddc2e9e8f1d8dc46f13b30b1b9a6017fb02 Author: Jiri Olsa <[email protected]> AuthorDate: Sat, 4 Aug 2018 15:05:15 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Wed, 8 Aug 2018 15:55:51 -0300
perf annotate: Pass 'struct annotation_options' to map_symbol__annotation_dump()
Pass 'struct annotation_options' to map_symbol__annotation_dump(), to carry on and pass the percent_type value.
--- tools/perf/ui/browsers/annotate.c | 4 ++-- tools/perf/util/annotate.c | 42 +++++++++++++++++++++------------------ tools/perf/util/annotate.h | 6 ++++-- 3 files changed, 29 insertions(+), 23 deletions(-)
tools/perf/ui/browsers/annotate.c +2 -2
@@ -115,7 +115,7 @@ static void annotate_browser__write(struct ui_browser *browser, void *entry, intif (!browser->navkeypressed) ops.width +=1 ; -annotation_line__write (al, notes, &ops); +annotation_line__write (al, notes, &ops, ab->opts);if (ops.current_entry) ab->selection = al;
@@ -783,7 +783,7 @@ show_sup_ins:continue ; }case 'P' : -map_symbol__annotation_dump (ms, evsel); +map_symbol__annotation_dump (ms, evsel, browser->opts);continue ;case 't' :if (notes->options->show_total_period) {
tools/perf/util/annotate.c +23 -19
111 lines not on this page · raw message
tools/perf/util/annotate.h +4 -2
@@ -185,7 +185,8 @@ struct annotation_write_ops { };void annotation_line__write (struct annotation_line *al,struct annotation *notes, -struct annotation_write_ops *ops); +struct annotation_write_ops *ops, +struct annotation_options *opts); int __annotation__scnprintf_samples_period(struct annotation *notes, char *bf, size_t size,
@@ -351,7 +352,8 @@ void symbol__annotate_zero_histogram(struct symbol *sym, int evidx);void symbol__annotate_decay_histogram (struct symbol *sym,int evidx);void annotated_source__purge (struct annotated_source *as); -int map_symbol__annotation_dump (struct map_symbol *ms,struct perf_evsel *evsel); +int map_symbol__annotation_dump (struct map_symbol *ms,struct perf_evsel *evsel, +struct annotation_options *opts);bool ui__has_annotation (void );
Jiri Olsa
reviewerPATCH 15/20 perf annotate: Pass browser percent_type in annotate_browser__calc_percent
In reply to Jiri OlsaPassing browser percent_type in annotate_browser__calc_percent.
--- tools/perf/ui/browsers/annotate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/ui/browsers/annotate.c +1 -1
@@ -318,7 +318,7 @@ static void annotate_browser__calc_percent(struct annotate_browser *browser,double percent; percent =annotation_data__percent (&pos->al.data[i], -PERCENT_HITS_LOCAL ); + browser->opts->percent_type);if (max_percent < percent) max_percent = percent;
Signature · 1 line
2.17.1
Re: [PATCH 15/20] perf annotate: Pass browser percent_type in annotate_browser__calc_percent
Em Sat, Aug 04, 2018 at 03:05:16PM +0200, Jiri Olsa escreveu:
Quoted 1 line
Passing browser
percent_typeinannotate_browser__calc_percent.
applied
tip-bot for Jiri Olsa
merge bot[tip:perf/urgent] perf annotate: Pass browser percent_type in annotate_browser__calc_percent()
In reply to Jiri Olsaperf annotate: Pass browser percent_type in annotate_browser__calc_percent()
Commit-ID: d4265b1a1b9b58df9c3bc0a3a7aa5b72c079c77a Gitweb: https://git.kernel.org/tip/d4265b1a1b9b58df9c3bc0a3a7aa5b72c079c77a Author: Jiri Olsa <[email protected]> AuthorDate: Sat, 4 Aug 2018 15:05:16 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Wed, 8 Aug 2018 15:55:51 -0300
perf annotate: Pass browser percent_type in annotate_browser__calc_percent()
Pass browser percent_type in annotate_browser__calc_percent().
--- tools/perf/ui/browsers/annotate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/ui/browsers/annotate.c +1 -1
@@ -318,7 +318,7 @@ static void annotate_browser__calc_percent(struct annotate_browser *browser,double percent; percent =annotation_data__percent (&pos->al.data[i], -PERCENT_HITS_LOCAL ); + browser->opts->percent_type);if (max_percent < percent) max_percent = percent;
Jiri Olsa
reviewerPATCH 16/20 perf annotate: Add support to togle percent type
In reply to Jiri OlsaAdding new key bindings to togle percent type/base in annotation UI browser:
'p' to switch between local and global percent type 'b' to switch between hits and perdio percent base
Adding following help messages to the UI browser '?' window:
...
p Toggle percent type [local/global]
b Toggle percent base [period/hits]
...
--- tools/perf/ui/browsers/annotate.c | 57 ++++++++++++++++++++++++++++--- tools/perf/util/annotate.h | 16 +++++++++ 2 files changed, 68 insertions(+), 5 deletions(-)
tools/perf/ui/browsers/annotate.c +52 -5
@@ -15,6 +15,7 @@#include <linux/kernel.h> #include <linux/string.h> #include <sys/ttydefaults.h> +#include <asm/bug.h> struct disasm_line_samples {double percent;
@@ -382,10 +383,13 @@ static void ui_browser__init_asm_mode(struct ui_browser *browser)#define SYM_TITLE_MAX_SIZE (PATH_MAX + 64) -static int sym_title (struct symbol *sym,struct map *map,char *title, -size_t sz) +static int +sym_title (struct symbol *sym,struct map *map,unsigned int percent_type, +char *title,size_t sz) { -return snprintf (title, sz,"%s %s" , sym->name, map->dso->long_name); +return snprintf (title, sz,"%s %s [Percent: %s]" , + sym->name, map->dso->long_name, +percent_type_str (percent_type)); }/*
@@ -423,7 +427,7 @@ static bool annotate_browser__callq(struct annotate_browser *browser,pthread_mutex_unlock (¬es->lock);symbol__tui_annotate (dl->ops.target.sym, ms->map, evsel, hbt, browser->opts); -sym_title (ms->sym, ms->map, title,sizeof (title)); +sym_title (ms->sym, ms->map, browser->opts->percent_type, title,sizeof (title));ui_browser__show_title (&browser->b, title);return true; }
@@ -598,6 +602,7 @@ bool annotate_browser__continue_search_reverse(struct annotate_browser *browser,static int annotate_browser__show (struct ui_browser *browser,char *title,const char *help) { + struct annotate_browser *ab = container_of(browser, struct annotate_browser, b);struct map_symbol *ms = browser->priv;struct symbol *sym = ms->sym;char symbol_dso[SYM_TITLE_MAX_SIZE ];
@@ -605,7 +610,8 @@ static int annotate_browser__show(struct ui_browser *browser, char *title, constif (ui_browser__show (browser, title, help) <0 )return -1 ; -sym_title (sym, ms->map, symbol_dso,sizeof (symbol_dso)); +sym_title (sym, ms->map, ab->opts->percent_type, + symbol_dso,sizeof (symbol_dso));ui_browser__gotorc_title (browser,0 ,0 );ui_browser__set_color (browser,HE_COLORSET_ROOT );
@@ -613,6 +619,39 @@ static int annotate_browser__show(struct ui_browser *browser, char *title, constreturn 0 ; } +static void +switch_percent_type (struct annotation_options *opts,bool base) +{ +switch (opts->percent_type) { +case PERCENT_HITS_LOCAL : +if (base) + opts->percent_type =PERCENT_PERIOD_LOCAL ; +else + opts->percent_type =PERCENT_HITS_GLOBAL ; +break ; +case PERCENT_HITS_GLOBAL : +if (base) + opts->percent_type =PERCENT_PERIOD_GLOBAL ; +else + opts->percent_type =PERCENT_HITS_LOCAL ; +break ; +case PERCENT_PERIOD_LOCAL : +if (base) + opts->percent_type =PERCENT_HITS_LOCAL ; +else + opts->percent_type =PERCENT_PERIOD_GLOBAL ; +break ; +case PERCENT_PERIOD_GLOBAL : +if (base) + opts->percent_type =PERCENT_HITS_GLOBAL ; +else + opts->percent_type =PERCENT_PERIOD_LOCAL ; +break ; +default : +WARN_ON (1 ); + } +} +static int annotate_browser__run (struct annotate_browser *browser,struct perf_evsel *evsel,struct hist_browser_timer *hbt)
@@ -703,6 +742,8 @@ static int annotate_browser__run(struct annotate_browser *browser,"k Toggle line numbers\n" "P Print to [symbol_name].annotation file.\n" "r Run available scripts\n" +"p Toggle percent type [local/global]\n" +"b Toggle percent base [period/hits]\n" "? Search string backwards\n");continue ;case 'r' :
@@ -802,6 +843,12 @@ static int annotate_browser__run(struct annotate_browser *browser, notes->options->show_minmax_cycle = true;annotation__update_column_widths (notes);continue ; +case 'p' : +case 'b' : +switch_percent_type (browser->opts, key =='b' ); +hists__scnprintf_title (hists, title,sizeof (title)); +annotate_browser__show (&browser->b, title, help); +continue ;case K_LEFT :case K_ESC :case 'q' :
tools/perf/util/annotate.h +16 -0
@@ -11,6 +11,7 @@#include <linux/list.h> #include <linux/rbtree.h> #include <pthread.h> +#include <asm/bug.h> struct ins_ops ;
@@ -149,6 +150,21 @@ static inline double annotation_data__percent(struct annotation_data *data,return which <PERCENT_MAX ? data->percent[which] :-1 ; } +static inline const char *percent_type_str (unsigned int type) +{ +static const char *str[PERCENT_MAX ] = { +"local hits" , +"global hits" , +"local period" , +"global period" , + }; + +if (WARN_ON (type >=PERCENT_MAX )) +return "N/A" ; + +return str[type]; +} +static inline struct disasm_line *disasm_line (struct annotation_line *al) { return al ? container_of(al, struct disasm_line, al) : NULL;
Signature · 1 line
2.17.1
Arnaldo Carvalho de Melo
maintainerRe: [PATCH 16/20] perf annotate: Add support to togle percent type
Em Sat, Aug 04, 2018 at 03:05:17PM +0200, Jiri Olsa escreveu:
Quoted 2 lines
Adding new key bindings to togle percent type/base in annotation UI browser:
Thanks, tested, nice! Applied.
- Arnaldo
tip-bot for Jiri Olsa
merge bot[tip:perf/urgent] perf annotate: Add support to toggle percent type
In reply to Jiri Olsaperf annotate: Add support to toggle percent type
Commit-ID: 3e0d79531984c731951d9a8a5be406df3a78ac97 Gitweb: https://git.kernel.org/tip/3e0d79531984c731951d9a8a5be406df3a78ac97 Author: Jiri Olsa <[email protected]> AuthorDate: Sat, 4 Aug 2018 15:05:17 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Wed, 8 Aug 2018 15:55:52 -0300
perf annotate: Add support to toggle percent type
Add new key bindings to toggle percent type/base in annotation UI browser:
'p' to switch between local and global percent type 'b' to switch between hits and perdio percent base
Add the following help messages to the UI browser '?' window:
...
p Toggle percent type [local/global]
b Toggle percent base [period/hits]
...
--- tools/perf/ui/browsers/annotate.c | 52 ++++++++++++++++++++++++++++++++++++--- tools/perf/util/annotate.h | 16 ++++++++++++ 2 files changed, 64 insertions(+), 4 deletions(-)
tools/perf/ui/browsers/annotate.c +48 -4
@@ -15,6 +15,7 @@#include <linux/kernel.h> #include <linux/string.h> #include <sys/ttydefaults.h> +#include <asm/bug.h> struct disasm_line_samples {double percent;
@@ -383,9 +384,10 @@ static void ui_browser__init_asm_mode(struct ui_browser *browser)#define SYM_TITLE_MAX_SIZE (PATH_MAX + 64)static int sym_title (struct symbol *sym,struct map *map,char *title, -size_t sz) +size_t sz,int percent_type) { -return snprintf (title, sz,"%s %s" , sym->name, map->dso->long_name); +return snprintf (title, sz,"%s %s [Percent: %s]" , sym->name, map->dso->long_name, +percent_type_str (percent_type)); }/*
@@ -423,7 +425,7 @@ static bool annotate_browser__callq(struct annotate_browser *browser,pthread_mutex_unlock (¬es->lock);symbol__tui_annotate (dl->ops.target.sym, ms->map, evsel, hbt, browser->opts); -sym_title (ms->sym, ms->map, title,sizeof (title)); +sym_title (ms->sym, ms->map, title,sizeof (title), browser->opts->percent_type);ui_browser__show_title (&browser->b, title);return true; }
@@ -598,6 +600,7 @@ bool annotate_browser__continue_search_reverse(struct annotate_browser *browser,static int annotate_browser__show (struct ui_browser *browser,char *title,const char *help) { + struct annotate_browser *ab = container_of(browser, struct annotate_browser, b);struct map_symbol *ms = browser->priv;struct symbol *sym = ms->sym;char symbol_dso[SYM_TITLE_MAX_SIZE ];
@@ -605,7 +608,7 @@ static int annotate_browser__show(struct ui_browser *browser, char *title, constif (ui_browser__show (browser, title, help) <0 )return -1 ; -sym_title (sym, ms->map, symbol_dso,sizeof (symbol_dso)); +sym_title (sym, ms->map, symbol_dso,sizeof (symbol_dso), ab->opts->percent_type);ui_browser__gotorc_title (browser,0 ,0 );ui_browser__set_color (browser,HE_COLORSET_ROOT );
@@ -613,6 +616,39 @@ static int annotate_browser__show(struct ui_browser *browser, char *title, constreturn 0 ; } +static void +switch_percent_type (struct annotation_options *opts,bool base) +{ +switch (opts->percent_type) { +case PERCENT_HITS_LOCAL : +if (base) + opts->percent_type =PERCENT_PERIOD_LOCAL ; +else + opts->percent_type =PERCENT_HITS_GLOBAL ; +break ; +case PERCENT_HITS_GLOBAL : +if (base) + opts->percent_type =PERCENT_PERIOD_GLOBAL ; +else + opts->percent_type =PERCENT_HITS_LOCAL ; +break ; +case PERCENT_PERIOD_LOCAL : +if (base) + opts->percent_type =PERCENT_HITS_LOCAL ; +else + opts->percent_type =PERCENT_PERIOD_GLOBAL ; +break ; +case PERCENT_PERIOD_GLOBAL : +if (base) + opts->percent_type =PERCENT_HITS_GLOBAL ; +else + opts->percent_type =PERCENT_PERIOD_LOCAL ; +break ; +default : +WARN_ON (1 ); + } +} +static int annotate_browser__run (struct annotate_browser *browser,struct perf_evsel *evsel,struct hist_browser_timer *hbt)
@@ -703,6 +739,8 @@ static int annotate_browser__run(struct annotate_browser *browser,"k Toggle line numbers\n" "P Print to [symbol_name].annotation file.\n" "r Run available scripts\n" +"p Toggle percent type [local/global]\n" +"b Toggle percent base [period/hits]\n" "? Search string backwards\n");continue ;case 'r' :
@@ -802,6 +840,12 @@ show_sup_ins: notes->options->show_minmax_cycle = true;annotation__update_column_widths (notes);continue ; +case 'p' : +case 'b' : +switch_percent_type (browser->opts, key =='b' ); +hists__scnprintf_title (hists, title,sizeof (title)); +annotate_browser__show (&browser->b, title, help); +continue ;case K_LEFT :case K_ESC :case 'q' :
tools/perf/util/annotate.h +16 -0
@@ -11,6 +11,7 @@#include <linux/list.h> #include <linux/rbtree.h> #include <pthread.h> +#include <asm/bug.h> struct ins_ops ;
@@ -149,6 +150,21 @@ static inline double annotation_data__percent(struct annotation_data *data,return which <PERCENT_MAX ? data->percent[which] :-1 ; } +static inline const char *percent_type_str (unsigned int type) +{ +static const char *str[PERCENT_MAX ] = { +"local hits" , +"global hits" , +"local period" , +"global period" , + }; + +if (WARN_ON (type >=PERCENT_MAX )) +return "N/A" ; + +return str[type]; +} +static inline struct disasm_line *disasm_line (struct annotation_line *al) { return al ? container_of(al, struct disasm_line, al) : NULL;
Jiri Olsa
reviewerPATCH 17/20 perf annotate: Make local period the default percent type
In reply to Jiri OlsaCurrently we display the percentages in annotation output based on number of samples hits. Switching it to period based percentage by default, because it corresponds more to the time spent on the line.
--- tools/perf/util/annotate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/annotate.c +1 -1
@@ -49,7 +49,7 @@ struct annotation_options annotation__default_options = { .jump_arrows = true, .annotate_src = true, .offset_level = ANNOTATION__OFFSET_JUMP_TARGETS, - .percent_type = PERCENT_HITS_LOCAL, + .percent_type = PERCENT_PERIOD_LOCAL, };static regex_t file_lineno;
Signature · 1 line
2.17.1
Arnaldo Carvalho de Melo
maintainerRe: [PATCH 17/20] perf annotate: Make local period the default percent type
Em Sat, Aug 04, 2018 at 03:05:18PM +0200, Jiri Olsa escreveu:
Quoted 4 lines
Currently we display the percentages in annotation output based on number of samples hits. Switching it to period based percentage by default, because it corresponds more to the time spent on the line.
Thanks, tested, applied.
- Arnaldo
tip-bot for Jiri Olsa
merge bot[tip:perf/urgent] perf annotate: Make local period the default percent type
In reply to Jiri Olsaperf annotate: Make local period the default percent type
Commit-ID: addba8b66f9101b0e55a151fc543ff35990bc8ef Gitweb: https://git.kernel.org/tip/addba8b66f9101b0e55a151fc543ff35990bc8ef Author: Jiri Olsa <[email protected]> AuthorDate: Sat, 4 Aug 2018 15:05:18 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Wed, 8 Aug 2018 15:55:52 -0300
perf annotate: Make local period the default percent type
Currently we display the percentages in annotation output based on number of samples hits. Switching it to period based percentage by default, because it corresponds more to the time spent on the line.
--- tools/perf/util/annotate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/annotate.c +1 -1
@@ -49,7 +49,7 @@ struct annotation_options annotation__default_options = { .jump_arrows = true, .annotate_src = true, .offset_level = ANNOTATION__OFFSET_JUMP_TARGETS, - .percent_type = PERCENT_HITS_LOCAL, + .percent_type = PERCENT_PERIOD_LOCAL, };static regex_t file_lineno;
Jiri Olsa
reviewerPATCH 18/20 perf annotate: Display percent type in stdio output
In reply to Jiri OlsaIn following patches we will allow to switch percent type even for stdio annotation outputs. Adding the percent type value into the annotation outputs title.
$ perf annotate --stdio Percent | Sou ... instructions:u } (2805 samples, percent: local period) --------------------------- ... ------------------------------------------------------ ...
$ perf annotate --stdio2 Samples: 2K of events 'anon ... count (approx.): 156525487, [percent: local period] safe_write.c() /usr/bin/yes Percent ...
--- tools/perf/util/annotate.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
tools/perf/util/annotate.c +6 -3
@@ -2056,10 +2056,12 @@ int symbol__annotate_printf(struct symbol *sym, struct map *map, evsel_name = buf; } - graph_dotted_len =printf (" %-*.*s| Source code & Disassembly of %s for %s (%" PRIu64" samples)\n" , + graph_dotted_len =printf (" %-*.*s| Source code & Disassembly of %s for %s (%" PRIu64" samples, " +"percent: %s)\n" , width, width, symbol_conf.show_total_period ?"Period" : symbol_conf.show_nr_samples ?"Samples" :"Percent" , - d_filename, evsel_name, h->nr_samples); + d_filename, evsel_name, h->nr_samples, +percent_type_str (opts->percent_type));printf ("%-*.*s----\n" , graph_dotted_len, graph_dotted_len, graph_dotted_line);
@@ -2434,7 +2436,8 @@ int symbol__tty_annotate2(struct symbol *sym, struct map *map, }hists__scnprintf_title (hists, buf,sizeof (buf)); -fprintf (stdout,"%s\n%s() %s\n" , buf, sym->name, dso->long_name); +fprintf (stdout,"%s, [percent: %s]\n%s() %s\n" , + buf,percent_type_str (opts->percent_type), sym->name, dso->long_name);symbol__annotate_fprintf2 (sym, stdout, opts);annotated_source__purge (symbol__annotation (sym)->src);
Signature · 1 line
2.17.1
Arnaldo Carvalho de Melo
maintainerRe: [PATCH 18/20] perf annotate: Display percent type in stdio output
Em Sat, Aug 04, 2018 at 03:05:19PM +0200, Jiri Olsa escreveu:
Quoted 9 lines
In following patches we will allow to switch percent type even for stdio annotation outputs. Adding the percent type value into the annotation outputs title.
$ perf annotate --stdio Percent | Sou ... instructions:u } (2805 samples, percent: local period) --------------------------- ... ------------------------------------------------------ ...
Quoted 5 lines
$ perf annotate --stdio2 Samples: 2K of events 'anon ... count (approx.): 156525487, [percent: local period] safe_write.c() /usr/bin/yes Percent ...
Thanks, tested, applied.
- Arnaldo
tip-bot for Jiri Olsa
merge bot[tip:perf/urgent] perf annotate: Display percent type in stdio output
In reply to Jiri Olsaperf annotate: Display percent type in stdio output
Commit-ID: 4c04868fbe931ec315ad34bb7e28e5cf725f88e4 Gitweb: https://git.kernel.org/tip/4c04868fbe931ec315ad34bb7e28e5cf725f88e4 Author: Jiri Olsa <[email protected]> AuthorDate: Sat, 4 Aug 2018 15:05:19 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Wed, 8 Aug 2018 15:55:53 -0300
perf annotate: Display percent type in stdio output
In following patches we will allow to switch percent type even for stdio annotation outputs. Adding the percent type value into the annotation outputs title.
$ perf annotate --stdio Percent | Sou ... instructions:u } (2805 samples, percent: local period) --------------------------- ... ------------------------------------------------------ ...
$ perf annotate --stdio2 Samples: 2K of events 'anon ... count (approx.): 156525487, [percent: local period] safe_write.c() /usr/bin/yes Percent ...
--- tools/perf/util/annotate.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
tools/perf/util/annotate.c +6 -3
@@ -2056,10 +2056,12 @@ int symbol__annotate_printf(struct symbol *sym, struct map *map, evsel_name = buf; } - graph_dotted_len =printf (" %-*.*s| Source code & Disassembly of %s for %s (%" PRIu64" samples)\n" , + graph_dotted_len =printf (" %-*.*s| Source code & Disassembly of %s for %s (%" PRIu64" samples, " +"percent: %s)\n" , width, width, symbol_conf.show_total_period ?"Period" : symbol_conf.show_nr_samples ?"Samples" :"Percent" , - d_filename, evsel_name, h->nr_samples); + d_filename, evsel_name, h->nr_samples, +percent_type_str (opts->percent_type));printf ("%-*.*s----\n" , graph_dotted_len, graph_dotted_len, graph_dotted_line);
@@ -2434,7 +2436,8 @@ int symbol__tty_annotate2(struct symbol *sym, struct map *map, }hists__scnprintf_title (hists, buf,sizeof (buf)); -fprintf (stdout,"%s\n%s() %s\n" , buf, sym->name, dso->long_name); +fprintf (stdout,"%s, [percent: %s]\n%s() %s\n" , + buf,percent_type_str (opts->percent_type), sym->name, dso->long_name);symbol__annotate_fprintf2 (sym, stdout, opts);annotated_source__purge (symbol__annotation (sym)->src);
Jiri Olsa
reviewerPATCH 19/20 perf annotate: Add --percent-type option
In reply to Jiri OlsaAdding --percent-type option to set annotation percent type from following choices:
global-period, local-period, global-hits, local-hits
Examples:
$ perf annotate --percent-type period-local --stdio | head -1 Percent | Source code ... es, percent: local period) $ perf annotate --percent-type hits-local --stdio | head -1 Percent | Source code ... es, percent: local hits) $ perf annotate --percent-type hits-global --stdio | head -1 Percent | Source code ... es, percent: global hits) $ perf annotate --percent-type period-global --stdio | head -1 Percent | Source code ... es, percent: global period)
The local/global keywords set if the percentage is computed in the scope of the function (local) or the whole data (global).
The period/hits keywords set the base the percentage is computed on - the samples period or the number of samples (hits).
--- tools/perf/Documentation/perf-annotate.txt | 9 ++++ tools/perf/builtin-annotate.c | 4 ++ tools/perf/util/annotate.c | 53 ++++++++++++++++++++++ tools/perf/util/annotate.h | 3 ++ 4 files changed, 69 insertions(+)
tools/perf/Documentation/perf-annotate.txt +9 -0
@@ -118,6 +118,15 @@ OPTIONS --group:: Show event group information together +--percent-type:: + Set annotation percent type from following choices: + global-period, local-period, global-hits, local-hits + + The local/global keywords set if the percentage is computed + in the scope of the function (local) or the whole data (global). + The period/hits keywords set the base the percentage is computed + on - the samples period or the number of samples (hits). + SEE ALSO -------- linkperf:perf-record[1], linkperf:perf-report[1]
tools/perf/builtin-annotate.c +4 -0
@@ -542,6 +542,10 @@ int cmd_annotate(int argc, const char **argv)OPT_CALLBACK_DEFAULT (0 ,"stdio-color" ,NULL ,"mode" ,"'always' (default), 'never' or 'auto' only applicable to --stdio mode" , stdio__config_color,"always" ), +OPT_CALLBACK (0 ,"percent-type" , &annotate.opts,"local-period" , +"Set percent type local/global-period/hits" , + annotate_parse_percent_type), + OPT_END() };int ret;
tools/perf/util/annotate.c +53 -0
56 lines not on this page · raw message
tools/perf/util/annotate.h +3 -0
@@ -397,4 +397,7 @@ static inline int symbol__tui_annotate(struct symbol *sym __maybe_unused,void annotation_config__init (void ); +int +annotate_parse_percent_type (const struct option *opt,const char *_str, +int unset);#endif /* __PERF_ANNOTATE_H */
Signature · 1 line
2.17.1
Namhyung Kim
maintainerRe: [PATCH 19/20] perf annotate: Add --percent-type option
Quoted 14 lines · Jiri Olsa
Adding --percent-type option to set annotation percent type from following choices:
global-period, local-period, global-hits, local-hitsExamples:
$ perf annotate --percent-type period-local --stdio | head -1 Percent | Source code ... es, percent: local period) $ perf annotate --percent-type hits-local --stdio | head -1 Percent | Source code ... es, percent: local hits) $ perf annotate --percent-type hits-global --stdio | head -1 Percent | Source code ... es, percent: global hits) $ perf annotate --percent-type period-global --stdio | head -1 Percent | Source code ... es, percent: global period)
Quoted 5 lines
The local/global keywords set if the percentage is computed in the scope of the function (local) or the whole data (global).
The period/hits keywords set the base the percentage is computed on - the samples period or the number of samples (hits).
What about adding "period" as an alias to "local-period" (and same for "hits" as well)?
Thanks,
Namhyung
Quoted 121 lines
Signed-off-by Jiri Olsa <[email protected]>--- tools/perf/Documentation/perf-annotate.txt | 9 ++++ tools/perf/builtin-annotate.c | 4 ++ tools/perf/util/annotate.c | 53 ++++++++++++++++++++++ tools/perf/util/annotate.h | 3 ++ 4 files changed, 69 insertions(+)tools/perf/Documentation/perf-annotate.txt +9
-0@@ -118,6 +118,15 @@ OPTIONS --group:: Show event group information together +--percent-type:: + Set annotation percent type from following choices: + global-period, local-period, global-hits, local-hits + + The local/global keywords set if the percentage is computed + in the scope of the function (local) or the whole data (global). + The period/hits keywords set the base the percentage is computed + on - the samples period or the number of samples (hits). + SEE ALSO -------- linkperf:perf-record[1], linkperf:perf-report[1]tools/perf/builtin-annotate.c +4
-0@@ -542,6 +542,10 @@ int cmd_annotate(int argc, const char **argv)OPT_CALLBACK_DEFAULT (0 ,"stdio-color" ,NULL ,"mode" ,"'always' (default), 'never' or 'auto' only applicable to --stdio mode" , stdio__config_color,"always" ), +OPT_CALLBACK (0 ,"percent-type" , &annotate.opts,"local-period" , +"Set percent type local/global-period/hits" , + annotate_parse_percent_type), + OPT_END() };int ret;tools/perf/util/annotate.c +53
-0@@ -2799,3 +2799,56 @@ void annotation_config__init(void) annotation__default_options.show_total_period = symbol_conf.show_total_period; annotation__default_options.show_nr_samples = symbol_conf.show_nr_samples; } + +static unsigned int parse_percent_type (char *str1,char *str2) +{ +unsigned int type = (unsigned int )-1 ; + +if (!strcmp ("period" , str1)) { +if (!strcmp ("local" , str2)) + type =PERCENT_PERIOD_LOCAL ; +else if (!strcmp ("global" , str2)) + type =PERCENT_PERIOD_GLOBAL ; + } + +if (!strcmp ("hits" , str1)) { +if (!strcmp ("local" , str2)) + type =PERCENT_HITS_LOCAL ; +else if (!strcmp ("global" , str2)) + type =PERCENT_HITS_GLOBAL ; + } + +return type; +} + +int +annotate_parse_percent_type (const struct option *opt,const char *_str, +int unset__maybe_unused ) +{ +struct annotation_options *opts = opt->value; +unsigned int type; +char *str1, *str2; +int err =-1 ; + + str1 =strdup (_str); +if (!str1) +return -ENOMEM ; + + str2 =strchr (str1,'-' ); +if (!str2) + goto out; + + *str2++ =0 ; + + type =parse_percent_type (str1, str2); +if (type == (unsigned int )-1 ) + type =parse_percent_type (str2, str1); +if (type != (unsigned int )-1 ) { + opts->percent_type = type; + err =0 ; + } + +out: +free (str1); +return err; +}tools/perf/util/annotate.h +3
-0@@ -397,4 +397,7 @@ static inline int symbol__tui_annotate(struct symbol *sym __maybe_unused,void annotation_config__init (void ); +int +annotate_parse_percent_type (const struct option *opt,const char *_str, +int unset);#endif /* __PERF_ANNOTATE_H */ Signature · 1 line
2.17.1
Re: [PATCH 19/20] perf annotate: Add --percent-type option
Quoted 15 lines · Namhyung Kim
Quoted 14 lines · Jiri Olsa
Adding --percent-type option to set annotation percent type from following choices:
global-period, local-period, global-hits, local-hitsExamples:
$ perf annotate --percent-type period-local --stdio | head -1 Percent | Source code ... es, percent: local period) $ perf annotate --percent-type hits-local --stdio | head -1 Percent | Source code ... es, percent: local hits) $ perf annotate --percent-type hits-global --stdio | head -1 Percent | Source code ... es, percent: global hits) $ perf annotate --percent-type period-global --stdio | head -1 Percent | Source code ... es, percent: global period)
Quoted 8 lines
Quoted 5 lines
The local/global keywords set if the percentage is computed in the scope of the function (local) or the whole data (global).
The period/hits keywords set the base the percentage is computed on - the samples period or the number of samples (hits).
What about adding "period" as an alias to "local-period" (and same for "hits" as well)?
I dont mind that.. will add to v2 if there are no objections
thanks,
jirka
Arnaldo Carvalho de Melo
maintainerRe: [PATCH 19/20] perf annotate: Add --percent-type option
Em Mon, Aug 06, 2018 at 04:26:25PM +0200, Jiri Olsa escreveu:
Quoted 5 lines · Namhyung Kim
Quoted 3 lines · Jiri Olsa
Quoted 2 lines
The local/global keywords set if the percentage is computed in the scope of the function (local) or the whole data (global).
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
The period/hits keywords set the base the percentage is computed on - the samples period or the number of samples (hits).
What about adding "period" as an alias to "local-period" (and same for "hits" as well)?
I dont mind that.. will add to v2 if there are no objections
Please add this on top of this, I'm finishing processing this now.
- Arnaldo
Arnaldo Carvalho de Melo
maintainerRe: [PATCH 19/20] perf annotate: Add --percent-type option
In reply to Jiri OlsaEm Sat, Aug 04, 2018 at 03:05:20PM +0200, Jiri Olsa escreveu:
Quoted 14 lines
Adding --percent-type option to set annotation percent type from following choices:
global-period, local-period, global-hits, local-hitsExamples:
$ perf annotate --percent-type period-local --stdio | head -1 Percent | Source code ... es, percent: local period) $ perf annotate --percent-type hits-local --stdio | head -1 Percent | Source code ... es, percent: local hits) $ perf annotate --percent-type hits-global --stdio | head -1 Percent | Source code ... es, percent: global hits) $ perf annotate --percent-type period-global --stdio | head -1 Percent | Source code ... es, percent: global period)
Quoted 5 lines
The local/global keywords set if the percentage is computed in the scope of the function (local) or the whole data (global).
The period/hits keywords set the base the percentage is computed on - the samples period or the number of samples (hits).
Thanks, tested, applied.
- Arnaldo
tip-bot for Jiri Olsa
merge bot[tip:perf/urgent] perf annotate: Add --percent-type option
In reply to Jiri Olsaperf annotate: Add --percent-type option
Commit-ID: 88c211907720f9eb23308401305aefa25392417f Gitweb: https://git.kernel.org/tip/88c211907720f9eb23308401305aefa25392417f Author: Jiri Olsa <[email protected]> AuthorDate: Sat, 4 Aug 2018 15:05:20 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Wed, 8 Aug 2018 15:55:53 -0300
perf annotate: Add --percent-type option
Add --percent-type option to set annotation percent type from following choices:
global-period, local-period, global-hits, local-hits
Examples:
$ perf annotate --percent-type period-local --stdio | head -1 Percent | Source code ... es, percent: local period) $ perf annotate --percent-type hits-local --stdio | head -1 Percent | Source code ... es, percent: local hits) $ perf annotate --percent-type hits-global --stdio | head -1 Percent | Source code ... es, percent: global hits) $ perf annotate --percent-type period-global --stdio | head -1 Percent | Source code ... es, percent: global period)
The local/global keywords set if the percentage is computed in the scope of the function (local) or the whole data (global).
The period/hits keywords set the base the percentage is computed on - the samples period or the number of samples (hits).
--- tools/perf/Documentation/perf-annotate.txt | 9 ++++++ tools/perf/builtin-annotate.c | 4 +++ tools/perf/util/annotate.c | 52 ++++++++++++++++++++++++++++++ tools/perf/util/annotate.h | 2 ++ 4 files changed, 67 insertions(+)
tools/perf/Documentation/perf-annotate.txt +9 -0
@@ -118,6 +118,15 @@ OPTIONS --group:: Show event group information together +--percent-type:: + Set annotation percent type from following choices: + global-period, local-period, global-hits, local-hits + + The local/global keywords set if the percentage is computed + in the scope of the function (local) or the whole data (global). + The period/hits keywords set the base the percentage is computed + on - the samples period or the number of samples (hits). + SEE ALSO -------- linkperf:perf-record[1], linkperf:perf-report[1]
tools/perf/builtin-annotate.c +4 -0
@@ -542,6 +542,10 @@ int cmd_annotate(int argc, const char **argv)OPT_CALLBACK_DEFAULT (0 ,"stdio-color" ,NULL ,"mode" ,"'always' (default), 'never' or 'auto' only applicable to --stdio mode" , stdio__config_color,"always" ), +OPT_CALLBACK (0 ,"percent-type" , &annotate.opts,"local-period" , +"Set percent type local/global-period/hits" , + annotate_parse_percent_type), + OPT_END() };int ret;
tools/perf/util/annotate.c +52 -0
55 lines not on this page · raw message
tools/perf/util/annotate.h +2 -0
@@ -397,4 +397,6 @@ static inline int symbol__tui_annotate(struct symbol *sym __maybe_unused,void annotation_config__init (void ); +int annotate_parse_percent_type (const struct option *opt,const char *_str, +int unset);#endif /* __PERF_ANNOTATE_H */
Jiri Olsa
reviewerPATCH 20/20 perf report: Add --percent-type option
In reply to Jiri OlsaSet annotation percent type from following choices:
global-period, local-period, global-hits, local-hits
With following report option setup the percent type will be passed to annotation browser:
$ perf report --percent-type period-local
The local/global keywords set if the percentage is computed in the scope of the function (local) or the whole data (global). The period/hits keywords set the base the percentage is computed on - the samples period or the number of samples (hits).
--- tools/perf/Documentation/perf-report.txt | 9 +++++++++ tools/perf/builtin-report.c | 3 +++ 2 files changed, 12 insertions(+)
tools/perf/Documentation/perf-report.txt +9 -0
@@ -477,6 +477,15 @@ include::itrace.txt[] Display monitored tasks stored in perf data. Displaying pid/tid/ppid plus the command string aligned to distinguish parent and child tasks. +--percent-type:: + Set annotation percent type from following choices: + global-period, local-period, global-hits, local-hits + + The local/global keywords set if the percentage is computed + in the scope of the function (local) or the whole data (global). + The period/hits keywords set the base the percentage is computed + on - the samples period or the number of samples (hits). + include::callchain-overhead-calculation.txt[] SEE ALSO
tools/perf/builtin-report.c +3 -0
@@ -1124,6 +1124,9 @@ int cmd_report(int argc, const char **argv) "Time span of interest (start,stop)"),OPT_BOOLEAN (0 ,"inline" , &symbol_conf.inline_name,"Show inline function" ), +OPT_CALLBACK (0 ,"percent-type" , &report.annotation_opts,"local-period" , +"Set percent type local/global-period/hits" , + annotate_parse_percent_type),OPT_END () }; struct perf_data data = {
Signature · 1 line
2.17.1
Arnaldo Carvalho de Melo
maintainerRe: [PATCH 20/20] perf report: Add --percent-type option
Em Sat, Aug 04, 2018 at 03:05:21PM +0200, Jiri Olsa escreveu:
Quoted 6 lines
Set annotation percent type from following choices:
global-period, local-period, global-hits, local-hitsWith following report option setup the percent type will be passed to annotation browser:
Quoted 6 lines
$ perf report --percent-type period-localThe local/global keywords set if the percentage is computed in the scope of the function (local) or the whole data (global). The period/hits keywords set the base the percentage is computed on - the samples period or the number of samples (hits).
Tested, applied,
- Arnaldo
tip-bot for Jiri Olsa
merge bot[tip:perf/urgent] perf report: Add --percent-type option
In reply to Jiri Olsaperf report: Add --percent-type option
Commit-ID: e6902d1b7326149952abf8e7f07513e254668e52 Gitweb: https://git.kernel.org/tip/e6902d1b7326149952abf8e7f07513e254668e52 Author: Jiri Olsa <[email protected]> AuthorDate: Sat, 4 Aug 2018 15:05:21 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Wed, 8 Aug 2018 15:55:54 -0300
perf report: Add --percent-type option
Set annotation percent type from following choices:
global-period, local-period, global-hits, local-hits
With following report option setup the percent type will be passed to annotation browser:
$ perf report --percent-type period-local
The local/global keywords set if the percentage is computed in the scope of the function (local) or the whole data (global). The period/hits keywords set the base the percentage is computed on - the samples period or the number of samples (hits).
--- tools/perf/Documentation/perf-report.txt | 9 +++++++++ tools/perf/builtin-report.c | 3 +++ 2 files changed, 12 insertions(+)
tools/perf/Documentation/perf-report.txt +9 -0
@@ -477,6 +477,15 @@ include::itrace.txt[] Display monitored tasks stored in perf data. Displaying pid/tid/ppid plus the command string aligned to distinguish parent and child tasks. +--percent-type:: + Set annotation percent type from following choices: + global-period, local-period, global-hits, local-hits + + The local/global keywords set if the percentage is computed + in the scope of the function (local) or the whole data (global). + The period/hits keywords set the base the percentage is computed + on - the samples period or the number of samples (hits). + include::callchain-overhead-calculation.txt[] SEE ALSO
tools/perf/builtin-report.c +3 -0
@@ -1124,6 +1124,9 @@ int cmd_report(int argc, const char **argv) "Time span of interest (start,stop)"),OPT_BOOLEAN (0 ,"inline" , &symbol_conf.inline_name,"Show inline function" ), +OPT_CALLBACK (0 ,"percent-type" , &report.annotation_opts,"local-period" , +"Set percent type local/global-period/hits" , + annotate_parse_percent_type),OPT_END () }; struct perf_data data = {