Blame view

tools/perf/util/probe-event.h 4.14 KB
50656eec8   Masami Hiramatsu   perf probe: Move ...
1
2
  #ifndef _PROBE_EVENT_H
  #define _PROBE_EVENT_H
fac13fd54   Masami Hiramatsu   perf probe: Clean...
3
  #include <stdbool.h>
4de189fe6   Masami Hiramatsu   perf probe: Add -...
4
  #include "strlist.h"
bd09d7b5e   Masami Hiramatsu   perf probe: Add v...
5
  #include "strfilter.h"
50656eec8   Masami Hiramatsu   perf probe: Move ...
6

f4d7da499   Masami Hiramatsu   perf probe: Add -...
7
  extern bool probe_event_dry_run;
4235b0454   Masami Hiramatsu   perf probe: Intro...
8
  /* kprobe-tracer tracing point */
0e60836bb   Srikar Dronamraju   perf probe: Renam...
9
  struct probe_trace_point {
4235b0454   Masami Hiramatsu   perf probe: Intro...
10
  	char		*symbol;	/* Base symbol */
190b57fcb   Masami Hiramatsu   perf probe: Add p...
11
  	char		*module;	/* Module name */
4235b0454   Masami Hiramatsu   perf probe: Intro...
12
13
14
  	unsigned long	offset;		/* Offset from symbol */
  	bool		retprobe;	/* Return probe flag */
  };
0e60836bb   Srikar Dronamraju   perf probe: Renam...
15
16
17
  /* probe-tracer tracing argument referencing offset */
  struct probe_trace_arg_ref {
  	struct probe_trace_arg_ref	*next;	/* Next reference */
4235b0454   Masami Hiramatsu   perf probe: Intro...
18
19
20
21
  	long				offset;	/* Offset value */
  };
  
  /* kprobe-tracer tracing argument */
0e60836bb   Srikar Dronamraju   perf probe: Renam...
22
  struct probe_trace_arg {
4235b0454   Masami Hiramatsu   perf probe: Intro...
23
24
  	char				*name;	/* Argument name */
  	char				*value;	/* Base value */
4984912eb   Masami Hiramatsu   perf probe: Query...
25
  	char				*type;	/* Type name */
0e60836bb   Srikar Dronamraju   perf probe: Renam...
26
  	struct probe_trace_arg_ref	*ref;	/* Referencing offset */
4235b0454   Masami Hiramatsu   perf probe: Intro...
27
28
29
  };
  
  /* kprobe-tracer tracing event (point + arg) */
0e60836bb   Srikar Dronamraju   perf probe: Renam...
30
  struct probe_trace_event {
4235b0454   Masami Hiramatsu   perf probe: Intro...
31
32
  	char				*event;	/* Event name */
  	char				*group;	/* Group name */
0e60836bb   Srikar Dronamraju   perf probe: Renam...
33
  	struct probe_trace_point	point;	/* Trace point */
4235b0454   Masami Hiramatsu   perf probe: Intro...
34
  	int				nargs;	/* Number of args */
0e60836bb   Srikar Dronamraju   perf probe: Renam...
35
  	struct probe_trace_arg		*args;	/* Arguments */
4235b0454   Masami Hiramatsu   perf probe: Intro...
36
37
38
39
40
41
42
  };
  
  /* Perf probe probing point */
  struct perf_probe_point {
  	char		*file;		/* File path */
  	char		*function;	/* Function name */
  	int		line;		/* Line number */
eed05fe70   Arnaldo Carvalho de Melo   perf tools: Reorg...
43
  	bool		retprobe;	/* Return probe flag */
4235b0454   Masami Hiramatsu   perf probe: Intro...
44
45
  	char		*lazy_line;	/* Lazy matching pattern */
  	unsigned long	offset;		/* Offset from function entry */
4235b0454   Masami Hiramatsu   perf probe: Intro...
46
  };
7df2f3295   Masami Hiramatsu   perf probe: Add d...
47
48
49
50
  /* Perf probe probing argument field chain */
  struct perf_probe_arg_field {
  	struct perf_probe_arg_field	*next;	/* Next field */
  	char				*name;	/* Name of the field */
b2a3c12b7   Masami Hiramatsu   perf probe: Suppo...
51
  	long				index;	/* Array index number */
7df2f3295   Masami Hiramatsu   perf probe: Add d...
52
53
  	bool				ref;	/* Referencing flag */
  };
