diff options
Diffstat (limited to 'tools/perf')
-rw-r--r-- | tools/perf/util/event.c | 23 | ||||
-rw-r--r-- | tools/perf/util/intel-bts.c | 1 | ||||
-rw-r--r-- | tools/perf/util/intel-pt.c | 3 | ||||
-rw-r--r-- | tools/perf/util/jitdump.c | 2 |
4 files changed, 22 insertions, 7 deletions
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c index 52cf479bc593..dad55d04ffdd 100644 --- a/tools/perf/util/event.c +++ b/tools/perf/util/event.c | |||
@@ -56,13 +56,22 @@ const char *perf_event__name(unsigned int id) | |||
56 | return perf_event__names[id]; | 56 | return perf_event__names[id]; |
57 | } | 57 | } |
58 | 58 | ||
59 | static struct perf_sample synth_sample = { | 59 | static int perf_tool__process_synth_event(struct perf_tool *tool, |
60 | union perf_event *event, | ||
61 | struct machine *machine, | ||
62 | perf_event__handler_t process) | ||
63 | { | ||
64 | struct perf_sample synth_sample = { | ||
60 | .pid = -1, | 65 | .pid = -1, |
61 | .tid = -1, | 66 | .tid = -1, |
62 | .time = -1, | 67 | .time = -1, |
63 | .stream_id = -1, | 68 | .stream_id = -1, |
64 | .cpu = -1, | 69 | .cpu = -1, |
65 | .period = 1, | 70 | .period = 1, |
71 | .cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK, | ||
72 | }; | ||
73 | |||
74 | return process(tool, event, &synth_sample, machine); | ||
66 | }; | 75 | }; |
67 | 76 | ||
68 | /* | 77 | /* |
@@ -186,7 +195,7 @@ pid_t perf_event__synthesize_comm(struct perf_tool *tool, | |||
186 | if (perf_event__prepare_comm(event, pid, machine, &tgid, &ppid) != 0) | 195 | if (perf_event__prepare_comm(event, pid, machine, &tgid, &ppid) != 0) |
187 | return -1; | 196 | return -1; |
188 | 197 | ||
189 | if (process(tool, event, &synth_sample, machine) != 0) | 198 | if (perf_tool__process_synth_event(tool, event, machine, process) != 0) |
190 | return -1; | 199 | return -1; |
191 | 200 | ||
192 | return tgid; | 201 | return tgid; |
@@ -218,7 +227,7 @@ static int perf_event__synthesize_fork(struct perf_tool *tool, | |||
218 | 227 | ||
219 | event->fork.header.size = (sizeof(event->fork) + machine->id_hdr_size); | 228 | event->fork.header.size = (sizeof(event->fork) + machine->id_hdr_size); |
220 | 229 | ||
221 | if (process(tool, event, &synth_sample, machine) != 0) | 230 | if (perf_tool__process_synth_event(tool, event, machine, process) != 0) |
222 | return -1; | 231 | return -1; |
223 | 232 | ||
224 | return 0; | 233 | return 0; |
@@ -344,7 +353,7 @@ out: | |||
344 | event->mmap2.pid = tgid; | 353 | event->mmap2.pid = tgid; |
345 | event->mmap2.tid = pid; | 354 | event->mmap2.tid = pid; |
346 | 355 | ||
347 | if (process(tool, event, &synth_sample, machine) != 0) { | 356 | if (perf_tool__process_synth_event(tool, event, machine, process) != 0) { |
348 | rc = -1; | 357 | rc = -1; |
349 | break; | 358 | break; |
350 | } | 359 | } |
@@ -402,7 +411,7 @@ int perf_event__synthesize_modules(struct perf_tool *tool, | |||
402 | 411 | ||
403 | memcpy(event->mmap.filename, pos->dso->long_name, | 412 | memcpy(event->mmap.filename, pos->dso->long_name, |
404 | pos->dso->long_name_len + 1); | 413 | pos->dso->long_name_len + 1); |
405 | if (process(tool, event, &synth_sample, machine) != 0) { | 414 | if (perf_tool__process_synth_event(tool, event, machine, process) != 0) { |
406 | rc = -1; | 415 | rc = -1; |
407 | break; | 416 | break; |
408 | } | 417 | } |
@@ -472,7 +481,7 @@ static int __event__synthesize_thread(union perf_event *comm_event, | |||
472 | /* | 481 | /* |
473 | * Send the prepared comm event | 482 | * Send the prepared comm event |
474 | */ | 483 | */ |
475 | if (process(tool, comm_event, &synth_sample, machine) != 0) | 484 | if (perf_tool__process_synth_event(tool, comm_event, machine, process) != 0) |
476 | break; | 485 | break; |
477 | 486 | ||
478 | rc = 0; | 487 | rc = 0; |
@@ -701,7 +710,7 @@ int perf_event__synthesize_kernel_mmap(struct perf_tool *tool, | |||
701 | event->mmap.len = map->end - event->mmap.start; | 710 | event->mmap.len = map->end - event->mmap.start; |
702 | event->mmap.pid = machine->pid; | 711 | event->mmap.pid = machine->pid; |
703 | 712 | ||
704 | err = process(tool, event, &synth_sample, machine); | 713 | err = perf_tool__process_synth_event(tool, event, machine, process); |
705 | free(event); | 714 | free(event); |
706 | 715 | ||
707 | return err; | 716 | return err; |
diff --git a/tools/perf/util/intel-bts.c b/tools/perf/util/intel-bts.c index 6bc3ecd2e7ca..abf1366e2a24 100644 --- a/tools/perf/util/intel-bts.c +++ b/tools/perf/util/intel-bts.c | |||
@@ -279,6 +279,7 @@ static int intel_bts_synth_branch_sample(struct intel_bts_queue *btsq, | |||
279 | event.sample.header.misc = PERF_RECORD_MISC_USER; | 279 | event.sample.header.misc = PERF_RECORD_MISC_USER; |
280 | event.sample.header.size = sizeof(struct perf_event_header); | 280 | event.sample.header.size = sizeof(struct perf_event_header); |
281 | 281 | ||
282 | sample.cpumode = PERF_RECORD_MISC_USER; | ||
282 | sample.ip = le64_to_cpu(branch->from); | 283 | sample.ip = le64_to_cpu(branch->from); |
283 | sample.pid = btsq->pid; | 284 | sample.pid = btsq->pid; |
284 | sample.tid = btsq->tid; | 285 | sample.tid = btsq->tid; |
diff --git a/tools/perf/util/intel-pt.c b/tools/perf/util/intel-pt.c index 05d815851be1..407f11b97c8d 100644 --- a/tools/perf/util/intel-pt.c +++ b/tools/perf/util/intel-pt.c | |||
@@ -979,6 +979,7 @@ static int intel_pt_synth_branch_sample(struct intel_pt_queue *ptq) | |||
979 | if (!pt->timeless_decoding) | 979 | if (!pt->timeless_decoding) |
980 | sample.time = tsc_to_perf_time(ptq->timestamp, &pt->tc); | 980 | sample.time = tsc_to_perf_time(ptq->timestamp, &pt->tc); |
981 | 981 | ||
982 | sample.cpumode = PERF_RECORD_MISC_USER; | ||
982 | sample.ip = ptq->state->from_ip; | 983 | sample.ip = ptq->state->from_ip; |
983 | sample.pid = ptq->pid; | 984 | sample.pid = ptq->pid; |
984 | sample.tid = ptq->tid; | 985 | sample.tid = ptq->tid; |
@@ -1035,6 +1036,7 @@ static int intel_pt_synth_instruction_sample(struct intel_pt_queue *ptq) | |||
1035 | if (!pt->timeless_decoding) | 1036 | if (!pt->timeless_decoding) |
1036 | sample.time = tsc_to_perf_time(ptq->timestamp, &pt->tc); | 1037 | sample.time = tsc_to_perf_time(ptq->timestamp, &pt->tc); |
1037 | 1038 | ||
1039 | sample.cpumode = PERF_RECORD_MISC_USER; | ||
1038 | sample.ip = ptq->state->from_ip; | 1040 | sample.ip = ptq->state->from_ip; |
1039 | sample.pid = ptq->pid; | 1041 | sample.pid = ptq->pid; |
1040 | sample.tid = ptq->tid; | 1042 | sample.tid = ptq->tid; |
@@ -1092,6 +1094,7 @@ static int intel_pt_synth_transaction_sample(struct intel_pt_queue *ptq) | |||
1092 | if (!pt->timeless_decoding) | 1094 | if (!pt->timeless_decoding) |
1093 | sample.time = tsc_to_perf_time(ptq->timestamp, &pt->tc); | 1095 | sample.time = tsc_to_perf_time(ptq->timestamp, &pt->tc); |
1094 | 1096 | ||
1097 | sample.cpumode = PERF_RECORD_MISC_USER; | ||
1095 | sample.ip = ptq->state->from_ip; | 1098 | sample.ip = ptq->state->from_ip; |
1096 | sample.pid = ptq->pid; | 1099 | sample.pid = ptq->pid; |
1097 | sample.tid = ptq->tid; | 1100 | sample.tid = ptq->tid; |
diff --git a/tools/perf/util/jitdump.c b/tools/perf/util/jitdump.c index cd272cc21e05..ad0c0bb1fbc7 100644 --- a/tools/perf/util/jitdump.c +++ b/tools/perf/util/jitdump.c | |||
@@ -417,6 +417,7 @@ static int jit_repipe_code_load(struct jit_buf_desc *jd, union jr_entry *jr) | |||
417 | * use first address as sample address | 417 | * use first address as sample address |
418 | */ | 418 | */ |
419 | memset(&sample, 0, sizeof(sample)); | 419 | memset(&sample, 0, sizeof(sample)); |
420 | sample.cpumode = PERF_RECORD_MISC_USER; | ||
420 | sample.pid = pid; | 421 | sample.pid = pid; |
421 | sample.tid = tid; | 422 | sample.tid = tid; |
422 | sample.time = id->time; | 423 | sample.time = id->time; |
@@ -505,6 +506,7 @@ static int jit_repipe_code_move(struct jit_buf_desc *jd, union jr_entry *jr) | |||
505 | * use first address as sample address | 506 | * use first address as sample address |
506 | */ | 507 | */ |
507 | memset(&sample, 0, sizeof(sample)); | 508 | memset(&sample, 0, sizeof(sample)); |
509 | sample.cpumode = PERF_RECORD_MISC_USER; | ||
508 | sample.pid = pid; | 510 | sample.pid = pid; |
509 | sample.tid = tid; | 511 | sample.tid = tid; |
510 | sample.time = id->time; | 512 | sample.time = id->time; |