linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] trace-cmd: Clean up python plugin warnings
@ 2019-07-09 14:26 Tzvetomir Stoyanov (VMware)
  2019-07-09 15:38 ` Steven Rostedt
  0 siblings, 1 reply; 2+ messages in thread
From: Tzvetomir Stoyanov (VMware) @ 2019-07-09 14:26 UTC (permalink / raw)
  To: rostedt; +Cc: linux-trace-devel

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.

Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
---
 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%)

diff --git a/include/trace-cmd/trace-cmd.h b/include/trace-cmd/trace-cmd.h
index 6f62ab9..1f2f5bf 100644
--- a/include/trace-cmd/trace-cmd.h
+++ b/include/trace-cmd/trace-cmd.h
@@ -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);
diff --git a/lib/trace-cmd/Makefile b/lib/trace-cmd/Makefile
index 44c1332..9086eb6 100644
--- a/lib/trace-cmd/Makefile
+++ b/lib/trace-cmd/Makefile
@@ -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
diff --git a/tracecmd/trace-output.c b/lib/trace-cmd/trace-output.c
similarity index 100%
rename from tracecmd/trace-output.c
rename to lib/trace-cmd/trace-output.c
diff --git a/tracecmd/Makefile b/tracecmd/Makefile
index bcd437a..6968f83 100644
--- a/tracecmd/Makefile
+++ b/tracecmd/Makefile
@@ -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
 
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] trace-cmd: Clean up python plugin warnings
  2019-07-09 14:26 [PATCH] trace-cmd: Clean up python plugin warnings Tzvetomir Stoyanov (VMware)
@ 2019-07-09 15:38 ` Steven Rostedt
  0 siblings, 0 replies; 2+ messages in thread
From: Steven Rostedt @ 2019-07-09 15:38 UTC (permalink / raw)
  To: Tzvetomir Stoyanov (VMware); +Cc: linux-trace-devel

On Tue,  9 Jul 2019 17:26:00 +0300
"Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com> 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


> 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.
> 
> Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
> ---
>  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%)
> 
> diff --git a/include/trace-cmd/trace-cmd.h b/include/trace-cmd/trace-cmd.h
> index 6f62ab9..1f2f5bf 100644
> --- a/include/trace-cmd/trace-cmd.h
> +++ b/include/trace-cmd/trace-cmd.h
> @@ -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);
> diff --git a/lib/trace-cmd/Makefile b/lib/trace-cmd/Makefile
> index 44c1332..9086eb6 100644
> --- a/lib/trace-cmd/Makefile
> +++ b/lib/trace-cmd/Makefile
> @@ -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
> diff --git a/tracecmd/trace-output.c b/lib/trace-cmd/trace-output.c
> similarity index 100%
> rename from tracecmd/trace-output.c
> rename to lib/trace-cmd/trace-output.c
> diff --git a/tracecmd/Makefile b/tracecmd/Makefile
> index bcd437a..6968f83 100644
> --- a/tracecmd/Makefile
> +++ b/tracecmd/Makefile
> @@ -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
>  


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-07-09 15:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-09 14:26 [PATCH] trace-cmd: Clean up python plugin warnings Tzvetomir Stoyanov (VMware)
2019-07-09 15:38 ` Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).