perf tools: Get rid of unused 'swapped' parameter from perf_event__synthesize_sample()
authorAdrian Hunter <adrian.hunter@intel.com>
Tue, 16 Jan 2018 13:14:52 +0000 (15:14 +0200)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 18 Jan 2018 12:01:23 +0000 (09:01 -0300)
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
tools/perf/tests/sample-parsing.c
tools/perf/util/event.h
tools/perf/util/evsel.c
tools/perf/util/intel-bts.c
tools/perf/util/intel-pt.c

index 16a28547ca86864ae0fb32c16dc003a3aff62684..40fe919bbcf333cb0ba3ff7fccbe9bc5ac9ebbad 100644 (file)
@@ -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);
 }
index 3ec6302b6498c24ac7841ac1f7aa9a5d13654ee2..0e2d00d69e6e2c86df59948d826b9de669e0c567 100644 (file)
@@ -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);
index e5fbd6dd1b01cb8b227fc5f6fb699c20bc6532b2..0f794744919c0e947d09999d1cc7e685e6c42a81 100644 (file)
@@ -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,
index 44032679180fde5f9848f9bdac36d866f71ad145..66fa45198a11b3ab81ec3fedbb80e4109a3fe2a7 100644 (file)
@@ -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);
 
index 7077bebc2fb0dc0c60b2182c803eb136496d53e1..72db2744876d9a5993b8b58b9c4b9c5f7b397f2b 100644 (file)
@@ -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;
        }
index 2daf641beb85fbdc987fa57f540b87cad4904ff5..3773d9c54f45e60cc9e293f0a1622f660e416561 100644 (file)
@@ -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,