mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	tracing: Move synthetic events to a separate file
With the addition of the in-kernel synthetic event API, synthetic events are no longer specifically tied to the histogram triggers. The synthetic event code is also making trace_event_hist.c very bloated, so for those reasons, move it to a separate file, trace_events_synth.c, along with a new trace_synth.h header file. Because synthetic events are now independent from hist triggers, add a new CONFIG_SYNTH_EVENTS config option, and have CONFIG_HIST_TRIGGERS select it, and have CONFIG_SYNTH_EVENT_GEN_TEST depend on it. Link: http://lkml.kernel.org/r/4d1fa1f85ed5982706ac44844ac92451dcb04715.1590693308.git.zanussi@kernel.org Signed-off-by: Tom Zanussi <zanussi@kernel.org> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
This commit is contained in:
		
							parent
							
								
									5bbf959de4
								
							
						
					
					
						commit
						726721a518
					
				
					 5 changed files with 1847 additions and 1786 deletions
				
			
		| 
						 | 
					@ -623,12 +623,30 @@ config TRACING_MAP
 | 
				
			||||||
	  generally used outside of that context, and is normally
 | 
						  generally used outside of that context, and is normally
 | 
				
			||||||
	  selected by tracers that use it.
 | 
						  selected by tracers that use it.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					config SYNTH_EVENTS
 | 
				
			||||||
 | 
						bool "Synthetic trace events"
 | 
				
			||||||
 | 
						select TRACING
 | 
				
			||||||
 | 
						select DYNAMIC_EVENTS
 | 
				
			||||||
 | 
						default n
 | 
				
			||||||
 | 
						help
 | 
				
			||||||
 | 
						  Synthetic events are user-defined trace events that can be
 | 
				
			||||||
 | 
						  used to combine data from other trace events or in fact any
 | 
				
			||||||
 | 
						  data source.  Synthetic events can be generated indirectly
 | 
				
			||||||
 | 
						  via the trace() action of histogram triggers or directly
 | 
				
			||||||
 | 
						  by way of an in-kernel API.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						  See Documentation/trace/events.rst or
 | 
				
			||||||
 | 
						  Documentation/trace/histogram.rst for details and examples.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						  If in doubt, say N.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
config HIST_TRIGGERS
 | 
					config HIST_TRIGGERS
 | 
				
			||||||
	bool "Histogram triggers"
 | 
						bool "Histogram triggers"
 | 
				
			||||||
	depends on ARCH_HAVE_NMI_SAFE_CMPXCHG
 | 
						depends on ARCH_HAVE_NMI_SAFE_CMPXCHG
 | 
				
			||||||
	select TRACING_MAP
 | 
						select TRACING_MAP
 | 
				
			||||||
	select TRACING
 | 
						select TRACING
 | 
				
			||||||
	select DYNAMIC_EVENTS
 | 
						select DYNAMIC_EVENTS
 | 
				
			||||||
 | 
						select SYNTH_EVENTS
 | 
				
			||||||
	default n
 | 
						default n
 | 
				
			||||||
	help
 | 
						help
 | 
				
			||||||
	  Hist triggers allow one or more arbitrary trace event fields
 | 
						  Hist triggers allow one or more arbitrary trace event fields
 | 
				
			||||||
| 
						 | 
					@ -824,7 +842,7 @@ config PREEMPTIRQ_DELAY_TEST
 | 
				
			||||||
 | 
					
 | 
				
			||||||
config SYNTH_EVENT_GEN_TEST
 | 
					config SYNTH_EVENT_GEN_TEST
 | 
				
			||||||
	tristate "Test module for in-kernel synthetic event generation"
 | 
						tristate "Test module for in-kernel synthetic event generation"
 | 
				
			||||||
	depends on HIST_TRIGGERS
 | 
						depends on SYNTH_EVENTS
 | 
				
			||||||
	help
 | 
						help
 | 
				
			||||||
          This option creates a test module to check the base
 | 
					          This option creates a test module to check the base
 | 
				
			||||||
          functionality of in-kernel synthetic event definition and
 | 
					          functionality of in-kernel synthetic event definition and
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -72,6 +72,7 @@ endif
 | 
				
			||||||
obj-$(CONFIG_EVENT_TRACING) += trace_events_filter.o
 | 
					obj-$(CONFIG_EVENT_TRACING) += trace_events_filter.o
 | 
				
			||||||
obj-$(CONFIG_EVENT_TRACING) += trace_events_trigger.o
 | 
					obj-$(CONFIG_EVENT_TRACING) += trace_events_trigger.o
 | 
				
			||||||
obj-$(CONFIG_TRACE_EVENT_INJECT) += trace_events_inject.o
 | 
					obj-$(CONFIG_TRACE_EVENT_INJECT) += trace_events_inject.o
 | 
				
			||||||
 | 
					obj-$(CONFIG_SYNTH_EVENTS) += trace_events_synth.o
 | 
				
			||||||
obj-$(CONFIG_HIST_TRIGGERS) += trace_events_hist.o
 | 
					obj-$(CONFIG_HIST_TRIGGERS) += trace_events_hist.o
 | 
				
			||||||
obj-$(CONFIG_BPF_EVENTS) += bpf_trace.o
 | 
					obj-$(CONFIG_BPF_EVENTS) += bpf_trace.o
 | 
				
			||||||
obj-$(CONFIG_KPROBE_EVENTS) += trace_kprobe.o
 | 
					obj-$(CONFIG_KPROBE_EVENTS) += trace_kprobe.o
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
							
								
								
									
										1789
									
								
								kernel/trace/trace_events_synth.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1789
									
								
								kernel/trace/trace_events_synth.c
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
							
								
								
									
										36
									
								
								kernel/trace/trace_synth.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								kernel/trace/trace_synth.h
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,36 @@
 | 
				
			||||||
 | 
					// SPDX-License-Identifier: GPL-2.0
 | 
				
			||||||
 | 
					#ifndef __TRACE_SYNTH_H
 | 
				
			||||||
 | 
					#define __TRACE_SYNTH_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "trace_dynevent.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define SYNTH_SYSTEM		"synthetic"
 | 
				
			||||||
 | 
					#define SYNTH_FIELDS_MAX	32
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define STR_VAR_LEN_MAX		32 /* must be multiple of sizeof(u64) */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct synth_field {
 | 
				
			||||||
 | 
						char *type;
 | 
				
			||||||
 | 
						char *name;
 | 
				
			||||||
 | 
						size_t size;
 | 
				
			||||||
 | 
						unsigned int offset;
 | 
				
			||||||
 | 
						bool is_signed;
 | 
				
			||||||
 | 
						bool is_string;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct synth_event {
 | 
				
			||||||
 | 
						struct dyn_event			devent;
 | 
				
			||||||
 | 
						int					ref;
 | 
				
			||||||
 | 
						char					*name;
 | 
				
			||||||
 | 
						struct synth_field			**fields;
 | 
				
			||||||
 | 
						unsigned int				n_fields;
 | 
				
			||||||
 | 
						unsigned int				n_u64;
 | 
				
			||||||
 | 
						struct trace_event_class		class;
 | 
				
			||||||
 | 
						struct trace_event_call			call;
 | 
				
			||||||
 | 
						struct tracepoint			*tp;
 | 
				
			||||||
 | 
						struct module				*mod;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					extern struct synth_event *find_synth_event(const char *name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif /* __TRACE_SYNTH_H */
 | 
				
			||||||
		Loading…
	
		Reference in a new issue