event.h (46557bef3f3834ac33031c7be27d39d90d507442) | event.h (e30a3d12ddf04add3268bfceb0e57ffe47f254c6) |
---|---|
1#ifndef __PERF_RECORD_H 2#define __PERF_RECORD_H | 1#ifndef __PERF_RECORD_H 2#define __PERF_RECORD_H |
3 |
|
3#include "../perf.h" 4#include "util.h" 5#include <linux/list.h> | 4#include "../perf.h" 5#include "util.h" 6#include <linux/list.h> |
7#include <linux/rbtree.h> |
|
6 | 8 |
7enum { 8 SHOW_KERNEL = 1, 9 SHOW_USER = 2, 10 SHOW_HV = 4, 11}; 12 | |
13/* 14 * PERF_SAMPLE_IP | PERF_SAMPLE_TID | * 15 */ 16struct ip_event { 17 struct perf_event_header header; 18 u64 ip; 19 u32 pid, tid; 20 unsigned char __more_data[]; --- 39 unchanged lines hidden (view full) --- 60 u64 id; 61}; 62 63struct sample_event{ 64 struct perf_event_header header; 65 u64 array[]; 66}; 67 | 9/* 10 * PERF_SAMPLE_IP | PERF_SAMPLE_TID | * 11 */ 12struct ip_event { 13 struct perf_event_header header; 14 u64 ip; 15 u32 pid, tid; 16 unsigned char __more_data[]; --- 39 unchanged lines hidden (view full) --- 56 u64 id; 57}; 58 59struct sample_event{ 60 struct perf_event_header header; 61 u64 array[]; 62}; 63 |
64#define BUILD_ID_SIZE 20 |
|
68 | 65 |
66struct build_id_event { 67 struct perf_event_header header; 68 u8 build_id[ALIGN(BUILD_ID_SIZE, sizeof(u64))]; 69 char filename[]; 70}; 71 |
|
69typedef union event_union { 70 struct perf_event_header header; 71 struct ip_event ip; 72 struct mmap_event mmap; 73 struct comm_event comm; 74 struct fork_event fork; 75 struct lost_event lost; 76 struct read_event read; 77 struct sample_event sample; 78} event_t; 79 80struct map { | 72typedef union event_union { 73 struct perf_event_header header; 74 struct ip_event ip; 75 struct mmap_event mmap; 76 struct comm_event comm; 77 struct fork_event fork; 78 struct lost_event lost; 79 struct read_event read; 80 struct sample_event sample; 81} event_t; 82 83struct map { |
81 struct list_head node; | 84 union { 85 struct rb_node rb_node; 86 struct list_head node; 87 }; |
82 u64 start; 83 u64 end; 84 u64 pgoff; 85 u64 (*map_ip)(struct map *, u64); | 88 u64 start; 89 u64 end; 90 u64 pgoff; 91 u64 (*map_ip)(struct map *, u64); |
92 u64 (*unmap_ip)(struct map *, u64); |
|
86 struct dso *dso; 87}; 88 89static inline u64 map__map_ip(struct map *map, u64 ip) 90{ 91 return ip - map->start + map->pgoff; 92} 93 | 93 struct dso *dso; 94}; 95 96static inline u64 map__map_ip(struct map *map, u64 ip) 97{ 98 return ip - map->start + map->pgoff; 99} 100 |
94static inline u64 vdso__map_ip(struct map *map __used, u64 ip) | 101static inline u64 map__unmap_ip(struct map *map, u64 ip) |
95{ | 102{ |
103 return ip + map->start - map->pgoff; 104} 105 106static inline u64 identity__map_ip(struct map *map __used, u64 ip) 107{ |
|
96 return ip; 97} 98 | 108 return ip; 109} 110 |
111struct symbol; 112 113typedef int (*symbol_filter_t)(struct map *map, struct symbol *sym); 114 115void map__init(struct map *self, u64 start, u64 end, u64 pgoff, 116 struct dso *dso); |
|
99struct map *map__new(struct mmap_event *event, char *cwd, int cwdlen); 100struct map *map__clone(struct map *self); 101int map__overlap(struct map *l, struct map *r); 102size_t map__fprintf(struct map *self, FILE *fp); | 117struct map *map__new(struct mmap_event *event, char *cwd, int cwdlen); 118struct map *map__clone(struct map *self); 119int map__overlap(struct map *l, struct map *r); 120size_t map__fprintf(struct map *self, FILE *fp); |
121struct symbol *map__find_symbol(struct map *self, u64 ip, symbol_filter_t filter); |
|
103 | 122 |
104#endif | 123int event__synthesize_thread(pid_t pid, int (*process)(event_t *event)); 124void event__synthesize_threads(int (*process)(event_t *event)); 125 126#endif /* __PERF_RECORD_H */ |