blob: 2495529cae7dada7cd11ff1d42397186141fd4f5 [file] [log] [blame]
Frederic Weisbecker66e274f2009-08-12 11:07:25 +02001#ifndef __PERF_EVENT_H
2#define __PERF_EVENT_H
Frederic Weisbecker1fe2c102009-08-12 10:19:53 +02003#include "../perf.h"
Frederic Weisbecker66e274f2009-08-12 11:07:25 +02004#include "util.h"
5#include <linux/list.h>
Frederic Weisbecker1fe2c102009-08-12 10:19:53 +02006
Frederic Weisbecker0f25bfc2009-08-16 19:56:54 +02007enum {
8 SHOW_KERNEL = 1,
9 SHOW_USER = 2,
10 SHOW_HV = 4,
11};
12
Peter Zijlstra18408dd2009-08-13 11:47:55 +020013/*
14 * PERF_SAMPLE_IP | PERF_SAMPLE_TID | *
15 */
Frederic Weisbecker1fe2c102009-08-12 10:19:53 +020016struct ip_event {
17 struct perf_event_header header;
18 u64 ip;
19 u32 pid, tid;
20 unsigned char __more_data[];
21};
22
23struct mmap_event {
24 struct perf_event_header header;
25 u32 pid, tid;
26 u64 start;
27 u64 len;
28 u64 pgoff;
29 char filename[PATH_MAX];
30};
31
32struct comm_event {
33 struct perf_event_header header;
34 u32 pid, tid;
35 char comm[16];
36};
37
38struct fork_event {
39 struct perf_event_header header;
40 u32 pid, ppid;
41 u32 tid, ptid;
42};
43
44struct lost_event {
45 struct perf_event_header header;
46 u64 id;
47 u64 lost;
48};
49
Peter Zijlstra18408dd2009-08-13 11:47:55 +020050/*
51 * PERF_FORMAT_ENABLED | PERF_FORMAT_RUNNING | PERF_FORMAT_ID
52 */
Frederic Weisbecker1fe2c102009-08-12 10:19:53 +020053struct read_event {
54 struct perf_event_header header;
Ingo Molnardc02bf72009-09-16 13:45:00 +020055 u32 pid, tid;
Frederic Weisbecker1fe2c102009-08-12 10:19:53 +020056 u64 value;
57 u64 time_enabled;
58 u64 time_running;
59 u64 id;
60};
61
62typedef union event_union {
63 struct perf_event_header header;
64 struct ip_event ip;
65 struct mmap_event mmap;
66 struct comm_event comm;
67 struct fork_event fork;
68 struct lost_event lost;
69 struct read_event read;
70} event_t;
Frederic Weisbecker66e274f2009-08-12 11:07:25 +020071
72struct map {
73 struct list_head node;
74 u64 start;
75 u64 end;
76 u64 pgoff;
77 u64 (*map_ip)(struct map *, u64);
78 struct dso *dso;
79};
80
81static inline u64 map__map_ip(struct map *map, u64 ip)
82{
83 return ip - map->start + map->pgoff;
84}
85
86static inline u64 vdso__map_ip(struct map *map __used, u64 ip)
87{
88 return ip;
89}
90
91struct map *map__new(struct mmap_event *event, char *cwd, int cwdlen);
92struct map *map__clone(struct map *self);
93int map__overlap(struct map *l, struct map *r);
94size_t map__fprintf(struct map *self, FILE *fp);
95
96#endif