4235b0454   Masami Hiramatsu   perf probe: Intro...
54
55
  /* Perf probe probing argument */
  struct perf_probe_arg {
7df2f3295   Masami Hiramatsu   perf probe: Add d...
56
  	char				*name;	/* Argument name */
48481938b   Masami Hiramatsu   perf probe: Suppo...
57
  	char				*var;	/* Variable name */
11a1ca355   Masami Hiramatsu   perf probe: Suppo...
58
  	char				*type;	/* Type name */
7df2f3295   Masami Hiramatsu   perf probe: Add d...
59
  	struct perf_probe_arg_field	*field;	/* Structure fields */
4235b0454   Masami Hiramatsu   perf probe: Intro...
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
  };
  
  /* Perf probe probing event (point + arg) */
  struct perf_probe_event {
  	char			*event;	/* Event name */
  	char			*group;	/* Group name */
  	struct perf_probe_point	point;	/* Probe point */
  	int			nargs;	/* Number of arguments */
  	struct perf_probe_arg	*args;	/* Arguments */
  };
  
  
  /* Line number container */
  struct line_node {
  	struct list_head	list;
d3b63d7ae   Masami Hiramatsu   perf probe: Fix a...
75
  	int			line;
4235b0454   Masami Hiramatsu   perf probe: Intro...
76
77
78
79
80
81
  };
  
  /* Line range */
  struct line_range {
  	char			*file;		/* File name */
  	char			*function;	/* Function name */
d3b63d7ae   Masami Hiramatsu   perf probe: Fix a...
82
83
  	int			start;		/* Start line number */
  	int			end;		/* End line number */
4235b0454   Masami Hiramatsu   perf probe: Intro...
84
85
  	int			offset;		/* Start line offset */
  	char			*path;		/* Real path name */
6a330a3c8   Masami Hiramatsu   perf probe: Suppo...
86
  	char			*comp_dir;	/* Compile directory */
4235b0454   Masami Hiramatsu   perf probe: Intro...
87
88
  	struct list_head	line_list;	/* Visible lines */
  };
cf6eb489e   Masami Hiramatsu   perf probe: Show ...
89
90
91
92
93
  /* List of variables */
  struct variable_list {
  	struct probe_trace_point	point;	/* Actual probepoint */
  	struct strlist			*vars;	/* Available variables */
  };
4235b0454   Masami Hiramatsu   perf probe: Intro...
94
  /* Command string to events */
146a14394   Masami Hiramatsu   perf probe: Remov...
95
96
  extern int parse_perf_probe_command(const char *cmd,
  				    struct perf_probe_event *pev);
4235b0454   Masami Hiramatsu   perf probe: Intro...
97
98
99
  
  /* Events to command string */
  extern char *synthesize_perf_probe_command(struct perf_probe_event *pev);
0e60836bb   Srikar Dronamraju   perf probe: Renam...
100
  extern char *synthesize_probe_trace_command(struct probe_trace_event *tev);
7df2f3295   Masami Hiramatsu   perf probe: Add d...
101
102
  extern int synthesize_perf_probe_arg(struct perf_probe_arg *pa, char *buf,
  				     size_t len);
4235b0454   Masami Hiramatsu   perf probe: Intro...
103
104
105
  
  /* Check the perf_probe_event needs debuginfo */
  extern bool perf_probe_event_need_dwarf(struct perf_probe_event *pev);
4235b0454   Masami Hiramatsu   perf probe: Intro...
106
107
  /* Release event contents */
  extern void clear_perf_probe_event(struct perf_probe_event *pev);
4235b0454   Masami Hiramatsu   perf probe: Intro...
108
109
  
  /* Command string to line-range */
146a14394   Masami Hiramatsu   perf probe: Remov...
110
  extern int parse_line_range_desc(const char *cmd, struct line_range *lr);
4235b0454   Masami Hiramatsu   perf probe: Intro...
111

469b9b884   Masami Hiramatsu   perf probe: Add b...
112
113
  /* Internal use: Return kernel/module path */
  extern const char *kernel_get_module_path(const char *module);
4235b0454   Masami Hiramatsu   perf probe: Intro...
114

ef4a35657   Masami Hiramatsu   perf probe: Add -...
115
  extern int add_perf_probe_events(struct perf_probe_event *pevs, int npevs,
469b9b884   Masami Hiramatsu   perf probe: Add b...
116
117
  				 int max_probe_points, const char *module,
  				 bool force_add);
146a14394   Masami Hiramatsu   perf probe: Remov...
118
119
  extern int del_perf_probe_events(struct strlist *dellist);
  extern int show_perf_probe_events(void);
469b9b884   Masami Hiramatsu   perf probe: Add b...
120
  extern int show_line_range(struct line_range *lr, const char *module);
cf6eb489e   Masami Hiramatsu   perf probe: Show ...
121
  extern int show_available_vars(struct perf_probe_event *pevs, int npevs,
469b9b884   Masami Hiramatsu   perf probe: Add b...
122
  			       int max_probe_points, const char *module,
bd09d7b5e   Masami Hiramatsu   perf probe: Add v...
123
  			       struct strfilter *filter, bool externs);
3c42258c9   Masami Hiramatsu   perf probe: Add f...
124
  extern int show_available_funcs(const char *module, struct strfilter *filter);
50656eec8   Masami Hiramatsu   perf probe: Move ...
125

4235b0454   Masami Hiramatsu   perf probe: Intro...
126

b498ce1f2   Masami Hiramatsu   perf probe: Simpl...
127
128
  /* Maximum index number of event-name postfix */
  #define MAX_EVENT_INDEX	1024
50656eec8   Masami Hiramatsu   perf probe: Move ...
129
  #endif /*_PROBE_EVENT_H */