]> 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 1f771ce3a95793c29abf14106e91408d86f319d6..51a96c2effdea662c4a77e5b5a2ed3cde1e61b64 100644 (file)
@@ -56,11 +56,25 @@ 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 {
@@ -69,13 +83,6 @@ struct build_id_event {
        char                     filename[];
 };
 
-struct build_id_list {
-       struct build_id_event   event;
-       struct list_head        list;
-       const char              *dso_name;
-       int                     len;
-};
-
 typedef union event_union {
        struct perf_event_header        header;
        struct ip_event                 ip;
@@ -87,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;
@@ -94,6 +115,7 @@ struct map {
        };
        u64                     start;
        u64                     end;
+       enum map_type           type;
        u64                     pgoff;
        u64                     (*map_ip)(struct map *, u64);
        u64                     (*unmap_ip)(struct map *, u64);
@@ -119,15 +141,37 @@ struct symbol;
 
 typedef int (*symbol_filter_t)(struct map *map, struct symbol *sym);
 
-void map__init(struct map *self, u64 start, u64 end, u64 pgoff,
-              struct dso *dso);
-struct map *map__new(struct mmap_event *event, char *cwd, int cwdlen);
+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 ip, symbol_filter_t filter);
+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 */