session.h 1.9 KB
Newer Older
1 2 3
#ifndef __PERF_SESSION_H
#define __PERF_SESSION_H

4
#include "event.h"
5
#include "header.h"
6
#include "thread.h"
7
#include <linux/rbtree.h>
8
#include "../../../include/linux/perf_event.h"
9

10
struct ip_callchain;
11
struct thread;
12
struct symbol;
13 14 15 16

struct perf_session {
	struct perf_header	header;
	unsigned long		size;
17
	unsigned long		mmap_window;
18
	struct map_groups	kmaps;
19 20
	struct rb_root		threads;
	struct thread		*last_match;
21
	struct map		*vmlinux_maps[MAP__NR_TYPES];
22 23
	struct events_stats	events_stats;
	unsigned long		event_total[PERF_RECORD_MAX];
24
	unsigned long		unknown_events;
25
	struct rb_root		hists;
26
	u64			sample_type;
27 28 29 30
	struct {
		const char	*name;
		u64		addr;
	}			ref_reloc_sym;
31
	int			fd;
32 33
	int			cwdlen;
	char			*cwd;
34 35 36
	char filename[0];
};

37 38 39
typedef int (*event_op)(event_t *self, struct perf_session *session);

struct perf_event_ops {
40 41 42 43 44 45 46 47 48
	event_op sample,
		 mmap,
		 comm,
		 fork,
		 exit,
		 lost,
		 read,
		 throttle,
		 unthrottle;
49 50
};

51
struct perf_session *perf_session__new(const char *filename, int mode, bool force);
52 53
void perf_session__delete(struct perf_session *self);

54 55
void perf_event_header__bswap(struct perf_event_header *self);

56
int perf_session__process_events(struct perf_session *self,
57
				 struct perf_event_ops *event_ops);
58

59 60 61 62 63
struct symbol **perf_session__resolve_callchain(struct perf_session *self,
						struct thread *thread,
						struct ip_callchain *chain,
						struct symbol **parent);

64
bool perf_session__has_traces(struct perf_session *self, const char *msg);
65

66 67
int perf_header__read_build_ids(struct perf_header *self, int input,
				u64 offset, u64 file_size);
68

69 70 71 72 73 74
int perf_session__set_kallsyms_ref_reloc_sym(struct perf_session *self,
					     const char *symbol_name,
					     u64 addr);
void perf_session__reloc_vmlinux_maps(struct perf_session *self,
				      u64 unrelocated_addr);

75 76
void mem_bswap_64(void *src, int byte_size);

77
#endif /* __PERF_SESSION_H */