blob: c31a5da6458b38f205b9e0acdb360f1e95447152 [file] [log] [blame]
Ingo Molnarcdd6c482009-09-21 12:02:48 +02001#ifndef __PERF_RECORD_H
2#define __PERF_RECORD_H
John Kacur8b40f522009-09-24 18:02:18 +02003
Frederic Weisbecker1fe2c102009-08-12 10:19:53 +02004#include "../perf.h"
Frederic Weisbecker66e274f2009-08-12 11:07:25 +02005#include "util.h"
6#include <linux/list.h>
Frederic Weisbecker1fe2c102009-08-12 10:19:53 +02007
Frederic Weisbecker0f25bfc2009-08-16 19:56:54 +02008enum {
9 SHOW_KERNEL = 1,
10 SHOW_USER = 2,
11 SHOW_HV = 4,
12};
13
Peter Zijlstra18408dd2009-08-13 11:47:55 +020014/*
15 * PERF_SAMPLE_IP | PERF_SAMPLE_TID | *
16 */
Frederic Weisbecker1fe2c102009-08-12 10:19:53 +020017struct ip_event {
18 struct perf_event_header header;
19 u64 ip;
20 u32 pid, tid;
21 unsigned char __more_data[];
22};
23
24struct mmap_event {
25 struct perf_event_header header;
26 u32 pid, tid;
27 u64 start;
28 u64 len;
29 u64 pgoff;
30 char filename[PATH_MAX];
31};
32
33struct comm_event {
34 struct perf_event_header header;
35 u32 pid, tid;
36 char comm[16];
37};
38
39struct fork_event {
40 struct perf_event_header header;
41 u32 pid, ppid;
42 u32 tid, ptid;
Arjan van de Ven393b2ad2009-09-12 07:52:47 +020043 u64 time;
Frederic Weisbecker1fe2c102009-08-12 10:19:53 +020044};
45
46struct lost_event {
47 struct perf_event_header header;
48 u64 id;
49 u64 lost;
50};
51
Peter Zijlstra18408dd2009-08-13 11:47:55 +020052/*
53 * PERF_FORMAT_ENABLED | PERF_FORMAT_RUNNING | PERF_FORMAT_ID
54 */
Frederic Weisbecker1fe2c102009-08-12 10:19:53 +020055struct read_event {
56 struct perf_event_header header;
Ingo Molnardc02bf72009-09-16 13:45:00 +020057 u32 pid, tid;
Frederic Weisbecker1fe2c102009-08-12 10:19:53 +020058 u64 value;
59 u64 time_enabled;
60 u64 time_running;
61 u64 id;
62};
63
Arjan van de Venfd39e052009-09-12 07:53:00 +020064struct sample_event{
65 struct perf_event_header header;
66 u64 array[];
67};
68
69
Frederic Weisbecker1fe2c102009-08-12 10:19:53 +020070typedef union event_union {
71 struct perf_event_header header;
72 struct ip_event ip;
73 struct mmap_event mmap;
74 struct comm_event comm;
75 struct fork_event fork;
76 struct lost_event lost;
77 struct read_event read;
Arjan van de Venfd39e052009-09-12 07:53:00 +020078 struct sample_event sample;
Frederic Weisbecker1fe2c102009-08-12 10:19:53 +020079} event_t;
Frederic Weisbecker66e274f2009-08-12 11:07:25 +020080
81struct map {
82 struct list_head node;
83 u64 start;
84 u64 end;
85 u64 pgoff;
86 u64 (*map_ip)(struct map *, u64);
87 struct dso *dso;
88};
89
90static inline u64 map__map_ip(struct map *map, u64 ip)
91{
92 return ip - map->start + map->pgoff;
93}
94
95static inline u64 vdso__map_ip(struct map *map __used, u64 ip)
96{
97 return ip;
98}
99
100struct map *map__new(struct mmap_event *event, char *cwd, int cwdlen);
101struct map *map__clone(struct map *self);
102int map__overlap(struct map *l, struct map *r);
103size_t map__fprintf(struct map *self, FILE *fp);
104
John Kacur8b40f522009-09-24 18:02:18 +0200105#endif /* __PERF_RECORD_H */