Lines Matching refs:event
43 union perf_event *event,
127 struct ordered_event *event)
132 return perf_session__deliver_event(session, event->event,
133 session->tool, event->file_offset,
134 event->file_path);
201 * kernel MMAP event, in perf_event__process_mmap().
262 static void swap_sample_id_all(union perf_event *event, void *data)
264 void *end = (void *) event + event->header.size;
271 static void perf_event__all64_swap(union perf_event *event,
274 struct perf_event_header *hdr = &event->header;
275 mem_bswap_64(hdr + 1, event->header.size - sizeof(*hdr));
278 static void perf_event__comm_swap(union perf_event *event, bool sample_id_all)
280 event->comm.pid = bswap_32(event->comm.pid);
281 event->comm.tid = bswap_32(event->comm.tid);
284 void *data = &event->comm.comm;
287 swap_sample_id_all(event, data);
291 static void perf_event__mmap_swap(union perf_event *event,
294 event->mmap.pid = bswap_32(event->mmap.pid);
295 event->mmap.tid = bswap_32(event->mmap.tid);
296 event->mmap.start = bswap_64(event->mmap.start);
297 event->mmap.len = bswap_64(event->mmap.len);
298 event->mmap.pgoff = bswap_64(event->mmap.pgoff);
301 void *data = &event->mmap.filename;
304 swap_sample_id_all(event, data);
308 static void perf_event__mmap2_swap(union perf_event *event,
311 event->mmap2.pid = bswap_32(event->mmap2.pid);
312 event->mmap2.tid = bswap_32(event->mmap2.tid);
313 event->mmap2.start = bswap_64(event->mmap2.start);
314 event->mmap2.len = bswap_64(event->mmap2.len);
315 event->mmap2.pgoff = bswap_64(event->mmap2.pgoff);
317 if (!(event->header.misc & PERF_RECORD_MISC_MMAP_BUILD_ID)) {
318 event->mmap2.maj = bswap_32(event->mmap2.maj);
319 event->mmap2.min = bswap_32(event->mmap2.min);
320 event->mmap2.ino = bswap_64(event->mmap2.ino);
321 event->mmap2.ino_generation = bswap_64(event->mmap2.ino_generation);
325 void *data = &event->mmap2.filename;
328 swap_sample_id_all(event, data);
331 static void perf_event__task_swap(union perf_event *event, bool sample_id_all)
333 event->fork.pid = bswap_32(event->fork.pid);
334 event->fork.tid = bswap_32(event->fork.tid);
335 event->fork.ppid = bswap_32(event->fork.ppid);
336 event->fork.ptid = bswap_32(event->fork.ptid);
337 event->fork.time = bswap_64(event->fork.time);
340 swap_sample_id_all(event, &event->fork + 1);
343 static void perf_event__read_swap(union perf_event *event, bool sample_id_all)
345 event->read.pid = bswap_32(event->read.pid);
346 event->read.tid = bswap_32(event->read.tid);
347 event->read.value = bswap_64(event->read.value);
348 event->read.time_enabled = bswap_64(event->read.time_enabled);
349 event->read.time_running = bswap_64(event->read.time_running);
350 event->read.id = bswap_64(event->read.id);
353 swap_sample_id_all(event, &event->read + 1);
356 static void perf_event__aux_swap(union perf_event *event, bool sample_id_all)
358 event->aux.aux_offset = bswap_64(event->aux.aux_offset);
359 event->aux.aux_size = bswap_64(event->aux.aux_size);
360 event->aux.flags = bswap_64(event->aux.flags);
363 swap_sample_id_all(event, &event->aux + 1);
366 static void perf_event__itrace_start_swap(union perf_event *event,
369 event->itrace_start.pid = bswap_32(event->itrace_start.pid);
370 event->itrace_start.tid = bswap_32(event->itrace_start.tid);
373 swap_sample_id_all(event, &event->itrace_start + 1);
376 static void perf_event__switch_swap(union perf_event *event, bool sample_id_all)
378 if (event->header.type == PERF_RECORD_SWITCH_CPU_WIDE) {
379 event->context_switch.next_prev_pid =
380 bswap_32(event->context_switch.next_prev_pid);
381 event->context_switch.next_prev_tid =
382 bswap_32(event->context_switch.next_prev_tid);
386 swap_sample_id_all(event, &event->context_switch + 1);
389 static void perf_event__text_poke_swap(union perf_event *event, bool sample_id_all)
391 event->text_poke.addr = bswap_64(event->text_poke.addr);
392 event->text_poke.old_len = bswap_16(event->text_poke.old_len);
393 event->text_poke.new_len = bswap_16(event->text_poke.new_len);
396 size_t len = sizeof(event->text_poke.old_len) +
397 sizeof(event->text_poke.new_len) +
398 event->text_poke.old_len +
399 event->text_poke.new_len;
400 void *data = &event->text_poke.old_len;
403 swap_sample_id_all(event, data);
407 static void perf_event__throttle_swap(union perf_event *event,
410 event->throttle.time = bswap_64(event->throttle.time);
411 event->throttle.id = bswap_64(event->throttle.id);
412 event->throttle.stream_id = bswap_64(event->throttle.stream_id);
415 swap_sample_id_all(event, &event->throttle + 1);
418 static void perf_event__namespaces_swap(union perf_event *event,
423 event->namespaces.pid = bswap_32(event->namespaces.pid);
424 event->namespaces.tid = bswap_32(event->namespaces.tid);
425 event->namespaces.nr_namespaces = bswap_64(event->namespaces.nr_namespaces);
427 for (i = 0; i < event->namespaces.nr_namespaces; i++) {
428 struct perf_ns_link_info *ns = &event->namespaces.link_info[i];
435 swap_sample_id_all(event, &event->namespaces.link_info[i]);
438 static void perf_event__cgroup_swap(union perf_event *event, bool sample_id_all)
440 event->cgroup.id = bswap_64(event->cgroup.id);
443 void *data = &event->cgroup.path;
446 swap_sample_id_all(event, data);
528 static void perf_event__hdr_attr_swap(union perf_event *event,
533 perf_event__attr_swap(&event->attr.attr);
535 size = event->header.size;
536 size -= perf_record_header_attr_id(event) - (void *)event;
537 mem_bswap_64(perf_record_header_attr_id(event), size);
540 static void perf_event__event_update_swap(union perf_event *event,
543 event->event_update.type = bswap_64(event->event_update.type);
544 event->event_update.id = bswap_64(event->event_update.id);
547 static void perf_event__event_type_swap(union perf_event *event,
550 event->event_type.event_type.event_id =
551 bswap_64(event->event_type.event_type.event_id);
554 static void perf_event__tracing_data_swap(union perf_event *event,
557 event->tracing_data.size = bswap_32(event->tracing_data.size);
560 static void perf_event__auxtrace_info_swap(union perf_event *event,
565 event->auxtrace_info.type = bswap_32(event->auxtrace_info.type);
567 size = event->header.size;
568 size -= (void *)&event->auxtrace_info.priv - (void *)event;
569 mem_bswap_64(event->auxtrace_info.priv, size);
572 static void perf_event__auxtrace_swap(union perf_event *event,
575 event->auxtrace.size = bswap_64(event->auxtrace.size);
576 event->auxtrace.offset = bswap_64(event->auxtrace.offset);
577 event->auxtrace.reference = bswap_64(event->auxtrace.reference);
578 event->auxtrace.idx = bswap_32(event->auxtrace.idx);
579 event->auxtrace.tid = bswap_32(event->auxtrace.tid);
580 event->auxtrace.cpu = bswap_32(event->auxtrace.cpu);
583 static void perf_event__auxtrace_error_swap(union perf_event *event,
586 event->auxtrace_error.type = bswap_32(event->auxtrace_error.type);
587 event->auxtrace_error.code = bswap_32(event->auxtrace_error.code);
588 event->auxtrace_error.cpu = bswap_32(event->auxtrace_error.cpu);
589 event->auxtrace_error.pid = bswap_32(event->auxtrace_error.pid);
590 event->auxtrace_error.tid = bswap_32(event->auxtrace_error.tid);
591 event->auxtrace_error.fmt = bswap_32(event->auxtrace_error.fmt);
592 event->auxtrace_error.ip = bswap_64(event->auxtrace_error.ip);
593 if (event->auxtrace_error.fmt)
594 event->auxtrace_error.time = bswap_64(event->auxtrace_error.time);
595 if (event->auxtrace_error.fmt >= 2) {
596 event->auxtrace_error.machine_pid = bswap_32(event->auxtrace_error.machine_pid);
597 event->auxtrace_error.vcpu = bswap_32(event->auxtrace_error.vcpu);
601 static void perf_event__thread_map_swap(union perf_event *event,
606 event->thread_map.nr = bswap_64(event->thread_map.nr);
608 for (i = 0; i < event->thread_map.nr; i++)
609 event->thread_map.entries[i].pid = bswap_64(event->thread_map.entries[i].pid);
612 static void perf_event__cpu_map_swap(union perf_event *event,
615 struct perf_record_cpu_map_data *data = &event->cpu_map.data;
653 static void perf_event__stat_config_swap(union perf_event *event,
658 size = bswap_64(event->stat_config.nr) * sizeof(event->stat_config.data[0]);
660 mem_bswap_64(&event->stat_config.nr, size);
663 static void perf_event__stat_swap(union perf_event *event,
666 event->stat.id = bswap_64(event->stat.id);
667 event->stat.thread = bswap_32(event->stat.thread);
668 event->stat.cpu = bswap_32(event->stat.cpu);
669 event->stat.val = bswap_64(event->stat.val);
670 event->stat.ena = bswap_64(event->stat.ena);
671 event->stat.run = bswap_64(event->stat.run);
674 static void perf_event__stat_round_swap(union perf_event *event,
677 event->stat_round.type = bswap_64(event->stat_round.type);
678 event->stat_round.time = bswap_64(event->stat_round.time);
681 static void perf_event__time_conv_swap(union perf_event *event,
684 event->time_conv.time_shift = bswap_64(event->time_conv.time_shift);
685 event->time_conv.time_mult = bswap_64(event->time_conv.time_mult);
686 event->time_conv.time_zero = bswap_64(event->time_conv.time_zero);
688 if (event_contains(event->time_conv, time_cycles)) {
689 event->time_conv.time_cycles = bswap_64(event->time_conv.time_cycles);
690 event->time_conv.time_mask = bswap_64(event->time_conv.time_mask);
694 typedef void (*perf_event__swap_op)(union perf_event *event,
737 * event.
775 union perf_event *event __maybe_unused,
783 int perf_session__queue_event(struct perf_session *s, union perf_event *event,
786 return ordered_events__queue(&s->ordered_events, event, timestamp, file_offset, file_path);
972 static void evlist__print_tstamp(struct evlist *evlist, union perf_event *event, struct perf_sample *sample)
976 if (event->header.type != PERF_RECORD_SAMPLE &&
1023 static void dump_event(struct evlist *evlist, union perf_event *event,
1030 printf("\n%#" PRIx64 "@%s [%#x]: event: %d\n",
1031 file_offset, file_path, event->header.size, event->header.type);
1033 trace_event(event);
1034 if (event->header.type == PERF_RECORD_SAMPLE && evlist->trace_event_sample_raw)
1035 evlist->trace_event_sample_raw(evlist, event, sample);
1038 evlist__print_tstamp(evlist, event, sample);
1041 event->header.size, perf_event__name(event->header.type));
1052 static void dump_sample(struct evsel *evsel, union perf_event *event,
1062 event->header.misc, sample->pid, sample->tid, sample->ip,
1110 static void dump_read(struct evsel *evsel, union perf_event *event)
1112 struct perf_record_read *read_event = &event->read;
1118 printf(": %d %d %s %" PRI_lu64 "\n", event->read.pid, event->read.tid,
1119 evsel__name(evsel), event->read.value);
1140 union perf_event *event,
1150 else if (event->header.type == PERF_RECORD_MMAP
1151 || event->header.type == PERF_RECORD_MMAP2)
1152 pid = event->mmap.pid;
1171 union perf_event *event,
1204 return tool->sample(tool, event, sample, evsel, machine);
1209 union perf_event *event,
1219 return deliver_sample_value(evlist, tool, event, sample, v, machine,
1223 ret = deliver_sample_value(evlist, tool, event, sample, v,
1233 union perf_event *event, struct perf_sample *sample,
1243 return tool->sample(tool, event, sample, evsel, machine);
1247 return deliver_sample_group(evlist, tool, event, sample,
1250 return deliver_sample_value(evlist, tool, event, sample,
1257 union perf_event *event,
1265 dump_event(evlist, event, file_offset, sample, file_path);
1269 machine = machines__find_for_cpumode(machines, event, sample);
1271 switch (event->header.type) {
1279 dump_sample(evsel, event, sample, perf_env__arch(NULL));
1282 dump_sample(evsel, event, sample, perf_env__arch(machine->env));
1283 return evlist__deliver_sample(evlist, tool, event, sample, evsel, machine);
1285 return tool->mmap(tool, event, sample, machine);
1287 if (event->header.misc & PERF_RECORD_MISC_PROC_MAP_PARSE_TIMEOUT)
1289 return tool->mmap2(tool, event, sample, machine);
1291 return tool->comm(tool, event, sample, machine);
1293 return tool->namespaces(tool, event, sample, machine);
1295 return tool->cgroup(tool, event, sample, machine);
1297 return tool->fork(tool, event, sample, machine);
1299 return tool->exit(tool, event, sample, machine);
1302 evlist->stats.total_lost += event->lost.lost;
1303 return tool->lost(tool, event, sample, machine);
1305 if (event->header.misc & PERF_RECORD_MISC_LOST_SAMPLES_BPF)
1306 evlist->stats.total_dropped_samples += event->lost_samples.lost;
1308 evlist->stats.total_lost_samples += event->lost_samples.lost;
1309 return tool->lost_samples(tool, event, sample, machine);
1311 dump_read(evsel, event);
1312 return tool->read(tool, event, sample, evsel, machine);
1314 return tool->throttle(tool, event, sample, machine);
1316 return tool->unthrottle(tool, event, sample, machine);
1319 if (event->aux.flags & PERF_AUX_FLAG_TRUNCATED)
1321 if (event->aux.flags & PERF_AUX_FLAG_PARTIAL)
1323 if (event->aux.flags & PERF_AUX_FLAG_COLLISION)
1326 return tool->aux(tool, event, sample, machine);
1328 return tool->itrace_start(tool, event, sample, machine);
1331 return tool->context_switch(tool, event, sample, machine);
1333 return tool->ksymbol(tool, event, sample, machine);
1335 return tool->bpf(tool, event, sample, machine);
1337 return tool->text_poke(tool, event, sample, machine);
1339 return tool->aux_output_hw_id(tool, event, sample, machine);
1347 union perf_event *event,
1353 int ret = evlist__parse_sample(session->evlist, event, &sample);
1360 ret = auxtrace__process_event(session, event, &sample, tool);
1367 event, &sample, tool, file_offset, file_path);
1376 union perf_event *event,
1386 if (event->header.type != PERF_RECORD_COMPRESSED || perf_tool__compressed_is_stub(tool))
1387 dump_event(session->evlist, event, file_offset, &sample, file_path);
1390 switch (event->header.type) {
1392 err = tool->attr(tool, event, &session->evlist);
1399 return tool->event_update(tool, event, &session->evlist);
1414 return tool->tracing_data(session, event);
1416 return tool->build_id(session, event);
1418 return tool->finished_round(tool, event, oe);
1420 return tool->id_index(session, event);
1422 return tool->auxtrace_info(session, event);
1430 lseek(fd, file_offset + event->header.size, SEEK_SET);
1431 return tool->auxtrace(session, event);
1433 perf_session__auxtrace_error_inc(session, event);
1434 return tool->auxtrace_error(session, event);
1436 return tool->thread_map(session, event);
1438 return tool->cpu_map(session, event);
1440 return tool->stat_config(session, event);
1442 return tool->stat(session, event);
1444 return tool->stat_round(session, event);
1446 session->time_conv = event->time_conv;
1447 return tool->time_conv(session, event);
1449 return tool->feature(session, event);
1451 err = tool->compressed(session, event, file_offset, file_path);
1453 dump_event(session->evlist, event, file_offset, &sample, file_path);
1456 return tool->finished_init(session, event);
1463 union perf_event *event,
1469 events_stats__inc(&evlist->stats, event->header.type);
1471 if (event->header.type >= PERF_RECORD_USER_TYPE_START)
1472 return perf_session__process_user_event(session, event, 0, NULL);
1474 return machines__deliver_event(&session->machines, evlist, event, sample, tool, 0, NULL);
1501 static void event_swap(union perf_event *event, bool sample_id_all)
1505 swap = perf_event__swap_ops[event->header.type];
1507 swap(event, sample_id_all);
1515 union perf_event *event;
1520 event = file_offset - session->one_mmap_offset +
1538 event = (union perf_event *)buf;
1541 perf_event_header__bswap(&event->header);
1543 if (event->header.size < hdr_sz || event->header.size > buf_sz)
1547 rest = event->header.size - hdr_sz;
1553 event_swap(event, evlist__sample_id_all(session->evlist));
1557 if (sample && event->header.type < PERF_RECORD_USER_TYPE_START &&
1558 evlist__parse_sample(session->evlist, event, sample))
1561 *event_ptr = event;
1571 union perf_event *event;
1576 PERF_SAMPLE_MAX_SIZE, &event,
1581 err = cb(session, event, offset, data);
1585 offset += event->header.size;
1586 if (event->header.type == PERF_RECORD_AUXTRACE)
1587 offset += event->auxtrace.size;
1595 union perf_event *event, u64 file_offset,
1603 event_swap(event, evlist__sample_id_all(evlist));
1605 if (event->header.type >= PERF_RECORD_HEADER_MAX)
1608 events_stats__inc(&evlist->stats, event->header.type);
1610 if (event->header.type >= PERF_RECORD_USER_TYPE_START)
1611 return perf_session__process_user_event(session, event, file_offset, file_path);
1616 ret = evlist__parse_sample_timestamp(evlist, event, ×tamp);
1620 ret = perf_session__queue_event(session, event, timestamp, file_offset, file_path);
1625 return perf_session__deliver_event(session, event, tool, file_offset, file_path);
1788 union perf_event *event;
1816 event = buf;
1817 err = perf_data__read(session->data, event,
1823 pr_err("failed to read event header\n");
1828 perf_event_header__bswap(&event->header);
1830 size = event->header.size;
1832 pr_err("bad event header size\n");
1839 pr_err("failed to allocate memory to read event\n");
1844 event = buf;
1846 p = event;
1854 pr_err("unexpected end of event stream\n");
1858 pr_err("failed to read event data\n");
1863 if ((skip = perf_session__process_event(session, event, head, "pipe")) < 0) {
1865 head, event->header.size, event->header.type);
1908 union perf_event *event;
1913 * the size of the event in the headers.
1915 if (head + sizeof(event->header) > mmap_size)
1918 event = (union perf_event *)(buf + head);
1920 perf_event_header__bswap(&event->header);
1922 event_size = event->header.size;
1924 return event;
1926 /* We're not fetching the event so swap back again */
1928 perf_event_header__bswap(&event->header);
1930 /* Check if the event fits into the next mmapped buf. */
1937 pr_debug("%s: head=%#" PRIx64 " event->header.size=%#x, mmap_size=%#zx:"
1965 union perf_event *event = fetch_decomp_event(decomp->head, decomp->size, decomp->data,
1968 if (!event)
1971 size = event->header.size;
1974 (skip = perf_session__process_event(session, event, decomp->file_pos,
1977 decomp->file_pos + decomp->head, event->header.size, event->header.type);
2005 union perf_event *event,
2115 union perf_event *event;
2118 event = fetch_mmaped_event(rd->head, rd->mmap_size, rd->mmap_cur,
2120 if (IS_ERR(event))
2121 return PTR_ERR(event);
2123 if (!event)
2126 size = event->header.size;
2131 (skip = rd->process(session, event, rd->file_pos, rd->path)) < 0) {
2133 rd->file_offset + rd->head, event->header.size,
2134 event->header.type, strerror(-skip));
2198 union perf_event *event,
2202 return perf_session__process_event(session, event, file_offset, file_path);
2582 union perf_event *event)
2585 struct perf_record_id_index *ie = &event->id_index;