4 * Builtin inject command: Examine the live mode (stdin) event stream
5 * and repipe it to stdout while optionally injecting additional
11 #include "util/color.h"
12 #include "util/evlist.h"
13 #include "util/evsel.h"
14 #include "util/session.h"
15 #include "util/tool.h"
16 #include "util/debug.h"
17 #include "util/build-id.h"
18 #include "util/data.h"
19 #include "util/auxtrace.h"
22 #include <subcmd/parse-options.h>
24 #include <linux/list.h>
27 struct perf_tool tool
;
28 struct perf_session
*session
;
34 const char *input_name
;
35 struct perf_data_file output
;
38 struct list_head samples
;
39 struct itrace_synth_opts itrace_synth_opts
;
43 struct list_head node
;
45 union perf_event event
[0];
48 static int output_bytes(struct perf_inject
*inject
, void *buf
, size_t sz
)
52 size
= perf_data_file__write(&inject
->output
, buf
, sz
);
56 inject
->bytes_written
+= size
;
60 static int perf_event__repipe_synth(struct perf_tool
*tool
,
61 union perf_event
*event
)
63 struct perf_inject
*inject
= container_of(tool
, struct perf_inject
,
66 return output_bytes(inject
, event
, event
->header
.size
);
69 static int perf_event__repipe_oe_synth(struct perf_tool
*tool
,
70 union perf_event
*event
,
71 struct ordered_events
*oe __maybe_unused
)
73 return perf_event__repipe_synth(tool
, event
);
76 #ifdef HAVE_LIBELF_SUPPORT
77 static int perf_event__drop_oe(struct perf_tool
*tool __maybe_unused
,
78 union perf_event
*event __maybe_unused
,
79 struct ordered_events
*oe __maybe_unused
)
85 static int perf_event__repipe_op2_synth(struct perf_tool
*tool
,
86 union perf_event
*event
,
87 struct perf_session
*session
90 return perf_event__repipe_synth(tool
, event
);
93 static int perf_event__repipe_attr(struct perf_tool
*tool
,
94 union perf_event
*event
,
95 struct perf_evlist
**pevlist
)
97 struct perf_inject
*inject
= container_of(tool
, struct perf_inject
,
101 ret
= perf_event__process_attr(tool
, event
, pevlist
);
105 if (!inject
->output
.is_pipe
)
108 return perf_event__repipe_synth(tool
, event
);
111 #ifdef HAVE_AUXTRACE_SUPPORT
113 static int copy_bytes(struct perf_inject
*inject
, int fd
, off_t size
)
120 ssz
= read(fd
, buf
, min(size
, (off_t
)sizeof(buf
)));
123 ret
= output_bytes(inject
, buf
, ssz
);
132 static s64
perf_event__repipe_auxtrace(struct perf_tool
*tool
,
133 union perf_event
*event
,
134 struct perf_session
*session
137 struct perf_inject
*inject
= container_of(tool
, struct perf_inject
,
141 inject
->have_auxtrace
= true;
143 if (!inject
->output
.is_pipe
) {
146 offset
= lseek(inject
->output
.fd
, 0, SEEK_CUR
);
149 ret
= auxtrace_index__auxtrace_event(&session
->auxtrace_index
,
155 if (perf_data_file__is_pipe(session
->file
) || !session
->one_mmap
) {
156 ret
= output_bytes(inject
, event
, event
->header
.size
);
159 ret
= copy_bytes(inject
, perf_data_file__fd(session
->file
),
160 event
->auxtrace
.size
);
162 ret
= output_bytes(inject
, event
,
163 event
->header
.size
+ event
->auxtrace
.size
);
168 return event
->auxtrace
.size
;
174 perf_event__repipe_auxtrace(struct perf_tool
*tool __maybe_unused
,
175 union perf_event
*event __maybe_unused
,
176 struct perf_session
*session __maybe_unused
)
178 pr_err("AUX area tracing not supported\n");
184 static int perf_event__repipe(struct perf_tool
*tool
,
185 union perf_event
*event
,
186 struct perf_sample
*sample __maybe_unused
,
187 struct machine
*machine __maybe_unused
)
189 return perf_event__repipe_synth(tool
, event
);
192 static int perf_event__drop(struct perf_tool
*tool __maybe_unused
,
193 union perf_event
*event __maybe_unused
,
194 struct perf_sample
*sample __maybe_unused
,
195 struct machine
*machine __maybe_unused
)
200 static int perf_event__drop_aux(struct perf_tool
*tool
,
201 union perf_event
*event __maybe_unused
,
202 struct perf_sample
*sample
,
203 struct machine
*machine __maybe_unused
)
205 struct perf_inject
*inject
= container_of(tool
, struct perf_inject
, tool
);
208 inject
->aux_id
= sample
->id
;
213 typedef int (*inject_handler
)(struct perf_tool
*tool
,
214 union perf_event
*event
,
215 struct perf_sample
*sample
,
216 struct perf_evsel
*evsel
,
217 struct machine
*machine
);
219 static int perf_event__repipe_sample(struct perf_tool
*tool
,
220 union perf_event
*event
,
221 struct perf_sample
*sample
,
222 struct perf_evsel
*evsel
,
223 struct machine
*machine
)
225 if (evsel
->handler
) {
226 inject_handler f
= evsel
->handler
;
227 return f(tool
, event
, sample
, evsel
, machine
);
230 build_id__mark_dso_hit(tool
, event
, sample
, evsel
, machine
);
232 return perf_event__repipe_synth(tool
, event
);
235 static int perf_event__repipe_mmap(struct perf_tool
*tool
,
236 union perf_event
*event
,
237 struct perf_sample
*sample
,
238 struct machine
*machine
)
242 err
= perf_event__process_mmap(tool
, event
, sample
, machine
);
243 perf_event__repipe(tool
, event
, sample
, machine
);
248 #ifdef HAVE_LIBELF_SUPPORT
249 static int perf_event__jit_repipe_mmap(struct perf_tool
*tool
,
250 union perf_event
*event
,
251 struct perf_sample
*sample
,
252 struct machine
*machine
)
254 struct perf_inject
*inject
= container_of(tool
, struct perf_inject
, tool
);
259 * if jit marker, then inject jit mmaps and generate ELF images
261 ret
= jit_process(inject
->session
, &inject
->output
, machine
,
262 event
->mmap
.filename
, sample
->pid
, &n
);
266 inject
->bytes_written
+= n
;
269 return perf_event__repipe_mmap(tool
, event
, sample
, machine
);
273 static int perf_event__repipe_mmap2(struct perf_tool
*tool
,
274 union perf_event
*event
,
275 struct perf_sample
*sample
,
276 struct machine
*machine
)
280 err
= perf_event__process_mmap2(tool
, event
, sample
, machine
);
281 perf_event__repipe(tool
, event
, sample
, machine
);
286 #ifdef HAVE_LIBELF_SUPPORT
287 static int perf_event__jit_repipe_mmap2(struct perf_tool
*tool
,
288 union perf_event
*event
,
289 struct perf_sample
*sample
,
290 struct machine
*machine
)
292 struct perf_inject
*inject
= container_of(tool
, struct perf_inject
, tool
);
297 * if jit marker, then inject jit mmaps and generate ELF images
299 ret
= jit_process(inject
->session
, &inject
->output
, machine
,
300 event
->mmap2
.filename
, sample
->pid
, &n
);
304 inject
->bytes_written
+= n
;
307 return perf_event__repipe_mmap2(tool
, event
, sample
, machine
);
311 static int perf_event__repipe_fork(struct perf_tool
*tool
,
312 union perf_event
*event
,
313 struct perf_sample
*sample
,
314 struct machine
*machine
)
318 err
= perf_event__process_fork(tool
, event
, sample
, machine
);
319 perf_event__repipe(tool
, event
, sample
, machine
);
324 static int perf_event__repipe_comm(struct perf_tool
*tool
,
325 union perf_event
*event
,
326 struct perf_sample
*sample
,
327 struct machine
*machine
)
331 err
= perf_event__process_comm(tool
, event
, sample
, machine
);
332 perf_event__repipe(tool
, event
, sample
, machine
);
337 static int perf_event__repipe_exit(struct perf_tool
*tool
,
338 union perf_event
*event
,
339 struct perf_sample
*sample
,
340 struct machine
*machine
)
344 err
= perf_event__process_exit(tool
, event
, sample
, machine
);
345 perf_event__repipe(tool
, event
, sample
, machine
);
350 static int perf_event__repipe_tracing_data(struct perf_tool
*tool
,
351 union perf_event
*event
,
352 struct perf_session
*session
)
356 perf_event__repipe_synth(tool
, event
);
357 err
= perf_event__process_tracing_data(tool
, event
, session
);
362 static int perf_event__repipe_id_index(struct perf_tool
*tool
,
363 union perf_event
*event
,
364 struct perf_session
*session
)
368 perf_event__repipe_synth(tool
, event
);
369 err
= perf_event__process_id_index(tool
, event
, session
);
374 static int dso__read_build_id(struct dso
*dso
)
376 if (dso
->has_build_id
)
379 if (filename__read_build_id(dso
->long_name
, dso
->build_id
,
380 sizeof(dso
->build_id
)) > 0) {
381 dso
->has_build_id
= true;
388 static int dso__inject_build_id(struct dso
*dso
, struct perf_tool
*tool
,
389 struct machine
*machine
)
391 u16 misc
= PERF_RECORD_MISC_USER
;
394 if (dso__read_build_id(dso
) < 0) {
395 pr_debug("no build_id found for %s\n", dso
->long_name
);
400 misc
= PERF_RECORD_MISC_KERNEL
;
402 err
= perf_event__synthesize_build_id(tool
, dso
, misc
, perf_event__repipe
,
405 pr_err("Can't synthesize build_id event for %s\n", dso
->long_name
);
412 static int perf_event__inject_buildid(struct perf_tool
*tool
,
413 union perf_event
*event
,
414 struct perf_sample
*sample
,
415 struct perf_evsel
*evsel __maybe_unused
,
416 struct machine
*machine
)
418 struct addr_location al
;
419 struct thread
*thread
;
422 cpumode
= event
->header
.misc
& PERF_RECORD_MISC_CPUMODE_MASK
;
424 thread
= machine__findnew_thread(machine
, sample
->pid
, sample
->tid
);
425 if (thread
== NULL
) {
426 pr_err("problem processing %d event, skipping it.\n",
431 thread__find_addr_map(thread
, cpumode
, MAP__FUNCTION
, sample
->ip
, &al
);
433 if (al
.map
!= NULL
) {
434 if (!al
.map
->dso
->hit
) {
435 al
.map
->dso
->hit
= 1;
436 if (map__load(al
.map
, NULL
) >= 0) {
437 dso__inject_build_id(al
.map
->dso
, tool
, machine
);
439 * If this fails, too bad, let the other side
440 * account this as unresolved.
443 #ifdef HAVE_LIBELF_SUPPORT
444 pr_warning("no symbols found in %s, maybe "
445 "install a debug package?\n",
446 al
.map
->dso
->long_name
);
454 perf_event__repipe(tool
, event
, sample
, machine
);
458 static int perf_inject__sched_process_exit(struct perf_tool
*tool
,
459 union perf_event
*event __maybe_unused
,
460 struct perf_sample
*sample
,
461 struct perf_evsel
*evsel __maybe_unused
,
462 struct machine
*machine __maybe_unused
)
464 struct perf_inject
*inject
= container_of(tool
, struct perf_inject
, tool
);
465 struct event_entry
*ent
;
467 list_for_each_entry(ent
, &inject
->samples
, node
) {
468 if (sample
->tid
== ent
->tid
) {
469 list_del_init(&ent
->node
);
478 static int perf_inject__sched_switch(struct perf_tool
*tool
,
479 union perf_event
*event
,
480 struct perf_sample
*sample
,
481 struct perf_evsel
*evsel
,
482 struct machine
*machine
)
484 struct perf_inject
*inject
= container_of(tool
, struct perf_inject
, tool
);
485 struct event_entry
*ent
;
487 perf_inject__sched_process_exit(tool
, event
, sample
, evsel
, machine
);
489 ent
= malloc(event
->header
.size
+ sizeof(struct event_entry
));
491 color_fprintf(stderr
, PERF_COLOR_RED
,
492 "Not enough memory to process sched switch event!");
496 ent
->tid
= sample
->tid
;
497 memcpy(&ent
->event
, event
, event
->header
.size
);
498 list_add(&ent
->node
, &inject
->samples
);
502 static int perf_inject__sched_stat(struct perf_tool
*tool
,
503 union perf_event
*event __maybe_unused
,
504 struct perf_sample
*sample
,
505 struct perf_evsel
*evsel
,
506 struct machine
*machine
)
508 struct event_entry
*ent
;
509 union perf_event
*event_sw
;
510 struct perf_sample sample_sw
;
511 struct perf_inject
*inject
= container_of(tool
, struct perf_inject
, tool
);
512 u32 pid
= perf_evsel__intval(evsel
, sample
, "pid");
514 list_for_each_entry(ent
, &inject
->samples
, node
) {
521 event_sw
= &ent
->event
[0];
522 perf_evsel__parse_sample(evsel
, event_sw
, &sample_sw
);
524 sample_sw
.period
= sample
->period
;
525 sample_sw
.time
= sample
->time
;
526 perf_event__synthesize_sample(event_sw
, evsel
->attr
.sample_type
,
527 evsel
->attr
.read_format
, &sample_sw
,
529 build_id__mark_dso_hit(tool
, event_sw
, &sample_sw
, evsel
, machine
);
530 return perf_event__repipe(tool
, event_sw
, &sample_sw
, machine
);
533 static void sig_handler(int sig __maybe_unused
)
538 static int perf_evsel__check_stype(struct perf_evsel
*evsel
,
539 u64 sample_type
, const char *sample_msg
)
541 struct perf_event_attr
*attr
= &evsel
->attr
;
542 const char *name
= perf_evsel__name(evsel
);
544 if (!(attr
->sample_type
& sample_type
)) {
545 pr_err("Samples for %s event do not have %s attribute set.",
553 static int drop_sample(struct perf_tool
*tool __maybe_unused
,
554 union perf_event
*event __maybe_unused
,
555 struct perf_sample
*sample __maybe_unused
,
556 struct perf_evsel
*evsel __maybe_unused
,
557 struct machine
*machine __maybe_unused
)
562 static void strip_init(struct perf_inject
*inject
)
564 struct perf_evlist
*evlist
= inject
->session
->evlist
;
565 struct perf_evsel
*evsel
;
567 inject
->tool
.context_switch
= perf_event__drop
;
569 evlist__for_each(evlist
, evsel
)
570 evsel
->handler
= drop_sample
;
573 static bool has_tracking(struct perf_evsel
*evsel
)
575 return evsel
->attr
.mmap
|| evsel
->attr
.mmap2
|| evsel
->attr
.comm
||
579 #define COMPAT_MASK (PERF_SAMPLE_ID | PERF_SAMPLE_TID | PERF_SAMPLE_TIME | \
580 PERF_SAMPLE_ID | PERF_SAMPLE_CPU | PERF_SAMPLE_IDENTIFIER)
583 * In order that the perf.data file is parsable, tracking events like MMAP need
584 * their selected event to exist, except if there is only 1 selected event left
585 * and it has a compatible sample type.
587 static bool ok_to_remove(struct perf_evlist
*evlist
,
588 struct perf_evsel
*evsel_to_remove
)
590 struct perf_evsel
*evsel
;
594 if (!has_tracking(evsel_to_remove
))
597 evlist__for_each(evlist
, evsel
) {
598 if (evsel
->handler
!= drop_sample
) {
600 if ((evsel
->attr
.sample_type
& COMPAT_MASK
) ==
601 (evsel_to_remove
->attr
.sample_type
& COMPAT_MASK
))
606 return ok
&& cnt
== 1;
609 static void strip_fini(struct perf_inject
*inject
)
611 struct perf_evlist
*evlist
= inject
->session
->evlist
;
612 struct perf_evsel
*evsel
, *tmp
;
614 /* Remove non-synthesized evsels if possible */
615 evlist__for_each_safe(evlist
, tmp
, evsel
) {
616 if (evsel
->handler
== drop_sample
&&
617 ok_to_remove(evlist
, evsel
)) {
618 pr_debug("Deleting %s\n", perf_evsel__name(evsel
));
619 perf_evlist__remove(evlist
, evsel
);
620 perf_evsel__delete(evsel
);
625 static int __cmd_inject(struct perf_inject
*inject
)
628 struct perf_session
*session
= inject
->session
;
629 struct perf_data_file
*file_out
= &inject
->output
;
630 int fd
= perf_data_file__fd(file_out
);
631 u64 output_data_offset
;
633 signal(SIGINT
, sig_handler
);
635 if (inject
->build_ids
|| inject
->sched_stat
||
636 inject
->itrace_synth_opts
.set
) {
637 inject
->tool
.mmap
= perf_event__repipe_mmap
;
638 inject
->tool
.mmap2
= perf_event__repipe_mmap2
;
639 inject
->tool
.fork
= perf_event__repipe_fork
;
640 inject
->tool
.tracing_data
= perf_event__repipe_tracing_data
;
643 output_data_offset
= session
->header
.data_offset
;
645 if (inject
->build_ids
) {
646 inject
->tool
.sample
= perf_event__inject_buildid
;
647 } else if (inject
->sched_stat
) {
648 struct perf_evsel
*evsel
;
650 evlist__for_each(session
->evlist
, evsel
) {
651 const char *name
= perf_evsel__name(evsel
);
653 if (!strcmp(name
, "sched:sched_switch")) {
654 if (perf_evsel__check_stype(evsel
, PERF_SAMPLE_TID
, "TID"))
657 evsel
->handler
= perf_inject__sched_switch
;
658 } else if (!strcmp(name
, "sched:sched_process_exit"))
659 evsel
->handler
= perf_inject__sched_process_exit
;
660 else if (!strncmp(name
, "sched:sched_stat_", 17))
661 evsel
->handler
= perf_inject__sched_stat
;
663 } else if (inject
->itrace_synth_opts
.set
) {
664 session
->itrace_synth_opts
= &inject
->itrace_synth_opts
;
665 inject
->itrace_synth_opts
.inject
= true;
666 inject
->tool
.comm
= perf_event__repipe_comm
;
667 inject
->tool
.exit
= perf_event__repipe_exit
;
668 inject
->tool
.id_index
= perf_event__repipe_id_index
;
669 inject
->tool
.auxtrace_info
= perf_event__process_auxtrace_info
;
670 inject
->tool
.auxtrace
= perf_event__process_auxtrace
;
671 inject
->tool
.aux
= perf_event__drop_aux
;
672 inject
->tool
.itrace_start
= perf_event__drop_aux
,
673 inject
->tool
.ordered_events
= true;
674 inject
->tool
.ordering_requires_timestamps
= true;
675 /* Allow space in the header for new attributes */
676 output_data_offset
= 4096;
681 if (!inject
->itrace_synth_opts
.set
)
682 auxtrace_index__free(&session
->auxtrace_index
);
684 if (!file_out
->is_pipe
)
685 lseek(fd
, output_data_offset
, SEEK_SET
);
687 ret
= perf_session__process_events(session
);
689 if (!file_out
->is_pipe
) {
690 if (inject
->build_ids
)
691 perf_header__set_feat(&session
->header
,
694 * Keep all buildids when there is unprocessed AUX data because
695 * it is not known which ones the AUX trace hits.
697 if (perf_header__has_feat(&session
->header
, HEADER_BUILD_ID
) &&
698 inject
->have_auxtrace
&& !inject
->itrace_synth_opts
.set
)
699 dsos__hit_all(session
);
701 * The AUX areas have been removed and replaced with
702 * synthesized hardware events, so clear the feature flag and
705 if (inject
->itrace_synth_opts
.set
) {
706 struct perf_evsel
*evsel
;
708 perf_header__clear_feat(&session
->header
,
710 if (inject
->itrace_synth_opts
.last_branch
)
711 perf_header__set_feat(&session
->header
,
712 HEADER_BRANCH_STACK
);
713 evsel
= perf_evlist__id2evsel_strict(session
->evlist
,
716 pr_debug("Deleting %s\n",
717 perf_evsel__name(evsel
));
718 perf_evlist__remove(session
->evlist
, evsel
);
719 perf_evsel__delete(evsel
);
724 session
->header
.data_offset
= output_data_offset
;
725 session
->header
.data_size
= inject
->bytes_written
;
726 perf_session__write_header(session
, session
->evlist
, fd
, true);
732 #ifdef HAVE_LIBELF_SUPPORT
734 jit_validate_events(struct perf_session
*session
)
736 struct perf_evsel
*evsel
;
739 * check that all events use CLOCK_MONOTONIC
741 evlist__for_each(session
->evlist
, evsel
) {
742 if (evsel
->attr
.use_clockid
== 0 || evsel
->attr
.clockid
!= CLOCK_MONOTONIC
)
749 int cmd_inject(int argc
, const char **argv
, const char *prefix __maybe_unused
)
751 struct perf_inject inject
= {
753 .sample
= perf_event__repipe_sample
,
754 .mmap
= perf_event__repipe
,
755 .mmap2
= perf_event__repipe
,
756 .comm
= perf_event__repipe
,
757 .fork
= perf_event__repipe
,
758 .exit
= perf_event__repipe
,
759 .lost
= perf_event__repipe
,
760 .lost_samples
= perf_event__repipe
,
761 .aux
= perf_event__repipe
,
762 .itrace_start
= perf_event__repipe
,
763 .context_switch
= perf_event__repipe
,
764 .read
= perf_event__repipe_sample
,
765 .throttle
= perf_event__repipe
,
766 .unthrottle
= perf_event__repipe
,
767 .attr
= perf_event__repipe_attr
,
768 .tracing_data
= perf_event__repipe_op2_synth
,
769 .auxtrace_info
= perf_event__repipe_op2_synth
,
770 .auxtrace
= perf_event__repipe_auxtrace
,
771 .auxtrace_error
= perf_event__repipe_op2_synth
,
772 .finished_round
= perf_event__repipe_oe_synth
,
773 .build_id
= perf_event__repipe_op2_synth
,
774 .id_index
= perf_event__repipe_op2_synth
,
777 .samples
= LIST_HEAD_INIT(inject
.samples
),
780 .mode
= PERF_DATA_MODE_WRITE
,
783 struct perf_data_file file
= {
784 .mode
= PERF_DATA_MODE_READ
,
788 struct option options
[] = {
789 OPT_BOOLEAN('b', "build-ids", &inject
.build_ids
,
790 "Inject build-ids into the output stream"),
791 OPT_STRING('i', "input", &inject
.input_name
, "file",
793 OPT_STRING('o', "output", &inject
.output
.path
, "file",
795 OPT_BOOLEAN('s', "sched-stat", &inject
.sched_stat
,
796 "Merge sched-stat and sched-switch for getting events "
797 "where and how long tasks slept"),
798 OPT_BOOLEAN('j', "jit", &inject
.jit_mode
, "merge jitdump files into perf.data file"),
799 OPT_INCR('v', "verbose", &verbose
,
800 "be more verbose (show build ids, etc)"),
801 OPT_STRING(0, "kallsyms", &symbol_conf
.kallsyms_name
, "file",
802 "kallsyms pathname"),
803 OPT_BOOLEAN('f', "force", &file
.force
, "don't complain, do it"),
804 OPT_CALLBACK_OPTARG(0, "itrace", &inject
.itrace_synth_opts
,
805 NULL
, "opts", "Instruction Tracing options",
806 itrace_parse_synth_opts
),
807 OPT_BOOLEAN(0, "strip", &inject
.strip
,
808 "strip non-synthesized events (use with --itrace)"),
811 const char * const inject_usage
[] = {
812 "perf inject [<options>]",
815 #ifndef HAVE_LIBELF_SUPPORT
816 set_option_nobuild(options
, 'j', "jit", "NO_LIBELF=1", true);
818 argc
= parse_options(argc
, argv
, options
, inject_usage
, 0);
821 * Any (unrecognized) arguments left?
824 usage_with_options(inject_usage
, options
);
826 if (inject
.strip
&& !inject
.itrace_synth_opts
.set
) {
827 pr_err("--strip option requires --itrace option\n");
831 if (perf_data_file__open(&inject
.output
)) {
832 perror("failed to create output file");
836 inject
.tool
.ordered_events
= inject
.sched_stat
;
838 file
.path
= inject
.input_name
;
839 inject
.session
= perf_session__new(&file
, true, &inject
.tool
);
840 if (inject
.session
== NULL
)
843 if (inject
.build_ids
) {
845 * to make sure the mmap records are ordered correctly
846 * and so that the correct especially due to jitted code
847 * mmaps. We cannot generate the buildid hit list and
848 * inject the jit mmaps at the same time for now.
850 inject
.tool
.ordered_events
= true;
851 inject
.tool
.ordering_requires_timestamps
= true;
853 #ifdef HAVE_LIBELF_SUPPORT
854 if (inject
.jit_mode
) {
856 * validate event is using the correct clockid
858 if (jit_validate_events(inject
.session
)) {
859 fprintf(stderr
, "error, jitted code must be sampled with perf record -k 1\n");
862 inject
.tool
.mmap2
= perf_event__jit_repipe_mmap2
;
863 inject
.tool
.mmap
= perf_event__jit_repipe_mmap
;
864 inject
.tool
.ordered_events
= true;
865 inject
.tool
.ordering_requires_timestamps
= true;
867 * JIT MMAP injection injects all MMAP events in one go, so it
868 * does not obey finished_round semantics.
870 inject
.tool
.finished_round
= perf_event__drop_oe
;
873 ret
= symbol__init(&inject
.session
->header
.env
);
877 ret
= __cmd_inject(&inject
);
880 perf_session__delete(inject
.session
);