]> Pileus Git - ~andy/linux/blobdiff - tools/perf/util/event.h
perf symbols: Allow lookups by symbol name too
[~andy/linux] / tools / perf / util / event.h
index c2e62be62798a62d1cc81341a9de872621c29ee1..51a96c2effdea662c4a77e5b5a2ed3cde1e61b64 100644 (file)
@@ -56,11 +56,32 @@ struct read_event {
        u64 id;
 };
 
-struct sample_event{
+struct sample_event {
        struct perf_event_header        header;
        u64 array[];
 };
 
+struct sample_data {
+       u64 ip;
+       u32 pid, tid;
+       u64 time;
+       u64 addr;
+       u64 id;
+       u64 stream_id;
+       u32 cpu;
+       u64 period;
+       struct ip_callchain *callchain;
+       u32 raw_size;
+       void *raw_data;
+};
+
+#define BUILD_ID_SIZE 20
+
+struct build_id_event {
+       struct perf_event_header header;
+       u8                       build_id[ALIGN(BUILD_ID_SIZE, sizeof(u64))];
+       char                     filename[];
+};
 
 typedef union event_union {
        struct perf_event_header        header;
@@ -73,6 +94,20 @@ typedef union event_union {
        struct sample_event             sample;
 } event_t;
 
+struct events_stats {
+       unsigned long total;
+       unsigned long lost;
+};
+
+void event__print_totals(void);
+
+enum map_type {
+       MAP__FUNCTION = 0,
+       MAP__VARIABLE,
+};
+
+#define MAP__NR_TYPES (MAP__VARIABLE + 1)
+
 struct map {
        union {
                struct rb_node  rb_node;
@@ -80,8 +115,10 @@ struct map {
        };
        u64                     start;
        u64                     end;
+       enum map_type           type;
        u64                     pgoff;
        u64                     (*map_ip)(struct map *, u64);
+       u64                     (*unmap_ip)(struct map *, u64);
        struct dso              *dso;
 };
 
@@ -90,14 +127,51 @@ static inline u64 map__map_ip(struct map *map, u64 ip)
        return ip - map->start + map->pgoff;
 }
 
-static inline u64 vdso__map_ip(struct map *map __used, u64 ip)
+static inline u64 map__unmap_ip(struct map *map, u64 ip)
+{
+       return ip + map->start - map->pgoff;
+}
+
+static inline u64 identity__map_ip(struct map *map __used, u64 ip)
 {
        return ip;
 }
 
-struct map *map__new(struct mmap_event *event, char *cwd, int cwdlen);
+struct symbol;
+
+typedef int (*symbol_filter_t)(struct map *map, struct symbol *sym);
+
+void map__init(struct map *self, enum map_type type,
+              u64 start, u64 end, u64 pgoff, struct dso *dso);
+struct map *map__new(struct mmap_event *event, enum map_type,
+                    char *cwd, int cwdlen);
+void map__delete(struct map *self);
 struct map *map__clone(struct map *self);
 int map__overlap(struct map *l, struct map *r);
 size_t map__fprintf(struct map *self, FILE *fp);
+struct symbol *map__find_symbol(struct map *self, u64 addr,
+                               symbol_filter_t filter);
+struct symbol *map__find_symbol_by_name(struct map *self, const char *name,
+                                       symbol_filter_t filter);
+void map__fixup_start(struct map *self);
+void map__fixup_end(struct map *self);
+
+int event__synthesize_thread(pid_t pid, int (*process)(event_t *event));
+void event__synthesize_threads(int (*process)(event_t *event));
+
+extern char *event__cwd;
+extern int  event__cwdlen;
+extern struct events_stats event__stats;
+extern unsigned long event__total[PERF_RECORD_MAX];
+
+int event__process_comm(event_t *self);
+int event__process_lost(event_t *self);
+int event__process_mmap(event_t *self);
+int event__process_task(event_t *self);
+
+struct addr_location;
+int event__preprocess_sample(const event_t *self, struct addr_location *al,
+                            symbol_filter_t filter);
+int event__parse_sample(event_t *event, u64 type, struct sample_data *data);
 
 #endif /* __PERF_RECORD_H */