• Home
  • Raw
  • Download

Lines Matching full:jd

109 jit_close(struct jit_buf_desc *jd)  in jit_close()  argument
111 if (!(jd && jd->in)) in jit_close()
113 funlockfile(jd->in); in jit_close()
114 fclose(jd->in); in jit_close()
115 jd->in = NULL; in jit_close()
134 jit_open(struct jit_buf_desc *jd, const char *name) in jit_open() argument
142 jd->in = fopen(name, "r"); in jit_open()
143 if (!jd->in) in jit_open()
155 flockfile(jd->in); in jit_open()
157 ret = fread(buf, sizeof(header), 1, jd->in); in jit_open()
166 jd->needs_bswap = true; in jit_open()
169 if (jd->needs_bswap) { in jit_open()
178 jd->use_arch_timestamp = header.flags & JITDUMP_FLAGS_ARCH_TIMESTAMP; in jit_open()
187 jd->use_arch_timestamp); in jit_open()
201 if (jd->use_arch_timestamp && !jd->session->time_conv.time_mult) { in jit_open()
209 if (!jd->use_arch_timestamp && jit_validate_events(jd->session)) { in jit_open()
223 ret = fread(buf, bs - bsz, 1, jd->in); in jit_open()
230 strcpy(jd->dir, name); in jit_open()
231 dirname(jd->dir); in jit_open()
235 funlockfile(jd->in); in jit_open()
236 fclose(jd->in); in jit_open()
241 jit_get_next_entry(struct jit_buf_desc *jd) in jit_get_next_entry() argument
249 if (!(jd && jd->in)) in jit_get_next_entry()
252 if (jd->buf == NULL) { in jit_get_next_entry()
257 jd->buf = malloc(sz); in jit_get_next_entry()
258 if (jd->buf == NULL) in jit_get_next_entry()
261 jd->bufsize = sz; in jit_get_next_entry()
264 prefix = jd->buf; in jit_get_next_entry()
269 ret = fread(prefix, sizeof(*prefix), 1, jd->in); in jit_get_next_entry()
273 if (jd->needs_bswap) { in jit_get_next_entry()
288 if (bs > jd->bufsize) { in jit_get_next_entry()
290 n = realloc(jd->buf, bs); in jit_get_next_entry()
293 jd->buf = n; in jit_get_next_entry()
294 jd->bufsize = bs; in jit_get_next_entry()
297 addr = ((void *)jd->buf) + sizeof(*prefix); in jit_get_next_entry()
299 ret = fread(addr, bs - sizeof(*prefix), 1, jd->in); in jit_get_next_entry()
303 jr = (union jr_entry *)jd->buf; in jit_get_next_entry()
307 if (jd->needs_bswap) { in jit_get_next_entry()
319 if (jd->needs_bswap) { in jit_get_next_entry()
328 if (jd->needs_bswap) { in jit_get_next_entry()
336 jd->code_load_count++; in jit_get_next_entry()
339 if (jd->needs_bswap) { in jit_get_next_entry()
358 jit_inject_event(struct jit_buf_desc *jd, union perf_event *event) in jit_inject_event() argument
362 size = perf_data__write(jd->output, event, event->header.size); in jit_inject_event()
366 jd->bytes_written += size; in jit_inject_event()
370 static uint64_t convert_timestamp(struct jit_buf_desc *jd, uint64_t timestamp) in convert_timestamp() argument
373 struct perf_record_time_conv *time_conv = &jd->session->time_conv; in convert_timestamp()
375 if (!jd->use_arch_timestamp) in convert_timestamp()
401 static int jit_repipe_code_load(struct jit_buf_desc *jd, union jr_entry *jr) in jit_repipe_code_load() argument
405 struct perf_tool *tool = jd->session->tool; in jit_repipe_code_load()
424 usize = jd->unwinding_mapped_size; in jit_repipe_code_load()
429 idr_size = jd->machine->id_hdr_size; in jit_repipe_code_load()
437 jd->dir, in jit_repipe_code_load()
445 …ret = jit_emit_elf(filename, sym, addr, (const void *)uaddr, csize, jd->debug_data, jd->nr_debug_e… in jit_repipe_code_load()
446 jd->unwinding_data, jd->eh_frame_hdr_size, jd->unwinding_size); in jit_repipe_code_load()
448 if (jd->debug_data && jd->nr_debug_entries) { in jit_repipe_code_load()
449 zfree(&jd->debug_data); in jit_repipe_code_load()
450 jd->nr_debug_entries = 0; in jit_repipe_code_load()
453 if (jd->unwinding_data && jd->eh_frame_hdr_size) { in jit_repipe_code_load()
454 zfree(&jd->unwinding_data); in jit_repipe_code_load()
455 jd->eh_frame_hdr_size = 0; in jit_repipe_code_load()
456 jd->unwinding_mapped_size = 0; in jit_repipe_code_load()
457 jd->unwinding_size = 0; in jit_repipe_code_load()
485 if (jd->sample_type & PERF_SAMPLE_TID) { in jit_repipe_code_load()
489 if (jd->sample_type & PERF_SAMPLE_TIME) in jit_repipe_code_load()
490 id->time = convert_timestamp(jd, jr->load.p.timestamp); in jit_repipe_code_load()
503 ret = perf_event__process_mmap2(tool, event, &sample, jd->machine); in jit_repipe_code_load()
507 ret = jit_inject_event(jd, event); in jit_repipe_code_load()
512 build_id__mark_dso_hit(tool, event, &sample, NULL, jd->machine); in jit_repipe_code_load()
517 static int jit_repipe_code_move(struct jit_buf_desc *jd, union jr_entry *jr) in jit_repipe_code_move() argument
521 struct perf_tool *tool = jd->session->tool; in jit_repipe_code_move()
536 usize = jd->unwinding_mapped_size; in jit_repipe_code_move()
537 idr_size = jd->machine->id_hdr_size; in jit_repipe_code_move()
548 jd->dir, in jit_repipe_code_move()
577 if (jd->sample_type & PERF_SAMPLE_TID) { in jit_repipe_code_move()
581 if (jd->sample_type & PERF_SAMPLE_TIME) in jit_repipe_code_move()
582 id->time = convert_timestamp(jd, jr->load.p.timestamp); in jit_repipe_code_move()
595 ret = perf_event__process_mmap2(tool, event, &sample, jd->machine); in jit_repipe_code_move()
599 ret = jit_inject_event(jd, event); in jit_repipe_code_move()
601 build_id__mark_dso_hit(tool, event, &sample, NULL, jd->machine); in jit_repipe_code_move()
606 static int jit_repipe_debug_info(struct jit_buf_desc *jd, union jr_entry *jr) in jit_repipe_debug_info() argument
611 if (!(jd && jr)) in jit_repipe_debug_info()
621 jd->debug_data = data; in jit_repipe_debug_info()
627 jd->nr_debug_entries = jr->info.nr_entry; in jit_repipe_debug_info()
633 jit_repipe_unwinding_info(struct jit_buf_desc *jd, union jr_entry *jr) in jit_repipe_unwinding_info() argument
638 if (!(jd && jr)) in jit_repipe_unwinding_info()
649 jd->eh_frame_hdr_size = jr->unwinding.eh_frame_hdr_size; in jit_repipe_unwinding_info()
650 jd->unwinding_size = jr->unwinding.unwinding_size; in jit_repipe_unwinding_info()
651 jd->unwinding_mapped_size = jr->unwinding.mapped_size; in jit_repipe_unwinding_info()
652 jd->unwinding_data = unwinding_data; in jit_repipe_unwinding_info()
658 jit_process_dump(struct jit_buf_desc *jd) in jit_process_dump() argument
663 while ((jr = jit_get_next_entry(jd))) { in jit_process_dump()
666 ret = jit_repipe_code_load(jd, jr); in jit_process_dump()
669 ret = jit_repipe_code_move(jd, jr); in jit_process_dump()
672 ret = jit_repipe_debug_info(jd, jr); in jit_process_dump()
675 ret = jit_repipe_unwinding_info(jd, jr); in jit_process_dump()
686 jit_inject(struct jit_buf_desc *jd, char *path) in jit_inject() argument
693 ret = jit_open(jd, path); in jit_inject()
697 ret = jit_process_dump(jd); in jit_inject()
699 jit_close(jd); in jit_inject()
798 struct jit_buf_desc jd; in jit_process() local
812 memset(&jd, 0, sizeof(jd)); in jit_process()
814 jd.session = session; in jit_process()
815 jd.output = output; in jit_process()
816 jd.machine = machine; in jit_process()
823 jd.sample_type = first->core.attr.sample_type; in jit_process()
827 ret = jit_inject(&jd, filename); in jit_process()
830 *nbytes = jd.bytes_written; in jit_process()