blob: 9c488fcadec9100d0a157fe84bad4b62e78abefa [file] [log] [blame]
John Kacur8b40f522009-09-24 18:02:18 +02001#ifndef __PERF_THREAD_H
2#define __PERF_THREAD_H
3
Frederic Weisbecker6baa0a52009-08-14 12:21:53 +02004#include <linux/rbtree.h>
Frederic Weisbecker6baa0a52009-08-14 12:21:53 +02005#include <unistd.h>
6#include "symbol.h"
7
Arnaldo Carvalho de Melo9958e1f2009-12-11 14:50:36 -02008struct thread {
9 struct rb_node rb_node;
10 struct map_groups mg;
11 pid_t pid;
Ingo Molnar0ec04e12009-09-16 17:40:48 +020012 char shortname[3];
Arnaldo Carvalho de Melofaa5c5c2010-02-19 23:02:07 -020013 bool comm_set;
Ingo Molnarb5fae122009-09-11 12:12:54 +020014 char *comm;
Frederic Weisbeckera4fb5812009-10-22 23:23:23 +020015 int comm_len;
Frederic Weisbecker6baa0a52009-08-14 12:21:53 +020016};
17
Arnaldo Carvalho de Melo4b8cf842010-03-25 19:58:58 -030018struct perf_session;
19
Zhang, Yanmind6d901c2010-03-18 11:36:05 -030020int find_all_tid(int pid, pid_t ** all_tid);
Frederic Weisbecker6baa0a52009-08-14 12:21:53 +020021int thread__set_comm(struct thread *self, const char *comm);
Frederic Weisbeckera4fb5812009-10-22 23:23:23 +020022int thread__comm_len(struct thread *self);
Arnaldo Carvalho de Melob3165f42009-12-13 19:50:28 -020023struct thread *perf_session__findnew(struct perf_session *self, pid_t pid);
Frederic Weisbecker6baa0a52009-08-14 12:21:53 +020024void thread__insert_map(struct thread *self, struct map *map);
25int thread__fork(struct thread *self, struct thread *parent);
Arnaldo Carvalho de Melob3165f42009-12-13 19:50:28 -020026size_t perf_session__fprintf(struct perf_session *self, FILE *fp);
John Kacur8b40f522009-09-24 18:02:18 +020027
Arnaldo Carvalho de Melo95011c62009-11-27 16:29:20 -020028static inline struct map *thread__find_map(struct thread *self,
Arnaldo Carvalho de Melo1ed091c2009-11-27 16:29:23 -020029 enum map_type type, u64 addr)
Arnaldo Carvalho de Melo1b46cdd2009-09-28 14:48:46 -030030{
Arnaldo Carvalho de Melo9958e1f2009-12-11 14:50:36 -020031 return self ? map_groups__find(&self->mg, type, addr) : NULL;
Arnaldo Carvalho de Melo95011c62009-11-27 16:29:20 -020032}
Arnaldo Carvalho de Melo1ed091c2009-11-27 16:29:23 -020033
Arnaldo Carvalho de Melo59ee68e2010-01-14 23:45:29 -020034void thread__find_addr_map(struct thread *self,
35 struct perf_session *session, u8 cpumode,
36 enum map_type type, u64 addr,
37 struct addr_location *al);
38
Arnaldo Carvalho de Melo4aa65632009-12-13 19:50:29 -020039void thread__find_addr_location(struct thread *self,
40 struct perf_session *session, u8 cpumode,
Arnaldo Carvalho de Melo1ed091c2009-11-27 16:29:23 -020041 enum map_type type, u64 addr,
42 struct addr_location *al,
43 symbol_filter_t filter);
John Kacur8b40f522009-09-24 18:02:18 +020044#endif /* __PERF_THREAD_H */