diff options
Diffstat (limited to 'tools/perf/builtin-inject.c')
-rw-r--r-- | tools/perf/builtin-inject.c | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c index f4591a1438b4..c14f40b858bc 100644 --- a/tools/perf/builtin-inject.c +++ b/tools/perf/builtin-inject.c | |||
@@ -8,8 +8,8 @@ | |||
8 | */ | 8 | */ |
9 | #include "builtin.h" | 9 | #include "builtin.h" |
10 | 10 | ||
11 | #include "perf.h" | ||
12 | #include "util/color.h" | 11 | #include "util/color.h" |
12 | #include "util/dso.h" | ||
13 | #include "util/evlist.h" | 13 | #include "util/evlist.h" |
14 | #include "util/evsel.h" | 14 | #include "util/evsel.h" |
15 | #include "util/map.h" | 15 | #include "util/map.h" |
@@ -96,7 +96,7 @@ static int perf_event__repipe_op2_synth(struct perf_session *session, | |||
96 | 96 | ||
97 | static int perf_event__repipe_attr(struct perf_tool *tool, | 97 | static int perf_event__repipe_attr(struct perf_tool *tool, |
98 | union perf_event *event, | 98 | union perf_event *event, |
99 | struct perf_evlist **pevlist) | 99 | struct evlist **pevlist) |
100 | { | 100 | { |
101 | struct perf_inject *inject = container_of(tool, struct perf_inject, | 101 | struct perf_inject *inject = container_of(tool, struct perf_inject, |
102 | tool); | 102 | tool); |
@@ -215,13 +215,13 @@ static int perf_event__drop_aux(struct perf_tool *tool, | |||
215 | typedef int (*inject_handler)(struct perf_tool *tool, | 215 | typedef int (*inject_handler)(struct perf_tool *tool, |
216 | union perf_event *event, | 216 | union perf_event *event, |
217 | struct perf_sample *sample, | 217 | struct perf_sample *sample, |
218 | struct perf_evsel *evsel, | 218 | struct evsel *evsel, |
219 | struct machine *machine); | 219 | struct machine *machine); |
220 | 220 | ||
221 | static int perf_event__repipe_sample(struct perf_tool *tool, | 221 | static int perf_event__repipe_sample(struct perf_tool *tool, |
222 | union perf_event *event, | 222 | union perf_event *event, |
223 | struct perf_sample *sample, | 223 | struct perf_sample *sample, |
224 | struct perf_evsel *evsel, | 224 | struct evsel *evsel, |
225 | struct machine *machine) | 225 | struct machine *machine) |
226 | { | 226 | { |
227 | if (evsel && evsel->handler) { | 227 | if (evsel && evsel->handler) { |
@@ -424,7 +424,7 @@ static int dso__inject_build_id(struct dso *dso, struct perf_tool *tool, | |||
424 | static int perf_event__inject_buildid(struct perf_tool *tool, | 424 | static int perf_event__inject_buildid(struct perf_tool *tool, |
425 | union perf_event *event, | 425 | union perf_event *event, |
426 | struct perf_sample *sample, | 426 | struct perf_sample *sample, |
427 | struct perf_evsel *evsel __maybe_unused, | 427 | struct evsel *evsel __maybe_unused, |
428 | struct machine *machine) | 428 | struct machine *machine) |
429 | { | 429 | { |
430 | struct addr_location al; | 430 | struct addr_location al; |
@@ -465,7 +465,7 @@ repipe: | |||
465 | static int perf_inject__sched_process_exit(struct perf_tool *tool, | 465 | static int perf_inject__sched_process_exit(struct perf_tool *tool, |
466 | union perf_event *event __maybe_unused, | 466 | union perf_event *event __maybe_unused, |
467 | struct perf_sample *sample, | 467 | struct perf_sample *sample, |
468 | struct perf_evsel *evsel __maybe_unused, | 468 | struct evsel *evsel __maybe_unused, |
469 | struct machine *machine __maybe_unused) | 469 | struct machine *machine __maybe_unused) |
470 | { | 470 | { |
471 | struct perf_inject *inject = container_of(tool, struct perf_inject, tool); | 471 | struct perf_inject *inject = container_of(tool, struct perf_inject, tool); |
@@ -485,7 +485,7 @@ static int perf_inject__sched_process_exit(struct perf_tool *tool, | |||
485 | static int perf_inject__sched_switch(struct perf_tool *tool, | 485 | static int perf_inject__sched_switch(struct perf_tool *tool, |
486 | union perf_event *event, | 486 | union perf_event *event, |
487 | struct perf_sample *sample, | 487 | struct perf_sample *sample, |
488 | struct perf_evsel *evsel, | 488 | struct evsel *evsel, |
489 | struct machine *machine) | 489 | struct machine *machine) |
490 | { | 490 | { |
491 | struct perf_inject *inject = container_of(tool, struct perf_inject, tool); | 491 | struct perf_inject *inject = container_of(tool, struct perf_inject, tool); |
@@ -509,7 +509,7 @@ static int perf_inject__sched_switch(struct perf_tool *tool, | |||
509 | static int perf_inject__sched_stat(struct perf_tool *tool, | 509 | static int perf_inject__sched_stat(struct perf_tool *tool, |
510 | union perf_event *event __maybe_unused, | 510 | union perf_event *event __maybe_unused, |
511 | struct perf_sample *sample, | 511 | struct perf_sample *sample, |
512 | struct perf_evsel *evsel, | 512 | struct evsel *evsel, |
513 | struct machine *machine) | 513 | struct machine *machine) |
514 | { | 514 | { |
515 | struct event_entry *ent; | 515 | struct event_entry *ent; |
@@ -530,8 +530,8 @@ found: | |||
530 | 530 | ||
531 | sample_sw.period = sample->period; | 531 | sample_sw.period = sample->period; |
532 | sample_sw.time = sample->time; | 532 | sample_sw.time = sample->time; |
533 | perf_event__synthesize_sample(event_sw, evsel->attr.sample_type, | 533 | perf_event__synthesize_sample(event_sw, evsel->core.attr.sample_type, |
534 | evsel->attr.read_format, &sample_sw); | 534 | evsel->core.attr.read_format, &sample_sw); |
535 | build_id__mark_dso_hit(tool, event_sw, &sample_sw, evsel, machine); | 535 | build_id__mark_dso_hit(tool, event_sw, &sample_sw, evsel, machine); |
536 | return perf_event__repipe(tool, event_sw, &sample_sw, machine); | 536 | return perf_event__repipe(tool, event_sw, &sample_sw, machine); |
537 | } | 537 | } |
@@ -541,10 +541,10 @@ static void sig_handler(int sig __maybe_unused) | |||
541 | session_done = 1; | 541 | session_done = 1; |
542 | } | 542 | } |
543 | 543 | ||
544 | static int perf_evsel__check_stype(struct perf_evsel *evsel, | 544 | static int perf_evsel__check_stype(struct evsel *evsel, |
545 | u64 sample_type, const char *sample_msg) | 545 | u64 sample_type, const char *sample_msg) |
546 | { | 546 | { |
547 | struct perf_event_attr *attr = &evsel->attr; | 547 | struct perf_event_attr *attr = &evsel->core.attr; |
548 | const char *name = perf_evsel__name(evsel); | 548 | const char *name = perf_evsel__name(evsel); |
549 | 549 | ||
550 | if (!(attr->sample_type & sample_type)) { | 550 | if (!(attr->sample_type & sample_type)) { |
@@ -559,7 +559,7 @@ static int perf_evsel__check_stype(struct perf_evsel *evsel, | |||
559 | static int drop_sample(struct perf_tool *tool __maybe_unused, | 559 | static int drop_sample(struct perf_tool *tool __maybe_unused, |
560 | union perf_event *event __maybe_unused, | 560 | union perf_event *event __maybe_unused, |
561 | struct perf_sample *sample __maybe_unused, | 561 | struct perf_sample *sample __maybe_unused, |
562 | struct perf_evsel *evsel __maybe_unused, | 562 | struct evsel *evsel __maybe_unused, |
563 | struct machine *machine __maybe_unused) | 563 | struct machine *machine __maybe_unused) |
564 | { | 564 | { |
565 | return 0; | 565 | return 0; |
@@ -567,8 +567,8 @@ static int drop_sample(struct perf_tool *tool __maybe_unused, | |||
567 | 567 | ||
568 | static void strip_init(struct perf_inject *inject) | 568 | static void strip_init(struct perf_inject *inject) |
569 | { | 569 | { |
570 | struct perf_evlist *evlist = inject->session->evlist; | 570 | struct evlist *evlist = inject->session->evlist; |
571 | struct perf_evsel *evsel; | 571 | struct evsel *evsel; |
572 | 572 | ||
573 | inject->tool.context_switch = perf_event__drop; | 573 | inject->tool.context_switch = perf_event__drop; |
574 | 574 | ||
@@ -576,10 +576,10 @@ static void strip_init(struct perf_inject *inject) | |||
576 | evsel->handler = drop_sample; | 576 | evsel->handler = drop_sample; |
577 | } | 577 | } |
578 | 578 | ||
579 | static bool has_tracking(struct perf_evsel *evsel) | 579 | static bool has_tracking(struct evsel *evsel) |
580 | { | 580 | { |
581 | return evsel->attr.mmap || evsel->attr.mmap2 || evsel->attr.comm || | 581 | return evsel->core.attr.mmap || evsel->core.attr.mmap2 || evsel->core.attr.comm || |
582 | evsel->attr.task; | 582 | evsel->core.attr.task; |
583 | } | 583 | } |
584 | 584 | ||
585 | #define COMPAT_MASK (PERF_SAMPLE_ID | PERF_SAMPLE_TID | PERF_SAMPLE_TIME | \ | 585 | #define COMPAT_MASK (PERF_SAMPLE_ID | PERF_SAMPLE_TID | PERF_SAMPLE_TIME | \ |
@@ -590,10 +590,10 @@ static bool has_tracking(struct perf_evsel *evsel) | |||
590 | * their selected event to exist, except if there is only 1 selected event left | 590 | * their selected event to exist, except if there is only 1 selected event left |
591 | * and it has a compatible sample type. | 591 | * and it has a compatible sample type. |
592 | */ | 592 | */ |
593 | static bool ok_to_remove(struct perf_evlist *evlist, | 593 | static bool ok_to_remove(struct evlist *evlist, |
594 | struct perf_evsel *evsel_to_remove) | 594 | struct evsel *evsel_to_remove) |
595 | { | 595 | { |
596 | struct perf_evsel *evsel; | 596 | struct evsel *evsel; |
597 | int cnt = 0; | 597 | int cnt = 0; |
598 | bool ok = false; | 598 | bool ok = false; |
599 | 599 | ||
@@ -603,8 +603,8 @@ static bool ok_to_remove(struct perf_evlist *evlist, | |||
603 | evlist__for_each_entry(evlist, evsel) { | 603 | evlist__for_each_entry(evlist, evsel) { |
604 | if (evsel->handler != drop_sample) { | 604 | if (evsel->handler != drop_sample) { |
605 | cnt += 1; | 605 | cnt += 1; |
606 | if ((evsel->attr.sample_type & COMPAT_MASK) == | 606 | if ((evsel->core.attr.sample_type & COMPAT_MASK) == |
607 | (evsel_to_remove->attr.sample_type & COMPAT_MASK)) | 607 | (evsel_to_remove->core.attr.sample_type & COMPAT_MASK)) |
608 | ok = true; | 608 | ok = true; |
609 | } | 609 | } |
610 | } | 610 | } |
@@ -614,16 +614,16 @@ static bool ok_to_remove(struct perf_evlist *evlist, | |||
614 | 614 | ||
615 | static void strip_fini(struct perf_inject *inject) | 615 | static void strip_fini(struct perf_inject *inject) |
616 | { | 616 | { |
617 | struct perf_evlist *evlist = inject->session->evlist; | 617 | struct evlist *evlist = inject->session->evlist; |
618 | struct perf_evsel *evsel, *tmp; | 618 | struct evsel *evsel, *tmp; |
619 | 619 | ||
620 | /* Remove non-synthesized evsels if possible */ | 620 | /* Remove non-synthesized evsels if possible */ |
621 | evlist__for_each_entry_safe(evlist, tmp, evsel) { | 621 | evlist__for_each_entry_safe(evlist, tmp, evsel) { |
622 | if (evsel->handler == drop_sample && | 622 | if (evsel->handler == drop_sample && |
623 | ok_to_remove(evlist, evsel)) { | 623 | ok_to_remove(evlist, evsel)) { |
624 | pr_debug("Deleting %s\n", perf_evsel__name(evsel)); | 624 | pr_debug("Deleting %s\n", perf_evsel__name(evsel)); |
625 | perf_evlist__remove(evlist, evsel); | 625 | evlist__remove(evlist, evsel); |
626 | perf_evsel__delete(evsel); | 626 | evsel__delete(evsel); |
627 | } | 627 | } |
628 | } | 628 | } |
629 | } | 629 | } |
@@ -651,7 +651,7 @@ static int __cmd_inject(struct perf_inject *inject) | |||
651 | if (inject->build_ids) { | 651 | if (inject->build_ids) { |
652 | inject->tool.sample = perf_event__inject_buildid; | 652 | inject->tool.sample = perf_event__inject_buildid; |
653 | } else if (inject->sched_stat) { | 653 | } else if (inject->sched_stat) { |
654 | struct perf_evsel *evsel; | 654 | struct evsel *evsel; |
655 | 655 | ||
656 | evlist__for_each_entry(session->evlist, evsel) { | 656 | evlist__for_each_entry(session->evlist, evsel) { |
657 | const char *name = perf_evsel__name(evsel); | 657 | const char *name = perf_evsel__name(evsel); |
@@ -712,7 +712,7 @@ static int __cmd_inject(struct perf_inject *inject) | |||
712 | * remove the evsel. | 712 | * remove the evsel. |
713 | */ | 713 | */ |
714 | if (inject->itrace_synth_opts.set) { | 714 | if (inject->itrace_synth_opts.set) { |
715 | struct perf_evsel *evsel; | 715 | struct evsel *evsel; |
716 | 716 | ||
717 | perf_header__clear_feat(&session->header, | 717 | perf_header__clear_feat(&session->header, |
718 | HEADER_AUXTRACE); | 718 | HEADER_AUXTRACE); |
@@ -724,8 +724,8 @@ static int __cmd_inject(struct perf_inject *inject) | |||
724 | if (evsel) { | 724 | if (evsel) { |
725 | pr_debug("Deleting %s\n", | 725 | pr_debug("Deleting %s\n", |
726 | perf_evsel__name(evsel)); | 726 | perf_evsel__name(evsel)); |
727 | perf_evlist__remove(session->evlist, evsel); | 727 | evlist__remove(session->evlist, evsel); |
728 | perf_evsel__delete(evsel); | 728 | evsel__delete(evsel); |
729 | } | 729 | } |
730 | if (inject->strip) | 730 | if (inject->strip) |
731 | strip_fini(inject); | 731 | strip_fini(inject); |