Skip to contentSkip to conversation

trace-cmd: Clean up python plugin warnings

PATCH In review Tzvetomir Stoyanov (VMware) 2 participants 2 messages Jul 9, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 trace-cmd: Clean up python plugin warnings

All trace-cmd APIs (functions, declared in trace-cmd.h) are exposed automatically at build time as python bindings, using trace-cmd python plugin. Implementation of those functions is supposed to be in libtracecmd library. Not all functions, declared in trace-cmd.h are APIs, some of them are internal and should not be exposed:
tracecmd_enable_events() is removed from trace-cmd.h, as it heavily depends on
trace-cmd internals. It is no more exposed as python binding.
Others are implemented in trace-cmd application and cannot be used outside it:
trace-output.c file is moved from trace-cmd to libtracecmd. All functions
implemented there are now part of the library.

---
 include/trace-cmd/trace-cmd.h              |  1 -
 lib/trace-cmd/Makefile                     | 11 ++++++++++-
 {tracecmd => lib/trace-cmd}/trace-output.c |  0
 tracecmd/Makefile                          |  1 -
 4 files changed, 10 insertions(+), 3 deletions(-)
 rename {tracecmd => lib/trace-cmd}/trace-output.c (100%)
include/trace-cmd/trace-cmd.h +0 -1
index 6f62ab9..1f2f5bf 100644
@@ -292,7 +292,6 @@ void tracecmd_stat_cpu(struct trace_seq *s, int cpu);
 long tracecmd_flush_recording(struct tracecmd_recorder *recorder);
 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);
 void tracecmd_disable_tracing(void);
 void tracecmd_enable_tracing(void);
lib/trace-cmd/Makefile +10 -1
index 44c1332..9086eb6 100644
@@ -4,12 +4,15 @@ include $(src)/scripts/utils.mk
 
 bdir:=$(obj)/lib/trace-cmd
 
-DEFAULT_TARGET = $(bdir)/libtracecmd.a
+TC_VERSION := $(bdir)/include/tc_version.h
+
+DEFAULT_TARGET = $(bdir)/libtracecmd.a $(TC_VERSION)
 
 OBJS =
 OBJS += trace-hash.o
 OBJS += trace-hooks.o
 OBJS += trace-input.o
+OBJS += trace-output.o
 OBJS += trace-recorder.o
 OBJS += trace-util.o
 OBJS += trace-filter-hash.o
@@ -29,6 +32,9 @@ $(bdir):
 $(OBJS): | $(bdir)
 $(DEPS): | $(bdir)
 
+$(TC_VERSION): force | $(bdir)/include
+	$(Q)$(call update_version.h)
+
 $(bdir)/libtracecmd.a: $(OBJS)
 	$(Q)$(call do_build_static_lib)
 
@@ -43,6 +49,8 @@ $(bdir)/trace-util.o: $(obj)/plugins/trace_plugin_dir
 $(DEPS): $(bdir)/.%.d: %.c
 	$(Q)$(CC) -M $(CPPFLAGS) $(CFLAGS) $< > $@
 
+$(DEPS): $(TC_VERSION)
+
 $(OBJS): $(bdir)/%.o : $(bdir)/.%.d
 
 dep_includes := $(wildcard $(DEPS))
