aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/event.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/event.c')
-rw-r--r--tools/perf/util/event.c54
1 files changed, 27 insertions, 27 deletions
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index 0cdc811c48e2..0ebbe7641335 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -43,7 +43,7 @@ static struct perf_sample synth_sample = {
43 .period = 1, 43 .period = 1,
44}; 44};
45 45
46static pid_t perf_event__synthesize_comm(struct perf_event_ops *ops, 46static pid_t perf_event__synthesize_comm(struct perf_tool *tool,
47 union perf_event *event, pid_t pid, 47 union perf_event *event, pid_t pid,
48 int full, perf_event__handler_t process, 48 int full, perf_event__handler_t process,
49 struct machine *machine) 49 struct machine *machine)
@@ -99,7 +99,7 @@ out_race:
99 if (!full) { 99 if (!full) {
100 event->comm.tid = pid; 100 event->comm.tid = pid;
101 101
102 process(ops, event, &synth_sample, machine); 102 process(tool, event, &synth_sample, machine);
103 goto out; 103 goto out;
104 } 104 }
105 105
@@ -117,7 +117,7 @@ out_race:
117 117
118 event->comm.tid = pid; 118 event->comm.tid = pid;
119 119
120 process(ops, event, &synth_sample, machine); 120 process(tool, event, &synth_sample, machine);
121 } 121 }
122 122
123 closedir(tasks); 123 closedir(tasks);
@@ -127,7 +127,7 @@ out:
127 return tgid; 127 return tgid;
128} 128}
129 129
130static int perf_event__synthesize_mmap_events(struct perf_event_ops *ops, 130static int perf_event__synthesize_mmap_events(struct perf_tool *tool,
131 union perf_event *event, 131 union perf_event *event,
132 pid_t pid, pid_t tgid, 132 pid_t pid, pid_t tgid,
133 perf_event__handler_t process, 133 perf_event__handler_t process,
@@ -199,7 +199,7 @@ static int perf_event__synthesize_mmap_events(struct perf_event_ops *ops,
199 event->mmap.pid = tgid; 199 event->mmap.pid = tgid;
200 event->mmap.tid = pid; 200 event->mmap.tid = pid;
201 201
202 process(ops, event, &synth_sample, machine); 202 process(tool, event, &synth_sample, machine);
203 } 203 }
204 } 204 }
205 205
@@ -207,7 +207,7 @@ static int perf_event__synthesize_mmap_events(struct perf_event_ops *ops,
207 return 0; 207 return 0;
208} 208}
209 209
210int perf_event__synthesize_modules(struct perf_event_ops *ops, 210int perf_event__synthesize_modules(struct perf_tool *tool,
211 perf_event__handler_t process, 211 perf_event__handler_t process,
212 struct machine *machine) 212 struct machine *machine)
213{ 213{
@@ -252,7 +252,7 @@ int perf_event__synthesize_modules(struct perf_event_ops *ops,
252 252
253 memcpy(event->mmap.filename, pos->dso->long_name, 253 memcpy(event->mmap.filename, pos->dso->long_name,
254 pos->dso->long_name_len + 1); 254 pos->dso->long_name_len + 1);
255 process(ops, event, &synth_sample, machine); 255 process(tool, event, &synth_sample, machine);
256 } 256 }
257 257
258 free(event); 258 free(event);
@@ -262,18 +262,18 @@ int perf_event__synthesize_modules(struct perf_event_ops *ops,
262static int __event__synthesize_thread(union perf_event *comm_event, 262static int __event__synthesize_thread(union perf_event *comm_event,
263 union perf_event *mmap_event, 263 union perf_event *mmap_event,
264 pid_t pid, perf_event__handler_t process, 264 pid_t pid, perf_event__handler_t process,
265 struct perf_event_ops *ops, 265 struct perf_tool *tool,
266 struct machine *machine) 266 struct machine *machine)
267{ 267{
268 pid_t tgid = perf_event__synthesize_comm(ops, comm_event, pid, 1, 268 pid_t tgid = perf_event__synthesize_comm(tool, comm_event, pid, 1,
269 process, machine); 269 process, machine);
270 if (tgid == -1) 270 if (tgid == -1)
271 return -1; 271 return -1;
272 return perf_event__synthesize_mmap_events(ops, mmap_event, pid, tgid, 272 return perf_event__synthesize_mmap_events(tool, mmap_event, pid, tgid,
273 process, machine); 273 process, machine);
274} 274}
275 275
276int perf_event__synthesize_thread_map(struct perf_event_ops *ops, 276int perf_event__synthesize_thread_map(struct perf_tool *tool,
277 struct thread_map *threads, 277 struct thread_map *threads,
278 perf_event__handler_t process, 278 perf_event__handler_t process,
279 struct machine *machine) 279 struct machine *machine)
@@ -293,7 +293,7 @@ int perf_event__synthesize_thread_map(struct perf_event_ops *ops,
293 for (thread = 0; thread < threads->nr; ++thread) { 293 for (thread = 0; thread < threads->nr; ++thread) {
294 if (__event__synthesize_thread(comm_event, mmap_event, 294 if (__event__synthesize_thread(comm_event, mmap_event,
295 threads->map[thread], 295 threads->map[thread],
296 process, ops, machine)) { 296 process, tool, machine)) {
297 err = -1; 297 err = -1;
298 break; 298 break;
299 } 299 }
@@ -305,7 +305,7 @@ out:
305 return err; 305 return err;
306} 306}
307 307
308int perf_event__synthesize_threads(struct perf_event_ops *ops, 308int perf_event__synthesize_threads(struct perf_tool *tool,
309 perf_event__handler_t process, 309 perf_event__handler_t process,
310 struct machine *machine) 310 struct machine *machine)
311{ 311{
@@ -334,7 +334,7 @@ int perf_event__synthesize_threads(struct perf_event_ops *ops,
334 continue; 334 continue;
335 335
336 __event__synthesize_thread(comm_event, mmap_event, pid, 336 __event__synthesize_thread(comm_event, mmap_event, pid,
337 process, ops, machine); 337 process, tool, machine);
338 } 338 }
339 339
340 closedir(proc); 340 closedir(proc);
@@ -369,7 +369,7 @@ static int find_symbol_cb(void *arg, const char *name, char type,
369 return 1; 369 return 1;
370} 370}
371 371
372int perf_event__synthesize_kernel_mmap(struct perf_event_ops *ops, 372int perf_event__synthesize_kernel_mmap(struct perf_tool *tool,
373 perf_event__handler_t process, 373 perf_event__handler_t process,
374 struct machine *machine, 374 struct machine *machine,
375 const char *symbol_name) 375 const char *symbol_name)
@@ -427,13 +427,13 @@ int perf_event__synthesize_kernel_mmap(struct perf_event_ops *ops,
427 event->mmap.len = map->end - event->mmap.start; 427 event->mmap.len = map->end - event->mmap.start;
428 event->mmap.pid = machine->pid; 428 event->mmap.pid = machine->pid;
429 429
430 err = process(ops, event, &synth_sample, machine); 430 err = process(tool, event, &synth_sample, machine);
431 free(event); 431 free(event);
432 432
433 return err; 433 return err;
434} 434}
435 435
436int perf_event__process_comm(struct perf_event_ops *ops __used, 436int perf_event__process_comm(struct perf_tool *tool __used,
437 union perf_event *event, 437 union perf_event *event,
438 struct perf_sample *sample __used, 438 struct perf_sample *sample __used,
439 struct machine *machine) 439 struct machine *machine)
@@ -450,7 +450,7 @@ int perf_event__process_comm(struct perf_event_ops *ops __used,
450 return 0; 450 return 0;
451} 451}
452 452
453int perf_event__process_lost(struct perf_event_ops *ops __used, 453int perf_event__process_lost(struct perf_tool *tool __used,
454 union perf_event *event, 454 union perf_event *event,
455 struct perf_sample *sample __used, 455 struct perf_sample *sample __used,
456 struct machine *machine __used) 456 struct machine *machine __used)
@@ -473,7 +473,7 @@ static void perf_event__set_kernel_mmap_len(union perf_event *event,
473 maps[MAP__FUNCTION]->end = ~0ULL; 473 maps[MAP__FUNCTION]->end = ~0ULL;
474} 474}
475 475
476static int perf_event__process_kernel_mmap(struct perf_event_ops *ops __used, 476static int perf_event__process_kernel_mmap(struct perf_tool *tool __used,
477 union perf_event *event, 477 union perf_event *event,
478 struct machine *machine) 478 struct machine *machine)
479{ 479{
@@ -566,7 +566,7 @@ out_problem:
566 return -1; 566 return -1;
567} 567}
568 568
569int perf_event__process_mmap(struct perf_event_ops *ops, 569int perf_event__process_mmap(struct perf_tool *tool,
570 union perf_event *event, 570 union perf_event *event,
571 struct perf_sample *sample __used, 571 struct perf_sample *sample __used,
572 struct machine *machine) 572 struct machine *machine)
@@ -582,7 +582,7 @@ int perf_event__process_mmap(struct perf_event_ops *ops,
582 582
583 if (cpumode == PERF_RECORD_MISC_GUEST_KERNEL || 583 if (cpumode == PERF_RECORD_MISC_GUEST_KERNEL ||
584 cpumode == PERF_RECORD_MISC_KERNEL) { 584 cpumode == PERF_RECORD_MISC_KERNEL) {
585 ret = perf_event__process_kernel_mmap(ops, event, machine); 585 ret = perf_event__process_kernel_mmap(tool, event, machine);
586 if (ret < 0) 586 if (ret < 0)
587 goto out_problem; 587 goto out_problem;
588 return 0; 588 return 0;
@@ -606,7 +606,7 @@ out_problem:
606 return 0; 606 return 0;
607} 607}
608 608
609int perf_event__process_task(struct perf_event_ops *ops __used, 609int perf_event__process_task(struct perf_tool *tool __used,
610 union perf_event *event, 610 union perf_event *event,
611 struct perf_sample *sample __used, 611 struct perf_sample *sample __used,
612 struct machine *machine) 612 struct machine *machine)
@@ -631,22 +631,22 @@ int perf_event__process_task(struct perf_event_ops *ops __used,
631 return 0; 631 return 0;
632} 632}
633 633
634int perf_event__process(struct perf_event_ops *ops, union perf_event *event, 634int perf_event__process(struct perf_tool *tool, union perf_event *event,
635 struct perf_sample *sample, struct machine *machine) 635 struct perf_sample *sample, struct machine *machine)
636{ 636{
637 switch (event->header.type) { 637 switch (event->header.type) {
638 case PERF_RECORD_COMM: 638 case PERF_RECORD_COMM:
639 perf_event__process_comm(ops, event, sample, machine); 639 perf_event__process_comm(tool, event, sample, machine);
640 break; 640 break;
641 case PERF_RECORD_MMAP: 641 case PERF_RECORD_MMAP:
642 perf_event__process_mmap(ops, event, sample, machine); 642 perf_event__process_mmap(tool, event, sample, machine);
643 break; 643 break;
644 case PERF_RECORD_FORK: 644 case PERF_RECORD_FORK:
645 case PERF_RECORD_EXIT: 645 case PERF_RECORD_EXIT:
646 perf_event__process_task(ops, event, sample, machine); 646 perf_event__process_task(tool, event, sample, machine);
647 break; 647 break;
648 case PERF_RECORD_LOST: 648 case PERF_RECORD_LOST:
649 perf_event__process_lost(ops, event, sample, machine); 649 perf_event__process_lost(tool, event, sample, machine);
650 default: 650 default:
651 break; 651 break;
652 } 652 }