ARM: dts: sun8i: Add dts file for the Orange Pi One SBC
[deliverable/linux.git] / tools / perf / util / thread.h
CommitLineData
8b40f521
JK
1#ifndef __PERF_THREAD_H
2#define __PERF_THREAD_H
3
e1ed3a5b 4#include <linux/atomic.h>
6baa0a5a 5#include <linux/rbtree.h>
1902efe7 6#include <linux/list.h>
6baa0a5a 7#include <unistd.h>
9d2f8e22 8#include <sys/types.h>
6baa0a5a 9#include "symbol.h"
1f3878c1 10#include <strlist.h>
e03eaa40 11#include <intlist.h>
6baa0a5a 12
00447ccd
AH
13struct thread_stack;
14
9958e1f0 15struct thread {
720a3aeb
ACM
16 union {
17 struct rb_node rb_node;
18 struct list_head node;
19 };
93d5731d 20 struct map_groups *mg;
99d725fc 21 pid_t pid_; /* Not all tools update this */
38051234 22 pid_t tid;
70c57efb 23 pid_t ppid;
bf49c35f 24 int cpu;
e1ed3a5b 25 atomic_t refcnt;
0ec04e16 26 char shortname[3];
faa5c5c3 27 bool comm_set;
86066064 28 int comm_len;
236a3bbd 29 bool dead; /* if set thread has exited */
1902efe7 30 struct list_head comm_list;
0db15b1e 31 u64 db_id;
bcf6edcd
XG
32
33 void *priv;
00447ccd 34 struct thread_stack *ts;
6baa0a5a
FW
35};
36
743eb868 37struct machine;
4dfced35 38struct comm;
4b8cf846 39
99d725fc 40struct thread *thread__new(pid_t pid, pid_t tid);
cddcef60 41int thread__init_map_groups(struct thread *thread, struct machine *machine);
316c7136 42void thread__delete(struct thread *thread);
f3b623b8
ACM
43
44struct thread *thread__get(struct thread *thread);
45void thread__put(struct thread *thread);
46
47static inline void __thread__zput(struct thread **thread)
48{
49 thread__put(*thread);
50 *thread = NULL;
51}
52
53#define thread__zput(thread) __thread__zput(&thread)
54
236a3bbd
DA
55static inline void thread__exited(struct thread *thread)
56{
57 thread->dead = true;
58}
591765fd 59
65de51f9
AH
60int __thread__set_comm(struct thread *thread, const char *comm, u64 timestamp,
61 bool exec);
62static inline int thread__set_comm(struct thread *thread, const char *comm,
63 u64 timestamp)
64{
65 return __thread__set_comm(thread, comm, timestamp, false);
66}
67
316c7136 68int thread__comm_len(struct thread *thread);
4dfced35 69struct comm *thread__comm(const struct thread *thread);
65de51f9 70struct comm *thread__exec_comm(const struct thread *thread);
b9c5143a 71const char *thread__comm_str(const struct thread *thread);
316c7136 72void thread__insert_map(struct thread *thread, struct map *map);
162f0bef 73int thread__fork(struct thread *thread, struct thread *parent, u64 timestamp);
3f067dca 74size_t thread__fprintf(struct thread *thread, FILE *fp);
8b40f521 75
bb871a9c 76void thread__find_addr_map(struct thread *thread,
743eb868 77 u8 cpumode, enum map_type type, u64 addr,
326f59bf 78 struct addr_location *al);
59ee68ec 79
bb871a9c 80void thread__find_addr_location(struct thread *thread,
743eb868 81 u8 cpumode, enum map_type type, u64 addr,
61710bde 82 struct addr_location *al);
ba58041a 83
52a3cb8c 84void thread__find_cpumode_addr_location(struct thread *thread,
52a3cb8c
ACM
85 enum map_type type, u64 addr,
86 struct addr_location *al);
87
ba58041a
DA
88static inline void *thread__priv(struct thread *thread)
89{
90 return thread->priv;
91}
92
93static inline void thread__set_priv(struct thread *thread, void *p)
94{
95 thread->priv = p;
96}
1f3878c1
DA
97
98static inline bool thread__is_filtered(struct thread *thread)
99{
100 if (symbol_conf.comm_list &&
101 !strlist__has_entry(symbol_conf.comm_list, thread__comm_str(thread))) {
102 return true;
103 }
104
e03eaa40
DA
105 if (symbol_conf.pid_list &&
106 !intlist__has_entry(symbol_conf.pid_list, thread->pid_)) {
107 return true;
108 }
109
110 if (symbol_conf.tid_list &&
111 !intlist__has_entry(symbol_conf.tid_list, thread->tid)) {
112 return true;
113 }
114
1f3878c1
DA
115 return false;
116}
117
8b40f521 118#endif /* __PERF_THREAD_H */
This page took 0.730931 seconds and 5 git commands to generate.