@@ -54,4 +62,5 @@ endif
 clean:
 	$(RM) $(bdir)/*.a $(bdir)/*.so $(bdir)/*.o $(bdir)/.*.d
 
+force:
 .PHONY: clean
lib/trace-cmd/trace-output.c renamed from tracecmd/trace-output.c +0 -0
similarity index 100%
rename from tracecmd/trace-output.c
rename to lib/trace-cmd/trace-output.c
tracecmd/Makefile +0 -1
index bcd437a..6968f83 100644
@@ -29,7 +29,6 @@ TRACE_CMD_OBJS += trace-restore.o
 TRACE_CMD_OBJS += trace-check-events.o
 TRACE_CMD_OBJS += trace-show.o
 TRACE_CMD_OBJS += trace-list.o
-TRACE_CMD_OBJS += trace-output.o
 TRACE_CMD_OBJS += trace-usage.o
 TRACE_CMD_OBJS += trace-msg.o
 
Signature · 1 line
2.21.0
#1 lore raw

On Tue, 9 Jul 2019 17:26:00 +0300
"Tzvetomir Stoyanov (VMware)" <[email protected]> wrote:

Hi Tzvetomir,

This should be broken up into two patches.

1) remove the tracecmd_enable_events(), and the subject should be:
trace-cmd: Remove tracecmd_enable_events() function
And the change log can talk about the python warning and also that nothing happens to use it.

2) trace-cmd: Move trace-output.c into the library code And the change log should state that trace-ouput.c contains code that can be used outside of trace-cmd, and should be part of the library. It can also mention that a warning is caused by loading python modules inside kernelshark because that depends on the library code.

Thanks!

-- Steve

Quoted 94 lines

All trace-cmd APIs (functions, declared in trace-cmd.h) are exposed automatically at build time as python bindings, using trace-cmd python plugin. Implementation of those functions is supposed to be in libtracecmd library. Not all functions, declared in trace-cmd.h are APIs, some of them are internal and should not be exposed:
tracecmd_enable_events() is removed from trace-cmd.h, as it heavily depends on
trace-cmd internals. It is no more exposed as python binding.
Others are implemented in trace-cmd application and cannot be used outside it:
trace-output.c file is moved from trace-cmd to libtracecmd. All functions
implemented there are now part of the library.

---
 include/trace-cmd/trace-cmd.h              |  1 -
 lib/trace-cmd/Makefile                     | 11 ++++++++++-
 {tracecmd => lib/trace-cmd}/trace-output.c |  0
 tracecmd/Makefile                          |  1 -
 4 files changed, 10 insertions(+), 3 deletions(-)
 rename {tracecmd => lib/trace-cmd}/trace-output.c (100%)
include/trace-cmd/trace-cmd.h +0 -1
index 6f62ab9..1f2f5bf 100644
@@ -292,7 +292,6 @@ void tracecmd_stat_cpu(struct trace_seq *s, int cpu);
 long tracecmd_flush_recording(struct tracecmd_recorder *recorder);
 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);
 void tracecmd_disable_tracing(void);
 void tracecmd_enable_tracing(void);
lib/trace-cmd/Makefile +10 -1
index 44c1332..9086eb6 100644
@@ -4,12 +4,15 @@ include $(src)/scripts/utils.mk
 
 bdir:=$(obj)/lib/trace-cmd
 
-DEFAULT_TARGET = $(bdir)/libtracecmd.a
+TC_VERSION := $(bdir)/include/tc_version.h
+
+DEFAULT_TARGET = $(bdir)/libtracecmd.a $(TC_VERSION)
 
 OBJS =
 OBJS += trace-hash.o
 OBJS += trace-hooks.o
 OBJS += trace-input.o
+OBJS += trace-output.o
 OBJS += trace-recorder.o
 OBJS += trace-util.o
 OBJS += trace-filter-hash.o
@@ -29,6 +32,9 @@ $(bdir):
 $(OBJS): | $(bdir)
 $(DEPS): | $(bdir)
 
+$(TC_VERSION): force | $(bdir)/include
+	$(Q)$(call update_version.h)
+
 $(bdir)/libtracecmd.a: $(OBJS)
 	$(Q)$(call do_build_static_lib)
 
@@ -43,6 +49,8 @@ $(bdir)/trace-util.o: $(obj)/plugins/trace_plugin_dir
 $(DEPS): $(bdir)/.%.d: %.c
 	$(Q)$(CC) -M $(CPPFLAGS) $(CFLAGS) $< > $@
 
+$(DEPS): $(TC_VERSION)
+
 $(OBJS): $(bdir)/%.o : $(bdir)/.%.d
 
 dep_includes := $(wildcard $(DEPS))
@@ -54,4 +62,5 @@ endif
 clean:
 	$(RM) $(bdir)/*.a $(bdir)/*.so $(bdir)/*.o $(bdir)/.*.d
 
+force:
 .PHONY: clean
lib/trace-cmd/trace-output.c renamed from tracecmd/trace-output.c +0 -0
similarity index 100%
rename from tracecmd/trace-output.c
rename to lib/trace-cmd/trace-output.c
tracecmd/Makefile +0 -1
index bcd437a..6968f83 100644
@@ -29,7 +29,6 @@ TRACE_CMD_OBJS += trace-restore.o
 TRACE_CMD_OBJS += trace-check-events.o
 TRACE_CMD_OBJS += trace-show.o
 TRACE_CMD_OBJS += trace-list.o
-TRACE_CMD_OBJS += trace-output.o
 TRACE_CMD_OBJS += trace-usage.o
 TRACE_CMD_OBJS += trace-msg.o