2009-12-11 21:24:02 -02:00
|
|
|
#ifndef __PERF_SESSION_H
|
|
|
|
|
#define __PERF_SESSION_H
|
|
|
|
|
|
2013-12-03 14:09:23 +01:00
|
|
|
#include "trace-event.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"
|
2013-10-15 16:27:32 +02:00
|
|
|
#include "data.h"
|
2014-08-01 13:02:58 -03:00
|
|
|
#include "ordered-events.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
|
|
|
|
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
|
|
|
|
|
|
|
|
struct perf_session {
|
|
|
|
|
struct perf_header header;
|
2012-12-18 19:15:48 -03:00
|
|
|
struct machines machines;
|
2011-03-05 21:40:06 -03:00
|
|
|
struct perf_evlist *evlist;
|
2013-12-03 14:09:23 +01:00
|
|
|
struct trace_event tevent;
|
2012-12-18 16:24:46 -03:00
|
|
|
struct events_stats stats;
|
2010-05-01 01:41:20 -05:00
|
|
|
bool repipe;
|
2014-07-14 13:02:51 +03:00
|
|
|
bool one_mmap;
|
|
|
|
|
void *one_mmap_addr;
|
|
|
|
|
u64 one_mmap_offset;
|
2014-07-06 14:23:03 +02:00
|
|
|
struct ordered_events ordered_events;
|
2013-10-15 16:27:34 +02:00
|
|
|
struct perf_data_file *file;
|
2009-12-11 21:24:02 -02:00
|
|
|
};
|
|
|
|
|
|
2013-08-07 22:50:51 -04:00
|
|
|
#define PRINT_IP_OPT_IP (1<<0)
|
|
|
|
|
#define PRINT_IP_OPT_SYM (1<<1)
|
|
|
|
|
#define PRINT_IP_OPT_DSO (1<<2)
|
|
|
|
|
#define PRINT_IP_OPT_SYMOFFSET (1<<3)
|
2013-08-07 22:50:52 -04:00
|
|
|
#define PRINT_IP_OPT_ONELINE (1<<4)
|
2013-12-06 09:42:57 +02:00
|
|
|
#define PRINT_IP_OPT_SRCLINE (1<<5)
|
2013-08-07 22:50:51 -04:00
|
|
|
|
2011-11-28 08:30:20 -02:00
|
|
|
struct perf_tool;
|
2009-12-13 19:50:25 -02:00
|
|
|
|
2013-10-15 16:27:32 +02:00
|
|
|
struct perf_session *perf_session__new(struct perf_data_file *file,
|
|
|
|
|
bool repipe, 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
|
|
|
|
2013-11-05 15:32:36 -03:00
|
|
|
void perf_event_header__bswap(struct perf_event_header *hdr);
|
2010-01-14 12:23:10 -02:00
|
|
|
|
2014-07-31 09:00:57 +03:00
|
|
|
int perf_session__peek_event(struct perf_session *session, off_t file_offset,
|
|
|
|
|
void *buf, size_t buf_sz,
|
|
|
|
|
union perf_event **event_ptr,
|
|
|
|
|
struct perf_sample *sample);
|
|
|
|
|
|
2013-11-05 15:32:36 -03:00
|
|
|
int perf_session__process_events(struct perf_session *session,
|
2011-11-28 08:30:20 -02:00
|
|
|
struct perf_tool *tool);
|
2009-12-13 19:50:25 -02:00
|
|
|
|
2013-08-05 21:41:33 -04:00
|
|
|
int perf_session_queue_event(struct perf_session *s, union perf_event *event,
|
2014-08-01 13:01:04 -03:00
|
|
|
struct perf_tool *tool, struct perf_sample *sample,
|
|
|
|
|
u64 file_offset);
|
2013-08-02 14:05:41 -06:00
|
|
|
|
|
|
|
|
void perf_tool__fill_defaults(struct perf_tool *tool);
|
|
|
|
|
|
2014-06-10 22:31:35 +02:00
|
|
|
int perf_session__deliver_event(struct perf_session *session,
|
|
|
|
|
union perf_event *event,
|
|
|
|
|
struct perf_sample *sample,
|
|
|
|
|
struct perf_tool *tool, u64 file_offset);
|
|
|
|
|
|
2013-11-05 15:32:36 -03:00
|
|
|
int perf_session__resolve_callchain(struct perf_session *session,
|
|
|
|
|
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
|
|
|
|
2013-11-05 15:32:36 -03:00
|
|
|
bool perf_session__has_traces(struct perf_session *session, const char *msg);
|
2009-12-27 21:37:01 -02:00
|
|
|
|
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
|
|
|
|
2013-11-05 15:32:36 -03:00
|
|
|
int perf_session__create_kernel_maps(struct perf_session *session);
|
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
|
2013-11-05 15:32:36 -03:00
|
|
|
struct machine *perf_session__find_machine(struct perf_session *session, pid_t pid)
|
2010-04-27 21:17:50 -03:00
|
|
|
{
|
2013-11-05 15:32:36 -03:00
|
|
|
return machines__find(&session->machines, pid);
|
2010-04-27 21:17:50 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline
|
2013-11-05 15:32:36 -03:00
|
|
|
struct machine *perf_session__findnew_machine(struct perf_session *session, pid_t pid)
|
2010-04-27 21:17:50 -03:00
|
|
|
{
|
2013-11-05 15:32:36 -03:00
|
|
|
return machines__findnew(&session->machines, pid);
|
2010-04-27 21:17:50 -03:00
|
|
|
}
|
|
|
|
|
|
2013-11-05 15:32:36 -03:00
|
|
|
struct thread *perf_session__findnew(struct perf_session *session, pid_t pid);
|
|
|
|
|
size_t perf_session__fprintf(struct perf_session *session, FILE *fp);
|
2011-11-28 07:56:39 -02:00
|
|
|
|
2013-11-05 15:32:36 -03:00
|
|
|
size_t perf_session__fprintf_dsos(struct perf_session *session, 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);
|
|
|
|
|
|
2013-12-04 16:16:36 +02:00
|
|
|
void perf_evsel__print_ip(struct perf_evsel *evsel, struct perf_sample *sample,
|
2013-12-19 17:20:06 -03:00
|
|
|
struct addr_location *al,
|
2013-08-07 22:50:53 -04:00
|
|
|
unsigned int print_opts, unsigned int stack_depth);
|
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))
|
2013-09-17 16:34:28 -03:00
|
|
|
|
|
|
|
|
extern volatile int session_done;
|
|
|
|
|
|
2014-09-23 10:55:08 -04:00
|
|
|
#define session_done() ACCESS_ONCE(session_done)
|
2014-10-27 15:49:22 +02:00
|
|
|
|
2014-10-27 15:49:23 +02:00
|
|
|
int perf_session__deliver_synth_event(struct perf_session *session,
|
|
|
|
|
union perf_event *event,
|
|
|
|
|
struct perf_sample *sample,
|
|
|
|
|
struct perf_tool *tool);
|
|
|
|
|
|
2014-10-27 15:49:22 +02:00
|
|
|
int perf_event__process_id_index(struct perf_tool *tool,
|
|
|
|
|
union perf_event *event,
|
|
|
|
|
struct perf_session *session);
|
|
|
|
|
|
|
|
|
|
int perf_event__synthesize_id_index(struct perf_tool *tool,
|
|
|
|
|
perf_event__handler_t process,
|
|
|
|
|
struct perf_evlist *evlist,
|
|
|
|
|
struct machine *machine);
|
|
|
|
|
|
2009-12-11 21:24:02 -02:00
|
|
|
#endif /* __PERF_SESSION_H */
|