perf kvm: fix sample_type manipulation
Adrian Hunter
reviewerv2 cover perf kvm: fix sample_type manipulation
Hi
Here is the sample identifier fix (version 2).
Changes in V2:
perf tools: fix id pos in perf_evlist__open()
New patch
perf kvm: fix sample_type manipulation
Remove setting of id_pos
Adrian Hunter (2):
perf tools: fix id pos in perf_evlist__open() perf kvm: fix sample_type manipulation
tools/perf/builtin-kvm.c | 18 +++++++++--------- tools/perf/util/evlist.c | 12 ++++++++++++ 2 files changed, 21 insertions(+), 9 deletions(-)
Regards
Adrian
Adrian Hunter
reviewerPATCH v2 1/2 perf tools: fix id pos in perf_evlist__open()
Ensure the id_pos is correct when perf_evlist__open() is used.
--- tools/perf/util/evlist.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
tools/perf/util/evlist.c +12 -0
@@ -64,6 +64,16 @@ void perf_evlist__set_id_pos(struct perf_evlist *evlist) evlist->is_pos = first->is_pos; } +static void perf_evlist__update_id_pos (struct perf_evlist *evlist) +{ +struct perf_evsel *evsel; + +list_for_each_entry (evsel, &evlist->entries, node) +perf_evsel__calc_id_pos (evsel); + +perf_evlist__set_id_pos (evlist); +} +static void perf_evlist__purge (struct perf_evlist *evlist) {struct perf_evsel *pos, *n;
@@ -915,6 +925,8 @@ int perf_evlist__open(struct perf_evlist *evlist)struct perf_evsel *evsel;int err; +perf_evlist__update_id_pos (evlist); +list_for_each_entry (evsel, &evlist->entries, node) { err =perf_evsel__open (evsel, evlist->cpus, evlist->threads);if (err <0 )
Signature · 1 line
1.7.11.7
Re: [PATCH V2 1/2] perf tools: fix id pos in perf_evlist__open()
Quoted 2 lines · Adrian Hunter
Ensure the
id_posis correct whenperf_evlist__open()is used.
The commit log should reference 7556257 and breakage of 'kvm stat live'; helps identify patches when backporting.
Other than that this patch fixes the problem.
Tested-by and Acked-by David Ahern <[email protected]>
Quoted 37 lines
Signed-off-by Adrian Hunter <[email protected]>--- tools/perf/util/evlist.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)tools/perf/util/evlist.c +12
-0@@ -64,6 +64,16 @@ void perf_evlist__set_id_pos(struct perf_evlist *evlist) evlist->is_pos = first->is_pos; } +static void perf_evlist__update_id_pos (struct perf_evlist *evlist) +{ +struct perf_evsel *evsel; + +list_for_each_entry (evsel, &evlist->entries, node) +perf_evsel__calc_id_pos (evsel); + +perf_evlist__set_id_pos (evlist); +} +static void perf_evlist__purge (struct perf_evlist *evlist) {struct perf_evsel *pos, *n;@@ -915,6 +925,8 @@ int perf_evlist__open(struct perf_evlist *evlist)struct perf_evsel *evsel;int err; +perf_evlist__update_id_pos (evlist); +list_for_each_entry (evsel, &evlist->entries, node) { err =perf_evsel__open (evsel, evlist->cpus, evlist->threads);if (err <0 )
Re: [PATCH V2 1/2] perf tools: fix id pos in perf_evlist__open()
Em Sat, Sep 07, 2013 at 08:20:10AM -0600, David Ahern escreveu:
Quoted 8 lines · Adrian Hunter
Quoted 2 lines
Ensure the
id_posis correct whenperf_evlist__open()is used.The commit log should reference 7556257 and breakage of 'kvm stat live'; helps identify patches when backporting.
Other than that this patch fixes the problem.
Thanks, I'm ammending the commit message log.
Quoted 39 lines
Tested-by and Acked-by David Ahern <[email protected]>
Quoted 37 lines
Signed-off-by Adrian Hunter <[email protected]>--- tools/perf/util/evlist.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)tools/perf/util/evlist.c +12
-0@@ -64,6 +64,16 @@ void perf_evlist__set_id_pos(struct perf_evlist *evlist) evlist->is_pos = first->is_pos; } +static void perf_evlist__update_id_pos (struct perf_evlist *evlist) +{ +struct perf_evsel *evsel; + +list_for_each_entry (evsel, &evlist->entries, node) +perf_evsel__calc_id_pos (evsel); + +perf_evlist__set_id_pos (evlist); +} +static void perf_evlist__purge (struct perf_evlist *evlist) {struct perf_evsel *pos, *n;@@ -915,6 +925,8 @@ int perf_evlist__open(struct perf_evlist *evlist)struct perf_evsel *evsel;int err; +perf_evlist__update_id_pos (evlist); +list_for_each_entry (evsel, &evlist->entries, node) { err =perf_evsel__open (evsel, evlist->cpus, evlist->threads);if (err <0 )
tip-bot for Adrian Hunter
merge bot[tip:perf/urgent] perf evlist: Fix id pos in perf_evlist__open()
In reply to Adrian Hunterperf evlist: Fix id pos in perf_evlist__open()
Commit-ID: 733cd2fe197a0c696c54916f7395451c0da9b867 Gitweb: http://git.kernel.org/tip/733cd2fe197a0c696c54916f7395451c0da9b867 Author: Adrian Hunter <[email protected]> AuthorDate: Fri, 6 Sep 2013 22:40:11 +0300 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Mon, 9 Sep 2013 15:51:44 -0300
perf evlist: Fix id pos in perf_evlist__open()
Ensure the id_pos is correct when perf_evlist__open() is used.
This fixes a problem introduced in 7556257 that broke 'perf kvm stat live' in that this tool wasn't updated to use the sample_type bits setting helpers.
--- tools/perf/util/evlist.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
tools/perf/util/evlist.c +12 -0
@@ -64,6 +64,16 @@ void perf_evlist__set_id_pos(struct perf_evlist *evlist) evlist->is_pos = first->is_pos; } +static void perf_evlist__update_id_pos (struct perf_evlist *evlist) +{ +struct perf_evsel *evsel; + +list_for_each_entry (evsel, &evlist->entries, node) +perf_evsel__calc_id_pos (evsel); + +perf_evlist__set_id_pos (evlist); +} +static void perf_evlist__purge (struct perf_evlist *evlist) {struct perf_evsel *pos, *n;
@@ -920,6 +930,8 @@ int perf_evlist__open(struct perf_evlist *evlist)struct perf_evsel *evsel;int err; +perf_evlist__update_id_pos (evlist); +list_for_each_entry (evsel, &evlist->entries, node) { err =perf_evsel__open (evsel, evlist->cpus, evlist->threads);if (err <0 )
Adrian Hunter
reviewerPATCH v2 2/2 perf kvm: fix sample_type manipulation
In reply to Adrian HunterManipulating the sample_type of an evsel requires
the use of:
perf_evsel__set_sample_bit()
and perf_evsel__reset_sample_bit()
--- tools/perf/builtin-kvm.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
tools/perf/builtin-kvm.c +9 -9
@@ -1165,16 +1165,16 @@ static int kvm_live_open_events(struct perf_kvm_stat *kvm)struct perf_event_attr *attr = &pos->attr;/* make sure these *are* set */ - attr->sample_type |=PERF_SAMPLE_TID ; - attr->sample_type |=PERF_SAMPLE_TIME ; - attr->sample_type |=PERF_SAMPLE_CPU ; - attr->sample_type |=PERF_SAMPLE_RAW ; +perf_evsel__set_sample_bit (pos,TID ); +perf_evsel__set_sample_bit (pos,TIME ); +perf_evsel__set_sample_bit (pos,CPU ); +perf_evsel__set_sample_bit (pos,RAW );/* make sure these are *not*; want as small a sample as possible */ - attr->sample_type &= ~PERF_SAMPLE_PERIOD ; - attr->sample_type &= ~PERF_SAMPLE_IP ; - attr->sample_type &= ~PERF_SAMPLE_CALLCHAIN ; - attr->sample_type &= ~PERF_SAMPLE_ADDR ; - attr->sample_type &= ~PERF_SAMPLE_READ ; +perf_evsel__reset_sample_bit (pos,PERIOD ); +perf_evsel__reset_sample_bit (pos,IP ); +perf_evsel__reset_sample_bit (pos,CALLCHAIN ); +perf_evsel__reset_sample_bit (pos,ADDR ); +perf_evsel__reset_sample_bit (pos,READ ); attr->mmap =0 ; attr->comm =0 ; attr->task =0 ;
Signature · 1 line
1.7.11.7
Quoted 6 lines · Adrian Hunter
Manipulating the
sample_typeof an evsel requires
the use of:
perf_evsel__set_sample_bit()
andperf_evsel__reset_sample_bit()Signed-off-by Adrian Hunter <[email protected]>
Tested-by and Acked-by David Ahern <[email protected]>
tip-bot for Adrian Hunter
merge bot[tip:perf/urgent] perf kvm: Fix sample_type manipulation
In reply to Adrian Hunterperf kvm: Fix sample_type manipulation
Commit-ID: e71aa28312b208a14cd87fa61e941ac8c85072f4 Gitweb: http://git.kernel.org/tip/e71aa28312b208a14cd87fa61e941ac8c85072f4 Author: Adrian Hunter <[email protected]> AuthorDate: Fri, 6 Sep 2013 22:40:12 +0300 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Mon, 9 Sep 2013 16:13:11 -0300
perf kvm: Fix sample_type manipulation
Manipulating the sample_type of an evsel requires the use of:
perf_evsel__set_sample_bit()
and perf_evsel__reset_sample_bit()
--- tools/perf/builtin-kvm.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
tools/perf/builtin-kvm.c +9 -9
@@ -1165,16 +1165,16 @@ static int kvm_live_open_events(struct perf_kvm_stat *kvm)struct perf_event_attr *attr = &pos->attr;/* make sure these *are* set */ - attr->sample_type |=PERF_SAMPLE_TID ; - attr->sample_type |=PERF_SAMPLE_TIME ; - attr->sample_type |=PERF_SAMPLE_CPU ; - attr->sample_type |=PERF_SAMPLE_RAW ; +perf_evsel__set_sample_bit (pos,TID ); +perf_evsel__set_sample_bit (pos,TIME ); +perf_evsel__set_sample_bit (pos,CPU ); +perf_evsel__set_sample_bit (pos,RAW );/* make sure these are *not*; want as small a sample as possible */ - attr->sample_type &= ~PERF_SAMPLE_PERIOD ; - attr->sample_type &= ~PERF_SAMPLE_IP ; - attr->sample_type &= ~PERF_SAMPLE_CALLCHAIN ; - attr->sample_type &= ~PERF_SAMPLE_ADDR ; - attr->sample_type &= ~PERF_SAMPLE_READ ; +perf_evsel__reset_sample_bit (pos,PERIOD ); +perf_evsel__reset_sample_bit (pos,IP ); +perf_evsel__reset_sample_bit (pos,CALLCHAIN ); +perf_evsel__reset_sample_bit (pos,ADDR ); +perf_evsel__reset_sample_bit (pos,READ ); attr->mmap =0 ; attr->comm =0 ; attr->task =0 ;