trace-cmd: separate out buffer_instances
PATCH 1/1 trace-cmd: separate out buffer_instances
In an effort to make trace-cmd more easily linked against we need to separate out the instance handling functionality. I've renamed buffer_instance to tracecmd_buffer_instance and moved the relevant helper functions into their own file and moved the definitions into trace-cmd.h. Thanks,
Signed-off-by Josef Bacik <[email protected]>
--- Makefile | 3 +- trace-cmd.c | 9 +- trace-cmd.h | 102 +++++++++++-- trace-instance.c | 185 +++++++++++++++++++++++ trace-local.h | 70 ++------- trace-record.c | 449 ++++++++++++++++++++----------------------------------- trace-stat.c | 68 ++++----- trace-stream.c | 4 +- 8 files changed, 482 insertions(+), 408 deletions(-) create mode 100644 trace-instance.c
Makefile +2 -1
@@ -336,7 +336,8 @@ PEVENT_LIB_OBJS = event-parse.o trace-seq.o parse-filter.o parse-utils.o TCMD_LIB_OBJS = $(PEVENT_LIB_OBJS) trace-util.o trace-input.o trace-ftrace.o \ trace-output.o trace-record.o trace-recorder.o \ trace-restore.o trace-usage.o trace-blk-hack.o \ - kbuffer-parse.o event-plugin.o trace-hooks.o + kbuffer-parse.o event-plugin.o trace-hooks.o \ + trace-instance.o PLUGIN_OBJS = PLUGIN_OBJS += plugin_jbd2.o
trace-cmd.c +5 -4
@@ -265,11 +265,12 @@ static void show_event_format_re(const char *re)process_file_re (event_format_write,"available_events" , re); } -void show_instance_file (struct buffer_instance *instance,const char *name) +void show_instance_file (struct tracecmd_buffer_instance *instance, +const char *name) {char *path; - path =get_instance_file (instance, name); + path =tracecmd_get_instance_file (instance, name);dump_file_content (path);tracecmd_put_tracing_file (path); }
@@ -499,7 +500,7 @@ int main (int argc, char **argv)const char *buffer =NULL ;const char *file ="trace" ;const char *cpu =NULL ; -struct buffer_instance *instance = &top_instance; +struct tracecmd_buffer_instance *instance = &top_instance;char cpu_path[128 ];char *path;int snap =0 ;
@@ -532,7 +533,7 @@ int main (int argc, char **argv)if (buffer)die ("Can only show one buffer at a time" ); buffer = optarg; - instance =create_instance (optarg); + instance =tracecmd_create_instance (optarg);break ;case 'c' :if (cpu)
trace-cmd.h +88 -14
112 lines not on this page · raw message
trace-instance.c new file +185 -0
185 lines not on this page · raw message
trace-local.h +10 -60
94 lines not on this page · raw message
trace-record.c +158 -291
1,233 lines not on this page · raw message
trace-stat.c +32 -36
226 lines not on this page · raw message
trace-stream.c +2 -2
@@ -34,8 +34,8 @@* it to create the pevent and handle. */ struct tracecmd_input * -trace_stream_init (struct buffer_instance *instance,int cpu,int fd,int cpus, -int profile,struct hook_list *hooks,int global) +trace_stream_init (struct tracecmd_buffer_instance *instance,int cpu,int fd, +int cpus,int profile,struct hook_list *hooks,int global) {struct tracecmd_input *trace_input;struct tracecmd_output *trace_output;
Signature · 1 line
2.1.0