6 #include <linux/kernel.h> 7 #include <linux/types.h> 11 #include <uapi/linux/mman.h> 12 #include <api/fs/fs.h> 13 #include <linux/perf_event.h> 24 #include "symbol/kallsyms.h" 30 [PERF_RECORD_MMAP] =
"MMAP",
31 [PERF_RECORD_MMAP2] =
"MMAP2",
32 [PERF_RECORD_LOST] =
"LOST",
33 [PERF_RECORD_COMM] =
"COMM",
34 [PERF_RECORD_EXIT] =
"EXIT",
35 [PERF_RECORD_THROTTLE] =
"THROTTLE",
36 [PERF_RECORD_UNTHROTTLE] =
"UNTHROTTLE",
37 [PERF_RECORD_FORK] =
"FORK",
38 [PERF_RECORD_READ] =
"READ",
39 [PERF_RECORD_SAMPLE] =
"SAMPLE",
40 [PERF_RECORD_AUX] =
"AUX",
41 [PERF_RECORD_ITRACE_START] =
"ITRACE_START",
42 [PERF_RECORD_LOST_SAMPLES] =
"LOST_SAMPLES",
43 [PERF_RECORD_SWITCH] =
"SWITCH",
44 [PERF_RECORD_SWITCH_CPU_WIDE] =
"SWITCH_CPU_WIDE",
45 [PERF_RECORD_NAMESPACES] =
"NAMESPACES",
66 [NET_NS_INDEX] =
"net",
67 [UTS_NS_INDEX] =
"uts",
68 [IPC_NS_INDEX] =
"ipc",
69 [PID_NS_INDEX] =
"pid",
70 [USER_NS_INDEX] =
"user",
71 [MNT_NS_INDEX] =
"mnt",
72 [CGROUP_NS_INDEX] =
"cgroup",
103 .cpumode =
event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK,
106 return process(tool, event, &synth_sample, machine);
114 pid_t *tgid, pid_t *ppid)
121 char *
name, *tgids, *ppids;
126 snprintf(filename,
sizeof(filename),
"/proc/%d/status", pid);
128 fd = open(filename, O_RDONLY);
130 pr_debug(
"couldn't open %s\n", filename);
134 n =
read(fd, bf,
sizeof(bf) - 1);
137 pr_warning(
"Couldn't get COMM, tigd and ppid for pid %d\n",
143 name = strstr(bf,
"Name:");
144 tgids = strstr(bf,
"Tgid:");
145 ppids = strstr(bf,
"PPid:");
153 nl = strchr(name,
'\n');
163 pr_debug(
"Name: string not found for pid %d\n", pid);
170 pr_debug(
"Tgid: string not found for pid %d\n", pid);
177 pr_debug(
"PPid: string not found for pid %d\n", pid);
185 pid_t *tgid, pid_t *ppid)
200 *tgid = machine->
pid;
206 event->comm.pid = *tgid;
207 event->comm.header.type = PERF_RECORD_COMM;
209 size = strlen(event->
comm.
comm) + 1;
210 size = PERF_ALIGN(size,
sizeof(u64));
212 event->comm.header.size = (
sizeof(
event->comm) -
215 event->comm.tid =
pid;
237 struct perf_ns_link_info *ns_link_info)
242 sprintf(proc_ns,
"/proc/%u/ns/%s", pid, ns);
243 if (stat64(proc_ns, &st) == 0) {
244 ns_link_info->dev = st.st_dev;
245 ns_link_info->ino = st.st_ino;
251 pid_t
pid, pid_t tgid,
256 struct perf_ns_link_info *ns_link_info;
262 (NR_NAMESPACES *
sizeof(
struct perf_ns_link_info)) +
265 event->namespaces.pid = tgid;
266 event->namespaces.tid =
pid;
268 event->namespaces.nr_namespaces = NR_NAMESPACES;
270 ns_link_info =
event->namespaces.link_info;
272 for (idx = 0; idx <
event->namespaces.nr_namespaces; idx++)
276 event->namespaces.header.type = PERF_RECORD_NAMESPACES;
278 event->namespaces.header.size = (
sizeof(
event->namespaces) +
279 (NR_NAMESPACES *
sizeof(
struct perf_ns_link_info)) +
290 pid_t
pid, pid_t tgid, pid_t ppid,
302 event->fork.ppid = ppid;
303 event->fork.ptid = ppid;
305 event->fork.ppid = tgid;
306 event->fork.ptid = tgid;
308 event->fork.pid = tgid;
309 event->fork.tid =
pid;
310 event->fork.header.type = PERF_RECORD_FORK;
312 event->fork.header.size = (
sizeof(
event->fork) + machine->
id_hdr_size);
322 pid_t
pid, pid_t tgid,
326 unsigned int proc_map_timeout)
330 unsigned long long t;
331 bool truncation =
false;
332 unsigned long long timeout = proc_map_timeout * 1000000ULL;
334 const char *hugetlbfs_mnt = hugetlbfs__mountpoint();
335 int hugetlbfs_mnt_len = hugetlbfs_mnt ? strlen(hugetlbfs_mnt) : 0;
340 snprintf(filename,
sizeof(filename),
"%s/proc/%d/task/%d/maps",
343 fp = fopen(filename,
"r");
348 pr_debug(
"couldn't open %s\n", filename);
352 event->header.type = PERF_RECORD_MMAP2;
359 char anonstr[] =
"//anon";
364 if (fgets(bf,
sizeof(bf), fp) == NULL)
367 if ((
rdclock() - t) > timeout) {
369 "You may want to increase " 370 "the time limit by --proc-map-timeout\n",
377 strcpy(execname,
"");
380 n = sscanf(bf,
"%"PRIx64
"-%"PRIx64
" %s %"PRIx64
" %x:%x %u %[^\n]\n",
392 event->mmap2.ino = (u64)ino;
398 event->
header.misc = PERF_RECORD_MISC_USER;
400 event->
header.misc = PERF_RECORD_MISC_GUEST_USER;
406 event->mmap2.prot |= PROT_READ;
408 event->mmap2.prot |= PROT_WRITE;
410 event->mmap2.prot |= PROT_EXEC;
413 event->mmap2.flags |= MAP_SHARED;
415 event->mmap2.flags |= MAP_PRIVATE;
417 if (prot[2] !=
'x') {
418 if (!mmap_data || prot[0] !=
'r')
421 event->header.misc |= PERF_RECORD_MISC_MMAP_DATA;
426 event->header.misc |= PERF_RECORD_MISC_PROC_MAP_PARSE_TIMEOUT;
428 if (!strcmp(execname,
""))
429 strcpy(execname, anonstr);
431 if (hugetlbfs_mnt_len &&
432 !strncmp(execname, hugetlbfs_mnt, hugetlbfs_mnt_len)) {
433 strcpy(execname, anonstr);
434 event->mmap2.flags |= MAP_HUGETLB;
437 size = strlen(execname) + 1;
439 size = PERF_ALIGN(size,
sizeof(u64));
440 event->mmap2.len -=
event->mmap.start;
441 event->mmap2.header.size = (
sizeof(
event->mmap2) -
445 event->mmap2.pid = tgid;
446 event->mmap2.tid =
pid;
471 pr_debug(
"Not enough memory synthesizing mmap event " 472 "for kernel modules\n");
476 event->header.type = PERF_RECORD_MMAP;
483 event->header.misc = PERF_RECORD_MISC_KERNEL;
485 event->header.misc = PERF_RECORD_MISC_GUEST_KERNEL;
494 event->mmap.header.type = PERF_RECORD_MMAP;
495 event->mmap.header.size = (
sizeof(
event->mmap) -
499 event->mmap.start = pos->
start;
500 event->mmap.len = pos->
end - pos->
start;
501 event->mmap.pid = machine->
pid;
524 unsigned int proc_map_timeout)
528 struct dirent *dirent;
541 tgid, process, machine) < 0)
546 process, machine, mmap_data,
553 snprintf(filename,
sizeof(filename),
"%s/proc/%d/task",
556 tasks = opendir(filename);
558 pr_debug(
"couldn't open %s\n", filename);
562 while ((dirent = readdir(tasks)) != NULL) {
566 _pid = strtol(dirent->d_name, &end, 10);
576 ppid, process, machine) < 0)
580 tgid, process, machine) < 0)
593 process, machine, mmap_data, proc_map_timeout);
608 unsigned int proc_map_timeout)
615 if (comm_event == NULL)
619 if (mmap_event == NULL)
623 if (fork_event == NULL)
627 (NR_NAMESPACES *
sizeof(
struct perf_ns_link_info)) +
629 if (namespaces_event == NULL)
635 fork_event, namespaces_event,
637 process, tool, machine,
638 mmap_data, proc_map_timeout)) {
648 bool need_leader =
true;
651 for (j = 0; j < threads->
nr; ++j) {
661 fork_event, namespaces_event,
663 process, tool, machine,
664 mmap_data, proc_map_timeout)) {
670 free(namespaces_event);
685 unsigned int proc_map_timeout,
686 struct dirent **dirent,
698 if (comm_event == NULL)
702 if (mmap_event == NULL)
706 if (fork_event == NULL)
710 (NR_NAMESPACES *
sizeof(
struct perf_ns_link_info)) +
712 if (namespaces_event == NULL)
715 for (i = start; i < start + num; i++) {
716 if (!
isdigit(dirent[i]->d_name[0]))
719 pid = (pid_t)strtol(dirent[i]->d_name, &end, 10);
728 namespaces_event, pid, 1, process,
729 tool, machine, mmap_data,
734 free(namespaces_event);
772 unsigned int nr_threads_synthesize)
775 pthread_t *synthesize_threads = NULL;
788 snprintf(proc_path,
sizeof(proc_path),
"%s/proc", machine->
root_dir);
789 n = scandir(proc_path, &dirent, 0, alphasort);
793 if (nr_threads_synthesize == UINT_MAX)
794 thread_nr = sysconf(_SC_NPROCESSORS_ONLN);
796 thread_nr = nr_threads_synthesize;
798 if (thread_nr <= 1) {
808 synthesize_threads = calloc(
sizeof(pthread_t), thread_nr);
809 if (synthesize_threads == NULL)
812 args = calloc(
sizeof(*args), thread_nr);
816 num_per_thread = n / thread_nr;
818 for (i = 0; i < thread_nr; i++) {
826 for (i = 0; i <
m; i++) {
827 args[i].
num = num_per_thread + 1;
831 base = args[i-1].
start + args[i-1].
num;
832 for (j = i; j < thread_nr; j++) {
833 args[j].
num = num_per_thread;
834 args[j].
start = base + (j - i) * args[i].
num;
837 for (i = 0; i < thread_nr; i++) {
838 if (pthread_create(&synthesize_threads[i], NULL,
844 for (i = 0; i < thread_nr; i++)
845 pthread_join(synthesize_threads[i], NULL);
848 free(synthesize_threads);
850 for (i = 0; i < n; i++)
871 if (!(kallsyms__is_function(type) ||
872 type ==
'A') || strcmp(name, args->
name))
880 const char *symbol_name, u64 *addr)
884 if (kallsyms__parse(kallsyms_filename, &args,
find_symbol_cb) <= 0)
920 pr_debug(
"Not enough memory synthesizing mmap event " 921 "for kernel modules\n");
930 event->header.misc = PERF_RECORD_MISC_KERNEL;
932 event->header.misc = PERF_RECORD_MISC_GUEST_KERNEL;
938 size = PERF_ALIGN(size,
sizeof(u64));
939 event->mmap.header.type = PERF_RECORD_MMAP;
940 event->mmap.header.size = (
sizeof(
event->mmap) -
943 event->mmap.start = map->
start;
944 event->mmap.len = map->
end -
event->mmap.start;
945 event->mmap.pid = machine->
pid;
974 size =
sizeof(
event->thread_map);
975 size += threads->
nr *
sizeof(
event->thread_map.entries[0]);
982 event->header.size =
size;
983 event->thread_map.nr = threads->
nr;
985 for (i = 0; i < threads->
nr; i++) {
993 strncpy((
char *) &entry->
comm, comm,
sizeof(entry->
comm));
996 err =
process(tool, event, NULL, machine);
1009 for (i = 0; i < map->
nr; i++)
1010 cpus->
cpu[i] = map->
map[i];
1018 mask->
nr = BITS_TO_LONGS(max);
1021 for (i = 0; i < map->
nr; i++)
1022 set_bit(map->
map[i], mask->
mask);
1036 for (i = 0; i < map->
nr; i++) {
1038 int bit = map->
map[i] + 1;
1044 return sizeof(
struct cpu_map_mask) + BITS_TO_LONGS(*max) *
sizeof(
long);
1049 size_t size_cpus, size_mask;
1068 if (is_dummy || (size_cpus < size_mask)) {
1108 event->header.size =
size;
1109 event->data.type = type;
1141 size =
sizeof(*event);
1149 event->header.size =
size;
1152 #define ADD(__term, __val) \ 1153 event->data[i].tag = PERF_STAT_CONFIG_TERM__##__term; \ 1154 event->data[i].val = __val; \ 1162 "stat config terms unbalanced\n");
1172 u32 cpu, u32
thread, u64
id,
1180 event.header.size =
sizeof(
event);
1181 event.header.misc = 0;
1186 event.val = count->
val;
1187 event.ena = count->
ena;
1188 event.run = count->
run;
1194 u64 evtime, u64 type,
1201 event.header.size =
sizeof(
event);
1202 event.header.misc = 0;
1204 event.time = evtime;
1215 for (i = 0; i <
event->nr; i++) {
1218 #define CASE(__term, __val) \ 1219 case PERF_STAT_CONFIG_TERM__##__term: \ 1220 config->__val = event->data[i].val; \ 1228 pr_warning(
"unknown stat config term %" PRIu64
"\n",
1238 if (event->
header.misc & PERF_RECORD_MISC_COMM_EXEC)
1249 struct perf_ns_link_info *ns_link_info;
1250 u32 nr_namespaces, idx;
1252 ns_link_info =
event->namespaces.link_info;
1253 nr_namespaces =
event->namespaces.nr_namespaces;
1255 ret += fprintf(fp,
" %d/%d - nr_namespaces: %u\n\t\t[",
1260 for (idx = 0; idx < nr_namespaces; idx++) {
1261 if (idx && (idx % 4 == 0))
1262 ret += fprintf(fp,
"\n\t\t ");
1264 ret += fprintf(fp,
"%u/%s: %" PRIu64
"/%#" PRIx64
"%s", idx,
1266 (u64)ns_link_info[idx].ino,
1267 ((idx + 1) != nr_namespaces) ?
", " :
"]\n");
1331 return fprintf(fp,
" %d/%d: [%#" PRIx64
"(%#" PRIx64
") @ %#" PRIx64
"]: %c %s\n",
1334 (event->
header.misc & PERF_RECORD_MISC_MMAP_DATA) ?
'r' :
'x',
1340 return fprintf(fp,
" %d/%d: [%#" PRIx64
"(%#" PRIx64
") @ %#" PRIx64
1341 " %02x:%02x %"PRIu64
" %"PRIu64
"]: %c%c%c%c %s\n",
1346 (event->
mmap2.
prot & PROT_READ) ?
'r' :
'-',
1347 (event->
mmap2.
prot & PROT_WRITE) ?
'w' :
'-',
1348 (event->
mmap2.
prot & PROT_EXEC) ?
'x' :
'-',
1349 (event->
mmap2.
flags & MAP_SHARED) ?
's' :
'p',
1358 ret = fprintf(fp,
" nr: ");
1363 ret += fprintf(fp,
"failed to get threads from event\n");
1374 ret = fprintf(fp,
": ");
1379 ret += fprintf(fp,
"failed to get cpumap from event\n");
1403 return fprintf(fp,
"(%d:%d):(%d:%d)\n",
1426 return fprintf(fp,
" offset: %#"PRIx64
" size: %#"PRIx64
" flags: %#"PRIx64
" [%s%s%s]\n",
1429 event->
aux.
flags & PERF_AUX_FLAG_TRUNCATED ?
"T" :
"",
1430 event->
aux.
flags & PERF_AUX_FLAG_OVERWRITE ?
"O" :
"",
1431 event->
aux.
flags & PERF_AUX_FLAG_PARTIAL ?
"P" :
"");
1436 return fprintf(fp,
" pid: %u tid: %u\n",
1442 bool out =
event->header.misc & PERF_RECORD_MISC_SWITCH_OUT;
1443 const char *in_out = !out ?
"IN " :
1444 !(
event->header.misc & PERF_RECORD_MISC_SWITCH_OUT_PREEMPT) ?
1445 "OUT " :
"OUT preempt";
1447 if (event->
header.type == PERF_RECORD_SWITCH)
1448 return fprintf(fp,
" %s\n", in_out);
1450 return fprintf(fp,
" %s %s pid/tid: %5u/%-5u\n",
1451 in_out, out ?
"next" :
"prev",
1458 return fprintf(fp,
" lost %" PRIu64
"\n", event->
lost.
lost);
1463 size_t ret = fprintf(fp,
"PERF_RECORD_%s",
1466 switch (event->
header.type) {
1467 case PERF_RECORD_COMM:
1470 case PERF_RECORD_FORK:
1471 case PERF_RECORD_EXIT:
1474 case PERF_RECORD_MMAP:
1477 case PERF_RECORD_NAMESPACES:
1480 case PERF_RECORD_MMAP2:
1483 case PERF_RECORD_AUX:
1486 case PERF_RECORD_ITRACE_START:
1489 case PERF_RECORD_SWITCH:
1490 case PERF_RECORD_SWITCH_CPU_WIDE:
1493 case PERF_RECORD_LOST:
1497 ret += fprintf(fp,
"\n");
1516 bool load_map =
false;
1524 if (machine == NULL) {
1529 if (cpumode == PERF_RECORD_MISC_KERNEL &&
perf_host) {
1531 mg = &machine->
kmaps;
1533 }
else if (cpumode == PERF_RECORD_MISC_USER &&
perf_host) {
1535 }
else if (cpumode == PERF_RECORD_MISC_GUEST_KERNEL &&
perf_guest) {
1537 mg = &machine->
kmaps;
1539 }
else if (cpumode == PERF_RECORD_MISC_GUEST_USER &&
perf_guest) {
1545 if ((cpumode == PERF_RECORD_MISC_GUEST_USER ||
1546 cpumode == PERF_RECORD_MISC_GUEST_KERNEL) &&
1549 if ((cpumode == PERF_RECORD_MISC_USER ||
1550 cpumode == PERF_RECORD_MISC_KERNEL) &&
1558 if (al->
map == NULL) {
1568 if (cpumode == PERF_RECORD_MISC_USER && machine &&
1569 mg != &machine->
kmaps &&
1571 mg = &machine->
kmaps;
1614 al->
level ==
'H' ?
"[hypervisor]" :
"<not found>");
1627 if (env && env->
cpu)
1668 return attr->type == PERF_TYPE_HARDWARE &&
1669 (attr->config & PERF_COUNT_HW_BRANCH_INSTRUCTIONS) &&
1670 attr->sample_period == 1;
1675 if (attr->type == PERF_TYPE_SOFTWARE &&
1676 (attr->config == PERF_COUNT_SW_PAGE_FAULTS ||
1677 attr->config == PERF_COUNT_SW_PAGE_FAULTS_MIN ||
1678 attr->config == PERF_COUNT_SW_PAGE_FAULTS_MAJ))
static bool thread__is_filtered(struct thread *thread)
void thread__resolve(struct thread *thread, struct addr_location *al, struct perf_sample *sample)
int machine__process_itrace_start_event(struct machine *machine __maybe_unused, union perf_event *event)
u64(* map_ip)(struct map *, u64)
int perf_event__synthesize_namespaces(struct perf_tool *tool, union perf_event *event, pid_t pid, pid_t tgid, perf_event__handler_t process, struct machine *machine)
int machine__process_switch_event(struct machine *machine __maybe_unused, union perf_event *event)
int machine__process_mmap2_event(struct machine *machine, union perf_event *event, struct perf_sample *sample)
bool is_bts_event(struct perf_event_attr *attr)
struct perf_event_header header
int machine__resolve(struct machine *machine, struct addr_location *al, struct perf_sample *sample)
perf_event__handler_t process
static const char * perf_ns__names[]
size_t perf_event__fprintf_cpu_map(union perf_event *event, FILE *fp)
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 bool machine__is_host(struct machine *machine)
static size_t cpus_size(struct cpu_map *map)
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__synthesize_kernel_mmap(struct perf_tool *tool, perf_event__handler_t process, 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 int perf_event__get_comm_ids(pid_t pid, char *comm, size_t len, pid_t *tgid, pid_t *ppid)
int perf_event__synthesize_mmap_events(struct perf_tool *tool, union perf_event *event, pid_t pid, pid_t tgid, perf_event__handler_t process, struct machine *machine, bool mmap_data, unsigned int proc_map_timeout)
#define thread__zput(thread)
int perf_event__process_mmap(struct perf_tool *tool __maybe_unused, union perf_event *event, struct perf_sample *sample, struct machine *machine)
int machine__process_aux_event(struct machine *machine __maybe_unused, union perf_event *event)
struct map * thread__find_map(struct thread *thread, u8 cpumode, u64 addr, struct addr_location *al)
static void synthesize_mask(struct cpu_map_mask *mask, struct cpu_map *map, int max)
size_t perf_event__fprintf_comm(union perf_event *event, FILE *fp)
int perf_event__synthesize_modules(struct perf_tool *tool, perf_event__handler_t process, struct machine *machine)
int __weak perf_event__synthesize_extra_kmaps(struct perf_tool *tool __maybe_unused, perf_event__handler_t process __maybe_unused, struct machine *machine __maybe_unused)
int machine__process_exit_event(struct machine *machine, union perf_event *event, struct perf_sample *sample __maybe_unused)
static const char * perf_ns__name(unsigned int id)
size_t perf_event__fprintf_aux(union perf_event *event, FILE *fp)
struct cpu_map * cpu_map__new_data(struct cpu_map_data *data)
struct namespaces_event namespaces
int perf_event__process_comm(struct perf_tool *tool __maybe_unused, union perf_event *event, struct perf_sample *sample, struct machine *machine)
static void * synthesize_threads_worker(void *arg)
int perf_event__process_exit(struct perf_tool *tool __maybe_unused, union perf_event *event, struct perf_sample *sample, struct machine *machine)
static int __perf_event__synthesize_kernel_mmap(struct perf_tool *tool, perf_event__handler_t process, struct machine *machine)
int perf_event__process_fork(struct perf_tool *tool __maybe_unused, union perf_event *event, struct perf_sample *sample, struct machine *machine)
int dump_printf(const char *fmt,...)
int perf_event__synthesize_cpu_map(struct perf_tool *tool, struct cpu_map *map, perf_event__handler_t process, struct machine *machine)
#define CASE(__term, __val)
int machine__process_event(struct machine *machine, union perf_event *event, struct perf_sample *sample)
struct itrace_start_event itrace_start
static unsigned long long rdclock(void)
int perf_event__synthesize_stat_config(struct perf_tool *tool, struct perf_stat_config *config, perf_event__handler_t process, struct machine *machine)
pid_t perf_event__synthesize_comm(struct perf_tool *tool, union perf_event *event, pid_t pid, perf_event__handler_t process, struct machine *machine)
x86 movsq based memset() in arch/x86/lib/memset_64.S") MEMSET_FN(memset_erms
static int __event__synthesize_thread(union perf_event *comm_event, union perf_event *mmap_event, union perf_event *fork_event, union perf_event *namespaces_event, pid_t pid, int full, perf_event__handler_t process, struct perf_tool *tool, struct machine *machine, bool mmap_data, unsigned int proc_map_timeout)
static bool __map__is_kmodule(const struct map *map)
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)
static const char * perf_event__names[]
size_t cpu_map__fprintf(struct cpu_map *map, FILE *fp)
static void perf_event__get_ns_link_info(pid_t pid, const char *ns, struct perf_ns_link_info *ns_link_info)
void * cpu_map_data__alloc(struct cpu_map *map, size_t *size, u16 *type, int *max)
static void synthesize_cpus(struct cpu_map_entries *cpus, struct cpu_map *map)
static struct map * machine__kernel_map(struct machine *machine)
void cpu_map__put(struct cpu_map *map)
void addr_location__put(struct addr_location *al)
struct map * maps__first(struct maps *maps)
int perf_event__synthesize_stat(struct perf_tool *tool, u32 cpu, u32 thread, u64 id, struct perf_counts_values *count, perf_event__handler_t process, struct machine *machine)
static size_t mask_size(struct cpu_map *map, int *max)
const char * thread__comm_str(const struct thread *thread)
int perf_event__process(struct perf_tool *tool __maybe_unused, union perf_event *event, struct perf_sample *sample, struct machine *machine)
#define pr_debug(fmt,...)
#define ADD(__term, __val)
static struct cpu_map_event * cpu_map_event__new(struct cpu_map *map)
struct cpu_topology_map * cpu
int perf_event__synthesize_threads(struct perf_tool *tool, perf_event__handler_t process, struct machine *machine, bool mmap_data, unsigned int proc_map_timeout, unsigned int nr_threads_synthesize)
static bool cpu_map__empty(const struct cpu_map *map)
struct stat_config_event_entry data[]
struct map * map__next(struct map *map)
static int entry(u64 ip, struct unwind_info *ui)
unsigned int proc_map_timeout
size_t perf_event__fprintf_namespaces(union perf_event *event, FILE *fp)
struct context_switch_event context_switch
size_t perf_event__fprintf_mmap2(union perf_event *event, FILE *fp)
static struct perf_tool tool
static bool machine__kernel_ip(struct machine *machine, u64 ip)
struct cpu_map_event cpu_map
struct thread_map * thread_map__new_event(struct thread_map_event *event)
static char * thread_map__comm(struct thread_map *map, int thread)
size_t thread_map__fprintf(struct thread_map *threads, FILE *fp)
const char * perf_event__name(unsigned int id)
struct ref_reloc_sym * ref_reloc_sym
x86 movsq based memcpy() in arch/x86/lib/memcpy_64.S") MEMCPY_FN(memcpy_erms
size_t perf_event__fprintf_thread_map(union perf_event *event, FILE *fp)
struct strlist * sym_list
struct symbol * map__find_symbol(struct map *map, u64 addr)
int perf_event__process_switch(struct perf_tool *tool __maybe_unused, union perf_event *event, struct perf_sample *sample __maybe_unused, struct machine *machine)
struct perf_event_header header
static struct map * map_groups__find(struct map_groups *mg, u64 addr)
struct perf_event_header header
int perf_event__process_mmap2(struct perf_tool *tool __maybe_unused, union perf_event *event, struct perf_sample *sample, struct machine *machine)
int perf_event__synthesize_stat_round(struct perf_tool *tool, u64 evtime, u64 type, perf_event__handler_t process, struct machine *machine)
int perf_event__synthesize_thread_map(struct perf_tool *tool, struct thread_map *threads, perf_event__handler_t process, struct machine *machine, bool mmap_data, unsigned int proc_map_timeout)
static int __perf_event__synthesize_threads(struct perf_tool *tool, perf_event__handler_t process, struct machine *machine, bool mmap_data, unsigned int proc_map_timeout, struct dirent **dirent, int start, int num)
static int perf_event__prepare_comm(union perf_event *event, pid_t pid, struct machine *machine, pid_t *tgid, pid_t *ppid)
struct symbol * thread__find_symbol(struct thread *thread, u8 cpumode, u64 addr, struct addr_location *al)
size_t perf_event__fprintf(union perf_event *event, FILE *fp)
size_t perf_event__fprintf_task(union perf_event *event, FILE *fp)
static pid_t thread_map__pid(struct thread_map *map, int thread)
int kallsyms__get_function_start(const char *kallsyms_filename, const char *symbol_name, u64 *addr)
static struct maps * machine__kernel_maps(struct machine *machine)
int machine__process_lost_event(struct machine *machine __maybe_unused, union perf_event *event, struct perf_sample *sample __maybe_unused)
void thread_map__put(struct thread_map *map)
size_t perf_event__fprintf_switch(union perf_event *event, FILE *fp)
struct thread_map_event thread_map
int perf_event__process_lost(struct perf_tool *tool __maybe_unused, union perf_event *event, struct perf_sample *sample, struct machine *machine)
static int find_symbol_cb(void *arg, const char *name, char type, u64 start)
void cpu_map_data__synthesize(struct cpu_map_data *data, struct cpu_map *map, u16 type, int max)
int perf_tool__process_synth_event(struct perf_tool *tool, union perf_event *event, struct machine *machine, perf_event__handler_t process)
static size_t perf_event__fprintf_lost(union perf_event *event, FILE *fp)
bool sample_addr_correlates_sym(struct perf_event_attr *attr)
#define pr_warning(fmt,...)
size_t perf_event__fprintf_mmap(union perf_event *event, FILE *fp)
int machine__process_comm_event(struct machine *machine, union perf_event *event, struct perf_sample *sample)
int perf_event__process_namespaces(struct perf_tool *tool __maybe_unused, union perf_event *event, struct perf_sample *sample, struct machine *machine)
int map__load(struct map *map)
size_t perf_event__fprintf_itrace_start(union perf_event *event, FILE *fp)
static bool strlist__has_entry(struct strlist *slist, const char *entry)
static int perf_event__synthesize_fork(struct perf_tool *tool, union perf_event *event, pid_t pid, pid_t tgid, pid_t ppid, perf_event__handler_t process, struct machine *machine)
struct thread * machine__findnew_thread(struct machine *machine, pid_t pid, pid_t tid)
struct strlist * dso_list
int machine__process_fork_event(struct machine *machine, union perf_event *event, struct perf_sample *sample)
int machine__process_namespaces_event(struct machine *machine __maybe_unused, union perf_event *event, struct perf_sample *sample __maybe_unused)
void perf_event__read_stat_config(struct perf_stat_config *config, struct stat_config_event *event)
int machine__process_lost_samples_event(struct machine *machine __maybe_unused, union perf_event *event, struct perf_sample *sample)
void static void * zalloc(size_t size)
static bool machine__is_default_guest(struct machine *machine)
int machine__process_mmap_event(struct machine *machine, union perf_event *event, struct perf_sample *sample)
int perf_event__synthesize_thread_map2(struct perf_tool *tool, struct thread_map *threads, perf_event__handler_t process, struct machine *machine)