| 
									
										
										
										
											2009-11-30 19:19:58 -05:00
										 |  |  | #ifndef _PROBE_EVENT_H
 | 
					
						
							|  |  |  | #define _PROBE_EVENT_H
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-12-15 10:31:14 -05:00
										 |  |  | #include <stdbool.h>
 | 
					
						
							| 
									
										
										
										
											2009-11-30 19:20:17 -05:00
										 |  |  | #include "strlist.h"
 | 
					
						
							| 
									
										
										
										
											2011-01-20 23:15:39 +09:00
										 |  |  | #include "strfilter.h"
 | 
					
						
							| 
									
										
										
										
											2009-11-30 19:19:58 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-16 18:06:05 -04:00
										 |  |  | extern bool probe_event_dry_run; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-04-16 17:39:09 +05:30
										 |  |  | /* kprobe-tracer and uprobe-tracer tracing point */ | 
					
						
							| 
									
										
										
										
											2010-07-29 19:43:51 +05:30
										 |  |  | struct probe_trace_point { | 
					
						
							| 
									
										
										
										
											2010-03-16 18:06:12 -04:00
										 |  |  | 	char		*symbol;	/* Base symbol */ | 
					
						
							| 
									
										
										
										
											2011-06-27 16:27:45 +09:00
										 |  |  | 	char		*module;	/* Module name */ | 
					
						
							| 
									
										
										
										
											2010-03-16 18:06:12 -04:00
										 |  |  | 	unsigned long	offset;		/* Offset from symbol */ | 
					
						
							|  |  |  | 	bool		retprobe;	/* Return probe flag */ | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-07-29 19:43:51 +05:30
										 |  |  | /* probe-tracer tracing argument referencing offset */ | 
					
						
							|  |  |  | struct probe_trace_arg_ref { | 
					
						
							|  |  |  | 	struct probe_trace_arg_ref	*next;	/* Next reference */ | 
					
						
							| 
									
										
										
										
											2010-03-16 18:06:12 -04:00
										 |  |  | 	long				offset;	/* Offset value */ | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-04-16 17:39:09 +05:30
										 |  |  | /* kprobe-tracer and uprobe-tracer tracing argument */ | 
					
						
							| 
									
										
										
										
											2010-07-29 19:43:51 +05:30
										 |  |  | struct probe_trace_arg { | 
					
						
							| 
									
										
										
										
											2010-03-16 18:06:12 -04:00
										 |  |  | 	char				*name;	/* Argument name */ | 
					
						
							|  |  |  | 	char				*value;	/* Base value */ | 
					
						
							| 
									
										
										
										
											2010-04-12 13:17:15 -04:00
										 |  |  | 	char				*type;	/* Type name */ | 
					
						
							| 
									
										
										
										
											2010-07-29 19:43:51 +05:30
										 |  |  | 	struct probe_trace_arg_ref	*ref;	/* Referencing offset */ | 
					
						
							| 
									
										
										
										
											2010-03-16 18:06:12 -04:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-04-16 17:39:09 +05:30
										 |  |  | /* kprobe-tracer and uprobe-tracer tracing event (point + arg) */ | 
					
						
							| 
									
										
										
										
											2010-07-29 19:43:51 +05:30
										 |  |  | struct probe_trace_event { | 
					
						
							| 
									
										
										
										
											2010-03-16 18:06:12 -04:00
										 |  |  | 	char				*event;	/* Event name */ | 
					
						
							|  |  |  | 	char				*group;	/* Group name */ | 
					
						
							| 
									
										
										
										
											2010-07-29 19:43:51 +05:30
										 |  |  | 	struct probe_trace_point	point;	/* Trace point */ | 
					
						
							| 
									
										
										
										
											2010-03-16 18:06:12 -04:00
										 |  |  | 	int				nargs;	/* Number of args */ | 
					
						
							| 
									
										
										
										
											2012-04-16 17:39:09 +05:30
										 |  |  | 	bool				uprobes;	/* uprobes only */ | 
					
						
							| 
									
										
										
										
											2010-07-29 19:43:51 +05:30
										 |  |  | 	struct probe_trace_arg		*args;	/* Arguments */ | 
					
						
							| 
									
										
										
										
											2010-03-16 18:06:12 -04:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* Perf probe probing point */ | 
					
						
							|  |  |  | struct perf_probe_point { | 
					
						
							|  |  |  | 	char		*file;		/* File path */ | 
					
						
							|  |  |  | 	char		*function;	/* Function name */ | 
					
						
							|  |  |  | 	int		line;		/* Line number */ | 
					
						
							| 
									
										
											  
											
												perf tools: Reorganize some structs to save space
Using 'pahole --packable' I found some structs that could be reorganized
to eliminate alignment holes, in some cases getting them to be cacheline
multiples.
[acme@doppio linux-2.6-tip]$ codiff perf.old ~/bin/perf
builtin-annotate.c:
  struct perf_session    |   -8
  struct perf_header     |   -8
 2 structs changed
builtin-diff.c:
  struct sample_data         |   -8
 1 struct changed
  diff__process_sample_event |   -8
 1 function changed, 8 bytes removed, diff: -8
builtin-sched.c:
  struct sched_atom      |   -8
 1 struct changed
builtin-timechart.c:
  struct per_pid         |   -8
 1 struct changed
  cmd_timechart          |  -16
 1 function changed, 16 bytes removed, diff: -16
builtin-probe.c:
  struct perf_probe_point |   -8
  struct perf_probe_event |   -8
 2 structs changed
  opt_add_probe_event     |   -3
 1 function changed, 3 bytes removed, diff: -3
util/probe-finder.c:
  struct probe_finder      |   -8
 1 struct changed
  find_kprobe_trace_events |  -16
 1 function changed, 16 bytes removed, diff: -16
/home/acme/bin/perf:
 4 functions changed, 43 bytes removed, diff: -43
[acme@doppio linux-2.6-tip]$
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
											
										 
											2010-04-05 12:53:45 -03:00
										 |  |  | 	bool		retprobe;	/* Return probe flag */ | 
					
						
							| 
									
										
										
										
											2010-03-16 18:06:12 -04:00
										 |  |  | 	char		*lazy_line;	/* Lazy matching pattern */ | 
					
						
							|  |  |  | 	unsigned long	offset;		/* Offset from function entry */ | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-16 18:06:26 -04:00
										 |  |  | /* 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 */ | 
					
						
							| 
									
										
										
										
											2010-05-19 15:57:42 -04:00
										 |  |  | 	long				index;	/* Array index number */ | 
					
						
							| 
									
										
										
										
											2010-03-16 18:06:26 -04:00
										 |  |  | 	bool				ref;	/* Referencing flag */ | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-16 18:06:12 -04:00
										 |  |  | /* Perf probe probing argument */ | 
					
						
							|  |  |  | struct perf_probe_arg { | 
					
						
							| 
									
										
										
										
											2010-03-16 18:06:26 -04:00
										 |  |  | 	char				*name;	/* Argument name */ | 
					
						
							| 
									
										
										
										
											2010-04-12 13:16:53 -04:00
										 |  |  | 	char				*var;	/* Variable name */ | 
					
						
							| 
									
										
										
										
											2010-04-12 13:17:22 -04:00
										 |  |  | 	char				*type;	/* Type name */ | 
					
						
							| 
									
										
										
										
											2010-03-16 18:06:26 -04:00
										 |  |  | 	struct perf_probe_arg_field	*field;	/* Structure fields */ | 
					
						
							| 
									
										
										
										
											2010-03-16 18:06:12 -04:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* 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 */ | 
					
						
							| 
									
										
										
										
											2012-04-16 17:39:09 +05:30
										 |  |  | 	bool			uprobes; | 
					
						
							| 
									
										
										
										
											2010-03-16 18:06:12 -04:00
										 |  |  | 	struct perf_probe_arg	*args;	/* Arguments */ | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* Line number container */ | 
					
						
							|  |  |  | struct line_node { | 
					
						
							|  |  |  | 	struct list_head	list; | 
					
						
							| 
									
										
										
										
											2010-04-14 18:39:42 -04:00
										 |  |  | 	int			line; | 
					
						
							| 
									
										
										
										
											2010-03-16 18:06:12 -04:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* Line range */ | 
					
						
							|  |  |  | struct line_range { | 
					
						
							|  |  |  | 	char			*file;		/* File name */ | 
					
						
							|  |  |  | 	char			*function;	/* Function name */ | 
					
						
							| 
									
										
										
										
											2010-04-14 18:39:42 -04:00
										 |  |  | 	int			start;		/* Start line number */ | 
					
						
							|  |  |  | 	int			end;		/* End line number */ | 
					
						
							| 
									
										
										
										
											2010-03-16 18:06:12 -04:00
										 |  |  | 	int			offset;		/* Start line offset */ | 
					
						
							|  |  |  | 	char			*path;		/* Real path name */ | 
					
						
							| 
									
										
										
										
											2010-07-09 18:29:11 +09:00
										 |  |  | 	char			*comp_dir;	/* Compile directory */ | 
					
						
							| 
									
										
										
										
											2010-03-16 18:06:12 -04:00
										 |  |  | 	struct list_head	line_list;	/* Visible lines */ | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-10-21 19:13:23 +09:00
										 |  |  | /* List of variables */ | 
					
						
							|  |  |  | struct variable_list { | 
					
						
							|  |  |  | 	struct probe_trace_point	point;	/* Actual probepoint */ | 
					
						
							|  |  |  | 	struct strlist			*vars;	/* Available variables */ | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-16 18:06:12 -04:00
										 |  |  | /* Command string to events */ | 
					
						
							| 
									
										
										
										
											2010-04-12 13:17:42 -04:00
										 |  |  | extern int parse_perf_probe_command(const char *cmd, | 
					
						
							|  |  |  | 				    struct perf_probe_event *pev); | 
					
						
							| 
									
										
										
										
											2010-03-16 18:06:12 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | /* Events to command string */ | 
					
						
							|  |  |  | extern char *synthesize_perf_probe_command(struct perf_probe_event *pev); | 
					
						
							| 
									
										
										
										
											2010-07-29 19:43:51 +05:30
										 |  |  | extern char *synthesize_probe_trace_command(struct probe_trace_event *tev); | 
					
						
							| 
									
										
										
										
											2010-03-16 18:06:26 -04:00
										 |  |  | extern int synthesize_perf_probe_arg(struct perf_probe_arg *pa, char *buf, | 
					
						
							|  |  |  | 				     size_t len); | 
					
						
							| 
									
										
										
										
											2010-03-16 18:06:12 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | /* Check the perf_probe_event needs debuginfo */ | 
					
						
							|  |  |  | extern bool perf_probe_event_need_dwarf(struct perf_probe_event *pev); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* Release event contents */ | 
					
						
							|  |  |  | extern void clear_perf_probe_event(struct perf_probe_event *pev); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* Command string to line-range */ | 
					
						
							| 
									
										
										
										
											2010-04-12 13:17:42 -04:00
										 |  |  | extern int parse_line_range_desc(const char *cmd, struct line_range *lr); | 
					
						
							| 
									
										
										
										
											2010-03-16 18:06:12 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-10-21 19:13:41 +09:00
										 |  |  | /* Internal use: Return kernel/module path */ | 
					
						
							|  |  |  | extern const char *kernel_get_module_path(const char *module); | 
					
						
							| 
									
										
										
										
											2010-03-16 18:06:12 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-04-21 15:56:40 -04:00
										 |  |  | extern int add_perf_probe_events(struct perf_probe_event *pevs, int npevs, | 
					
						
							| 
									
										
										
										
											2010-10-21 19:13:41 +09:00
										 |  |  | 				 int max_probe_points, const char *module, | 
					
						
							|  |  |  | 				 bool force_add); | 
					
						
							| 
									
										
										
										
											2010-04-12 13:17:42 -04:00
										 |  |  | extern int del_perf_probe_events(struct strlist *dellist); | 
					
						
							|  |  |  | extern int show_perf_probe_events(void); | 
					
						
							| 
									
										
										
										
											2010-10-21 19:13:41 +09:00
										 |  |  | extern int show_line_range(struct line_range *lr, const char *module); | 
					
						
							| 
									
										
										
										
											2010-10-21 19:13:23 +09:00
										 |  |  | extern int show_available_vars(struct perf_probe_event *pevs, int npevs, | 
					
						
							| 
									
										
										
										
											2010-10-21 19:13:41 +09:00
										 |  |  | 			       int max_probe_points, const char *module, | 
					
						
							| 
									
										
										
										
											2011-01-20 23:15:39 +09:00
										 |  |  | 			       struct strfilter *filter, bool externs); | 
					
						
							| 
									
										
										
										
											2012-04-16 17:39:09 +05:30
										 |  |  | extern int show_available_funcs(const char *module, struct strfilter *filter, | 
					
						
							|  |  |  | 				bool user); | 
					
						
							| 
									
										
										
										
											2010-03-16 18:06:12 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-30 19:20:25 -05:00
										 |  |  | /* Maximum index number of event-name postfix */ | 
					
						
							|  |  |  | #define MAX_EVENT_INDEX	1024
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-30 19:19:58 -05:00
										 |  |  | #endif /*_PROBE_EVENT_H */
 |