2009-12-11 21:24:02 -02:00
|
|
|
#ifndef __PERF_SESSION_H
|
|
|
|
|
#define __PERF_SESSION_H
|
|
|
|
|
|
2010-05-10 13:04:11 -03:00
|
|
|
#include "hist.h"
|
2009-12-13 19:50:25 -02:00
|
|
|
#include "event.h"
|
2009-12-11 21:24:02 -02:00
|
|
|
#include "header.h"
|
2012-11-09 11:32:52 -03:00
|
|
|
#include "machine.h"
|
2010-02-03 16:52:00 -02:00
|
|
|
#include "symbol.h"
|
2009-12-13 19:50:29 -02:00
|
|
|
#include "thread.h"
|
2009-12-13 19:50:28 -02:00
|
|
|
#include <linux/rbtree.h>
|
2012-11-19 22:21:03 +00:00
|
|
|
#include <linux/perf_event.h>
|
2009-12-13 19:50:28 -02:00
|
|
|
|
2010-04-24 00:04:12 +02:00
|
|
|
struct sample_queue;
|
2009-12-14 14:22:59 -02:00
|
|
|
struct ip_callchain;
|
2009-12-13 19:50:28 -02:00
|
|
|
struct thread;
|
2009-12-11 21:24:02 -02:00
|
|
|
|
2010-04-24 00:04:12 +02:00
|
|
|
struct ordered_samples {
|
|
|
|
|
u64 last_flush;
|
2010-05-03 15:14:33 +02:00
|
|
|
u64 next_flush;
|
|
|
|
|
u64 max_timestamp;
|
2010-11-30 17:49:33 +00:00
|
|
|
struct list_head samples;
|
2010-11-30 17:49:53 +00:00
|
|
|
struct list_head sample_cache;
|
2010-11-30 17:49:55 +00:00
|
|
|
struct list_head to_free;
|
|
|
|
|
struct sample_queue *sample_buffer;
|
2010-11-30 17:49:33 +00:00
|
|
|
struct sample_queue *last_sample;
|
2010-11-30 17:49:55 +00:00
|
|
|
int sample_buffer_idx;
|
2011-10-29 12:41:45 -02:00
|
|
|
unsigned int nr_samples;
|
2010-04-24 00:04:12 +02:00
|
|
|
};
|
|
|
|
|
|
2009-12-11 21:24:02 -02:00
|
|
|
struct perf_session {
|
|
|
|
|
struct perf_header header;
|
|
|
|
|
unsigned long size;
|
2012-12-18 19:15:48 -03:00
|
|
|
struct machines machines;
|
2011-03-05 21:40:06 -03:00
|
|
|
struct perf_evlist *evlist;
|
2012-06-27 13:08:42 -03:00
|
|
|
struct pevent *pevent;
|
2012-12-18 16:24:46 -03:00
|
|
|
struct events_stats stats;
|
2009-12-11 21:24:02 -02:00
|
|
|
int fd;
|
2010-04-01 23:59:15 -05:00
|
|
|
bool fd_pipe;
|
2010-05-01 01:41:20 -05:00
|
|
|
bool repipe;
|
2009-12-13 19:50:27 -02:00
|
|
|
char *cwd;
|
2010-04-24 00:04:12 +02:00
|
|
|
struct ordered_samples ordered_samples;
|
2011-12-07 10:02:52 +01:00
|
|
|
char filename[1];
|
2009-12-11 21:24:02 -02:00
|
|
|
};
|
|
|
|
|
|
2011-11-28 08:30:20 -02:00
|
|
|
struct perf_tool;
|
2009-12-13 19:50:25 -02:00
|
|
|
|
2010-12-10 14:09:16 +11:00
|
|
|
struct perf_session *perf_session__new(const char *filename, int mode,
|
|
|
|
|
bool force, bool repipe,
|
2011-11-28 08:30:20 -02:00
|
|
|
struct perf_tool *tool);
|
2012-12-18 19:15:48 -03:00
|
|
|
void perf_session__delete(struct perf_session *session);
|
2009-12-11 21:24:02 -02:00
|
|
|
|
2010-01-14 12:23:10 -02:00
|
|
|
void perf_event_header__bswap(struct perf_event_header *self);
|
|
|
|
|
|
2010-02-03 16:52:05 -02:00
|
|
|
int __perf_session__process_events(struct perf_session *self,
|
|
|
|
|
u64 data_offset, u64 data_size, u64 size,
|
2011-11-28 08:30:20 -02:00
|
|
|
struct perf_tool *tool);
|
2009-12-13 19:50:25 -02:00
|
|
|
int perf_session__process_events(struct perf_session *self,
|
2011-11-28 08:30:20 -02:00
|
|
|
struct perf_tool *tool);
|
2009-12-13 19:50:25 -02:00
|
|
|
|
2011-11-11 23:10:26 -02:00
|
|
|
int perf_session__resolve_callchain(struct perf_session *self, struct perf_evsel *evsel,
|
2011-01-14 04:51:58 +01:00
|
|
|
struct thread *thread,
|
|
|
|
|
struct ip_callchain *chain,
|
|
|
|
|
struct symbol **parent);
|
2009-12-14 14:22:59 -02:00
|
|
|
|
2009-12-27 21:37:02 -02:00
|
|
|
bool perf_session__has_traces(struct perf_session *self, const char *msg);
|
2009-12-27 21:37:01 -02:00
|
|
|
|
2010-01-14 12:23:10 -02:00
|
|
|
void mem_bswap_64(void *src, int byte_size);
|
2012-06-08 11:47:51 -03:00
|
|
|
void mem_bswap_32(void *src, int byte_size);
|
2011-07-15 12:34:09 -06:00
|
|
|
void perf_event__attr_swap(struct perf_event_attr *attr);
|
2010-01-14 12:23:10 -02:00
|
|
|
|
2010-04-19 13:32:50 +08:00
|
|
|
int perf_session__create_kernel_maps(struct perf_session *self);
|
2010-03-11 20:12:44 -03:00
|
|
|
|
2012-08-01 19:31:00 -03:00
|
|
|
void perf_session__set_id_hdr_size(struct perf_session *session);
|
2010-04-01 23:59:15 -05:00
|
|
|
|
2010-04-27 21:17:50 -03:00
|
|
|
static inline
|
|
|
|
|
struct machine *perf_session__find_machine(struct perf_session *self, pid_t pid)
|
|
|
|
|
{
|
|
|
|
|
return machines__find(&self->machines, pid);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline
|
|
|
|
|
struct machine *perf_session__findnew_machine(struct perf_session *self, pid_t pid)
|
|
|
|
|
{
|
|
|
|
|
return machines__findnew(&self->machines, pid);
|
|
|
|
|
}
|
|
|
|
|
|
2011-11-28 07:56:39 -02:00
|
|
|
struct thread *perf_session__findnew(struct perf_session *self, pid_t pid);
|
|
|
|
|
size_t perf_session__fprintf(struct perf_session *self, FILE *fp);
|
|
|
|
|
|
2010-05-09 19:57:08 -03:00
|
|
|
size_t perf_session__fprintf_dsos(struct perf_session *self, FILE *fp);
|
2010-04-27 21:22:44 -03:00
|
|
|
|
2012-12-07 09:53:58 -03:00
|
|
|
size_t perf_session__fprintf_dsos_buildid(struct perf_session *session, FILE *fp,
|
|
|
|
|
bool (fn)(struct dso *dso, int parm), int parm);
|
2010-05-14 10:36:42 -03:00
|
|
|
|
2011-03-05 21:40:06 -03:00
|
|
|
size_t perf_session__fprintf_nr_events(struct perf_session *session, FILE *fp);
|
2011-01-21 13:46:41 -02:00
|
|
|
|
2011-04-06 21:54:20 -06:00
|
|
|
struct perf_evsel *perf_session__find_first_evtype(struct perf_session *session,
|
|
|
|
|
unsigned int type);
|
|
|
|
|
|
2012-08-07 15:20:46 +02:00
|
|
|
void perf_evsel__print_ip(struct perf_evsel *evsel, union perf_event *event,
|
|
|
|
|
struct perf_sample *sample, struct machine *machine,
|
|
|
|
|
int print_sym, int print_dso, int print_symoffset);
|
2011-03-09 22:23:27 -07:00
|
|
|
|
2011-07-04 21:57:50 +10:00
|
|
|
int perf_session__cpu_bitmap(struct perf_session *session,
|
|
|
|
|
const char *cpu_list, unsigned long *cpu_bitmap);
|
|
|
|
|
|
2011-09-30 15:40:40 +02:00
|
|
|
void perf_session__fprintf_info(struct perf_session *s, FILE *fp, bool full);
|
2012-06-27 13:08:42 -03:00
|
|
|
|
|
|
|
|
struct perf_evsel_str_handler;
|
|
|
|
|
|
|
|
|
|
int __perf_session__set_tracepoints_handlers(struct perf_session *session,
|
|
|
|
|
const struct perf_evsel_str_handler *assocs,
|
|
|
|
|
size_t nr_assocs);
|
|
|
|
|
|
|
|
|
|
#define perf_session__set_tracepoints_handlers(session, array) \
|
|
|
|
|
__perf_session__set_tracepoints_handlers(session, array, ARRAY_SIZE(array))
|
2009-12-11 21:24:02 -02:00
|
|
|
#endif /* __PERF_SESSION_H */
|