Linux Perf
thread-stack.h
Go to the documentation of this file.
1 /*
2  * thread-stack.h: Synthesize a thread's stack using call / return events
3  * Copyright (c) 2014, Intel Corporation.
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms and conditions of the GNU General Public License,
7  * version 2, as published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12  * more details.
13  *
14  */
15 
16 #ifndef __PERF_THREAD_STACK_H
17 #define __PERF_THREAD_STACK_H
18 
19 #include <sys/types.h>
20 
21 #include <linux/types.h>
22 
23 struct thread;
24 struct comm;
25 struct ip_callchain;
26 struct symbol;
27 struct dso;
28 struct comm;
29 struct perf_sample;
30 struct addr_location;
31 struct call_path;
32 
33 /*
34  * Call/Return flags.
35  *
36  * CALL_RETURN_NO_CALL: 'return' but no matching 'call'
37  * CALL_RETURN_NO_RETURN: 'call' but no matching 'return'
38  */
39 enum {
42 };
43 
57 struct call_return {
58  struct thread *thread;
59  struct comm *comm;
60  struct call_path *cp;
61  u64 call_time;
64  u64 call_ref;
66  u64 db_id;
67  u32 flags;
68 };
69 
79  int (*process)(struct call_return *cr, void *data);
80  void *data;
81 };
82 
83 int thread_stack__event(struct thread *thread, u32 flags, u64 from_ip,
84  u64 to_ip, u16 insn_len, u64 trace_nr);
85 void thread_stack__set_trace_nr(struct thread *thread, u64 trace_nr);
86 void thread_stack__sample(struct thread *thread, struct ip_callchain *chain,
87  size_t sz, u64 ip);
88 int thread_stack__flush(struct thread *thread);
89 void thread_stack__free(struct thread *thread);
90 size_t thread_stack__depth(struct thread *thread);
91 
92 struct call_return_processor *
93 call_return_processor__new(int (*process)(struct call_return *cr, void *data),
94  void *data);
96 int thread_stack__process(struct thread *thread, struct comm *comm,
97  struct perf_sample *sample,
98  struct addr_location *from_al,
99  struct addr_location *to_al, u64 ref,
100  struct call_return_processor *crp);
101 
102 #endif
int thread_stack__flush(struct thread *thread)
Definition: thread-stack.c:211
void thread_stack__set_trace_nr(struct thread *thread, u64 trace_nr)
Definition: thread-stack.c:267
struct comm * comm
Definition: thread-stack.h:59
struct call_return_processor * call_return_processor__new(int(*process)(struct call_return *cr, void *data), void *data)
Definition: thread-stack.c:305
dictionary data
Definition: stat-cpi.py:4
void thread_stack__sample(struct thread *thread, struct ip_callchain *chain, size_t sz, u64 ip)
Definition: thread-stack.c:288
Definition: comm.h:11
u64 branch_count
Definition: thread-stack.h:63
Definition: thread.h:18
int thread_stack__event(struct thread *thread, u32 flags, u64 from_ip, u64 to_ip, u16 insn_len, u64 trace_nr)
Definition: thread-stack.c:219
size_t thread_stack__depth(struct thread *thread)
Definition: thread-stack.c:621
struct call_path_root * cpr
Definition: thread-stack.h:78
Definition: dso.h:138
int thread_stack__process(struct thread *thread, struct comm *comm, struct perf_sample *sample, struct addr_location *from_al, struct addr_location *to_al, u64 ref, struct call_return_processor *crp)
Definition: thread-stack.c:535
int(* process)(struct call_return *cr, void *data)
Definition: thread-stack.h:79
void thread_stack__free(struct thread *thread)
Definition: thread-stack.c:279
struct call_path * cp
Definition: thread-stack.h:60
struct thread * thread
Definition: thread-stack.h:58
Definition: symbol.h:55
void call_return_processor__free(struct call_return_processor *crp)
Definition: thread-stack.c:325