4 #include <linux/kernel.h> 5 #include <traceevent/event-parse.h> 10 #include <sys/types.h> 38 pr_err(
"incompatible file format (rerun with -v to learn more)\n");
49 pr_err(
"non matching sample_type\n");
54 pr_err(
"non matching sample_id_all\n");
59 pr_err(
"non matching read_format\n");
92 if (evsel->
attr.comm_exec)
168 dump_printf(
"WARNING: No sample_id_all support, falling back to unordered processing\n");
271 ret = read(fd, buf,
min(n, (off_t)
sizeof(buf)));
288 return event->auxtrace.size;
364 if (tool->
mmap == NULL)
366 if (tool->
mmap2 == NULL)
368 if (tool->
comm == NULL)
372 if (tool->
fork == NULL)
374 if (tool->
exit == NULL)
376 if (tool->
lost == NULL)
380 if (tool->
aux == NULL)
386 if (tool->
read == NULL)
392 if (tool->
attr == NULL)
420 if (tool->
stat == NULL)
432 void *end = (
void *) event + event->
header.size;
433 int size = end - data;
435 BUG_ON(
size %
sizeof(u64));
440 bool sample_id_all __maybe_unused)
442 struct perf_event_header *hdr = &
event->header;
448 event->comm.pid = bswap_32(event->
comm.
pid);
449 event->comm.tid = bswap_32(event->
comm.
tid);
452 void *
data = &
event->comm.comm;
454 data += PERF_ALIGN(strlen(data) + 1,
sizeof(u64));
462 event->mmap.pid = bswap_32(event->
mmap.
pid);
463 event->mmap.tid = bswap_32(event->
mmap.
tid);
464 event->mmap.start = bswap_64(event->
mmap.
start);
465 event->mmap.len = bswap_64(event->
mmap.
len);
466 event->mmap.pgoff = bswap_64(event->
mmap.
pgoff);
469 void *
data = &
event->mmap.filename;
471 data += PERF_ALIGN(strlen(data) + 1,
sizeof(u64));
479 event->mmap2.pid = bswap_32(event->
mmap2.
pid);
480 event->mmap2.tid = bswap_32(event->
mmap2.
tid);
481 event->mmap2.start = bswap_64(event->
mmap2.
start);
482 event->mmap2.len = bswap_64(event->
mmap2.
len);
483 event->mmap2.pgoff = bswap_64(event->
mmap2.
pgoff);
484 event->mmap2.maj = bswap_32(event->
mmap2.
maj);
485 event->mmap2.min = bswap_32(event->
mmap2.
min);
486 event->mmap2.ino = bswap_64(event->
mmap2.
ino);
489 void *
data = &
event->mmap2.filename;
491 data += PERF_ALIGN(strlen(data) + 1,
sizeof(u64));
497 event->fork.pid = bswap_32(event->
fork.
pid);
498 event->fork.tid = bswap_32(event->
fork.
tid);
499 event->fork.ppid = bswap_32(event->
fork.
ppid);
500 event->fork.ptid = bswap_32(event->
fork.
ptid);
501 event->fork.time = bswap_64(event->
fork.
time);
509 event->read.pid = bswap_32(event->
read.
pid);
510 event->read.tid = bswap_32(event->
read.
tid);
511 event->read.value = bswap_64(event->
read.
value);
514 event->read.id = bswap_64(event->
read.
id);
523 event->aux.aux_size = bswap_64(event->
aux.
aux_size);
524 event->aux.flags = bswap_64(event->
aux.
flags);
542 if (event->
header.type == PERF_RECORD_SWITCH_CPU_WIDE) {
543 event->context_switch.next_prev_pid =
545 event->context_switch.next_prev_tid =
557 event->throttle.id = bswap_64(event->
throttle.
id);
566 int rev = (b >> 4) | ((b & 0xf) << 4);
567 rev = ((rev & 0xcc) >> 2) | ((rev & 0x33) << 2);
568 rev = ((rev & 0xaa) >> 1) | ((rev & 0x55) << 1);
590 for (i = 0; i < len; i++) {
599 attr->type = bswap_32(attr->type);
600 attr->size = bswap_32(attr->size);
602 #define bswap_safe(f, n) \ 603 (attr->size > (offsetof(struct perf_event_attr, f) + \ 604 sizeof(attr->f) * (n))) 605 #define bswap_field(f, sz) \ 607 if (bswap_safe(f, 0)) \ 608 attr->f = bswap_##sz(attr->f); \ 610 #define bswap_field_16(f) bswap_field(f, 16) 611 #define bswap_field_32(f) bswap_field(f, 32) 612 #define bswap_field_64(f) bswap_field(f, 64) 635 #undef bswap_field_64 636 #undef bswap_field_32 642 bool sample_id_all __maybe_unused)
648 size =
event->header.size;
654 bool sample_id_all __maybe_unused)
661 bool sample_id_all __maybe_unused)
663 event->event_type.event_type.event_id =
668 bool sample_id_all __maybe_unused)
674 bool sample_id_all __maybe_unused)
680 size =
event->header.size;
686 bool sample_id_all __maybe_unused)
691 event->auxtrace.idx = bswap_32(event->
auxtrace.
idx);
692 event->auxtrace.tid = bswap_32(event->
auxtrace.
tid);
693 event->auxtrace.cpu = bswap_32(event->
auxtrace.
cpu);
697 bool sample_id_all __maybe_unused)
708 bool sample_id_all __maybe_unused)
714 for (i = 0; i <
event->thread_map.nr; i++)
719 bool sample_id_all __maybe_unused)
728 switch (data->
type) {
732 cpus->
nr = bswap_16(cpus->
nr);
734 for (i = 0; i < cpus->
nr; i++)
735 cpus->
cpu[i] = bswap_16(cpus->
cpu[i]);
740 mask->
nr = bswap_16(mask->
nr);
747 pr_err(
"cpu_map swap: unsupported long size\n");
755 bool sample_id_all __maybe_unused)
759 size =
event->stat_config.nr *
sizeof(
event->stat_config.data[0]);
765 bool sample_id_all __maybe_unused)
767 event->stat.id = bswap_64(event->
stat.
id);
768 event->stat.thread = bswap_32(event->
stat.
thread);
769 event->stat.cpu = bswap_32(event->
stat.
cpu);
770 event->stat.val = bswap_64(event->
stat.
val);
771 event->stat.ena = bswap_64(event->
stat.
ena);
772 event->stat.run = bswap_64(event->
stat.
run);
776 bool sample_id_all __maybe_unused)
863 fprintf(stdout,
"\n");
868 u64 timestamp, u64 file_offset)
877 u64 kernel_callchain_nr = callchain->
nr;
880 for (i = 0; i < kernel_callchain_nr; i++) {
881 if (callchain->
ips[i] == PERF_CONTEXT_USER)
885 if ((i != kernel_callchain_nr) && lbr_stack->
nr) {
903 total_nr = i + 1 + lbr_stack->
nr + 1;
904 kernel_callchain_nr = i + 1;
906 printf(
"... LBR call chain: nr:%" PRIu64
"\n", total_nr);
908 for (i = 0; i < kernel_callchain_nr; i++)
909 printf(
"..... %2d: %016" PRIx64
"\n",
910 i, callchain->
ips[i]);
912 printf(
"..... %2d: %016" PRIx64
"\n",
913 (
int)(kernel_callchain_nr), lbr_stack->
entries[0].
to);
914 for (i = 0; i < lbr_stack->
nr; i++)
915 printf(
"..... %2d: %016" PRIx64
"\n",
916 (
int)(i + kernel_callchain_nr + 1), lbr_stack->
entries[i].
from);
929 printf(
"... FP chain: nr:%" PRIu64
"\n", callchain->
nr);
931 for (i = 0; i < callchain->
nr; i++)
932 printf(
"..... %2d: %016" PRIx64
"\n",
933 i, callchain->
ips[i]);
940 printf(
"... branch stack: nr:%" PRIu64
"\n", sample->
branch_stack->
nr);
945 printf(
"..... %2"PRIu64
": %016" PRIx64
" -> %016" PRIx64
" %hu cycles %s%s%s%s %x\n",
960 for_each_set_bit(rid, (
unsigned long *) &mask,
sizeof(mask) * 8) {
963 printf(
".... %-5s 0x%" PRIx64
"\n",
969 [PERF_SAMPLE_REGS_ABI_NONE] =
"none",
970 [PERF_SAMPLE_REGS_ABI_32] =
"32-bit",
971 [PERF_SAMPLE_REGS_ABI_64] =
"64-bit",
976 if (d->
abi > PERF_SAMPLE_REGS_ABI_64)
984 u64 mask = regs->
mask;
986 printf(
"... %s regs: mask 0x%" PRIx64
" ABI %s\n",
1006 if (intr_regs->
regs)
1012 printf(
"... ustack: size %" PRIu64
", offset 0x%x\n",
1022 if (event->
header.type != PERF_RECORD_SAMPLE &&
1024 fputs(
"-1 -1 ", stdout);
1028 if ((sample_type & PERF_SAMPLE_CPU))
1029 printf(
"%u ", sample->
cpu);
1031 if (sample_type & PERF_SAMPLE_TIME)
1032 printf(
"%" PRIu64
" ", sample->
time);
1037 printf(
"... sample_read:\n");
1039 if (read_format & PERF_FORMAT_TOTAL_TIME_ENABLED)
1040 printf(
"...... time enabled %016" PRIx64
"\n",
1043 if (read_format & PERF_FORMAT_TOTAL_TIME_RUNNING)
1044 printf(
"...... time running %016" PRIx64
"\n",
1047 if (read_format & PERF_FORMAT_GROUP) {
1050 printf(
".... group nr %" PRIu64
"\n", sample->
read.
group.nr);
1052 for (i = 0; i < sample->
read.
group.nr; i++) {
1056 printf(
"..... id %016" PRIx64
1057 ", value %016" PRIx64
"\n",
1061 printf(
"..... id %016" PRIx64
", value %016" PRIx64
"\n",
1071 printf(
"\n%#" PRIx64
" [%#x]: event: %d\n",
1079 printf(
"%#" PRIx64
" [%#x]: PERF_RECORD_%s", file_offset,
1091 printf(
"(IP, 0x%x): %d/%d: %#" PRIx64
" period: %" PRIu64
" addr: %#" PRIx64
"\n",
1095 sample_type = evsel->
attr.sample_type;
1103 if (sample_type & PERF_SAMPLE_REGS_USER)
1106 if (sample_type & PERF_SAMPLE_REGS_INTR)
1109 if (sample_type & PERF_SAMPLE_STACK_USER)
1112 if (sample_type & PERF_SAMPLE_WEIGHT)
1113 printf(
"... weight: %" PRIu64
"\n", sample->
weight);
1115 if (sample_type & PERF_SAMPLE_DATA_SRC)
1116 printf(
" . data_src: 0x%"PRIx64
"\n", sample->
data_src);
1118 if (sample_type & PERF_SAMPLE_PHYS_ADDR)
1119 printf(
" .. phys_addr: 0x%"PRIx64
"\n", sample->
phys_addr);
1121 if (sample_type & PERF_SAMPLE_TRANSACTION)
1122 printf(
"... transaction: %" PRIx64
"\n", sample->
transaction);
1124 if (sample_type & PERF_SAMPLE_READ)
1136 printf(
": %d %d %s %" PRIu64
"\n", event->
read.
pid, event->
read.
tid,
1140 read_format = evsel->
attr.read_format;
1142 if (read_format & PERF_FORMAT_TOTAL_TIME_ENABLED)
1143 printf(
"... time enabled : %" PRIu64
"\n", read_event->
time_enabled);
1145 if (read_format & PERF_FORMAT_TOTAL_TIME_RUNNING)
1146 printf(
"... time running : %" PRIu64
"\n", read_event->
time_running);
1148 if (read_format & PERF_FORMAT_ID)
1149 printf(
"... id : %" PRIu64
"\n", read_event->
id);
1159 ((sample->
cpumode == PERF_RECORD_MISC_GUEST_KERNEL) ||
1160 (sample->
cpumode == PERF_RECORD_MISC_GUEST_USER))) {
1163 if (event->
header.type == PERF_RECORD_MMAP
1164 || event->
header.type == PERF_RECORD_MMAP2)
1165 pid =
event->mmap.pid;
1175 return &machines->
host;
1193 if (!sid || sid->
evsel == NULL) {
1198 return tool->
sample(tool, event, sample, sid->
evsel, machine);
1210 for (i = 0; i < sample->
read.
group.nr; i++) {
1230 u64 sample_type = evsel->
attr.sample_type;
1231 u64 read_format = evsel->
attr.read_format;
1234 if (!(sample_type & PERF_SAMPLE_READ))
1235 return tool->
sample(tool, event, sample, evsel, machine);
1238 if (read_format & PERF_FORMAT_GROUP)
1250 struct perf_tool *tool, u64 file_offset)
1255 dump_event(evlist, event, file_offset, sample);
1261 switch (event->
header.type) {
1262 case PERF_RECORD_SAMPLE:
1263 if (evsel == NULL) {
1268 if (machine == NULL) {
1273 case PERF_RECORD_MMAP:
1274 return tool->
mmap(tool, event, sample, machine);
1275 case PERF_RECORD_MMAP2:
1276 if (event->
header.misc & PERF_RECORD_MISC_PROC_MAP_PARSE_TIMEOUT)
1278 return tool->
mmap2(tool, event, sample, machine);
1279 case PERF_RECORD_COMM:
1280 return tool->
comm(tool, event, sample, machine);
1281 case PERF_RECORD_NAMESPACES:
1282 return tool->
namespaces(tool, event, sample, machine);
1283 case PERF_RECORD_FORK:
1284 return tool->
fork(tool, event, sample, machine);
1285 case PERF_RECORD_EXIT:
1286 return tool->
exit(tool, event, sample, machine);
1287 case PERF_RECORD_LOST:
1290 return tool->
lost(tool, event, sample, machine);
1291 case PERF_RECORD_LOST_SAMPLES:
1294 return tool->
lost_samples(tool, event, sample, machine);
1295 case PERF_RECORD_READ:
1297 return tool->
read(tool, event, sample, evsel, machine);
1298 case PERF_RECORD_THROTTLE:
1299 return tool->
throttle(tool, event, sample, machine);
1300 case PERF_RECORD_UNTHROTTLE:
1301 return tool->
unthrottle(tool, event, sample, machine);
1302 case PERF_RECORD_AUX:
1304 if (event->
aux.
flags & PERF_AUX_FLAG_TRUNCATED)
1306 if (event->
aux.
flags & PERF_AUX_FLAG_PARTIAL)
1309 return tool->
aux(tool, event, sample, machine);
1310 case PERF_RECORD_ITRACE_START:
1311 return tool->
itrace_start(tool, event, sample, machine);
1312 case PERF_RECORD_SWITCH:
1313 case PERF_RECORD_SWITCH_CPU_WIDE:
1331 pr_err(
"Can't parse sample, err = %d\n", ret);
1342 event, &sample, tool, file_offset);
1358 switch (event->
header.type) {
1360 err = tool->
attr(tool, event, &session->
evlist);
1376 lseek(fd, file_offset, SEEK_SET);
1379 return tool->
build_id(tool, event, session);
1383 return tool->
id_index(tool, event, session);
1388 lseek(fd, file_offset + event->
header.size, SEEK_SET);
1389 return tool->
auxtrace(tool, event, session);
1394 return tool->
thread_map(tool, event, session);
1396 return tool->
cpu_map(tool, event, session);
1400 return tool->
stat(tool, event, session);
1402 return tool->
stat_round(tool, event, session);
1405 return tool->
time_conv(tool, event, session);
1407 return tool->
feature(tool, event, session);
1434 swap(event, sample_id_all);
1438 void *buf,
size_t buf_sz,
1443 size_t hdr_sz, rest;
1449 goto out_parse_sample;
1456 hdr_sz =
sizeof(
struct perf_event_header);
1458 if (buf_sz < hdr_sz)
1461 if (lseek(fd, file_offset, SEEK_SET) == (off_t)-1 ||
1462 readn(fd, buf, hdr_sz) != (ssize_t)hdr_sz)
1470 if (event->
header.size < hdr_sz || event->
header.size > buf_sz)
1473 rest =
event->header.size - hdr_sz;
1475 if (
readn(fd, buf, rest) != (ssize_t)rest)
1511 u64 timestamp = -1ULL;
1514 if (ret && ret != -1)
1527 hdr->type = bswap_32(hdr->type);
1528 hdr->misc = bswap_16(hdr->misc);
1529 hdr->size = bswap_16(hdr->size);
1544 pr_err(
"problem inserting idle task.\n");
1549 pr_err(
"problem inserting idle task.\n");
1563 bool should_warn =
true;
1566 if (evsel->
attr.write_backward)
1567 should_warn =
false;
1581 stats->
nr_events[PERF_RECORD_LOST] != 0) {
1582 ui__warning(
"Processed %d events and lost %d chunks!\n\n" 1583 "Check IO/CPU overload!\n\n",
1593 if (drop_rate > 0.05) {
1594 ui__warning(
"Processed %" PRIu64
" samples and lost %3.2f%%!\n\n",
1602 ui__warning(
"AUX data lost %" PRIu64
" times out of %u!\n\n",
1609 bool vmm_exclusive =
false;
1611 (void)sysfs__read_bool(
"module/kvm_intel/parameters/vmm_exclusive",
1614 ui__warning(
"AUX data had gaps in it %" PRIu64
" times out of %u!\n\n" 1615 "Are you running a KVM guest in the background?%s\n\n",
1619 "\nReloading kvm_intel module with vmm_exclusive=0\n" 1620 "will reduce the gaps to only guest's timeslices." :
1626 "Is this an older tool processing a perf.data " 1627 "file generated by a more recent tool?\n\n" 1628 "If that is not the case, consider " 1629 "reporting to linux-kernel@vger.kernel.org.\n\n",
1634 ui__warning(
"%u samples with id not present in the header\n",
1640 "%u out of %u events were discarded for this reason.\n\n" 1641 "Consider reporting to linux-kernel@vger.kernel.org.\n\n",
1647 ui__warning(
"%u unprocessable samples recorded.\n" 1648 "Do you have a KVM guest running and not using 'perf kvm'?\n",
1657 ui__warning(
"%d map information files for pre-existing threads were\n" 1658 "not processed, if there are samples for addresses they\n" 1659 "will not be resolved, you may find out which are these\n" 1660 "threads by running with -v and redirecting the output\n" 1662 "The time limit to process proc map is too short?\n" 1663 "Increase it by --proc-map-timeout\n",
1669 void *p __maybe_unused)
1689 uint32_t
size, cur_size = 0;
1707 err =
readn(fd, event,
sizeof(
struct perf_event_header));
1712 pr_err(
"failed to read event header\n");
1719 size =
event->header.size;
1720 if (size <
sizeof(
struct perf_event_header)) {
1721 pr_err(
"bad event header size\n");
1725 if (size > cur_size) {
1726 void *
new = realloc(buf, size);
1728 pr_err(
"failed to allocate memory to read event\n");
1736 p +=
sizeof(
struct perf_event_header);
1738 if (size -
sizeof(
struct perf_event_header)) {
1739 err =
readn(fd, p, size -
sizeof(
struct perf_event_header));
1742 pr_err(
"unexpected end of event stream\n");
1746 pr_err(
"failed to read event data\n");
1752 pr_err(
"%#" PRIx64
" [%#x]: failed to process type: %d\n",
1785 u64 head,
size_t mmap_size,
char *buf)
1793 if (head +
sizeof(event->
header) > mmap_size)
1801 if (head + event->
header.size > mmap_size) {
1815 #if BITS_PER_LONG == 64 1816 #define MMAP_SIZE ULLONG_MAX 1819 #define MMAP_SIZE (32 * 1024 * 1024ULL) 1820 #define NUM_MMAPS 128 1824 u64 data_offset, u64 data_size,
1830 u64 head, page_offset, file_offset, file_pos,
size;
1831 int err, mmap_prot, mmap_flags, map_idx = 0;
1841 file_offset = page_offset;
1842 head = data_offset - page_offset;
1847 if (data_offset + data_size < file_size)
1848 file_size = data_offset + data_size;
1853 if (mmap_size > file_size) {
1854 mmap_size = file_size;
1858 memset(mmaps, 0,
sizeof(mmaps));
1860 mmap_prot = PROT_READ;
1861 mmap_flags = MAP_SHARED;
1864 mmap_prot |= PROT_WRITE;
1865 mmap_flags = MAP_PRIVATE;
1868 buf = mmap(NULL, mmap_size, mmap_prot, mmap_flags, fd,
1870 if (buf == MAP_FAILED) {
1871 pr_err(
"failed to mmap file\n");
1875 mmaps[map_idx] = buf;
1876 map_idx = (map_idx + 1) & (ARRAY_SIZE(mmaps) - 1);
1877 file_pos = file_offset + head;
1886 if (mmaps[map_idx]) {
1887 munmap(mmaps[map_idx], mmap_size);
1888 mmaps[map_idx] = NULL;
1892 file_offset += page_offset;
1893 head -= page_offset;
1897 size =
event->header.size;
1899 if (size <
sizeof(
struct perf_event_header) ||
1901 pr_err(
"%#" PRIx64
" [%#x]: failed to process type: %d\n",
1902 file_offset + head, event->
header.size,
1919 if (file_pos < file_size)
1968 if (evsel->
attr.type == PERF_TYPE_TRACEPOINT)
1972 pr_err(
"No trace sample to read. Did you call 'perf %s'?\n", msg);
1986 ref->
name = strdup(symbol_name);
1987 if (ref->
name == NULL) {
1992 bracket = strchr(ref->
name,
']');
2011 bool (
skip)(
struct dso *
dso,
int parm),
int parm)
2019 const char *msg =
"";
2022 msg =
" (excludes AUX area (e.g. instruction trace) decoded / synthesized events)";
2024 ret = fprintf(fp,
"\nAggregated stats:%s\n", msg);
2045 if (pos->
attr.type == type)
2052 const char *
cpu_list,
unsigned long *cpu_bitmap)
2057 for (i = 0; i < PERF_TYPE_MAX; ++i) {
2064 if (!(evsel->
attr.sample_type & PERF_SAMPLE_CPU)) {
2065 pr_err(
"File does not contain CPU events. " 2066 "Remove -C option to proceed.\n");
2073 pr_err(
"Invalid cpu_list\n");
2077 for (i = 0; i < map->
nr; i++) {
2078 int cpu = map->
map[i];
2081 pr_err(
"Requested CPU %d too large. " 2082 "Consider raising MAX_NR_CPUS\n", cpu);
2083 goto out_delete_map;
2086 set_bit(cpu, cpu_bitmap);
2099 if (session == NULL || fp == NULL)
2102 fprintf(fp,
"# ========\n");
2104 fprintf(fp,
"# ========\n#\n");
2116 for (i = 0; i < nr_assocs; i++) {
2142 size_t i,
nr, max_nr;
2145 sizeof(struct id_index_entry);
2151 fprintf(stdout,
" nr: %zu\n", nr);
2153 for (i = 0; i <
nr; i++) {
2154 struct id_index_entry *e = &ie->
entries[i];
2158 fprintf(stdout,
" ... id: %"PRIu64, e->
id);
2159 fprintf(stdout,
" idx: %"PRIu64, e->
idx);
2160 fprintf(stdout,
" cpu: %"PRId64, e->
cpu);
2161 fprintf(stdout,
" tid: %"PRId64
"\n", e->
tid);
2181 size_t nr = 0, i = 0, sz, max_nr, n;
2187 sizeof(struct id_index_entry);
2192 n = nr > max_nr ? max_nr :
nr;
2193 sz =
sizeof(
struct id_index_event) + n *
sizeof(
struct id_index_entry);
2199 ev->id_index.
header.size = sz;
2200 ev->id_index.
nr = n;
2205 for (j = 0; j < evsel->
ids; j++) {
2206 struct id_index_entry *e;
2210 err = process(tool, ev, NULL, machine);
2217 e = &ev->id_index.
entries[i++];
2219 e->
id = evsel->
id[j];
2233 sz =
sizeof(
struct id_index_event) + nr *
sizeof(
struct id_index_entry);
2234 ev->id_index.
header.size = sz;
2235 ev->id_index.
nr = nr;
2237 err = process(tool, ev, NULL, machine);
struct event_update_event event_update
void perf_session__set_id_hdr_size(struct perf_session *session)
#define bswap_field_32(f)
static void event_swap(union perf_event *event, bool sample_id_all)
static void regs__printf(const char *type, struct regs_dump *regs)
static perf_event__swap_op perf_event__swap_ops[]
static void callchain__printf(struct perf_evsel *evsel, struct perf_sample *sample)
void ui_progress__update(struct ui_progress *p, u64 adv)
static int process_finished_round(struct perf_tool *tool, union perf_event *event, struct ordered_events *oe)
static struct machine * machines__find_for_cpumode(struct machines *machines, union perf_event *event, struct perf_sample *sample)
void machines__exit(struct machines *machines)
static s64 process_event_auxtrace_stub(struct perf_tool *tool __maybe_unused, union perf_event *event, struct perf_session *session __maybe_unused)
size_t perf_session__fprintf_dsos_buildid(struct perf_session *session, FILE *fp, bool(skip)(struct dso *dso, int parm), int parm)
static int process_stat_stub(struct perf_tool *tool __maybe_unused, union perf_event *event __maybe_unused, struct perf_session *perf_session __maybe_unused)
bool perf_evlist__valid_sample_id_all(struct perf_evlist *evlist)
struct perf_evlist * evlist
void ordered_events__reinit(struct ordered_events *oe)
void perf_session__auxtrace_error_inc(struct perf_session *session, union perf_event *event)
static void perf_event__stat_config_swap(union perf_event *event, bool sample_id_all __maybe_unused)
bool perf_evlist__valid_sample_type(struct perf_evlist *evlist)
void mem_bswap_64(void *src, int byte_size)
static const char * regs_dump_abi(struct regs_dump *d)
static int perf_session__flush_thread_stack(struct thread *thread, void *p __maybe_unused)
static int deliver_sample_group(struct perf_evlist *evlist, struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct machine *machine)
static void swap_sample_id_all(union perf_event *event, void *data)
bool perf_evlist__valid_read_format(struct perf_evlist *evlist)
static unsigned long perf_data__size(struct perf_data *data)
size_t perf_session__fprintf_nr_events(struct perf_session *session, FILE *fp)
static int process_event_stat_config_stub(struct perf_tool *tool __maybe_unused, union perf_event *event __maybe_unused, struct perf_session *session __maybe_unused)
int __perf_session__set_tracepoints_handlers(struct perf_session *session, const struct perf_evsel_str_handler *assocs, size_t nr_assocs)
struct ordered_events ordered_events
size_t perf_event__fprintf_cpu_map(union perf_event *event, FILE *fp)
void mem_bswap_32(void *src, int byte_size)
struct time_conv_event time_conv
static int process_event_op2_stub(struct perf_tool *tool __maybe_unused, union perf_event *event __maybe_unused, struct perf_session *session __maybe_unused)
struct thread_map_event_entry entries[]
int(* perf_event__handler_t)(struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct machine *machine)
struct kmap * map__kmap(struct map *map)
static void auxtrace__free(struct perf_session *session __maybe_unused)
static int perf_session__flush_thread_stacks(struct perf_session *session)
static void perf_event__comm_swap(union perf_event *event, bool sample_id_all)
static int process_event_synth_tracing_data_stub(struct perf_tool *tool __maybe_unused, union perf_event *event __maybe_unused, struct perf_session *session __maybe_unused)
int perf_event__process_aux(struct perf_tool *tool __maybe_unused, union perf_event *event, struct perf_sample *sample __maybe_unused, struct machine *machine)
int perf_event__process_lost_samples(struct perf_tool *tool __maybe_unused, union perf_event *event, struct perf_sample *sample, struct machine *machine)
static void skip(int size)
#define bswap_field_16(f)
static int process_stat_round_stub(struct perf_tool *tool __maybe_unused, union perf_event *event __maybe_unused, struct perf_session *perf_session __maybe_unused)
static bool perf_data__is_read(struct perf_data *data)
static void auxtrace__free_events(struct perf_session *session __maybe_unused)
void perf_event__attr_swap(struct perf_event_attr *attr)
ssize_t readn(int fd, void *buf, size_t n)
struct tracing_data_event tracing_data
int machine__create_kernel_maps(struct machine *machine)
void trace_event(union perf_event *event)
int ui__warning(const char *format,...)
struct ip_callchain * callchain
int perf_session__deliver_synth_event(struct perf_session *session, union perf_event *event, struct perf_sample *sample)
size_t machines__fprintf_dsos(struct machines *machines, FILE *fp)
struct throttle_event throttle
bool perf_evlist__sample_id_all(struct perf_evlist *evlist)
#define DEFAULT_GUEST_KERNEL_ID
static int ordered_events__deliver_event(struct ordered_events *oe, struct ordered_event *event)
static void perf_event__read_swap(union perf_event *event, bool sample_id_all)
#define pr_debug2(fmt,...)
void machines__set_id_hdr_size(struct machines *machines, u16 id_hdr_size)
size_t perf_session__fprintf_dsos(struct perf_session *session, FILE *fp)
size_t perf_session__fprintf(struct perf_session *session, FILE *fp)
static int skipn(int fd, off_t n)
static void perf_event__throttle_swap(union perf_event *event, bool sample_id_all)
size_t perf_event__fprintf_stat(union perf_event *event, FILE *fp)
static const char * perf_reg_name(int id)
struct perf_event_header header
static int auxtrace__process_event(struct perf_session *session __maybe_unused, union perf_event *event __maybe_unused, struct perf_sample *sample __maybe_unused, struct perf_tool *tool __maybe_unused)
struct machine * machines__findnew(struct machines *machines, pid_t pid)
struct stat_config_event stat_config
int dump_printf(const char *fmt,...)
static void perf_session__delete_threads(struct perf_session *session)
static void perf_event__event_update_swap(union perf_event *event, bool sample_id_all __maybe_unused)
struct stat_round_event stat_round
struct itrace_start_event itrace_start
bool perf_session__has_traces(struct perf_session *session, const char *msg)
x86 movsq based memset() in arch/x86/lib/memset_64.S") MEMSET_FN(memset_erms
static void perf_event__cpu_map_swap(union perf_event *event, bool sample_id_all __maybe_unused)
struct id_index_entry entries[0]
struct sample_read::@79::@81 group
struct sample_read_value one
void perf_session__delete(struct perf_session *session)
static int deliver_sample_value(struct perf_evlist *evlist, struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct sample_read_value *v, struct machine *machine)
static void branch_stack__printf(struct perf_sample *sample)
static void perf_event__thread_map_swap(union perf_event *event, bool sample_id_all __maybe_unused)
int perf_event__process_itrace_start(struct perf_tool *tool __maybe_unused, union perf_event *event, struct perf_sample *sample __maybe_unused, struct machine *machine)
struct branch_entry entries[0]
static void perf_event__mmap2_swap(union perf_event *event, bool sample_id_all)
static void perf_session__warn_about_errors(const struct perf_session *session)
struct machine * machines__find(struct machines *machines, pid_t pid)
void machines__set_comm_exec(struct machines *machines, bool comm_exec)
void cpu_map__put(struct cpu_map *map)
static int process_event_synth_event_update_stub(struct perf_tool *tool __maybe_unused, union perf_event *event __maybe_unused, struct perf_evlist **pevlist __maybe_unused)
void perf_env__exit(struct perf_env *env)
static void perf_session__warn_order(const struct perf_session *session)
void ordered_events__free(struct ordered_events *oe)
static void dump_read(struct perf_evsel *evsel, union perf_event *event)
static struct perf_session * session
static void perf_event__stat_swap(union perf_event *event, bool sample_id_all __maybe_unused)
int perf_data__open(struct perf_data *data)
#define bswap_field_64(f)
#define evlist__for_each_entry(evlist, evsel)
static int process_event_stub(struct perf_tool *tool __maybe_unused, union perf_event *event __maybe_unused, struct perf_sample *sample __maybe_unused, struct machine *machine __maybe_unused)
static s64 perf_session__process_event(struct perf_session *session, union perf_event *event, u64 file_offset)
int perf_evlist__parse_sample(struct perf_evlist *evlist, union perf_event *event, struct perf_sample *sample)
static void regs_dump__printf(u64 mask, u64 *regs)
static void dump_sample(struct perf_evsel *evsel, union perf_event *event, struct perf_sample *sample)
struct context_switch_event context_switch
struct regs_dump user_regs
#define ui_progress__init_size(p, total, title)
int perf_session__register_idle_thread(struct perf_session *session)
size_t perf_event__fprintf_stat_config(union perf_event *event, FILE *fp)
static int process_event_sample_stub(struct perf_tool *tool __maybe_unused, union perf_event *event __maybe_unused, struct perf_sample *sample __maybe_unused, struct perf_evsel *evsel __maybe_unused, struct machine *machine __maybe_unused)
static struct perf_tool tool
static int process_event_thread_map_stub(struct perf_tool *tool __maybe_unused, union perf_event *event __maybe_unused, struct perf_session *session __maybe_unused)
void auxtrace_index__free(struct list_head *head)
static void perf_event__switch_swap(union perf_event *event, bool sample_id_all)
static void perf_event__tracing_data_swap(union perf_event *event, bool sample_id_all __maybe_unused)
static int process_event_cpu_map_stub(struct perf_tool *tool __maybe_unused, union perf_event *event __maybe_unused, struct perf_session *session __maybe_unused)
struct perf_evsel * perf_evlist__id2evsel(struct perf_evlist *evlist, u64 id)
int perf_evlist__parse_sample_timestamp(struct perf_evlist *evlist, union perf_event *event, u64 *timestamp)
static const char * cpu_list
u16 perf_evlist__id_hdr_size(struct perf_evlist *evlist)
void events_stats__inc(struct events_stats *stats, u32 type)
struct regs_dump intr_regs
int machines__create_guest_kernel_maps(struct machines *machines)
struct perf_trace_event_type event_type
struct branch_stack * branch_stack
static void perf_event__itrace_start_swap(union perf_event *event, bool sample_id_all)
int ordered_events__flush(struct ordered_events *oe, enum oe_flush how)
void ordered_events__init(struct ordered_events *oe, ordered_events__deliver_t deliver)
static void dump_event(struct perf_evlist *evlist, union perf_event *event, u64 file_offset, struct perf_sample *sample)
static int perf_session__open(struct perf_session *session)
const char * perf_event__name(unsigned int id)
struct ref_reloc_sym * ref_reloc_sym
static void regs_intr__printf(struct perf_sample *sample)
static int perf_data__fd(struct perf_data *data)
size_t perf_event__fprintf_thread_map(union perf_event *event, FILE *fp)
size_t machines__fprintf_dsos_buildid(struct machines *machines, FILE *fp, bool(skip)(struct dso *dso, int parm), int parm)
void(* perf_event__swap_op)(union perf_event *event, bool sample_id_all)
int thread__set_namespaces(struct thread *thread, u64 timestamp, struct namespaces_event *event)
u32 nr_unprocessable_samples
int perf_event__process_switch(struct perf_tool *tool __maybe_unused, union perf_event *event, struct perf_sample *sample __maybe_unused, struct machine *machine)
static int process_finished_round_stub(struct perf_tool *tool __maybe_unused, union perf_event *event __maybe_unused, struct ordered_events *oe __maybe_unused)
void machines__destroy_kernel_maps(struct machines *machines)
const char * perf_evsel__name(struct perf_evsel *evsel)
static void ordered_events__set_copy_on_queue(struct ordered_events *oe, bool copy)
static void perf_session__set_comm_exec(struct perf_session *session)
struct perf_event_header header
static int auxtrace__flush_events(struct perf_session *session __maybe_unused, struct perf_tool *tool __maybe_unused)
size_t events_stats__fprintf(struct events_stats *stats, FILE *fp)
volatile int session_done
void perf_event_header__bswap(struct perf_event_header *hdr)
static int thread__set_comm(struct thread *thread, const char *comm, u64 timestamp)
size_t perf_event__fprintf_stat_round(union perf_event *event, FILE *fp)
void ui_progress__finish(void)
struct auxtrace_error_event auxtrace_error
static void swap_bitfield(u8 *p, unsigned len)
static int perf_data__is_pipe(struct perf_data *data)
static void perf_event__task_swap(union perf_event *event, bool sample_id_all)
struct perf_session * perf_session__new(struct perf_data *data, bool repipe, struct perf_tool *tool)
static void perf_event__aux_swap(union perf_event *event, bool sample_id_all)
int perf_session__queue_event(struct perf_session *s, union perf_event *event, u64 timestamp, u64 file_offset)
void thread__put(struct thread *thread)
static void perf_event__auxtrace_error_swap(union perf_event *event, bool sample_id_all __maybe_unused)
static void perf_evlist__print_tstamp(struct perf_evlist *evlist, union perf_event *event, struct perf_sample *sample)
static bool perf_data__is_write(struct perf_data *data)
int map__set_kallsyms_ref_reloc_sym(struct map *map, const char *symbol_name, u64 addr)
int perf_session__process_events(struct perf_session *session)
u64 __perf_evlist__combined_sample_type(struct perf_evlist *evlist)
struct list_head auxtrace_index
static int machines__deliver_event(struct machines *machines, struct perf_evlist *evlist, union perf_event *event, struct perf_sample *sample, struct perf_tool *tool, u64 file_offset)
void machines__init(struct machines *machines)
void events_stats__auxtrace_error_warn(const struct events_stats *stats)
static void perf_event__mmap_swap(union perf_event *event, bool sample_id_all)
struct auxtrace_event auxtrace
struct events_stats stats
struct perf_evsel * perf_evlist__find_tracepoint_by_name(struct perf_evlist *evlist, const char *name)
static int process_event_synth_attr_stub(struct perf_tool *tool __maybe_unused, union perf_event *event __maybe_unused, struct perf_evlist **pevlist __maybe_unused)
struct perf_header header
struct perf_evsel * perf_session__find_first_evtype(struct perf_session *session, unsigned int type)
static void perf_event__auxtrace_info_swap(union perf_event *event, bool sample_id_all __maybe_unused)
int perf_event__process_id_index(struct perf_tool *tool __maybe_unused, union perf_event *event, struct perf_session *session)
static int perf_evlist__deliver_sample(struct perf_evlist *evlist, struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct perf_evsel *evsel, struct machine *machine)
u32 nr_events[PERF_RECORD_HEADER_MAX]
int ordered_events__queue(struct ordered_events *oe, union perf_event *event, u64 timestamp, u64 file_offset)
static void sample_read__printf(struct perf_sample *sample, u64 read_format)
struct auxtrace_info_event auxtrace_info
struct event_type_event event_type
static void perf_session__destroy_kernel_maps(struct perf_session *session)
int machines__for_each_thread(struct machines *machines, int(*fn)(struct thread *thread, void *p), void *priv)
struct thread_map_event thread_map
static const char * regs_abi[]
int perf_event__process_lost(struct perf_tool *tool __maybe_unused, union perf_event *event, struct perf_sample *sample, struct machine *machine)
int thread_stack__flush(struct thread *thread)
static void regs_user__printf(struct perf_sample *sample)
struct thread * perf_session__findnew(struct perf_session *session, pid_t pid)
int perf_session__peek_event(struct perf_session *session, off_t file_offset, void *buf, size_t buf_sz, union perf_event **event_ptr, struct perf_sample *sample)
static int __perf_session__process_events(struct perf_session *session, u64 data_offset, u64 data_size, u64 file_size)
static int perf_session__deliver_event(struct perf_session *session, union perf_event *event, struct perf_tool *tool, u64 file_offset)
struct perf_evsel * evsel
int perf_event__synthesize_id_index(struct perf_tool *tool, perf_event__handler_t process, struct perf_evlist *evlist, struct machine *machine)
static void perf_event__event_type_swap(union perf_event *event, bool sample_id_all __maybe_unused)
static void perf_event__stat_round_swap(union perf_event *event, bool sample_id_all __maybe_unused)
static s64 perf_session__process_user_event(struct perf_session *session, union perf_event *event, u64 file_offset)
static void perf_event__auxtrace_swap(union perf_event *event, bool sample_id_all __maybe_unused)
#define pr_warning(fmt,...)
int perf_session__cpu_bitmap(struct perf_session *session, const char *cpu_list, unsigned long *cpu_bitmap)
static void stack_user__printf(struct stack_dump *dump)
static void perf_event__all64_swap(union perf_event *event, bool sample_id_all __maybe_unused)
struct cpu_map * cpu_map__new(const char *cpu_list)
void perf_session__fprintf_info(struct perf_session *session, FILE *fp, bool full)
static bool evsel__has_callchain(const struct perf_evsel *evsel)
static void callchain__lbr_callstack_printf(struct perf_sample *sample)
struct perf_sample_id * perf_evlist__id2sid(struct perf_evlist *evlist, u64 id)
void machine__delete_threads(struct machine *machine)
struct stack_dump user_stack
struct perf_event_attr attr
void perf_data__close(struct perf_data *data)
static void perf_event__hdr_attr_swap(union perf_event *event, bool sample_id_all __maybe_unused)
size_t machine__fprintf(struct machine *machine, FILE *fp)
struct thread * machine__findnew_thread(struct machine *machine, pid_t pid, pid_t tid)
struct perf_event_attr attr
static union perf_event * fetch_mmaped_event(struct perf_session *session, u64 head, size_t mmap_size, char *buf)
int perf_session__create_kernel_maps(struct perf_session *session)
void perf_tool__fill_defaults(struct perf_tool *tool)
static bool perf_evsel__has_branch_callstack(const struct perf_evsel *evsel)
struct branch_flags flags
static int __perf_session__process_pipe_events(struct perf_session *session)
static bool perf_session__has_comm_exec(struct perf_session *session)
void static void * zalloc(size_t size)