forked from OpenCloudOS/perf-prof
-
Notifications
You must be signed in to change notification settings - Fork 0
/
stack_helpers.h
72 lines (59 loc) · 3.03 KB
/
stack_helpers.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#ifndef __STACK_HELPERS_H
#define __STACK_HELPERS_H
void function_resolver_ref(void);
void function_resolver_unref(void);
char *function_resolver(void *priv, unsigned long long *addrp, char **modp);
struct callchain {
__u64 nr;
__u64 ips[0];
};
struct callchain_ctx;
enum {
CALLCHAIN_KERNEL = 1,
CALLCHAIN_USER = 2,
};
struct callchain_ctx *callchain_ctx_new(int flags, FILE *fout);
void callchain_ctx_config(struct callchain_ctx *cc, bool addr, bool symbol, bool offset,
bool dso, bool reverse, char sep, char end);
void callchain_ctx_free(struct callchain_ctx *cc);
void print_callchain(struct callchain_ctx *cc, struct callchain *callchain, u32 pid);
typedef void (*callchain_cbs)(void *opaque, u64 perf_context);
void print_callchain_common_cbs(struct callchain_ctx *cc, struct callchain *callchain, u32 pid,
callchain_cbs kernel_cb, callchain_cbs user_cb, void *opaque);
void print_callchain_common(struct callchain_ctx *cc, struct callchain *callchain, u32 pid);
void task_exit_free_syms(union perf_event *event);
typedef struct callchain struct_key;
struct key_value_paires;
struct key_value_paires *keyvalue_pairs_new(int value_size);
void keyvalue_pairs_free(struct key_value_paires *pairs);
void *keyvalue_pairs_add_key(struct key_value_paires *pairs, struct_key *key);
typedef void (*foreach_keyvalue)(void *opaque, struct_key *key, void *value, unsigned int n);
void keyvalue_pairs_foreach(struct key_value_paires *pairs, foreach_keyvalue f, void *opaque);
typedef int (*keyvalue_cmp)(void **value1, void **value2);
void keyvalue_pairs_sorted_firstn(struct key_value_paires *pairs, keyvalue_cmp cmp, foreach_keyvalue f, void *opaque, unsigned int n);
void keyvalue_pairs_sorted_foreach(struct key_value_paires *pairs, keyvalue_cmp cmp, foreach_keyvalue f, void *opaque);
void keyvalue_pairs_reinit(struct key_value_paires *pairs);
const char *unique_string(const char *str);
void unique_string_stat(FILE *fp);
#define PERF_CONTEXT_FLAME_GRAPH (PERF_CONTEXT_KERNEL - 1)
struct flame_graph;
struct flame_graph *flame_graph_new(int flags, FILE *fout);
void flame_graph_free(struct flame_graph *fg);
void flame_graph_add_callchain_at_time(struct flame_graph *fg, struct callchain *callchain,
u32 pid, const char *comm,
u64 time, const char *time_str);
static inline
void flame_graph_add_callchain(struct flame_graph *fg, struct callchain *callchain,
u32 pid, const char *comm)
{
flame_graph_add_callchain_at_time(fg, callchain, pid, comm, 0, NULL);
}
void flame_graph_output(struct flame_graph *fg);
struct flame_graph *flame_graph_open(int flags, const char *path);
void flame_graph_close(struct flame_graph *fg);
void flame_graph_reset(struct flame_graph *fg);
struct heatmap;
struct heatmap *heatmap_open(const char *time_uints, const char *latency_units, const char *path);
void heatmap_close(struct heatmap *heatmap);
void heatmap_write(struct heatmap *heatmap, unsigned long time, unsigned long latency);
#endif