* [PATCH 0/3] perf tools: Get rid of unused 'swapped' parameter from perf_event__synthesize_sample()
@ 2018-01-16 13:14 Adrian Hunter
2018-01-16 13:14 ` [PATCH 1/3] perf intel-pt/bts: Do not swap when synthesizing samples Adrian Hunter
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Adrian Hunter @ 2018-01-16 13:14 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo; +Cc: Jiri Olsa, linux-kernel
Hi
Here is a minor tidy-up for perf_event__synthesize_sample().
Adrian Hunter (3):
perf intel-pt/bts: Do not swap when synthesizing samples
perf tools: Ensure reserved member of PERF_SAMPLE_CPU is zero in perf_event__synthesize_sample()
perf tools: Get rid of unused 'swapped' parameter from perf_event__synthesize_sample()
tools/perf/builtin-inject.c | 3 +--
tools/perf/tests/sample-parsing.c | 2 +-
tools/perf/util/event.h | 3 +--
tools/perf/util/evsel.c | 29 ++---------------------------
tools/perf/util/intel-bts.c | 6 +-----
tools/perf/util/intel-pt.c | 11 +++--------
6 files changed, 9 insertions(+), 45 deletions(-)
Regards
Adrian
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/3] perf intel-pt/bts: Do not swap when synthesizing samples
2018-01-16 13:14 [PATCH 0/3] perf tools: Get rid of unused 'swapped' parameter from perf_event__synthesize_sample() Adrian Hunter
@ 2018-01-16 13:14 ` Adrian Hunter
2018-01-24 11:19 ` [tip:perf/core] " tip-bot for Adrian Hunter
2018-01-16 13:14 ` [PATCH 2/3] perf tools: Ensure reserved member of PERF_SAMPLE_CPU is zero in perf_event__synthesize_sample() Adrian Hunter
` (2 subsequent siblings)
3 siblings, 1 reply; 8+ messages in thread
From: Adrian Hunter @ 2018-01-16 13:14 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo; +Cc: Jiri Olsa, linux-kernel
Both 'perf inject' and internal tools consume cpu endian samples, so there
is never a need to do any swapping when synthesizing samples.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
tools/perf/util/intel-bts.c | 6 +-----
tools/perf/util/intel-pt.c | 11 +++--------
2 files changed, 4 insertions(+), 13 deletions(-)
diff --git a/tools/perf/util/intel-bts.c b/tools/perf/util/intel-bts.c
index 5325e65f9711..7077bebc2fb0 100644
--- a/tools/perf/util/intel-bts.c
+++ b/tools/perf/util/intel-bts.c
@@ -67,7 +67,6 @@ struct intel_bts {
u64 branches_sample_type;
u64 branches_id;
size_t branches_event_size;
- bool synth_needs_swap;
unsigned long num_events;
};
@@ -303,8 +302,7 @@ static int intel_bts_synth_branch_sample(struct intel_bts_queue *btsq,
event.sample.header.size = bts->branches_event_size;
ret = perf_event__synthesize_sample(&event,
bts->branches_sample_type,
- 0, &sample,
- bts->synth_needs_swap);
+ 0, &sample, false);
if (ret)
return ret;
}
@@ -841,8 +839,6 @@ static int intel_bts_synth_events(struct intel_bts *bts,
__perf_evsel__sample_size(attr.sample_type);
}
- bts->synth_needs_swap = evsel->needs_swap;
-
return 0;
}
diff --git a/tools/perf/util/intel-pt.c b/tools/perf/util/intel-pt.c
index 23f9ba676df0..2daf641beb85 100644
--- a/tools/perf/util/intel-pt.c
+++ b/tools/perf/util/intel-pt.c
@@ -104,8 +104,6 @@ struct intel_pt {
u64 pwrx_id;
u64 cbr_id;
- bool synth_needs_swap;
-
u64 tsc_bit;
u64 mtc_bit;
u64 mtc_freq_bits;
@@ -1101,11 +1099,10 @@ static void intel_pt_prep_b_sample(struct intel_pt *pt,
}
static int intel_pt_inject_event(union perf_event *event,
- struct perf_sample *sample, u64 type,
- bool swapped)
+ struct perf_sample *sample, u64 type)
{
event->header.size = perf_event__sample_event_size(sample, type, 0);
- return perf_event__synthesize_sample(event, type, 0, sample, swapped);
+ return perf_event__synthesize_sample(event, type, 0, sample, false);
}
static inline int intel_pt_opt_inject(struct intel_pt *pt,
@@ -1115,7 +1112,7 @@ static inline int intel_pt_opt_inject(struct intel_pt *pt,
if (!pt->synth_opts.inject)
return 0;
- return intel_pt_inject_event(event, sample, type, pt->synth_needs_swap);
+ return intel_pt_inject_event(event, sample, type);
}
static int intel_pt_deliver_synth_b_event(struct intel_pt *pt,
@@ -2329,8 +2326,6 @@ static int intel_pt_synth_events(struct intel_pt *pt,
id += 1;
}
- pt->synth_needs_swap = evsel->needs_swap;
-
return 0;
}
--
1.9.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/3] perf tools: Ensure reserved member of PERF_SAMPLE_CPU is zero in perf_event__synthesize_sample()
2018-01-16 13:14 [PATCH 0/3] perf tools: Get rid of unused 'swapped' parameter from perf_event__synthesize_sample() Adrian Hunter
2018-01-16 13:14 ` [PATCH 1/3] perf intel-pt/bts: Do not swap when synthesizing samples Adrian Hunter
@ 2018-01-16 13:14 ` Adrian Hunter
2018-01-24 11:19 ` [tip:perf/core] perf evsel: " tip-bot for Adrian Hunter
2018-01-16 13:14 ` [PATCH 3/3] perf tools: Get rid of unused 'swapped' parameter from perf_event__synthesize_sample() Adrian Hunter
2018-01-18 9:37 ` [PATCH 0/3] " Jiri Olsa
3 siblings, 1 reply; 8+ messages in thread
From: Adrian Hunter @ 2018-01-16 13:14 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo; +Cc: Jiri Olsa, linux-kernel
PERF_SAMPLE_CPU contains the cpu number in the first 4 bytes and the second
4 bytes are reserved. Ensure the reserved bytes are zero in
perf_event__synthesize_sample().
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
tools/perf/util/evsel.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 8f971a2301d1..7d066e83abe8 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -2523,6 +2523,7 @@ int perf_event__synthesize_sample(union perf_event *event, u64 type,
if (type & PERF_SAMPLE_CPU) {
u.val32[0] = sample->cpu;
+ u.val32[1] = 0;
if (swapped) {
/*
* Inverse of what is done in perf_evsel__parse_sample
--
1.9.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/3] perf tools: Get rid of unused 'swapped' parameter from perf_event__synthesize_sample()
2018-01-16 13:14 [PATCH 0/3] perf tools: Get rid of unused 'swapped' parameter from perf_event__synthesize_sample() Adrian Hunter
2018-01-16 13:14 ` [PATCH 1/3] perf intel-pt/bts: Do not swap when synthesizing samples Adrian Hunter
2018-01-16 13:14 ` [PATCH 2/3] perf tools: Ensure reserved member of PERF_SAMPLE_CPU is zero in perf_event__synthesize_sample() Adrian Hunter
@ 2018-01-16 13:14 ` Adrian Hunter
2018-01-24 11:20 ` [tip:perf/core] " tip-bot for Adrian Hunter
2018-01-18 9:37 ` [PATCH 0/3] " Jiri Olsa
3 siblings, 1 reply; 8+ messages in thread
From: Adrian Hunter @ 2018-01-16 13:14 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo; +Cc: Jiri Olsa, linux-kernel
There is never a need to synthesize a 'swapped' sample, so all callers to
perf_event__synthesize_sample() pass 'false' as the value to 'swapped'. So
get rid of the unused 'swapped' parameter.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
tools/perf/builtin-inject.c | 3 +--
tools/perf/tests/sample-parsing.c | 2 +-
tools/perf/util/event.h | 3 +--
tools/perf/util/evsel.c | 28 +---------------------------
tools/perf/util/intel-bts.c | 2 +-
tools/perf/util/intel-pt.c | 2 +-
6 files changed, 6 insertions(+), 34 deletions(-)
diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c
index 16a28547ca86..40fe919bbcf3 100644
--- a/tools/perf/builtin-inject.c
+++ b/tools/perf/builtin-inject.c
@@ -536,8 +536,7 @@ static int perf_inject__sched_stat(struct perf_tool *tool,
sample_sw.period = sample->period;
sample_sw.time = sample->time;
perf_event__synthesize_sample(event_sw, evsel->attr.sample_type,
- evsel->attr.read_format, &sample_sw,
- false);
+ evsel->attr.read_format, &sample_sw);
build_id__mark_dso_hit(tool, event_sw, &sample_sw, evsel, machine);
return perf_event__repipe(tool, event_sw, &sample_sw, machine);
}
diff --git a/tools/perf/tests/sample-parsing.c b/tools/perf/tests/sample-parsing.c
index 3ec6302b6498..0e2d00d69e6e 100644
--- a/tools/perf/tests/sample-parsing.c
+++ b/tools/perf/tests/sample-parsing.c
@@ -248,7 +248,7 @@ static int do_test(u64 sample_type, u64 sample_regs, u64 read_format)
event->header.size = sz;
err = perf_event__synthesize_sample(event, sample_type, read_format,
- &sample, false);
+ &sample);
if (err) {
pr_debug("%s failed for sample_type %#"PRIx64", error %d\n",
"perf_event__synthesize_sample", sample_type, err);
diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h
index e5fbd6dd1b01..0f794744919c 100644
--- a/tools/perf/util/event.h
+++ b/tools/perf/util/event.h
@@ -775,8 +775,7 @@ size_t perf_event__sample_event_size(const struct perf_sample *sample, u64 type,
u64 read_format);
int perf_event__synthesize_sample(union perf_event *event, u64 type,
u64 read_format,
- const struct perf_sample *sample,
- bool swapped);
+ const struct perf_sample *sample);
pid_t perf_event__synthesize_comm(struct perf_tool *tool,
union perf_event *event, pid_t pid,
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 7d066e83abe8..477345b1c3ce 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -2462,8 +2462,7 @@ size_t perf_event__sample_event_size(const struct perf_sample *sample, u64 type,
int perf_event__synthesize_sample(union perf_event *event, u64 type,
u64 read_format,
- const struct perf_sample *sample,
- bool swapped)
+ const struct perf_sample *sample)
{
u64 *array;
size_t sz;
@@ -2488,15 +2487,6 @@ int perf_event__synthesize_sample(union perf_event *event, u64 type,
if (type & PERF_SAMPLE_TID) {
u.val32[0] = sample->pid;
u.val32[1] = sample->tid;
- if (swapped) {
- /*
- * Inverse of what is done in perf_evsel__parse_sample
- */
- u.val32[0] = bswap_32(u.val32[0]);
- u.val32[1] = bswap_32(u.val32[1]);
- u.val64 = bswap_64(u.val64);
- }
-
*array = u.val64;
array++;
}
@@ -2524,13 +2514,6 @@ int perf_event__synthesize_sample(union perf_event *event, u64 type,
if (type & PERF_SAMPLE_CPU) {
u.val32[0] = sample->cpu;
u.val32[1] = 0;
- if (swapped) {
- /*
- * Inverse of what is done in perf_evsel__parse_sample
- */
- u.val32[0] = bswap_32(u.val32[0]);
- u.val64 = bswap_64(u.val64);
- }
*array = u.val64;
array++;
}
@@ -2577,15 +2560,6 @@ int perf_event__synthesize_sample(union perf_event *event, u64 type,
if (type & PERF_SAMPLE_RAW) {
u.val32[0] = sample->raw_size;
- if (WARN_ONCE(swapped,
- "Endianness of raw data not corrected!\n")) {
- /*
- * Inverse of what is done in perf_evsel__parse_sample
- */
- u.val32[0] = bswap_32(u.val32[0]);
- u.val32[1] = bswap_32(u.val32[1]);
- u.val64 = bswap_64(u.val64);
- }
*array = u.val64;
array = (void *)array + sizeof(u32);
diff --git a/tools/perf/util/intel-bts.c b/tools/perf/util/intel-bts.c
index 7077bebc2fb0..72db2744876d 100644
--- a/tools/perf/util/intel-bts.c
+++ b/tools/perf/util/intel-bts.c
@@ -302,7 +302,7 @@ static int intel_bts_synth_branch_sample(struct intel_bts_queue *btsq,
event.sample.header.size = bts->branches_event_size;
ret = perf_event__synthesize_sample(&event,
bts->branches_sample_type,
- 0, &sample, false);
+ 0, &sample);
if (ret)
return ret;
}
diff --git a/tools/perf/util/intel-pt.c b/tools/perf/util/intel-pt.c
index 2daf641beb85..3773d9c54f45 100644
--- a/tools/perf/util/intel-pt.c
+++ b/tools/perf/util/intel-pt.c
@@ -1102,7 +1102,7 @@ static int intel_pt_inject_event(union perf_event *event,
struct perf_sample *sample, u64 type)
{
event->header.size = perf_event__sample_event_size(sample, type, 0);
- return perf_event__synthesize_sample(event, type, 0, sample, false);
+ return perf_event__synthesize_sample(event, type, 0, sample);
}
static inline int intel_pt_opt_inject(struct intel_pt *pt,
--
1.9.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 0/3] perf tools: Get rid of unused 'swapped' parameter from perf_event__synthesize_sample()
2018-01-16 13:14 [PATCH 0/3] perf tools: Get rid of unused 'swapped' parameter from perf_event__synthesize_sample() Adrian Hunter
` (2 preceding siblings ...)
2018-01-16 13:14 ` [PATCH 3/3] perf tools: Get rid of unused 'swapped' parameter from perf_event__synthesize_sample() Adrian Hunter
@ 2018-01-18 9:37 ` Jiri Olsa
3 siblings, 0 replies; 8+ messages in thread
From: Jiri Olsa @ 2018-01-18 9:37 UTC (permalink / raw)
To: Adrian Hunter; +Cc: Arnaldo Carvalho de Melo, linux-kernel
On Tue, Jan 16, 2018 at 03:14:49PM +0200, Adrian Hunter wrote:
> Hi
>
> Here is a minor tidy-up for perf_event__synthesize_sample().
>
>
> Adrian Hunter (3):
> perf intel-pt/bts: Do not swap when synthesizing samples
> perf tools: Ensure reserved member of PERF_SAMPLE_CPU is zero in perf_event__synthesize_sample()
> perf tools: Get rid of unused 'swapped' parameter from perf_event__synthesize_sample()
Acked-by: Jiri Olsa <jolsa@kernel.org>
thanks,
jirka
^ permalink raw reply [flat|nested] 8+ messages in thread
* [tip:perf/core] perf intel-pt/bts: Do not swap when synthesizing samples
2018-01-16 13:14 ` [PATCH 1/3] perf intel-pt/bts: Do not swap when synthesizing samples Adrian Hunter
@ 2018-01-24 11:19 ` tip-bot for Adrian Hunter
0 siblings, 0 replies; 8+ messages in thread
From: tip-bot for Adrian Hunter @ 2018-01-24 11:19 UTC (permalink / raw)
To: linux-tip-commits
Cc: acme, linux-kernel, jolsa, hpa, adrian.hunter, tglx, mingo
Commit-ID: a10eb530ae497e2411525fc1f5ec73f39eb11c11
Gitweb: https://git.kernel.org/tip/a10eb530ae497e2411525fc1f5ec73f39eb11c11
Author: Adrian Hunter <adrian.hunter@intel.com>
AuthorDate: Tue, 16 Jan 2018 15:14:50 +0200
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 18 Jan 2018 09:00:16 -0300
perf intel-pt/bts: Do not swap when synthesizing samples
Both 'perf inject' and internal tools consume cpu endian samples, so
there is never a need to do any swapping when synthesizing samples.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Link: http://lkml.kernel.org/r/1516108492-21401-2-git-send-email-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/intel-bts.c | 6 +-----
tools/perf/util/intel-pt.c | 11 +++--------
2 files changed, 4 insertions(+), 13 deletions(-)
diff --git a/tools/perf/util/intel-bts.c b/tools/perf/util/intel-bts.c
index 5325e65..7077beb 100644
--- a/tools/perf/util/intel-bts.c
+++ b/tools/perf/util/intel-bts.c
@@ -67,7 +67,6 @@ struct intel_bts {
u64 branches_sample_type;
u64 branches_id;
size_t branches_event_size;
- bool synth_needs_swap;
unsigned long num_events;
};
@@ -303,8 +302,7 @@ static int intel_bts_synth_branch_sample(struct intel_bts_queue *btsq,
event.sample.header.size = bts->branches_event_size;
ret = perf_event__synthesize_sample(&event,
bts->branches_sample_type,
- 0, &sample,
- bts->synth_needs_swap);
+ 0, &sample, false);
if (ret)
return ret;
}
@@ -841,8 +839,6 @@ static int intel_bts_synth_events(struct intel_bts *bts,
__perf_evsel__sample_size(attr.sample_type);
}
- bts->synth_needs_swap = evsel->needs_swap;
-
return 0;
}
diff --git a/tools/perf/util/intel-pt.c b/tools/perf/util/intel-pt.c
index 23f9ba6..2daf641 100644
--- a/tools/perf/util/intel-pt.c
+++ b/tools/perf/util/intel-pt.c
@@ -104,8 +104,6 @@ struct intel_pt {
u64 pwrx_id;
u64 cbr_id;
- bool synth_needs_swap;
-
u64 tsc_bit;
u64 mtc_bit;
u64 mtc_freq_bits;
@@ -1101,11 +1099,10 @@ static void intel_pt_prep_b_sample(struct intel_pt *pt,
}
static int intel_pt_inject_event(union perf_event *event,
- struct perf_sample *sample, u64 type,
- bool swapped)
+ struct perf_sample *sample, u64 type)
{
event->header.size = perf_event__sample_event_size(sample, type, 0);
- return perf_event__synthesize_sample(event, type, 0, sample, swapped);
+ return perf_event__synthesize_sample(event, type, 0, sample, false);
}
static inline int intel_pt_opt_inject(struct intel_pt *pt,
@@ -1115,7 +1112,7 @@ static inline int intel_pt_opt_inject(struct intel_pt *pt,
if (!pt->synth_opts.inject)
return 0;
- return intel_pt_inject_event(event, sample, type, pt->synth_needs_swap);
+ return intel_pt_inject_event(event, sample, type);
}
static int intel_pt_deliver_synth_b_event(struct intel_pt *pt,
@@ -2329,8 +2326,6 @@ static int intel_pt_synth_events(struct intel_pt *pt,
id += 1;
}
- pt->synth_needs_swap = evsel->needs_swap;
-
return 0;
}
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [tip:perf/core] perf evsel: Ensure reserved member of PERF_SAMPLE_CPU is zero in perf_event__synthesize_sample()
2018-01-16 13:14 ` [PATCH 2/3] perf tools: Ensure reserved member of PERF_SAMPLE_CPU is zero in perf_event__synthesize_sample() Adrian Hunter
@ 2018-01-24 11:19 ` tip-bot for Adrian Hunter
0 siblings, 0 replies; 8+ messages in thread
From: tip-bot for Adrian Hunter @ 2018-01-24 11:19 UTC (permalink / raw)
To: linux-tip-commits
Cc: mingo, adrian.hunter, acme, hpa, linux-kernel, tglx, jolsa
Commit-ID: 59a87fdad1467d228acc5cb1303b0b568a9e86a8
Gitweb: https://git.kernel.org/tip/59a87fdad1467d228acc5cb1303b0b568a9e86a8
Author: Adrian Hunter <adrian.hunter@intel.com>
AuthorDate: Tue, 16 Jan 2018 15:14:51 +0200
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 18 Jan 2018 09:00:45 -0300
perf evsel: Ensure reserved member of PERF_SAMPLE_CPU is zero in perf_event__synthesize_sample()
PERF_SAMPLE_CPU contains the cpu number in the first 4 bytes and the
second 4 bytes are reserved. Ensure the reserved bytes are zero in
perf_event__synthesize_sample().
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Link: http://lkml.kernel.org/r/1516108492-21401-3-git-send-email-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/evsel.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 85eb84d..4403267 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -2533,6 +2533,7 @@ int perf_event__synthesize_sample(union perf_event *event, u64 type,
if (type & PERF_SAMPLE_CPU) {
u.val32[0] = sample->cpu;
+ u.val32[1] = 0;
if (swapped) {
/*
* Inverse of what is done in perf_evsel__parse_sample
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [tip:perf/core] perf tools: Get rid of unused 'swapped' parameter from perf_event__synthesize_sample()
2018-01-16 13:14 ` [PATCH 3/3] perf tools: Get rid of unused 'swapped' parameter from perf_event__synthesize_sample() Adrian Hunter
@ 2018-01-24 11:20 ` tip-bot for Adrian Hunter
0 siblings, 0 replies; 8+ messages in thread
From: tip-bot for Adrian Hunter @ 2018-01-24 11:20 UTC (permalink / raw)
To: linux-tip-commits
Cc: tglx, acme, linux-kernel, adrian.hunter, mingo, hpa, jolsa
Commit-ID: 936f1f30bb7892f010670f1edebc419d47b139b1
Gitweb: https://git.kernel.org/tip/936f1f30bb7892f010670f1edebc419d47b139b1
Author: Adrian Hunter <adrian.hunter@intel.com>
AuthorDate: Tue, 16 Jan 2018 15:14:52 +0200
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 18 Jan 2018 09:01:23 -0300
perf tools: Get rid of unused 'swapped' parameter from perf_event__synthesize_sample()
There is never a need to synthesize a 'swapped' sample, so all callers
to perf_event__synthesize_sample() pass 'false' as the value to
'swapped'. So get rid of the unused 'swapped' parameter.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Link: http://lkml.kernel.org/r/1516108492-21401-4-git-send-email-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-inject.c | 3 +--
tools/perf/tests/sample-parsing.c | 2 +-
tools/perf/util/event.h | 3 +--
tools/perf/util/evsel.c | 28 +---------------------------
tools/perf/util/intel-bts.c | 2 +-
tools/perf/util/intel-pt.c | 2 +-
6 files changed, 6 insertions(+), 34 deletions(-)
diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c
index 16a2854..40fe919 100644
--- a/tools/perf/builtin-inject.c
+++ b/tools/perf/builtin-inject.c
@@ -536,8 +536,7 @@ found:
sample_sw.period = sample->period;
sample_sw.time = sample->time;
perf_event__synthesize_sample(event_sw, evsel->attr.sample_type,
- evsel->attr.read_format, &sample_sw,
- false);
+ evsel->attr.read_format, &sample_sw);
build_id__mark_dso_hit(tool, event_sw, &sample_sw, evsel, machine);
return perf_event__repipe(tool, event_sw, &sample_sw, machine);
}
diff --git a/tools/perf/tests/sample-parsing.c b/tools/perf/tests/sample-parsing.c
index 3ec6302..0e2d00d 100644
--- a/tools/perf/tests/sample-parsing.c
+++ b/tools/perf/tests/sample-parsing.c
@@ -248,7 +248,7 @@ static int do_test(u64 sample_type, u64 sample_regs, u64 read_format)
event->header.size = sz;
err = perf_event__synthesize_sample(event, sample_type, read_format,
- &sample, false);
+ &sample);
if (err) {
pr_debug("%s failed for sample_type %#"PRIx64", error %d\n",
"perf_event__synthesize_sample", sample_type, err);
diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h
index e5fbd6d..0f79474 100644
--- a/tools/perf/util/event.h
+++ b/tools/perf/util/event.h
@@ -775,8 +775,7 @@ size_t perf_event__sample_event_size(const struct perf_sample *sample, u64 type,
u64 read_format);
int perf_event__synthesize_sample(union perf_event *event, u64 type,
u64 read_format,
- const struct perf_sample *sample,
- bool swapped);
+ const struct perf_sample *sample);
pid_t perf_event__synthesize_comm(struct perf_tool *tool,
union perf_event *event, pid_t pid,
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 4403267..66fa451 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -2472,8 +2472,7 @@ size_t perf_event__sample_event_size(const struct perf_sample *sample, u64 type,
int perf_event__synthesize_sample(union perf_event *event, u64 type,
u64 read_format,
- const struct perf_sample *sample,
- bool swapped)
+ const struct perf_sample *sample)
{
u64 *array;
size_t sz;
@@ -2498,15 +2497,6 @@ int perf_event__synthesize_sample(union perf_event *event, u64 type,
if (type & PERF_SAMPLE_TID) {
u.val32[0] = sample->pid;
u.val32[1] = sample->tid;
- if (swapped) {
- /*
- * Inverse of what is done in perf_evsel__parse_sample
- */
- u.val32[0] = bswap_32(u.val32[0]);
- u.val32[1] = bswap_32(u.val32[1]);
- u.val64 = bswap_64(u.val64);
- }
-
*array = u.val64;
array++;
}
@@ -2534,13 +2524,6 @@ int perf_event__synthesize_sample(union perf_event *event, u64 type,
if (type & PERF_SAMPLE_CPU) {
u.val32[0] = sample->cpu;
u.val32[1] = 0;
- if (swapped) {
- /*
- * Inverse of what is done in perf_evsel__parse_sample
- */
- u.val32[0] = bswap_32(u.val32[0]);
- u.val64 = bswap_64(u.val64);
- }
*array = u.val64;
array++;
}
@@ -2587,15 +2570,6 @@ int perf_event__synthesize_sample(union perf_event *event, u64 type,
if (type & PERF_SAMPLE_RAW) {
u.val32[0] = sample->raw_size;
- if (WARN_ONCE(swapped,
- "Endianness of raw data not corrected!\n")) {
- /*
- * Inverse of what is done in perf_evsel__parse_sample
- */
- u.val32[0] = bswap_32(u.val32[0]);
- u.val32[1] = bswap_32(u.val32[1]);
- u.val64 = bswap_64(u.val64);
- }
*array = u.val64;
array = (void *)array + sizeof(u32);
diff --git a/tools/perf/util/intel-bts.c b/tools/perf/util/intel-bts.c
index 7077beb..72db274 100644
--- a/tools/perf/util/intel-bts.c
+++ b/tools/perf/util/intel-bts.c
@@ -302,7 +302,7 @@ static int intel_bts_synth_branch_sample(struct intel_bts_queue *btsq,
event.sample.header.size = bts->branches_event_size;
ret = perf_event__synthesize_sample(&event,
bts->branches_sample_type,
- 0, &sample, false);
+ 0, &sample);
if (ret)
return ret;
}
diff --git a/tools/perf/util/intel-pt.c b/tools/perf/util/intel-pt.c
index 2daf641..3773d9c 100644
--- a/tools/perf/util/intel-pt.c
+++ b/tools/perf/util/intel-pt.c
@@ -1102,7 +1102,7 @@ static int intel_pt_inject_event(union perf_event *event,
struct perf_sample *sample, u64 type)
{
event->header.size = perf_event__sample_event_size(sample, type, 0);
- return perf_event__synthesize_sample(event, type, 0, sample, false);
+ return perf_event__synthesize_sample(event, type, 0, sample);
}
static inline int intel_pt_opt_inject(struct intel_pt *pt,
^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2018-01-24 11:21 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-16 13:14 [PATCH 0/3] perf tools: Get rid of unused 'swapped' parameter from perf_event__synthesize_sample() Adrian Hunter
2018-01-16 13:14 ` [PATCH 1/3] perf intel-pt/bts: Do not swap when synthesizing samples Adrian Hunter
2018-01-24 11:19 ` [tip:perf/core] " tip-bot for Adrian Hunter
2018-01-16 13:14 ` [PATCH 2/3] perf tools: Ensure reserved member of PERF_SAMPLE_CPU is zero in perf_event__synthesize_sample() Adrian Hunter
2018-01-24 11:19 ` [tip:perf/core] perf evsel: " tip-bot for Adrian Hunter
2018-01-16 13:14 ` [PATCH 3/3] perf tools: Get rid of unused 'swapped' parameter from perf_event__synthesize_sample() Adrian Hunter
2018-01-24 11:20 ` [tip:perf/core] " tip-bot for Adrian Hunter
2018-01-18 9:37 ` [PATCH 0/3] " Jiri Olsa
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.