[RFC 2/4] perf kvm: Introduce evsel as argument to perf_event__preprocess_sample

2016-02-24 Thread Ravi Bangoria
This patch changes prototype of perf_event__preprocess_sample() with
additional argument evsel added at the end.

This change is required because perf_event__preprocess_sample()
function will use evsel to determine cpumode of samples for powerpc
architecture.

Signed-off-by: Ravi Bangoria 
---
 tools/perf/builtin-annotate.c |  3 ++-
 tools/perf/builtin-diff.c |  3 ++-
 tools/perf/builtin-mem.c  | 10 ++
 tools/perf/builtin-report.c   |  3 ++-
 tools/perf/builtin-script.c   |  3 ++-
 tools/perf/builtin-timechart.c|  8 +---
 tools/perf/builtin-top.c  |  3 ++-
 tools/perf/tests/hists_cumulate.c |  2 +-
 tools/perf/tests/hists_filter.c   |  2 +-
 tools/perf/tests/hists_link.c |  4 ++--
 tools/perf/tests/hists_output.c   |  2 +-
 tools/perf/util/event.c   |  3 ++-
 tools/perf/util/event.h   |  3 ++-
 13 files changed, 30 insertions(+), 19 deletions(-)

diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index cfe3663..da330ae 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -94,7 +94,8 @@ static int process_sample_event(struct perf_tool *tool,
struct addr_location al;
int ret = 0;
 
-   if (perf_event__preprocess_sample(event, machine, , sample) < 0) {
+   if (perf_event__preprocess_sample(event, machine, ,
+ sample, evsel) < 0) {
pr_warning("problem processing %d event, skipping it.\n",
   event->header.type);
return -1;
diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
index 36ccc2b..d2a27fe 100644
--- a/tools/perf/builtin-diff.c
+++ b/tools/perf/builtin-diff.c
@@ -330,7 +330,8 @@ static int diff__process_sample_event(struct perf_tool 
*tool __maybe_unused,
struct hists *hists = evsel__hists(evsel);
int ret = -1;
 
-   if (perf_event__preprocess_sample(event, machine, , sample) < 0) {
+   if (perf_event__preprocess_sample(event, machine, ,
+ sample, evsel) < 0) {
pr_warning("problem processing %d event, skipping it.\n",
   event->header.type);
return -1;
diff --git a/tools/perf/builtin-mem.c b/tools/perf/builtin-mem.c
index b3f8a89..a7c01fe 100644
--- a/tools/perf/builtin-mem.c
+++ b/tools/perf/builtin-mem.c
@@ -118,13 +118,15 @@ static int
 dump_raw_samples(struct perf_tool *tool,
 union perf_event *event,
 struct perf_sample *sample,
-struct machine *machine)
+struct machine *machine,
+struct perf_evsel *evsel)
 {
struct perf_mem *mem = container_of(tool, struct perf_mem, tool);
struct addr_location al;
const char *fmt;
 
-   if (perf_event__preprocess_sample(event, machine, , sample) < 0) {
+   if (perf_event__preprocess_sample(event, machine, ,
+ sample, evsel) < 0) {
fprintf(stderr, "problem processing %d event, skipping it.\n",
event->header.type);
return -1;
@@ -168,10 +170,10 @@ out_put:
 static int process_sample_event(struct perf_tool *tool,
union perf_event *event,
struct perf_sample *sample,
-   struct perf_evsel *evsel __maybe_unused,
+   struct perf_evsel *evsel,
struct machine *machine)
 {
-   return dump_raw_samples(tool, event, sample, machine);
+   return dump_raw_samples(tool, event, sample, machine, evsel);
 }
 
 static int report_raw_events(struct perf_mem *mem)
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 760e886..31ec4ba 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -154,7 +154,8 @@ static int process_sample_event(struct perf_tool *tool,
};
int ret = 0;
 
-   if (perf_event__preprocess_sample(event, machine, , sample) < 0) {
+   if (perf_event__preprocess_sample(event, machine, ,
+ sample, evsel) < 0) {
pr_debug("problem processing %d event, skipping it.\n",
 event->header.type);
return -1;
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index f4caf48..792868e 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -804,7 +804,8 @@ static int process_sample_event(struct perf_tool *tool,
return 0;
}
 
-   if (perf_event__preprocess_sample(event, machine, , sample) < 0) {
+   if (perf_event__preprocess_sample(event, machine, ,
+ sample, evsel) < 0) {
pr_err("problem processing %d event, skipping 

[RFC 2/4] perf kvm: Introduce evsel as argument to perf_event__preprocess_sample

2016-02-24 Thread Ravi Bangoria
This patch changes prototype of perf_event__preprocess_sample() with
additional argument evsel added at the end.

This change is required because perf_event__preprocess_sample()
function will use evsel to determine cpumode of samples for powerpc
architecture.

Signed-off-by: Ravi Bangoria 
---
 tools/perf/builtin-annotate.c |  3 ++-
 tools/perf/builtin-diff.c |  3 ++-
 tools/perf/builtin-mem.c  | 10 ++
 tools/perf/builtin-report.c   |  3 ++-
 tools/perf/builtin-script.c   |  3 ++-
 tools/perf/builtin-timechart.c|  8 +---
 tools/perf/builtin-top.c  |  3 ++-
 tools/perf/tests/hists_cumulate.c |  2 +-
 tools/perf/tests/hists_filter.c   |  2 +-
 tools/perf/tests/hists_link.c |  4 ++--
 tools/perf/tests/hists_output.c   |  2 +-
 tools/perf/util/event.c   |  3 ++-
 tools/perf/util/event.h   |  3 ++-
 13 files changed, 30 insertions(+), 19 deletions(-)

diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index cfe3663..da330ae 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -94,7 +94,8 @@ static int process_sample_event(struct perf_tool *tool,
struct addr_location al;
int ret = 0;
 
-   if (perf_event__preprocess_sample(event, machine, , sample) < 0) {
+   if (perf_event__preprocess_sample(event, machine, ,
+ sample, evsel) < 0) {
pr_warning("problem processing %d event, skipping it.\n",
   event->header.type);
return -1;
diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
index 36ccc2b..d2a27fe 100644
--- a/tools/perf/builtin-diff.c
+++ b/tools/perf/builtin-diff.c
@@ -330,7 +330,8 @@ static int diff__process_sample_event(struct perf_tool 
*tool __maybe_unused,
struct hists *hists = evsel__hists(evsel);
int ret = -1;
 
-   if (perf_event__preprocess_sample(event, machine, , sample) < 0) {
+   if (perf_event__preprocess_sample(event, machine, ,
+ sample, evsel) < 0) {
pr_warning("problem processing %d event, skipping it.\n",
   event->header.type);
return -1;
diff --git a/tools/perf/builtin-mem.c b/tools/perf/builtin-mem.c
index b3f8a89..a7c01fe 100644
--- a/tools/perf/builtin-mem.c
+++ b/tools/perf/builtin-mem.c
@@ -118,13 +118,15 @@ static int
 dump_raw_samples(struct perf_tool *tool,
 union perf_event *event,
 struct perf_sample *sample,
-struct machine *machine)
+struct machine *machine,
+struct perf_evsel *evsel)
 {
struct perf_mem *mem = container_of(tool, struct perf_mem, tool);
struct addr_location al;
const char *fmt;
 
-   if (perf_event__preprocess_sample(event, machine, , sample) < 0) {
+   if (perf_event__preprocess_sample(event, machine, ,
+ sample, evsel) < 0) {
fprintf(stderr, "problem processing %d event, skipping it.\n",
event->header.type);
return -1;
@@ -168,10 +170,10 @@ out_put:
 static int process_sample_event(struct perf_tool *tool,
union perf_event *event,
struct perf_sample *sample,
-   struct perf_evsel *evsel __maybe_unused,
+   struct perf_evsel *evsel,
struct machine *machine)
 {
-   return dump_raw_samples(tool, event, sample, machine);
+   return dump_raw_samples(tool, event, sample, machine, evsel);
 }
 
 static int report_raw_events(struct perf_mem *mem)
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 760e886..31ec4ba 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -154,7 +154,8 @@ static int process_sample_event(struct perf_tool *tool,
};
int ret = 0;
 
-   if (perf_event__preprocess_sample(event, machine, , sample) < 0) {
+   if (perf_event__preprocess_sample(event, machine, ,
+ sample, evsel) < 0) {
pr_debug("problem processing %d event, skipping it.\n",
 event->header.type);
return -1;
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index f4caf48..792868e 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -804,7 +804,8 @@ static int process_sample_event(struct perf_tool *tool,
return 0;
}
 
-   if (perf_event__preprocess_sample(event, machine, , sample) < 0) {
+   if (perf_event__preprocess_sample(event, machine, ,
+ sample, evsel) < 0) {
pr_err("problem processing %d event, skipping it.\n",