perf stat: Clear sample_(type|period) for counting
Jiri Olsa
reviewerPATCH 1/2 perf stat: Clear sample_(type|period) for counting
Clear sample_(type|period) for counting, as it only confuses debug output with unwanted sampling details:
Before:
$ sudo perf stat -e 'raw_syscalls:sys_enter' -vv ls
------------------------------------------------------------
perf_event_attr:
type 2
size 112
config 0x11
{ sample_period, sample_freq } 1
sample_type TIME|CPU|PERIOD|RAW
read_format TOTAL_TIME_ENABLED|TOTAL_TIME_RUNNING
disabled 1
inherit 1
enable_on_exec 1
exclude_guest 1
...After:
$ sudo perf stat -e 'raw_syscalls:sys_enter' -vv ls
------------------------------------------------------------
perf_event_attr:
type 2
size 112
config 0x11
read_format TOTAL_TIME_ENABLED|TOTAL_TIME_RUNNING
disabled 1
inherit 1
enable_on_exec 1
exclude_guest 1
...--- tools/perf/builtin-stat.c | 7 +++++++ 1 file changed, 7 insertions(+)
tools/perf/builtin-stat.c +7 -0
@@ -161,6 +161,13 @@ static int create_perf_stat_counter(struct perf_evsel *evsel) attr->inherit = !no_inherit; +/* +* Some events get initialized with sample_(period/type) set, +* like tracepoints. Clear it up for counting. +*/ + attr->sample_period =0 ; + attr->sample_type =0 ; +if (target__has_cpu (&target))return perf_evsel__open_per_cpu (evsel,perf_evsel__cpus (evsel));
Signature · 1 line
2.4.3
Jiri Olsa
reviewerPATCH 2/2 perf evlist: Display WEIGHT sample type bit
Adding WIEGHT bit_name call to display sample_type properly.
$ perf evlist -v cpu/mem-loads/pp: ...SNIP... sample_type: IP|TID|TIME|ADDR|ID|CPU|DATA_SRC|WEIGHT ...
--- tools/perf/util/evsel.c | 1 + 1 file changed, 1 insertion(+)
tools/perf/util/evsel.c +1 -0
@@ -1192,6 +1192,7 @@ static void __p_sample_type(char *buf, size_t size, u64 value)bit_name (PERIOD ),bit_name (STREAM_ID ),bit_name (RAW ),bit_name (BRANCH_STACK ),bit_name (REGS_USER ),bit_name (STACK_USER ),bit_name (IDENTIFIER ),bit_name (REGS_INTR ),bit_name (DATA_SRC ), +bit_name (WEIGHT ), { .name = NULL, } };#undef bit_name
Signature · 1 line
2.4.3
Re: [PATCH 2/2] perf evlist: Display WEIGHT sample type bit
Em Wed, Nov 25, 2015 at 04:36:55PM +0100, Jiri Olsa escreveu:
Quoted 1 line
Adding WIEGHT
bit_namecall to displaysample_typeproperly.
Thanks, applied both.
tip-bot for Jiri Olsa
merge bot[tip:perf/core] perf evlist: Display WEIGHT sample type bit
In reply to Jiri Olsaperf evlist: Display WEIGHT sample type bit
Commit-ID: dcdd184b60c3943fb678dcbaf899a26f845901ad Gitweb: http://git.kernel.org/tip/dcdd184b60c3943fb678dcbaf899a26f845901ad Author: Jiri Olsa <[email protected]> AuthorDate: Wed, 25 Nov 2015 16:36:55 +0100 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Thu, 26 Nov 2015 16:54:00 -0300
perf evlist: Display WEIGHT sample type bit
Adding WIEGHT bit_name call to display sample_type properly.
$ perf evlist -v cpu/mem-loads/pp: ...SNIP... sample_type: IP|TID|TIME|ADDR|ID|CPU|DATA_SRC|WEIGHT ...
--- tools/perf/util/evsel.c | 1 + 1 file changed, 1 insertion(+)
tools/perf/util/evsel.c +1 -0
@@ -1192,6 +1192,7 @@ static void __p_sample_type(char *buf, size_t size, u64 value)bit_name (PERIOD ),bit_name (STREAM_ID ),bit_name (RAW ),bit_name (BRANCH_STACK ),bit_name (REGS_USER ),bit_name (STACK_USER ),bit_name (IDENTIFIER ),bit_name (REGS_INTR ),bit_name (DATA_SRC ), +bit_name (WEIGHT ), { .name = NULL, } };#undef bit_name
tip-bot for Jiri Olsa
merge botperf stat: Clear sample_(type|period) for counting
Commit-ID: 6acd8e9271cdeaec458fd4eec4a6765d16e0e61c Gitweb: http://git.kernel.org/tip/6acd8e9271cdeaec458fd4eec4a6765d16e0e61c Author: Jiri Olsa <[email protected]> AuthorDate: Wed, 25 Nov 2015 16:36:54 +0100 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Thu, 26 Nov 2015 16:52:28 -0300
perf stat: Clear sample_(type|period) for counting
Clear sample_(type|period) for counting, as it only confuses debug output with unwanted sampling details:
Before:
$ sudo perf stat -e 'raw_syscalls:sys_enter' -vv ls
------------------------------------------------------------
perf_event_attr:
type 2
size 112
config 0x11
{ sample_period, sample_freq } 1
sample_type TIME|CPU|PERIOD|RAW
read_format TOTAL_TIME_ENABLED|TOTAL_TIME_RUNNING
disabled 1
inherit 1
enable_on_exec 1
exclude_guest 1
...After:
$ sudo perf stat -e 'raw_syscalls:sys_enter' -vv ls
------------------------------------------------------------
perf_event_attr:
type 2
size 112
config 0x11
read_format TOTAL_TIME_ENABLED|TOTAL_TIME_RUNNING
disabled 1
inherit 1
enable_on_exec 1
exclude_guest 1
...--- tools/perf/builtin-stat.c | 7 +++++++ 1 file changed, 7 insertions(+)
tools/perf/builtin-stat.c +7 -0
@@ -161,6 +161,13 @@ static int create_perf_stat_counter(struct perf_evsel *evsel) attr->inherit = !no_inherit; +/* +* Some events get initialized with sample_(period/type) set, +* like tracepoints. Clear it up for counting. +*/ + attr->sample_period =0 ; + attr->sample_type =0 ; +if (target__has_cpu (&target))return perf_evsel__open_per_cpu (evsel,perf_evsel__cpus (evsel));