Lines Matching full:inject
3 * builtin-inject.c
5 * Builtin inject command: Examine the live mode (stdin) event stream
162 static int output_bytes(struct perf_inject *inject, void *buf, size_t sz) in output_bytes() argument
166 size = perf_data__write(&inject->output, buf, sz); in output_bytes()
170 inject->bytes_written += size; in output_bytes()
178 struct perf_inject *inject = container_of(tool, struct perf_inject, in perf_event__repipe_synth() local
181 return output_bytes(inject, event, event->header.size); in perf_event__repipe_synth()
218 struct perf_inject *inject = container_of(tool, struct perf_inject, in perf_event__repipe_attr() local
227 if (!inject->output.is_pipe) in perf_event__repipe_attr()
242 static int copy_bytes(struct perf_inject *inject, struct perf_data *data, off_t size) in copy_bytes() argument
252 ret = output_bytes(inject, buf, ssz); in copy_bytes()
265 struct perf_inject *inject = container_of(tool, struct perf_inject, in perf_event__repipe_auxtrace() local
269 inject->have_auxtrace = true; in perf_event__repipe_auxtrace()
271 if (!inject->output.is_pipe) { in perf_event__repipe_auxtrace()
274 offset = lseek(inject->output.file.fd, 0, SEEK_CUR); in perf_event__repipe_auxtrace()
284 ret = output_bytes(inject, event, event->header.size); in perf_event__repipe_auxtrace()
287 ret = copy_bytes(inject, session->data, in perf_event__repipe_auxtrace()
290 ret = output_bytes(inject, event, in perf_event__repipe_auxtrace()
332 struct perf_inject *inject = container_of(tool, struct perf_inject, tool); in perf_event__drop_aux() local
334 if (!inject->aux_id) in perf_event__drop_aux()
335 inject->aux_id = sample->id; in perf_event__drop_aux()
341 perf_inject__cut_auxtrace_sample(struct perf_inject *inject, in perf_inject__cut_auxtrace_sample() argument
349 if (inject->event_copy == NULL) { in perf_inject__cut_auxtrace_sample()
350 inject->event_copy = malloc(PERF_SAMPLE_MAX_SIZE); in perf_inject__cut_auxtrace_sample()
351 if (!inject->event_copy) in perf_inject__cut_auxtrace_sample()
354 ev = (union perf_event *)inject->event_copy; in perf_inject__cut_auxtrace_sample()
380 struct perf_inject *inject = container_of(tool, struct perf_inject, in perf_event__repipe_sample() local
390 if (inject->itrace_synth_opts.set && sample->aux_sample.size) { in perf_event__repipe_sample()
391 event = perf_inject__cut_auxtrace_sample(inject, event, sample); in perf_event__repipe_sample()
449 static const struct evsel *inject__mmap_evsel(struct perf_inject *inject) in inject__mmap_evsel() argument
453 if (inject->mmap_evsel) in inject__mmap_evsel()
454 return inject->mmap_evsel; in inject__mmap_evsel()
456 evlist__for_each_entry(inject->session->evlist, pos) { in inject__mmap_evsel()
458 inject->mmap_evsel = pos; in inject__mmap_evsel()
480 struct perf_inject *inject = container_of(tool, struct perf_inject, tool); in perf_event__repipe_common_mmap() local
485 if (inject->jit_mode) { in perf_event__repipe_common_mmap()
489 /* If jit marker, then inject jit mmaps and generate ELF images. */ in perf_event__repipe_common_mmap()
490 ret = jit_process(inject->session, &inject->output, machine, in perf_event__repipe_common_mmap()
495 inject->bytes_written += n; in perf_event__repipe_common_mmap()
504 /* mark it not to inject build-id */ in perf_event__repipe_common_mmap()
508 if (inject->build_id_style == BID_RWS__INJECT_HEADER_ALL) { in perf_event__repipe_common_mmap()
515 struct evsel *evsel = evlist__event2evsel(inject->session->evlist, event); in perf_event__repipe_common_mmap()
531 if ((inject->build_id_style == BID_RWS__INJECT_HEADER_LAZY || in perf_event__repipe_common_mmap()
532 inject->build_id_style == BID_RWS__MMAP2_BUILDID_LAZY) && in perf_event__repipe_common_mmap()
533 !inject->mmap_evsel) in perf_event__repipe_common_mmap()
534 inject->mmap_evsel = evlist__event2evsel(inject->session->evlist, event); in perf_event__repipe_common_mmap()
536 /* Create the thread, map, etc. Not done for the unordered inject all case. */ in perf_event__repipe_common_mmap()
544 if ((inject->build_id_style == BID_RWS__MMAP2_BUILDID_ALL) && in perf_event__repipe_common_mmap()
546 struct evsel *evsel = evlist__event2evsel(inject->session->evlist, event); in perf_event__repipe_common_mmap()
565 if (inject->build_id_style == BID_RWS__MMAP2_BUILDID_LAZY) in perf_event__repipe_common_mmap()
731 static bool perf_inject__lookup_known_build_id(struct perf_inject *inject, in perf_inject__lookup_known_build_id() argument
737 strlist__for_each_entry(pos, inject->known_build_ids) { in perf_inject__lookup_known_build_id()
765 struct perf_inject *inject = container_of(tool, struct perf_inject, tool); in tool__inject_build_id() local
773 if (inject->known_build_ids != NULL && in tool__inject_build_id()
774 perf_inject__lookup_known_build_id(inject, dso)) in tool__inject_build_id()
833 static int mark_dso_hit(const struct perf_inject *inject, in mark_dso_hit() argument
863 if (inject->build_id_style == BID_RWS__INJECT_HEADER_LAZY) { in mark_dso_hit()
870 } else if (inject->build_id_style == BID_RWS__MMAP2_BUILDID_LAZY) { in mark_dso_hit()
895 const struct perf_inject *inject; member
907 return mark_dso_hit(args->inject, args->tool, args->sample, args->machine, in mark_dso_hit_callback()
918 struct perf_inject *inject = container_of(tool, struct perf_inject, tool); in perf_event__inject_buildid() local
920 .inject = inject, in perf_event__inject_buildid()
928 .mmap_evsel = inject__mmap_evsel(inject), in perf_event__inject_buildid()
940 mark_dso_hit(inject, tool, sample, machine, args.mmap_evsel, al.map, in perf_event__inject_buildid()
960 struct perf_inject *inject = container_of(tool, struct perf_inject, tool); in perf_inject__sched_process_exit() local
963 list_for_each_entry(ent, &inject->samples, node) { in perf_inject__sched_process_exit()
980 struct perf_inject *inject = container_of(tool, struct perf_inject, tool); in perf_inject__sched_switch() local
994 list_add(&ent->node, &inject->samples); in perf_inject__sched_switch()
1008 struct perf_inject *inject = container_of(tool, struct perf_inject, tool); in perf_inject__sched_stat() local
1011 list_for_each_entry(ent, &inject->samples, node) { in perf_inject__sched_stat()
1214 struct perf_inject *inject = container_of(tool, struct perf_inject, tool); in process_attr() local
1216 return perf_event__process_attr(tool, event, &inject->session->evlist); in process_attr()
1221 struct perf_inject *inject = container_of(gs, struct perf_inject, guest_session); in guest_session__add_attr() local
1253 ret = perf_event__synthesize_attr(&inject->tool, &attr, evsel->core.ids, in guest_session__add_attr()
1262 sid = evlist__id2sid(inject->session->evlist, id_array[i]); in guest_session__add_attr()
1290 static int synthesize_id_index(struct perf_inject *inject, size_t new_cnt) in synthesize_id_index() argument
1292 struct perf_session *session = inject->session; in synthesize_id_index()
1297 return __perf_event__synthesize_id_index(&inject->tool, perf_event__repipe, in synthesize_id_index()
1343 struct perf_inject *inject = container_of(tool, struct perf_inject, tool); in process_build_id() local
1345 return perf_event__process_build_id(inject->session, event); in process_build_id()
1348 static int synthesize_build_id(struct perf_inject *inject, struct dso *dso, pid_t machine_pid) in synthesize_build_id() argument
1350 struct machine *machine = perf_session__findnew_machine(inject->session, machine_pid); in synthesize_build_id()
1368 return perf_event__synthesize_build_id(&inject->tool, &synth_sample, machine, in synthesize_build_id()
1369 process_build_id, inject__mmap_evsel(inject), in synthesize_build_id()
1377 struct perf_inject *inject = container_of(gs, struct perf_inject, guest_session); in guest_session__add_build_ids_cb() local
1382 return synthesize_build_id(inject, dso, gs->machine_pid); in guest_session__add_build_ids_cb()
1388 struct perf_inject *inject = container_of(gs, struct perf_inject, guest_session); in guest_session__add_build_ids() local
1391 perf_header__set_feat(&inject->session->header, HEADER_BUILD_ID); in guest_session__add_build_ids()
1414 char tmp_file_name[] = "/tmp/perf-inject-guest_session-XXXXXX"; in guest_session__start()
1531 struct perf_inject *inject = container_of(gs, struct perf_inject, guest_session); in guest_session__get_tc() local
1533 get_tsc_conv(&gs->host_tc, &inject->session->time_conv); in guest_session__get_tc()
1651 struct perf_inject *inject = container_of(gs, struct perf_inject, guest_session); in guest_session__inject_events() local
1740 ret = evlist__append_id_sample(inject->session->evlist, ev, sample); in guest_session__inject_events()
1751 ret = output_bytes(inject, ev, ev->header.size); in guest_session__inject_events()
1767 struct perf_inject *inject = container_of(tool, struct perf_inject, tool); in host__repipe() local
1770 ret = guest_session__inject_events(&inject->guest_session, sample->time); in host__repipe()
1779 struct perf_inject *inject = container_of(session->tool, struct perf_inject, tool); in host__finished_init() local
1780 struct guest_session *gs = &inject->guest_session; in host__finished_init()
1808 ret = synthesize_id_index(inject, gs->session->evlist->core.nr_entries); in host__finished_init()
1831 * which flushes host events to file up until the last flush time. Then inject
1839 struct perf_inject *inject = container_of(tool, struct perf_inject, tool); in host__finished_round() local
1846 ret = guest_session__inject_events(&inject->guest_session, timestamp); in host__finished_round()
1858 struct perf_inject *inject = container_of(tool, struct perf_inject, tool); in host__context_switch() local
1860 struct guest_session *gs = &inject->guest_session; in host__context_switch()
1916 static void strip_init(struct perf_inject *inject) in strip_init() argument
1918 struct evlist *evlist = inject->session->evlist; in strip_init()
1921 inject->tool.context_switch = perf_event__drop; in strip_init()
1929 struct perf_inject *inject = opt->value; in parse_vm_time_correlation() local
1936 inject->itrace_synth_opts.set = true; in parse_vm_time_correlation()
1937 inject->itrace_synth_opts.vm_time_correlation = true; in parse_vm_time_correlation()
1938 inject->in_place_update = true; in parse_vm_time_correlation()
1945 inject->itrace_synth_opts.vm_tm_corr_dry_run = true; in parse_vm_time_correlation()
1946 inject->in_place_update_dry_run = true; in parse_vm_time_correlation()
1952 inject->itrace_synth_opts.vm_tm_corr_args = strdup(args); in parse_vm_time_correlation()
1954 return inject->itrace_synth_opts.vm_tm_corr_args ? 0 : -ENOMEM; in parse_vm_time_correlation()
1959 struct perf_inject *inject = opt->value; in parse_guest_data() local
1960 struct guest_session *gs = &inject->guest_session; in parse_guest_data()
1980 inject->output.is_dir = true; in parse_guest_data()
1986 if (!inject->guest_session.machine_pid) in parse_guest_data()
2016 struct perf_inject *inject = data; in save_section_info_cb() local
2018 inject->secs[feat] = *section; in save_section_info_cb()
2022 static int save_section_info(struct perf_inject *inject) in save_section_info() argument
2024 struct perf_header *header = &inject->session->header; in save_section_info()
2025 int fd = perf_data__fd(inject->session->data); in save_section_info()
2027 return perf_header__process_sections(header, fd, inject, save_section_info_cb); in save_section_info()
2083 static int feat_copy(struct perf_inject *inject, int feat, struct feat_writer *fw) in feat_copy() argument
2085 int fd = perf_data__fd(inject->session->data); in feat_copy()
2086 u64 offs = inject->secs[feat].offset; in feat_copy()
2087 size_t sz = inject->secs[feat].size; in feat_copy()
2106 struct perf_inject *inject; member
2112 struct perf_inject *inject = inj_fc->inject; in feat_copy_cb() local
2115 if (!inject->secs[feat].offset || in feat_copy_cb()
2119 ret = feat_copy(inject, feat, fw); in feat_copy_cb()
2126 static int copy_kcore_dir(struct perf_inject *inject) in copy_kcore_dir() argument
2132 inject->input_name, inject->output.path); in copy_kcore_dir()
2143 struct perf_inject *inject = container_of(gs, struct perf_inject, guest_session); in guest_session__copy_kcore_dir() local
2148 gs->perf_data_file, inject->output.path, gs->machine_pid); in guest_session__copy_kcore_dir()
2157 static int output_fd(struct perf_inject *inject) in output_fd() argument
2159 return inject->in_place_update ? -1 : perf_data__fd(&inject->output); in output_fd()
2162 static int __cmd_inject(struct perf_inject *inject) in __cmd_inject() argument
2165 struct guest_session *gs = &inject->guest_session; in __cmd_inject()
2166 struct perf_session *session = inject->session; in __cmd_inject()
2167 int fd = output_fd(inject); in __cmd_inject()
2174 bool write_attrs_after_data = !inject->output.is_pipe && inject->session->data->is_pipe; in __cmd_inject()
2178 if (inject->build_id_style != BID_RWS__NONE || inject->sched_stat || in __cmd_inject()
2179 inject->itrace_synth_opts.set) { in __cmd_inject()
2180 inject->tool.mmap = perf_event__repipe_mmap; in __cmd_inject()
2181 inject->tool.mmap2 = perf_event__repipe_mmap2; in __cmd_inject()
2182 inject->tool.fork = perf_event__repipe_fork; in __cmd_inject()
2184 inject->tool.tracing_data = perf_event__repipe_tracing_data; in __cmd_inject()
2188 if (inject->build_id_style == BID_RWS__INJECT_HEADER_LAZY || in __cmd_inject()
2189 inject->build_id_style == BID_RWS__MMAP2_BUILDID_LAZY) { in __cmd_inject()
2190 inject->tool.sample = perf_event__inject_buildid; in __cmd_inject()
2191 } else if (inject->sched_stat) { in __cmd_inject()
2209 } else if (inject->itrace_synth_opts.vm_time_correlation) { in __cmd_inject()
2210 session->itrace_synth_opts = &inject->itrace_synth_opts; in __cmd_inject()
2211 memset(&inject->tool, 0, sizeof(inject->tool)); in __cmd_inject()
2212 inject->tool.id_index = perf_event__process_id_index; in __cmd_inject()
2213 inject->tool.auxtrace_info = perf_event__process_auxtrace_info; in __cmd_inject()
2214 inject->tool.auxtrace = perf_event__process_auxtrace; in __cmd_inject()
2215 inject->tool.auxtrace_error = perf_event__process_auxtrace_error; in __cmd_inject()
2216 inject->tool.ordered_events = true; in __cmd_inject()
2217 inject->tool.ordering_requires_timestamps = true; in __cmd_inject()
2218 } else if (inject->itrace_synth_opts.set) { in __cmd_inject()
2219 session->itrace_synth_opts = &inject->itrace_synth_opts; in __cmd_inject()
2220 inject->itrace_synth_opts.inject = true; in __cmd_inject()
2221 inject->tool.comm = perf_event__repipe_comm; in __cmd_inject()
2222 inject->tool.namespaces = perf_event__repipe_namespaces; in __cmd_inject()
2223 inject->tool.exit = perf_event__repipe_exit; in __cmd_inject()
2224 inject->tool.id_index = perf_event__process_id_index; in __cmd_inject()
2225 inject->tool.auxtrace_info = perf_event__process_auxtrace_info; in __cmd_inject()
2226 inject->tool.auxtrace = perf_event__process_auxtrace; in __cmd_inject()
2227 inject->tool.aux = perf_event__drop_aux; in __cmd_inject()
2228 inject->tool.itrace_start = perf_event__drop_aux; in __cmd_inject()
2229 inject->tool.aux_output_hw_id = perf_event__drop_aux; in __cmd_inject()
2230 inject->tool.ordered_events = true; in __cmd_inject()
2231 inject->tool.ordering_requires_timestamps = true; in __cmd_inject()
2234 if (inject->strip) in __cmd_inject()
2235 strip_init(inject); in __cmd_inject()
2243 inject->tool.mmap = host__repipe; in __cmd_inject()
2244 inject->tool.mmap2 = host__repipe; in __cmd_inject()
2245 inject->tool.comm = host__repipe; in __cmd_inject()
2246 inject->tool.fork = host__repipe; in __cmd_inject()
2247 inject->tool.exit = host__repipe; in __cmd_inject()
2248 inject->tool.lost = host__repipe; in __cmd_inject()
2249 inject->tool.context_switch = host__repipe; in __cmd_inject()
2250 inject->tool.ksymbol = host__repipe; in __cmd_inject()
2251 inject->tool.text_poke = host__repipe; in __cmd_inject()
2257 inject->tool.finished_init = host__finished_init; in __cmd_inject()
2259 inject->tool.finished_round = host__finished_round; in __cmd_inject()
2261 inject->tool.context_switch = host__context_switch; in __cmd_inject()
2266 inject->tool.ordered_events = true; in __cmd_inject()
2267 inject->tool.ordering_requires_timestamps = true; in __cmd_inject()
2279 if (!inject->itrace_synth_opts.set) in __cmd_inject()
2282 if (!inject->output.is_pipe && !inject->in_place_update) in __cmd_inject()
2301 if (!inject->output.is_pipe && !inject->in_place_update) { in __cmd_inject()
2304 .inject = inject, in __cmd_inject()
2307 if (inject->build_id_style == BID_RWS__INJECT_HEADER_LAZY || in __cmd_inject()
2308 inject->build_id_style == BID_RWS__INJECT_HEADER_ALL) in __cmd_inject()
2315 inject->have_auxtrace && !inject->itrace_synth_opts.set) in __cmd_inject()
2321 if (inject->itrace_synth_opts.set) { in __cmd_inject()
2324 if (inject->itrace_synth_opts.last_branch || in __cmd_inject()
2325 inject->itrace_synth_opts.add_last_branch) in __cmd_inject()
2330 session->header.data_size = inject->bytes_written; in __cmd_inject()
2334 if (inject->copy_kcore_dir) { in __cmd_inject()
2335 ret = copy_kcore_dir(inject); in __cmd_inject()
2355 struct perf_inject inject = { in cmd_inject() local
2357 .samples = LIST_HEAD_INIT(inject.samples), in cmd_inject()
2377 "Inject build-ids into the output stream"), in cmd_inject()
2379 "Inject build-ids of all DSOs into the output stream"), in cmd_inject()
2387 OPT_STRING('i', "input", &inject.input_name, "file", in cmd_inject()
2389 OPT_STRING('o', "output", &inject.output.path, "file", in cmd_inject()
2391 OPT_BOOLEAN('s', "sched-stat", &inject.sched_stat, in cmd_inject()
2395 OPT_BOOLEAN('j', "jit", &inject.jit_mode, "merge jitdump files into perf.data file"), in cmd_inject()
2406 OPT_CALLBACK_OPTARG(0, "itrace", &inject.itrace_synth_opts, in cmd_inject()
2410 OPT_BOOLEAN(0, "strip", &inject.strip, in cmd_inject()
2412 OPT_CALLBACK_OPTARG(0, "vm-time-correlation", &inject, NULL, "opts", in cmd_inject()
2415 OPT_CALLBACK_OPTARG(0, "guest-data", &inject, NULL, "opts", in cmd_inject()
2416 "inject events from a guest perf.data file", in cmd_inject()
2424 "perf inject [<options>]", in cmd_inject()
2429 if (!inject.itrace_synth_opts.set) { in cmd_inject()
2430 /* Disable eager loading of kernel symbols that adds overhead to perf inject. */ in cmd_inject()
2445 if (inject.strip && !inject.itrace_synth_opts.set) { in cmd_inject()
2453 if (inject.in_place_update) { in cmd_inject()
2454 if (!strcmp(inject.input_name, "-")) { in cmd_inject()
2458 if (strcmp(inject.output.path, "-")) { in cmd_inject()
2462 if (!data.force && !inject.in_place_update_dry_run) { in cmd_inject()
2467 if (!inject.in_place_update_dry_run) in cmd_inject()
2470 if (strcmp(inject.output.path, "-") && !inject.strip && in cmd_inject()
2471 has_kcore_dir(inject.input_name)) { in cmd_inject()
2472 inject.output.is_dir = true; in cmd_inject()
2473 inject.copy_kcore_dir = true; in cmd_inject()
2475 if (perf_data__open(&inject.output)) { in cmd_inject()
2481 inject.build_id_style = BID_RWS__MMAP2_BUILDID_LAZY; in cmd_inject()
2483 inject.build_id_style = BID_RWS__MMAP2_BUILDID_ALL; in cmd_inject()
2485 inject.build_id_style = BID_RWS__INJECT_HEADER_LAZY; in cmd_inject()
2487 inject.build_id_style = BID_RWS__INJECT_HEADER_ALL; in cmd_inject()
2489 data.path = inject.input_name; in cmd_inject()
2491 ordered_events = inject.jit_mode || inject.sched_stat || in cmd_inject()
2492 inject.build_id_style == BID_RWS__INJECT_HEADER_LAZY || in cmd_inject()
2493 inject.build_id_style == BID_RWS__MMAP2_BUILDID_LAZY; in cmd_inject()
2494 perf_tool__init(&inject.tool, ordered_events); in cmd_inject()
2495 inject.tool.sample = perf_event__repipe_sample; in cmd_inject()
2496 inject.tool.read = perf_event__repipe_sample; in cmd_inject()
2497 inject.tool.mmap = perf_event__repipe; in cmd_inject()
2498 inject.tool.mmap2 = perf_event__repipe; in cmd_inject()
2499 inject.tool.comm = perf_event__repipe; in cmd_inject()
2500 inject.tool.namespaces = perf_event__repipe; in cmd_inject()
2501 inject.tool.cgroup = perf_event__repipe; in cmd_inject()
2502 inject.tool.fork = perf_event__repipe; in cmd_inject()
2503 inject.tool.exit = perf_event__repipe; in cmd_inject()
2504 inject.tool.lost = perf_event__repipe; in cmd_inject()
2505 inject.tool.lost_samples = perf_event__repipe; in cmd_inject()
2506 inject.tool.aux = perf_event__repipe; in cmd_inject()
2507 inject.tool.itrace_start = perf_event__repipe; in cmd_inject()
2508 inject.tool.aux_output_hw_id = perf_event__repipe; in cmd_inject()
2509 inject.tool.context_switch = perf_event__repipe; in cmd_inject()
2510 inject.tool.throttle = perf_event__repipe; in cmd_inject()
2511 inject.tool.unthrottle = perf_event__repipe; in cmd_inject()
2512 inject.tool.ksymbol = perf_event__repipe; in cmd_inject()
2513 inject.tool.bpf = perf_event__repipe; in cmd_inject()
2514 inject.tool.text_poke = perf_event__repipe; in cmd_inject()
2515 inject.tool.attr = perf_event__repipe_attr; in cmd_inject()
2516 inject.tool.event_update = perf_event__repipe_event_update; in cmd_inject()
2517 inject.tool.tracing_data = perf_event__repipe_op2_synth; in cmd_inject()
2518 inject.tool.finished_round = perf_event__repipe_oe_synth; in cmd_inject()
2519 inject.tool.build_id = perf_event__repipe_op2_synth; in cmd_inject()
2520 inject.tool.id_index = perf_event__repipe_op2_synth; in cmd_inject()
2521 inject.tool.auxtrace_info = perf_event__repipe_op2_synth; in cmd_inject()
2522 inject.tool.auxtrace_error = perf_event__repipe_op2_synth; in cmd_inject()
2523 inject.tool.time_conv = perf_event__repipe_op2_synth; in cmd_inject()
2524 inject.tool.thread_map = perf_event__repipe_op2_synth; in cmd_inject()
2525 inject.tool.cpu_map = perf_event__repipe_op2_synth; in cmd_inject()
2526 inject.tool.stat_config = perf_event__repipe_op2_synth; in cmd_inject()
2527 inject.tool.stat = perf_event__repipe_op2_synth; in cmd_inject()
2528 inject.tool.stat_round = perf_event__repipe_op2_synth; in cmd_inject()
2529 inject.tool.feature = perf_event__repipe_op2_synth; in cmd_inject()
2530 inject.tool.finished_init = perf_event__repipe_op2_synth; in cmd_inject()
2531 inject.tool.compressed = perf_event__repipe_op4_synth; in cmd_inject()
2532 inject.tool.auxtrace = perf_event__repipe_auxtrace; in cmd_inject()
2533 inject.tool.dont_split_sample_group = true; in cmd_inject()
2534 inject.session = __perf_session__new(&data, &inject.tool, in cmd_inject()
2535 /*trace_event_repipe=*/inject.output.is_pipe); in cmd_inject()
2537 if (IS_ERR(inject.session)) { in cmd_inject()
2538 ret = PTR_ERR(inject.session); in cmd_inject()
2542 if (zstd_init(&(inject.session->zstd_data), 0) < 0) in cmd_inject()
2546 ret = save_section_info(&inject); in cmd_inject()
2550 if (inject.output.is_pipe) { in cmd_inject()
2551 ret = perf_header__write_pipe(perf_data__fd(&inject.output)); in cmd_inject()
2563 ret = perf_event__synthesize_for_pipe(&inject.tool, in cmd_inject()
2564 inject.session, in cmd_inject()
2565 &inject.output, in cmd_inject()
2572 if (inject.build_id_style == BID_RWS__INJECT_HEADER_LAZY || in cmd_inject()
2573 inject.build_id_style == BID_RWS__MMAP2_BUILDID_LAZY) { in cmd_inject()
2578 * inject the jit mmaps at the same time for now. in cmd_inject()
2580 inject.tool.ordering_requires_timestamps = true; in cmd_inject()
2582 if (inject.build_id_style != BID_RWS__NONE && known_build_ids != NULL) { in cmd_inject()
2583 inject.known_build_ids = in cmd_inject()
2586 if (inject.known_build_ids == NULL) { in cmd_inject()
2593 if (inject.jit_mode) { in cmd_inject()
2594 inject.tool.mmap2 = perf_event__repipe_mmap2; in cmd_inject()
2595 inject.tool.mmap = perf_event__repipe_mmap; in cmd_inject()
2596 inject.tool.ordering_requires_timestamps = true; in cmd_inject()
2601 inject.tool.finished_round = perf_event__drop_oe; in cmd_inject()
2604 ret = symbol__init(&inject.session->header.env); in cmd_inject()
2608 ret = __cmd_inject(&inject); in cmd_inject()
2610 guest_session__exit(&inject.guest_session); in cmd_inject()
2613 strlist__delete(inject.known_build_ids); in cmd_inject()
2614 zstd_fini(&(inject.session->zstd_data)); in cmd_inject()
2615 perf_session__delete(inject.session); in cmd_inject()
2617 if (!inject.in_place_update) in cmd_inject()
2618 perf_data__close(&inject.output); in cmd_inject()
2619 free(inject.itrace_synth_opts.vm_tm_corr_args); in cmd_inject()
2620 free(inject.event_copy); in cmd_inject()
2621 free(inject.guest_session.ev.event_buf); in cmd_inject()