Skip to contentSkip to conversation

trace-cmd: Handle filtered PIDs per ftarce instance

PATCH Superseded Tzvetomir Stoyanov (VMware) 1 participant 1 message Apr 30, 2020

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 trace-cmd: Handle filtered PIDs per ftarce instance

Ftrace supports PID filtering per instance. Currently
trace-cmd does not use this functionality, all PIDs specified with "-P" option are propagated to all configured tracing instances. The patch affects these trace-cmd options:
-P, -O, -T, --proc-map
their configuration scope is limited to the specified ftrace instance only. If no instance is specified, the configuration is applied to the main instance

---
 tracecmd/include/trace-local.h |  24 +-
 tracecmd/trace-record.c        | 536 ++++++++++++++++++---------------
 2 files changed, 311 insertions(+), 249 deletions(-)
tracecmd/include/trace-local.h +23 -1
index 0f58c772..4c6a63d0 100644
@@ -184,6 +184,17 @@ struct pid_addr_maps {
 	int				pid;
 };
 
+struct opt_list {
+	struct opt_list *next;
+	const char	*option;
+};
+
+struct filter_pids {
+	struct filter_pids *next;
+	int pid;
+	int exclude;
+};
+
 struct buffer_instance {
 	struct buffer_instance	*next;
 	struct tracefs_instance	*tracefs;
@@ -202,6 +213,18 @@ struct buffer_instance {
 	struct func_list	*filter_funcs;
 	struct func_list	*notrace_funcs;
 
+	struct opt_list		*options;
+	struct filter_pids	*filter_pids;
+	char			*common_pid_filter;
+	int			nr_filter_pids;
+	int			len_filter_pids;
+	bool			ptrace_child;
+
+	int			have_set_event_pid;
+	int			have_event_fork;
+	int			have_func_fork;
+	int			get_procmap;
+
 	const char		*clock;
 	unsigned int		*client_ports;
 
@@ -260,7 +283,6 @@ int get_guest_vcpu_pid(unsigned int guest_cid, unsigned int guest_vcpu);
 /* moved from trace-cmd.h */
 void tracecmd_create_top_instance(char *name);
 void tracecmd_remove_instances(void);
-void tracecmd_filter_pid(int pid, int exclude);
 int tracecmd_add_event(const char *event_str, int stack);
 void tracecmd_enable_events(void);
 void tracecmd_disable_all_tracing(int disable_tracer);
tracecmd/trace-record.c +288 -248

1,002 lines not on this page · raw message

Signature · 1 line
2.25.4