From patchwork Wed Dec 20 18:07:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vladislav Valtchev (VMware)" X-Patchwork-Id: 10758357 Return-Path: linux-trace-devel-owner@vger.kernel.org Received: from mail-wr0-f196.google.com ([209.85.128.196]:44484 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755624AbdLTSIB (ORCPT ); Wed, 20 Dec 2017 13:08:01 -0500 From: "Vladislav Valtchev (VMware)" To: rostedt@goodmis.org Cc: y.karadz@gmail.com, linux-trace-devel@vger.kernel.org, linux-kernel@vger.kernel.org, "Vladislav Valtchev (VMware)" Subject: [PATCH 01/18] trace-cmd: Rename libparsevent to libtraceevent Date: Wed, 20 Dec 2017 20:07:31 +0200 Message-Id: <20171220180748.17273-2-vladislav.valtchev@gmail.com> In-Reply-To: <20171220180748.17273-1-vladislav.valtchev@gmail.com> References: <20171220180748.17273-1-vladislav.valtchev@gmail.com> Sender: linux-trace-devel-owner@vger.kernel.org List-ID: Content-Length: 2480 This simple patch renames libparsevent to libtraceevent in order to trace-cmd to be consistent with the kernel. Signed-off-by: Vladislav Valtchev (VMware) --- Makefile | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index b7bb3cc..bd2d844 100644 --- a/Makefile +++ b/Makefile @@ -350,8 +350,8 @@ TRACE_GRAPH_MAIN_OBJS = trace-graph-main.o $(TRACE_GRAPH_OBJS) $(TRACE_GUI_OBJS) KERNEL_SHARK_OBJS = $(TRACE_VIEW_OBJS) $(TRACE_GRAPH_OBJS) $(TRACE_GUI_OBJS) \ trace-capture.o kernel-shark.o -PEVENT_LIB_OBJS = event-parse.o trace-seq.o parse-filter.o parse-utils.o str_error_r.o -TCMD_LIB_OBJS = $(PEVENT_LIB_OBJS) trace-util.o trace-input.o trace-ftrace.o \ +TRACEEVENT_LIB_OBJS = event-parse.o trace-seq.o parse-filter.o parse-utils.o str_error_r.o +TCMD_LIB_OBJS = $(TRACEEVENT_LIB_OBJS) trace-util.o trace-input.o trace-ftrace.o \ trace-output.o trace-recorder.o \ trace-usage.o trace-blk-hack.o \ kbuffer-parse.o event-plugin.o trace-hooks.o \ @@ -376,7 +376,7 @@ PLUGINS := $(PLUGIN_OBJS:.o=.so) ALL_OBJS = $(TRACE_CMD_OBJS) $(KERNEL_SHARK_OBJS) $(TRACE_VIEW_MAIN_OBJS) \ $(TRACE_GRAPH_MAIN_OBJS) $(TCMD_LIB_OBJS) $(PLUGIN_OBJS) -CMD_TARGETS = trace_plugin_dir trace_python_dir tc_version.h libparsevent.a $(LIB_FILE) \ +CMD_TARGETS = trace_plugin_dir trace_python_dir tc_version.h libtraceevent.a $(LIB_FILE) \ trace-cmd $(PLUGINS) $(BUILD_PYTHON) GUI_TARGETS = ks_version.h trace-graph trace-view kernelshark @@ -422,10 +422,10 @@ kernelshark: libtracecmd.a trace-view: libtracecmd.a trace-graph: libtracecmd.a -libparsevent.so: $(PEVENT_LIB_OBJS) +libtraceevent.so: $(TRACEEVENT_LIB_OBJS) $(Q)$(do_compile_shared_library) -libparsevent.a: $(PEVENT_LIB_OBJS) +libtraceevent.a: $(TRACEEVENT_LIB_OBJS) $(Q)$(do_build_static_lib) $(TCMD_LIB_OBJS): %.o: $(src)/%.c @@ -437,7 +437,7 @@ libtracecmd.so: $(TCMD_LIB_OBJS) libtracecmd.a: $(TCMD_LIB_OBJS) $(Q)$(do_build_static_lib) -libs: libtracecmd.so libparsevent.so +libs: libtracecmd.so libtraceevent.so trace-util.o: trace_plugin_dir @@ -603,7 +603,7 @@ install_gui: install_cmd gui install_libs: libs $(Q)$(call do_install,libtracecmd.so,$(libdir_SQ)) - $(Q)$(call do_install,libparsevent.so,$(libdir_SQ)) + $(Q)$(call do_install,libtraceevent.so,$(libdir_SQ)) $(Q)$(call do_install,event-parse.h,$(includedir_SQ)) $(Q)$(call do_install,trace-cmd.h,$(includedir_SQ)) From patchwork Wed Dec 20 18:07:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vladislav Valtchev (VMware)" X-Patchwork-Id: 10758359 Return-Path: linux-trace-devel-owner@vger.kernel.org Received: from mail-wr0-f195.google.com ([209.85.128.195]:44485 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755874AbdLTSID (ORCPT ); Wed, 20 Dec 2017 13:08:03 -0500 From: "Vladislav Valtchev (VMware)" To: rostedt@goodmis.org Cc: y.karadz@gmail.com, linux-trace-devel@vger.kernel.org, linux-kernel@vger.kernel.org, "Vladislav Valtchev (VMware)" Subject: [PATCH 02/18] trace-cmd: Move libtraceevent headers in include/traceevent Date: Wed, 20 Dec 2017 20:07:32 +0200 Message-Id: <20171220180748.17273-3-vladislav.valtchev@gmail.com> In-Reply-To: <20171220180748.17273-1-vladislav.valtchev@gmail.com> References: <20171220180748.17273-1-vladislav.valtchev@gmail.com> Sender: linux-trace-devel-owner@vger.kernel.org List-ID: Content-Length: 2173 This patch moves event-parse.h and kbuffer.h in include/traceevent as part of a bigger restructuring plan of trace-cmd's code base. In this case, the new directory will be the "public headers" directory of the traceevent library. Signed-off-by: Vladislav Valtchev (VMware) --- Makefile | 5 +++-- event-parse.h => include/traceevent/event-parse.h | 0 kbuffer.h => include/traceevent/kbuffer.h | 0 3 files changed, 3 insertions(+), 2 deletions(-) rename event-parse.h => include/traceevent/event-parse.h (100%) rename kbuffer.h => include/traceevent/kbuffer.h (100%) diff --git a/Makefile b/Makefile index bd2d844..a5aea70 100644 --- a/Makefile +++ b/Makefile @@ -237,6 +237,7 @@ TRACECMD_VERSION = $(TC_VERSION).$(TC_PATCHLEVEL).$(TC_EXTRAVERSION) KERNELSHARK_VERSION = $(KS_VERSION).$(KS_PATCHLEVEL).$(KS_EXTRAVERSION) INCLUDES = -I. -I ./include -I $(srctree)/../../include $(CONFIG_INCLUDES) +INCLUDES += -I$(src)/include/traceevent include $(src)/features.mk @@ -604,7 +605,7 @@ install_gui: install_cmd gui install_libs: libs $(Q)$(call do_install,libtracecmd.so,$(libdir_SQ)) $(Q)$(call do_install,libtraceevent.so,$(libdir_SQ)) - $(Q)$(call do_install,event-parse.h,$(includedir_SQ)) + $(Q)$(call do_install,$(src)/include/traceevent/event-parse.h,$(includedir_SQ)) $(Q)$(call do_install,trace-cmd.h,$(includedir_SQ)) doc: @@ -634,7 +635,7 @@ PYTHON_LDFLAGS = `pkg-config --libs $(PYTHON_VERS)` \ PYGTK_CFLAGS = `pkg-config --cflags pygtk-2.0` ctracecmd.so: $(TCMD_LIB_OBJS) ctracecmd.i - swig -Wall -python -noproxy ctracecmd.i + swig -Wall -python -noproxy -I$(src)/include/traceevent ctracecmd.i $(CC) -fpic -c $(CPPFLAGS) $(CFLAGS) $(PYTHON_INCLUDES) ctracecmd_wrap.c $(CC) --shared $(TCMD_LIB_OBJS) $(LDFLAGS) ctracecmd_wrap.o -o ctracecmd.so diff --git a/event-parse.h b/include/traceevent/event-parse.h similarity index 100% rename from event-parse.h rename to include/traceevent/event-parse.h diff --git a/kbuffer.h b/include/traceevent/kbuffer.h similarity index 100% rename from kbuffer.h rename to include/traceevent/kbuffer.h From patchwork Wed Dec 20 18:07:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vladislav Valtchev (VMware)" X-Patchwork-Id: 10758355 Return-Path: linux-trace-devel-owner@vger.kernel.org Received: from mail-wm0-f65.google.com ([74.125.82.65]:33637 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932075AbdLTSIE (ORCPT ); Wed, 20 Dec 2017 13:08:04 -0500 From: "Vladislav Valtchev (VMware)" To: rostedt@goodmis.org Cc: y.karadz@gmail.com, linux-trace-devel@vger.kernel.org, linux-kernel@vger.kernel.org, "Vladislav Valtchev (VMware)" Subject: [PATCH 03/18] trace-cmd: Move trace-cmd headers in include/trace-cmd Date: Wed, 20 Dec 2017 20:07:33 +0200 Message-Id: <20171220180748.17273-4-vladislav.valtchev@gmail.com> In-Reply-To: <20171220180748.17273-1-vladislav.valtchev@gmail.com> References: <20171220180748.17273-1-vladislav.valtchev@gmail.com> Sender: linux-trace-devel-owner@vger.kernel.org List-ID: Content-Length: 2219 This patch moves trace-cmd.h and trace-hash.h in include/trace-cmd as part of a bigger restructuring plan of trace-cmd's code base. In this case, the new directory will be the "public headers" directory of the trace-cmd library. Signed-off-by: Vladislav Valtchev (VMware) --- Makefile | 5 +++-- trace-cmd.h => include/trace-cmd/trace-cmd.h | 0 trace-hash.h => include/trace-cmd/trace-hash.h | 0 3 files changed, 3 insertions(+), 2 deletions(-) rename trace-cmd.h => include/trace-cmd/trace-cmd.h (100%) rename trace-hash.h => include/trace-cmd/trace-hash.h (100%) diff --git a/Makefile b/Makefile index a5aea70..b2728c1 100644 --- a/Makefile +++ b/Makefile @@ -238,6 +238,7 @@ KERNELSHARK_VERSION = $(KS_VERSION).$(KS_PATCHLEVEL).$(KS_EXTRAVERSION) INCLUDES = -I. -I ./include -I $(srctree)/../../include $(CONFIG_INCLUDES) INCLUDES += -I$(src)/include/traceevent +INCLUDES += -I$(src)/include/trace-cmd include $(src)/features.mk @@ -606,7 +607,7 @@ install_libs: libs $(Q)$(call do_install,libtracecmd.so,$(libdir_SQ)) $(Q)$(call do_install,libtraceevent.so,$(libdir_SQ)) $(Q)$(call do_install,$(src)/include/traceevent/event-parse.h,$(includedir_SQ)) - $(Q)$(call do_install,trace-cmd.h,$(includedir_SQ)) + $(Q)$(call do_install,$(src)/include/trace-cmd/trace-cmd.h,$(includedir_SQ)) doc: $(MAKE) -C $(src)/Documentation all @@ -635,7 +636,7 @@ PYTHON_LDFLAGS = `pkg-config --libs $(PYTHON_VERS)` \ PYGTK_CFLAGS = `pkg-config --cflags pygtk-2.0` ctracecmd.so: $(TCMD_LIB_OBJS) ctracecmd.i - swig -Wall -python -noproxy -I$(src)/include/traceevent ctracecmd.i + swig -Wall -python -noproxy -I$(src)/include/traceevent -I$(src)/include/trace-cmd ctracecmd.i $(CC) -fpic -c $(CPPFLAGS) $(CFLAGS) $(PYTHON_INCLUDES) ctracecmd_wrap.c $(CC) --shared $(TCMD_LIB_OBJS) $(LDFLAGS) ctracecmd_wrap.o -o ctracecmd.so diff --git a/trace-cmd.h b/include/trace-cmd/trace-cmd.h similarity index 100% rename from trace-cmd.h rename to include/trace-cmd/trace-cmd.h diff --git a/trace-hash.h b/include/trace-cmd/trace-hash.h similarity index 100% rename from trace-hash.h rename to include/trace-cmd/trace-hash.h From patchwork Wed Dec 20 18:07:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vladislav Valtchev (VMware)" X-Patchwork-Id: 10758349 Return-Path: linux-trace-devel-owner@vger.kernel.org Received: from mail-wm0-f65.google.com ([74.125.82.65]:39702 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932097AbdLTSIF (ORCPT ); Wed, 20 Dec 2017 13:08:05 -0500 From: "Vladislav Valtchev (VMware)" To: rostedt@goodmis.org Cc: y.karadz@gmail.com, linux-trace-devel@vger.kernel.org, linux-kernel@vger.kernel.org, "Vladislav Valtchev (VMware)" Subject: [PATCH 04/18] trace-cmd: Move event-utils.h in lib/traceevent/include Date: Wed, 20 Dec 2017 20:07:34 +0200 Message-Id: <20171220180748.17273-5-vladislav.valtchev@gmail.com> In-Reply-To: <20171220180748.17273-1-vladislav.valtchev@gmail.com> References: <20171220180748.17273-1-vladislav.valtchev@gmail.com> Sender: linux-trace-devel-owner@vger.kernel.org List-ID: Content-Length: 1203 This patch moves event-utils.h in lib/traceevent/include as part of a bigger restructuring plan of trace-cmd's code base. In this case event-utils.h has been moved into the private headers directory the traceevent library. In the next steps, the source files of the traceevent lib will be moved there as well. Signed-off-by: Vladislav Valtchev (VMware) --- Makefile | 1 + event-utils.h => lib/traceevent/include/event-utils.h | 0 2 files changed, 1 insertion(+) rename event-utils.h => lib/traceevent/include/event-utils.h (100%) diff --git a/Makefile b/Makefile index b2728c1..6d45870 100644 --- a/Makefile +++ b/Makefile @@ -239,6 +239,7 @@ KERNELSHARK_VERSION = $(KS_VERSION).$(KS_PATCHLEVEL).$(KS_EXTRAVERSION) INCLUDES = -I. -I ./include -I $(srctree)/../../include $(CONFIG_INCLUDES) INCLUDES += -I$(src)/include/traceevent INCLUDES += -I$(src)/include/trace-cmd +INCLUDES += -I$(src)/lib/traceevent/include include $(src)/features.mk diff --git a/event-utils.h b/lib/traceevent/include/event-utils.h similarity index 100% rename from event-utils.h rename to lib/traceevent/include/event-utils.h From patchwork Wed Dec 20 18:07:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vladislav Valtchev (VMware)" X-Patchwork-Id: 10758325 Return-Path: linux-trace-devel-owner@vger.kernel.org Received: from mail-wm0-f66.google.com ([74.125.82.66]:35200 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932239AbdLTSIG (ORCPT ); Wed, 20 Dec 2017 13:08:06 -0500 From: "Vladislav Valtchev (VMware)" To: rostedt@goodmis.org Cc: y.karadz@gmail.com, linux-trace-devel@vger.kernel.org, linux-kernel@vger.kernel.org, "Vladislav Valtchev (VMware)" Subject: [PATCH 05/18] trace-cmd: Extract part of Makefile in scripts/utils.mk Date: Wed, 20 Dec 2017 20:07:35 +0200 Message-Id: <20171220180748.17273-6-vladislav.valtchev@gmail.com> In-Reply-To: <20171220180748.17273-1-vladislav.valtchev@gmail.com> References: <20171220180748.17273-1-vladislav.valtchev@gmail.com> Sender: linux-trace-devel-owner@vger.kernel.org List-ID: Content-Length: 4796 This patch extracts useful functions for Makefile in order to allow the new Makefiles that will be introduced in the next steps to reuse them. Signed-off-by: Vladislav Valtchev (VMware) --- Makefile | 57 +++---------------------------------------------- scripts/utils.mk | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+), 54 deletions(-) create mode 100644 scripts/utils.mk diff --git a/Makefile b/Makefile index 6d45870..6f502e7 100644 --- a/Makefile +++ b/Makefile @@ -203,10 +203,6 @@ VERSION = $(KS_VERSION) PATCHLEVEL = $(KS_PATCHLEVEL) EXTRAVERSION = $(KS_EXTRAVERSION) -GUI = 'GUI ' -GOBJ = $@ -GSPACE = - REBUILD_GUI = /bin/true G = N = @/bin/true || @@ -222,10 +218,6 @@ VERSION = $(TC_VERSION) PATCHLEVEL = $(TC_PATCHLEVEL) EXTRAVERSION = $(TC_EXTRAVERSION) -GUI = -GSPACE = " " -GOBJ = $(GSPACE)$@ - REBUILD_GUI = $(MAKE) -f $(src)/Makefile BUILDGUI=1 $@ G = $(REBUILD_GUI); /bin/true || N = @@ -233,6 +225,9 @@ endif export Q VERBOSE +# Include the utils +include scripts/utils.mk + TRACECMD_VERSION = $(TC_VERSION).$(TC_PATCHLEVEL).$(TC_EXTRAVERSION) KERNELSHARK_VERSION = $(KS_VERSION).$(KS_PATCHLEVEL).$(KS_EXTRAVERSION) @@ -279,52 +274,6 @@ endif override CFLAGS += $(CONFIG_FLAGS) $(INCLUDES) $(PLUGIN_DIR_SQ) $(VAR_DIR) override CFLAGS += $(udis86-flags) $(blk-flags) -ifeq ($(VERBOSE),1) - Q = - print_compile = - print_app_build = - print_fpic_compile = - print_shared_lib_compile = - print_plugin_obj_compile = - print_plugin_build = - print_install = -else - Q = @ - print_compile = echo ' $(GUI)COMPILE '$(GOBJ); - print_app_build = echo ' $(GUI)BUILD '$(GOBJ); - print_fpic_compile = echo ' $(GUI)COMPILE FPIC '$(GOBJ); - print_shared_lib_compile = echo ' $(GUI)COMPILE SHARED LIB '$(GOBJ); - print_plugin_obj_compile = echo ' $(GUI)COMPILE PLUGIN OBJ '$(GOBJ); - print_plugin_build = echo ' $(GUI)BUILD PLUGIN '$(GOBJ); - print_static_lib_build = echo ' $(GUI)BUILD STATIC LIB '$(GOBJ); - print_install = echo ' $(GUI)INSTALL '$(GSPACE)$1' to $(DESTDIR_SQ)$2'; -endif - -do_fpic_compile = \ - ($(print_fpic_compile) \ - $(CC) -c $(CPPFLAGS) $(CFLAGS) $(EXT) -fPIC $< -o $@) - -do_app_build = \ - ($(print_app_build) \ - $(CC) $^ -rdynamic -o $@ $(LDFLAGS) $(CONFIG_LIBS) $(LIBS)) - -do_compile_shared_library = \ - ($(print_shared_lib_compile) \ - $(CC) --shared $^ -o $@) - -do_compile_plugin_obj = \ - ($(print_plugin_obj_compile) \ - $(CC) -c $(CPPFLAGS) $(CFLAGS) -fPIC -o $@ $<) - -do_plugin_build = \ - ($(print_plugin_build) \ - $(CC) $(CFLAGS) $(LDFLAGS) -shared -nostartfiles -o $@ $<) - -do_build_static_lib = \ - ($(print_static_lib_build) \ - $(RM) $@; $(AR) rcs $@ $^) - - define check_gui if [ $(BUILDGUI) -ne 1 -a ! -z "$(filter $(gui_objs),$(@))" ]; then \ $(REBUILD_GUI); \ diff --git a/scripts/utils.mk b/scripts/utils.mk new file mode 100644 index 0000000..39cb387 --- /dev/null +++ b/scripts/utils.mk @@ -0,0 +1,64 @@ + +# Utils + +ifeq ($(BUILDGUI), 1) + GUI = 'GUI ' + GOBJ = $@ + GSPACE = +else + GUI = + GSPACE = " " + GOBJ = $(GSPACE)$@ +endif + + +ifeq ($(VERBOSE),1) + Q = + print_compile = + print_app_build = + print_fpic_compile = + print_shared_lib_compile = + print_plugin_obj_compile = + print_plugin_build = + print_install = +else + Q = @ + print_compile = echo ' $(GUI)COMPILE '$(GOBJ); + print_app_build = echo ' $(GUI)BUILD '$(GOBJ); + print_fpic_compile = echo ' $(GUI)COMPILE FPIC '$(GOBJ); + print_shared_lib_compile = echo ' $(GUI)COMPILE SHARED LIB '$(GOBJ); + print_plugin_obj_compile = echo ' $(GUI)COMPILE PLUGIN OBJ '$(GOBJ); + print_plugin_build = echo ' $(GUI)BUILD PLUGIN '$(GOBJ); + print_static_lib_build = echo ' $(GUI)BUILD STATIC LIB '$(GOBJ); + print_install = echo ' $(GUI)INSTALL '$(GSPACE)$1' to $(DESTDIR_SQ)$2'; +endif + + +do_compile = \ + ($(print_compile) \ + $(CC) -c $(CPPFLAGS) $(CFLAGS) $(EXT) $< -o $@) + +do_fpic_compile = \ + ($(print_fpic_compile) \ + $(CC) -c $(CPPFLAGS) $(CFLAGS) $(EXT) -fPIC $< -o $@) + +do_app_build = \ + ($(print_app_build) \ + $(CC) $^ -rdynamic -o $@ $(LDFLAGS) $(CONFIG_LIBS) $(LIBS)) + +do_build_static_lib = \ + ($(print_static_lib_build) \ + $(RM) $@; $(AR) rcs $@ $^) + +do_compile_shared_library = \ + ($(print_shared_lib_compile) \ + $(CC) --shared $^ -o $@) + +do_compile_plugin_obj = \ + ($(print_plugin_obj_compile) \ + $(CC) -c $(CPPFLAGS) $(CFLAGS) -fPIC -o $@ $<) + +do_plugin_build = \ + ($(print_plugin_build) \ + $(CC) $(CFLAGS) $(LDFLAGS) -shared -nostartfiles -o $@ $<) + From patchwork Wed Dec 20 18:07:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vladislav Valtchev (VMware)" X-Patchwork-Id: 10758353 Return-Path: linux-trace-devel-owner@vger.kernel.org Received: from mail-wm0-f66.google.com ([74.125.82.66]:45337 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755687AbdLTSIH (ORCPT ); Wed, 20 Dec 2017 13:08:07 -0500 From: "Vladislav Valtchev (VMware)" To: rostedt@goodmis.org Cc: y.karadz@gmail.com, linux-trace-devel@vger.kernel.org, linux-kernel@vger.kernel.org, "Vladislav Valtchev (VMware)" Subject: [PATCH 06/18] trace-cmd: Move libtraceevent *.c files in lib/traceevent Date: Wed, 20 Dec 2017 20:07:36 +0200 Message-Id: <20171220180748.17273-7-vladislav.valtchev@gmail.com> In-Reply-To: <20171220180748.17273-1-vladislav.valtchev@gmail.com> References: <20171220180748.17273-1-vladislav.valtchev@gmail.com> Sender: linux-trace-devel-owner@vger.kernel.org List-ID: Content-Length: 7429 This patch moves all the files belonging to the traceevent lib in a dedicated directory. The build system has been updated to support this by introducing a Makefile in lib/traceevent and by making the parent Makefile to run it with the classic recursive make approach. Signed-off-by: Vladislav Valtchev (VMware) --- Makefile | 42 ++++++++++++--------- lib/traceevent/Makefile | 45 +++++++++++++++++++++++ event-parse.c => lib/traceevent/event-parse.c | 0 event-plugin.c => lib/traceevent/event-plugin.c | 0 kbuffer-parse.c => lib/traceevent/kbuffer-parse.c | 0 parse-filter.c => lib/traceevent/parse-filter.c | 0 parse-utils.c => lib/traceevent/parse-utils.c | 0 str_error_r.c => lib/traceevent/str_error_r.c | 0 trace-seq.c => lib/traceevent/trace-seq.c | 0 9 files changed, 70 insertions(+), 17 deletions(-) create mode 100644 lib/traceevent/Makefile rename event-parse.c => lib/traceevent/event-parse.c (100%) rename event-plugin.c => lib/traceevent/event-plugin.c (100%) rename kbuffer-parse.c => lib/traceevent/kbuffer-parse.c (100%) rename parse-filter.c => lib/traceevent/parse-filter.c (100%) rename parse-utils.c => lib/traceevent/parse-utils.c (100%) rename str_error_r.c => lib/traceevent/str_error_r.c (100%) rename trace-seq.c => lib/traceevent/trace-seq.c (100%) diff --git a/Makefile b/Makefile index 6f502e7..646ff2d 100644 --- a/Makefile +++ b/Makefile @@ -180,7 +180,11 @@ bindir_relative_SQ = $(subst ','\'',$(bindir_relative)) plugin_dir_SQ = $(subst ','\'',$(plugin_dir)) python_dir_SQ = $(subst ','\'',$(python_dir)) -LIBS = -L. -ltracecmd -ldl +LIBS = -L. -ldl +LIBTRACEEVENT_DIR = $(obj)/lib/traceevent +LIBTRACEEVENT_STATIC = $(LIBTRACEEVENT_DIR)/libtraceevent.a +LIBTRACEEVENT_SHARED = $(LIBTRACEEVENT_DIR)/libtraceevent.so + LIB_FILE = libtracecmd.a PACKAGES= gtk+-2.0 libxml-2.0 gthread-2.0 @@ -231,7 +235,7 @@ include scripts/utils.mk TRACECMD_VERSION = $(TC_VERSION).$(TC_PATCHLEVEL).$(TC_EXTRAVERSION) KERNELSHARK_VERSION = $(KS_VERSION).$(KS_PATCHLEVEL).$(KS_EXTRAVERSION) -INCLUDES = -I. -I ./include -I $(srctree)/../../include $(CONFIG_INCLUDES) +INCLUDES = -I$(src) -I $(src)/include -I $(srctree)/../../include $(CONFIG_INCLUDES) INCLUDES += -I$(src)/include/traceevent INCLUDES += -I$(src)/include/trace-cmd INCLUDES += -I$(src)/lib/traceevent/include @@ -243,6 +247,8 @@ CFLAGS ?= -g -Wall CPPFLAGS ?= LDFLAGS ?= +export CFLAGS + # Required CFLAGS override CFLAGS += -D_GNU_SOURCE @@ -302,12 +308,10 @@ TRACE_GRAPH_MAIN_OBJS = trace-graph-main.o $(TRACE_GRAPH_OBJS) $(TRACE_GUI_OBJS) KERNEL_SHARK_OBJS = $(TRACE_VIEW_OBJS) $(TRACE_GRAPH_OBJS) $(TRACE_GUI_OBJS) \ trace-capture.o kernel-shark.o -TRACEEVENT_LIB_OBJS = event-parse.o trace-seq.o parse-filter.o parse-utils.o str_error_r.o -TCMD_LIB_OBJS = $(TRACEEVENT_LIB_OBJS) trace-util.o trace-input.o trace-ftrace.o \ +TCMD_LIB_OBJS = trace-util.o trace-input.o trace-ftrace.o \ trace-output.o trace-recorder.o \ trace-usage.o trace-blk-hack.o \ - kbuffer-parse.o event-plugin.o trace-hooks.o \ - trace-msg.o + trace-hooks.o trace-msg.o PLUGIN_OBJS = PLUGIN_OBJS += plugin_jbd2.o @@ -328,7 +332,7 @@ PLUGINS := $(PLUGIN_OBJS:.o=.so) ALL_OBJS = $(TRACE_CMD_OBJS) $(KERNEL_SHARK_OBJS) $(TRACE_VIEW_MAIN_OBJS) \ $(TRACE_GRAPH_MAIN_OBJS) $(TCMD_LIB_OBJS) $(PLUGIN_OBJS) -CMD_TARGETS = trace_plugin_dir trace_python_dir tc_version.h libtraceevent.a $(LIB_FILE) \ +CMD_TARGETS = trace_plugin_dir trace_python_dir tc_version.h $(LIB_FILE) \ trace-cmd $(PLUGINS) $(BUILD_PYTHON) GUI_TARGETS = ks_version.h trace-graph trace-view kernelshark @@ -369,16 +373,19 @@ trace-view: $(TRACE_VIEW_MAIN_OBJS) trace-graph: $(TRACE_GRAPH_MAIN_OBJS) $(Q)$(G)$(do_app_build) -trace-cmd: libtracecmd.a -kernelshark: libtracecmd.a -trace-view: libtracecmd.a -trace-graph: libtracecmd.a +trace-cmd: libtracecmd.a $(LIBTRACEEVENT_STATIC) +kernelshark: libtracecmd.a $(LIBTRACEEVENT_STATIC) +trace-view: libtracecmd.a $(LIBTRACEEVENT_STATIC) +trace-graph: libtracecmd.a $(LIBTRACEEVENT_STATIC) -libtraceevent.so: $(TRACEEVENT_LIB_OBJS) - $(Q)$(do_compile_shared_library) +$(LIBTRACEEVENT_SHARED): force + $(Q)$(MAKE) -C $(src)/lib/traceevent libtraceevent.so -libtraceevent.a: $(TRACEEVENT_LIB_OBJS) - $(Q)$(do_build_static_lib) +$(LIBTRACEEVENT_STATIC): force + $(Q)$(MAKE) -C $(src)/lib/traceevent libtraceevent.a + +libtraceevent.so: $(LIBTRACEEVENT_SHARED) +libtraceevent.a: $(LIBTRACEEVENT_STATIC) $(TCMD_LIB_OBJS): %.o: $(src)/%.c $(Q)$(do_fpic_compile) @@ -389,7 +396,7 @@ libtracecmd.so: $(TCMD_LIB_OBJS) libtracecmd.a: $(TCMD_LIB_OBJS) $(Q)$(do_build_static_lib) -libs: libtracecmd.so libtraceevent.so +libs: libtracecmd.so $(LIBTRACEEVENT_SHARED) trace-util.o: trace_plugin_dir @@ -555,7 +562,7 @@ install_gui: install_cmd gui install_libs: libs $(Q)$(call do_install,libtracecmd.so,$(libdir_SQ)) - $(Q)$(call do_install,libtraceevent.so,$(libdir_SQ)) + $(Q)$(call do_install,$(LIBTRACEEVENT_SHARED),$(libdir_SQ)) $(Q)$(call do_install,$(src)/include/traceevent/event-parse.h,$(includedir_SQ)) $(Q)$(call do_install,$(src)/include/trace-cmd/trace-cmd.h,$(includedir_SQ)) @@ -571,6 +578,7 @@ install_doc: clean: $(RM) *.o *~ $(TARGETS) *.a *.so ctracecmd_wrap.c .*.d $(RM) tags TAGS cscope* + $(MAKE) -C $(src)/lib/traceevent clean ##### PYTHON STUFF ##### diff --git a/lib/traceevent/Makefile b/lib/traceevent/Makefile new file mode 100644 index 0000000..f9c595c --- /dev/null +++ b/lib/traceevent/Makefile @@ -0,0 +1,45 @@ + + +include $(src)/scripts/utils.mk + +DEFAULT_TARGET = libtraceevent.a + +OBJS = +OBJS += event-parse.o +OBJS += event-plugin.o +OBJS += kbuffer-parse.o +OBJS += trace-seq.o +OBJS += parse-filter.o +OBJS += parse-utils.o + +# Additional util objects +OBJS += str_error_r.o + +DEPS := $(OBJS:%.o=.%.d) + +all: $(DEFAULT_TARGET) + +libtraceevent.a: $(OBJS) + $(Q)$(call do_build_static_lib) + +libtraceevent.so: $(OBJS) + $(Q)$(call do_compile_shared_library) + +%.o: %.c + $(Q)$(call do_fpic_compile) + +$(DEPS): .%.d: %.c + $(Q)$(CC) -M $(CPPFLAGS) $(CFLAGS) $< > $@ + +$(OBJS): %.o : .%.d + +dep_includes := $(wildcard $(DEPS)) + +ifneq ($(dep_includes),) + include $(dep_includes) +endif + +clean: + $(RM) *.a *.so *.o .*.d + +.PHONY: clean diff --git a/event-parse.c b/lib/traceevent/event-parse.c similarity index 100% rename from event-parse.c rename to lib/traceevent/event-parse.c diff --git a/event-plugin.c b/lib/traceevent/event-plugin.c similarity index 100% rename from event-plugin.c rename to lib/traceevent/event-plugin.c diff --git a/kbuffer-parse.c b/lib/traceevent/kbuffer-parse.c similarity index 100% rename from kbuffer-parse.c rename to lib/traceevent/kbuffer-parse.c diff --git a/parse-filter.c b/lib/traceevent/parse-filter.c similarity index 100% rename from parse-filter.c rename to lib/traceevent/parse-filter.c diff --git a/parse-utils.c b/lib/traceevent/parse-utils.c similarity index 100% rename from parse-utils.c rename to lib/traceevent/parse-utils.c diff --git a/str_error_r.c b/lib/traceevent/str_error_r.c similarity index 100% rename from str_error_r.c rename to lib/traceevent/str_error_r.c diff --git a/trace-seq.c b/lib/traceevent/trace-seq.c similarity index 100% rename from trace-seq.c rename to lib/traceevent/trace-seq.c From patchwork Wed Dec 20 18:07:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vladislav Valtchev (VMware)" X-Patchwork-Id: 10758351 Return-Path: linux-trace-devel-owner@vger.kernel.org Received: from mail-wm0-f68.google.com ([74.125.82.68]:33650 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755415AbdLTSIJ (ORCPT ); Wed, 20 Dec 2017 13:08:09 -0500 From: "Vladislav Valtchev (VMware)" To: rostedt@goodmis.org Cc: y.karadz@gmail.com, linux-trace-devel@vger.kernel.org, linux-kernel@vger.kernel.org, "Vladislav Valtchev (VMware)" Subject: [PATCH 07/18] trace-cmd: Move trace-hash-local.h in lib/trace-cmd/include Date: Wed, 20 Dec 2017 20:07:37 +0200 Message-Id: <20171220180748.17273-8-vladislav.valtchev@gmail.com> In-Reply-To: <20171220180748.17273-1-vladislav.valtchev@gmail.com> References: <20171220180748.17273-1-vladislav.valtchev@gmail.com> Sender: linux-trace-devel-owner@vger.kernel.org List-ID: Content-Length: 1218 This patch moves trace-hash-local.h in lib/trace-cmd/include, as part of a bigger restructuring plan of trace-cmd's code base. In this case, the new directory in the "private headers" directory in the trace-cmd library. In the next step, the source files of that library will be moved in lib/trace-cmd. Signed-off-by: Vladislav Valtchev (VMware) --- Makefile | 1 + trace-hash-local.h => lib/trace-cmd/include/trace-hash-local.h | 0 2 files changed, 1 insertion(+) rename trace-hash-local.h => lib/trace-cmd/include/trace-hash-local.h (100%) diff --git a/Makefile b/Makefile index 646ff2d..a3cce82 100644 --- a/Makefile +++ b/Makefile @@ -239,6 +239,7 @@ INCLUDES = -I$(src) -I $(src)/include -I $(srctree)/../../include $(CONFIG_INCLU INCLUDES += -I$(src)/include/traceevent INCLUDES += -I$(src)/include/trace-cmd INCLUDES += -I$(src)/lib/traceevent/include +INCLUDES += -I$(src)/lib/trace-cmd/include include $(src)/features.mk diff --git a/trace-hash-local.h b/lib/trace-cmd/include/trace-hash-local.h similarity index 100% rename from trace-hash-local.h rename to lib/trace-cmd/include/trace-hash-local.h From patchwork Wed Dec 20 18:07:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vladislav Valtchev (VMware)" X-Patchwork-Id: 10758347 Return-Path: linux-trace-devel-owner@vger.kernel.org Received: from mail-wm0-f65.google.com ([74.125.82.65]:33650 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755946AbdLTSIK (ORCPT ); Wed, 20 Dec 2017 13:08:10 -0500 From: "Vladislav Valtchev (VMware)" To: rostedt@goodmis.org Cc: y.karadz@gmail.com, linux-trace-devel@vger.kernel.org, linux-kernel@vger.kernel.org, "Vladislav Valtchev (VMware)" Subject: [PATCH 08/18] trace-cmd: Move libtracecmd *.c files in lib/trace-cmd Date: Wed, 20 Dec 2017 20:07:38 +0200 Message-Id: <20171220180748.17273-9-vladislav.valtchev@gmail.com> In-Reply-To: <20171220180748.17273-1-vladislav.valtchev@gmail.com> References: <20171220180748.17273-1-vladislav.valtchev@gmail.com> Sender: linux-trace-devel-owner@vger.kernel.org List-ID: Content-Length: 8689 This patch moves all the source files belonging to the trace-cmd library into the dedicated directory lib/trace-cmd. The build system has been updated to support this new directory structure by adding a dedicated Makefile in lib/trace-cmd and by making the parent Makefile to invoke it. Signed-off-by: Vladislav Valtchev (VMware) --- Makefile | 54 ++++++++++------------ lib/trace-cmd/Makefile | 45 ++++++++++++++++++ trace-blk-hack.c => lib/trace-cmd/trace-blk-hack.c | 0 trace-ftrace.c => lib/trace-cmd/trace-ftrace.c | 0 trace-hash.c => lib/trace-cmd/trace-hash.c | 0 trace-hooks.c => lib/trace-cmd/trace-hooks.c | 0 trace-input.c => lib/trace-cmd/trace-input.c | 0 trace-recorder.c => lib/trace-cmd/trace-recorder.c | 0 trace-util.c => lib/trace-cmd/trace-util.c | 0 9 files changed, 70 insertions(+), 29 deletions(-) create mode 100644 lib/trace-cmd/Makefile rename trace-blk-hack.c => lib/trace-cmd/trace-blk-hack.c (100%) rename trace-ftrace.c => lib/trace-cmd/trace-ftrace.c (100%) rename trace-hash.c => lib/trace-cmd/trace-hash.c (100%) rename trace-hooks.c => lib/trace-cmd/trace-hooks.c (100%) rename trace-input.c => lib/trace-cmd/trace-input.c (100%) rename trace-recorder.c => lib/trace-cmd/trace-recorder.c (100%) rename trace-util.c => lib/trace-cmd/trace-util.c (100%) diff --git a/Makefile b/Makefile index a3cce82..8b34705 100644 --- a/Makefile +++ b/Makefile @@ -185,7 +185,9 @@ LIBTRACEEVENT_DIR = $(obj)/lib/traceevent LIBTRACEEVENT_STATIC = $(LIBTRACEEVENT_DIR)/libtraceevent.a LIBTRACEEVENT_SHARED = $(LIBTRACEEVENT_DIR)/libtraceevent.so -LIB_FILE = libtracecmd.a +LIBTRACECMD_DIR = $(obj)/lib/trace-cmd +LIBTRACECMD_STATIC = $(LIBTRACECMD_DIR)/libtracecmd.a +LIBTRACECMD_SHARED = $(LIBTRACECMD_DIR)/libtracecmd.so PACKAGES= gtk+-2.0 libxml-2.0 gthread-2.0 @@ -300,8 +302,9 @@ TRACE_GUI_OBJS = trace-filter.o trace-compat.o trace-filter-hash.o trace-dialog. trace-xml.o TRACE_CMD_OBJS = trace-cmd.o trace-record.o trace-read.o trace-split.o trace-listen.o \ trace-stack.o trace-hist.o trace-mem.o trace-snapshot.o trace-stat.o \ - trace-hash.o trace-profile.o trace-stream.o trace-record.o trace-restore.o \ - trace-check-events.o trace-show.o trace-list.o + trace-profile.o trace-stream.o trace-record.o trace-restore.o \ + trace-check-events.o trace-show.o trace-list.o \ + trace-output.o trace-usage.o trace-msg.o TRACE_VIEW_OBJS = trace-view.o trace-view-store.o TRACE_GRAPH_OBJS = trace-graph.o trace-plot.o trace-plot-cpu.o trace-plot-task.o TRACE_VIEW_MAIN_OBJS = trace-view-main.o $(TRACE_VIEW_OBJS) $(TRACE_GUI_OBJS) @@ -309,11 +312,6 @@ TRACE_GRAPH_MAIN_OBJS = trace-graph-main.o $(TRACE_GRAPH_OBJS) $(TRACE_GUI_OBJS) KERNEL_SHARK_OBJS = $(TRACE_VIEW_OBJS) $(TRACE_GRAPH_OBJS) $(TRACE_GUI_OBJS) \ trace-capture.o kernel-shark.o -TCMD_LIB_OBJS = trace-util.o trace-input.o trace-ftrace.o \ - trace-output.o trace-recorder.o \ - trace-usage.o trace-blk-hack.o \ - trace-hooks.o trace-msg.o - PLUGIN_OBJS = PLUGIN_OBJS += plugin_jbd2.o PLUGIN_OBJS += plugin_hrtimer.o @@ -331,9 +329,9 @@ PLUGIN_OBJS += plugin_tlb.o PLUGINS := $(PLUGIN_OBJS:.o=.so) ALL_OBJS = $(TRACE_CMD_OBJS) $(KERNEL_SHARK_OBJS) $(TRACE_VIEW_MAIN_OBJS) \ - $(TRACE_GRAPH_MAIN_OBJS) $(TCMD_LIB_OBJS) $(PLUGIN_OBJS) + $(TRACE_GRAPH_MAIN_OBJS) $(PLUGIN_OBJS) -CMD_TARGETS = trace_plugin_dir trace_python_dir tc_version.h $(LIB_FILE) \ +CMD_TARGETS = trace_plugin_dir trace_python_dir tc_version.h \ trace-cmd $(PLUGINS) $(BUILD_PYTHON) GUI_TARGETS = ks_version.h trace-graph trace-view kernelshark @@ -374,10 +372,10 @@ trace-view: $(TRACE_VIEW_MAIN_OBJS) trace-graph: $(TRACE_GRAPH_MAIN_OBJS) $(Q)$(G)$(do_app_build) -trace-cmd: libtracecmd.a $(LIBTRACEEVENT_STATIC) -kernelshark: libtracecmd.a $(LIBTRACEEVENT_STATIC) -trace-view: libtracecmd.a $(LIBTRACEEVENT_STATIC) -trace-graph: libtracecmd.a $(LIBTRACEEVENT_STATIC) +trace-cmd: $(LIBTRACECMD_STATIC) $(LIBTRACEEVENT_STATIC) +kernelshark: $(LIBTRACECMD_STATIC) $(LIBTRACEEVENT_STATIC) +trace-view: $(LIBTRACECMD_STATIC) $(LIBTRACEEVENT_STATIC) +trace-graph: $(LIBTRACECMD_STATIC) $(LIBTRACEEVENT_STATIC) $(LIBTRACEEVENT_SHARED): force $(Q)$(MAKE) -C $(src)/lib/traceevent libtraceevent.so @@ -385,21 +383,18 @@ $(LIBTRACEEVENT_SHARED): force $(LIBTRACEEVENT_STATIC): force $(Q)$(MAKE) -C $(src)/lib/traceevent libtraceevent.a +$(LIBTRACECMD_STATIC): force trace_plugin_dir + $(Q)$(MAKE) -C $(src)/lib/trace-cmd libtracecmd.a + +$(LIBTRACECMD_SHARED): force trace_plugin_dir + $(Q)$(MAKE) -C $(src)/lib/trace-cmd libtracecmd.so + libtraceevent.so: $(LIBTRACEEVENT_SHARED) libtraceevent.a: $(LIBTRACEEVENT_STATIC) +libtracecmd.a: $(LIBTRACECMD_STATIC) +libtracecmd.so: $(LIBTRACECMD_SHARED) -$(TCMD_LIB_OBJS): %.o: $(src)/%.c - $(Q)$(do_fpic_compile) - -libtracecmd.so: $(TCMD_LIB_OBJS) - $(Q)$(do_compile_shared_library) - -libtracecmd.a: $(TCMD_LIB_OBJS) - $(Q)$(do_build_static_lib) - -libs: libtracecmd.so $(LIBTRACEEVENT_SHARED) - -trace-util.o: trace_plugin_dir +libs: $(LIBTRACECMD_SHARED) $(LIBTRACEEVENT_SHARED) $(PLUGIN_OBJS): %.o : $(src)/%.c $(Q)$(do_compile_plugin_obj) @@ -562,7 +557,7 @@ install_gui: install_cmd gui $(Q)$(call do_install,kernelshark,$(bindir_SQ)) install_libs: libs - $(Q)$(call do_install,libtracecmd.so,$(libdir_SQ)) + $(Q)$(call do_install,$(LIBTRACECMD_SHARED),$(libdir_SQ)) $(Q)$(call do_install,$(LIBTRACEEVENT_SHARED),$(libdir_SQ)) $(Q)$(call do_install,$(src)/include/traceevent/event-parse.h,$(includedir_SQ)) $(Q)$(call do_install,$(src)/include/trace-cmd/trace-cmd.h,$(includedir_SQ)) @@ -580,6 +575,7 @@ clean: $(RM) *.o *~ $(TARGETS) *.a *.so ctracecmd_wrap.c .*.d $(RM) tags TAGS cscope* $(MAKE) -C $(src)/lib/traceevent clean + $(MAKE) -C $(src)/lib/trace-cmd clean ##### PYTHON STUFF ##### @@ -597,9 +593,9 @@ PYGTK_CFLAGS = `pkg-config --cflags pygtk-2.0` ctracecmd.so: $(TCMD_LIB_OBJS) ctracecmd.i swig -Wall -python -noproxy -I$(src)/include/traceevent -I$(src)/include/trace-cmd ctracecmd.i $(CC) -fpic -c $(CPPFLAGS) $(CFLAGS) $(PYTHON_INCLUDES) ctracecmd_wrap.c - $(CC) --shared $(TCMD_LIB_OBJS) $(LDFLAGS) ctracecmd_wrap.o -o ctracecmd.so + $(CC) --shared $(LIBTRACECMD_STATIC) $(LDFLAGS) ctracecmd_wrap.o -o ctracecmd.so -ctracecmdgui.so: $(TRACE_VIEW_OBJS) $(LIB_FILE) +ctracecmdgui.so: $(TRACE_VIEW_OBJS) $(LIBTRACECMD_STATIC) swig -Wall -python -noproxy ctracecmdgui.i $(CC) -fpic -c $(CPPFLAGS) $(CFLAGS) $(INCLUDES) $(PYTHON_INCLUDES) $(PYGTK_CFLAGS) ctracecmdgui_wrap.c $(CC) --shared $^ $(LDFLAGS) $(LIBS) $(CONFIG_LIBS) ctracecmdgui_wrap.o -o ctracecmdgui.so diff --git a/lib/trace-cmd/Makefile b/lib/trace-cmd/Makefile new file mode 100644 index 0000000..dcb5cd5 --- /dev/null +++ b/lib/trace-cmd/Makefile @@ -0,0 +1,45 @@ + + +include $(src)/scripts/utils.mk + +DEFAULT_TARGET = libtracecmd.a + +OBJS = +OBJS += trace-hash.o +OBJS += trace-hooks.o +OBJS += trace-input.o +OBJS += trace-recorder.o +OBJS += trace-util.o + +# Additional util objects +OBJS += trace-blk-hack.o +OBJS += trace-ftrace.o + +DEPS := $(OBJS:%.o=.%.d) + +all: $(DEFAULT_TARGET) + +libtracecmd.a: $(OBJS) + $(Q)$(call do_build_static_lib) + +libtracecmd.so: $(OBJS) + $(Q)$(call do_compile_shared_library) + +%.o: %.c + $(Q)$(call do_fpic_compile) + +$(DEPS): .%.d: %.c + $(Q)$(CC) -M $(CPPFLAGS) $(CFLAGS) $< > $@ + +$(OBJS): %.o : .%.d + +dep_includes := $(wildcard $(DEPS)) + +ifneq ($(dep_includes),) + include $(dep_includes) +endif + +clean: + $(RM) *.a *.so *.o .*.d + +.PHONY: clean diff --git a/trace-blk-hack.c b/lib/trace-cmd/trace-blk-hack.c similarity index 100% rename from trace-blk-hack.c rename to lib/trace-cmd/trace-blk-hack.c diff --git a/trace-ftrace.c b/lib/trace-cmd/trace-ftrace.c similarity index 100% rename from trace-ftrace.c rename to lib/trace-cmd/trace-ftrace.c diff --git a/trace-hash.c b/lib/trace-cmd/trace-hash.c similarity index 100% rename from trace-hash.c rename to lib/trace-cmd/trace-hash.c diff --git a/trace-hooks.c b/lib/trace-cmd/trace-hooks.c similarity index 100% rename from trace-hooks.c rename to lib/trace-cmd/trace-hooks.c diff --git a/trace-input.c b/lib/trace-cmd/trace-input.c similarity index 100% rename from trace-input.c rename to lib/trace-cmd/trace-input.c diff --git a/trace-recorder.c b/lib/trace-cmd/trace-recorder.c similarity index 100% rename from trace-recorder.c rename to lib/trace-cmd/trace-recorder.c diff --git a/trace-util.c b/lib/trace-cmd/trace-util.c similarity index 100% rename from trace-util.c rename to lib/trace-cmd/trace-util.c From patchwork Wed Dec 20 18:07:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vladislav Valtchev (VMware)" X-Patchwork-Id: 10758327 Return-Path: linux-trace-devel-owner@vger.kernel.org Received: from mail-wm0-f67.google.com ([74.125.82.67]:38431 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932308AbdLTSIM (ORCPT ); Wed, 20 Dec 2017 13:08:12 -0500 From: "Vladislav Valtchev (VMware)" To: rostedt@goodmis.org Cc: y.karadz@gmail.com, linux-trace-devel@vger.kernel.org, linux-kernel@vger.kernel.org, "Vladislav Valtchev (VMware)" Subject: [PATCH 09/18] trace-cmd: Move GUI headers in kernel-shark/include Date: Wed, 20 Dec 2017 20:07:39 +0200 Message-Id: <20171220180748.17273-10-vladislav.valtchev@gmail.com> In-Reply-To: <20171220180748.17273-1-vladislav.valtchev@gmail.com> References: <20171220180748.17273-1-vladislav.valtchev@gmail.com> Sender: linux-trace-devel-owner@vger.kernel.org List-ID: Content-Length: 4848 This patch moves, as part of a bigger code base restructuring, all the header files of kernelshark in a dedicated directory. The next patch will move all of kernelshark's source files in kernel-shark/. Signed-off-by: Vladislav Valtchev (VMware) --- Makefile | 3 ++- cpu.h => kernel-shark/include/cpu.h | 0 kernel-shark.h => kernel-shark/include/kernel-shark.h | 0 kshark-plugin.h => kernel-shark/include/kshark-plugin.h | 0 trace-capture.h => kernel-shark/include/trace-capture.h | 0 trace-compat.h => kernel-shark/include/trace-compat.h | 0 trace-filter-hash.h => kernel-shark/include/trace-filter-hash.h | 0 trace-filter.h => kernel-shark/include/trace-filter.h | 0 trace-graph.h => kernel-shark/include/trace-graph.h | 0 trace-gui.h => kernel-shark/include/trace-gui.h | 0 trace-view-store.h => kernel-shark/include/trace-view-store.h | 0 trace-view.h => kernel-shark/include/trace-view.h | 0 trace-xml.h => kernel-shark/include/trace-xml.h | 0 13 files changed, 2 insertions(+), 1 deletion(-) rename cpu.h => kernel-shark/include/cpu.h (100%) rename kernel-shark.h => kernel-shark/include/kernel-shark.h (100%) rename kshark-plugin.h => kernel-shark/include/kshark-plugin.h (100%) rename trace-capture.h => kernel-shark/include/trace-capture.h (100%) rename trace-compat.h => kernel-shark/include/trace-compat.h (100%) rename trace-filter-hash.h => kernel-shark/include/trace-filter-hash.h (100%) rename trace-filter.h => kernel-shark/include/trace-filter.h (100%) rename trace-graph.h => kernel-shark/include/trace-graph.h (100%) rename trace-gui.h => kernel-shark/include/trace-gui.h (100%) rename trace-view-store.h => kernel-shark/include/trace-view-store.h (100%) rename trace-view.h => kernel-shark/include/trace-view.h (100%) rename trace-xml.h => kernel-shark/include/trace-xml.h (100%) diff --git a/Makefile b/Makefile index 8b34705..a72a2c9 100644 --- a/Makefile +++ b/Makefile @@ -242,6 +242,7 @@ INCLUDES += -I$(src)/include/traceevent INCLUDES += -I$(src)/include/trace-cmd INCLUDES += -I$(src)/lib/traceevent/include INCLUDES += -I$(src)/lib/trace-cmd/include +INCLUDES += -I$(src)/kernel-shark/include include $(src)/features.mk @@ -596,7 +597,7 @@ ctracecmd.so: $(TCMD_LIB_OBJS) ctracecmd.i $(CC) --shared $(LIBTRACECMD_STATIC) $(LDFLAGS) ctracecmd_wrap.o -o ctracecmd.so ctracecmdgui.so: $(TRACE_VIEW_OBJS) $(LIBTRACECMD_STATIC) - swig -Wall -python -noproxy ctracecmdgui.i + swig -Wall -python -noproxy -I$(src)/kernel-shark/include ctracecmdgui.i $(CC) -fpic -c $(CPPFLAGS) $(CFLAGS) $(INCLUDES) $(PYTHON_INCLUDES) $(PYGTK_CFLAGS) ctracecmdgui_wrap.c $(CC) --shared $^ $(LDFLAGS) $(LIBS) $(CONFIG_LIBS) ctracecmdgui_wrap.o -o ctracecmdgui.so diff --git a/cpu.h b/kernel-shark/include/cpu.h similarity index 100% rename from cpu.h rename to kernel-shark/include/cpu.h diff --git a/kernel-shark.h b/kernel-shark/include/kernel-shark.h similarity index 100% rename from kernel-shark.h rename to kernel-shark/include/kernel-shark.h diff --git a/kshark-plugin.h b/kernel-shark/include/kshark-plugin.h similarity index 100% rename from kshark-plugin.h rename to kernel-shark/include/kshark-plugin.h diff --git a/trace-capture.h b/kernel-shark/include/trace-capture.h similarity index 100% rename from trace-capture.h rename to kernel-shark/include/trace-capture.h diff --git a/trace-compat.h b/kernel-shark/include/trace-compat.h similarity index 100% rename from trace-compat.h rename to kernel-shark/include/trace-compat.h diff --git a/trace-filter-hash.h b/kernel-shark/include/trace-filter-hash.h similarity index 100% rename from trace-filter-hash.h rename to kernel-shark/include/trace-filter-hash.h diff --git a/trace-filter.h b/kernel-shark/include/trace-filter.h similarity index 100% rename from trace-filter.h rename to kernel-shark/include/trace-filter.h diff --git a/trace-graph.h b/kernel-shark/include/trace-graph.h similarity index 100% rename from trace-graph.h rename to kernel-shark/include/trace-graph.h diff --git a/trace-gui.h b/kernel-shark/include/trace-gui.h similarity index 100% rename from trace-gui.h rename to kernel-shark/include/trace-gui.h diff --git a/trace-view-store.h b/kernel-shark/include/trace-view-store.h similarity index 100% rename from trace-view-store.h rename to kernel-shark/include/trace-view-store.h diff --git a/trace-view.h b/kernel-shark/include/trace-view.h similarity index 100% rename from trace-view.h rename to kernel-shark/include/trace-view.h diff --git a/trace-xml.h b/kernel-shark/include/trace-xml.h similarity index 100% rename from trace-xml.h rename to kernel-shark/include/trace-xml.h From patchwork Wed Dec 20 18:07:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vladislav Valtchev (VMware)" X-Patchwork-Id: 10758345 Return-Path: linux-trace-devel-owner@vger.kernel.org Received: from mail-wm0-f66.google.com ([74.125.82.66]:44320 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755268AbdLTSIN (ORCPT ); Wed, 20 Dec 2017 13:08:13 -0500 From: "Vladislav Valtchev (VMware)" To: rostedt@goodmis.org Cc: y.karadz@gmail.com, linux-trace-devel@vger.kernel.org, linux-kernel@vger.kernel.org, "Vladislav Valtchev (VMware)" Subject: [PATCH 10/18] trace-cmd: Move GUI *.c files in kernel-shark/ Date: Wed, 20 Dec 2017 20:07:40 +0200 Message-Id: <20171220180748.17273-11-vladislav.valtchev@gmail.com> In-Reply-To: <20171220180748.17273-1-vladislav.valtchev@gmail.com> References: <20171220180748.17273-1-vladislav.valtchev@gmail.com> Sender: linux-trace-devel-owner@vger.kernel.org List-ID: Content-Length: 18213 This patch moves all the source files belonging to the GUI (kernelshark, trace-view and trace-graph) into the dedicated directory kernel-shark/. The build system has been updated to support this new directory structure by adding a separate Makefile in kernel-shark/ and by making the parent Makefile to invoke it. Signed-off-by: Vladislav Valtchev (VMware) --- Makefile | 190 ++++----------------- kernel-shark/Makefile | 84 +++++++++ kernel-shark.c => kernel-shark/kernel-shark.c | 0 trace-capture.c => kernel-shark/trace-capture.c | 0 trace-compat.c => kernel-shark/trace-compat.c | 0 trace-dialog.c => kernel-shark/trace-dialog.c | 0 .../trace-filter-hash.c | 0 trace-filter.c => kernel-shark/trace-filter.c | 0 .../trace-graph-main.c | 0 trace-graph.c => kernel-shark/trace-graph.c | 0 trace-plot-cpu.c => kernel-shark/trace-plot-cpu.c | 0 .../trace-plot-task.c | 0 trace-plot.c => kernel-shark/trace-plot.c | 0 .../trace-view-main.c | 0 .../trace-view-store.c | 0 trace-view.c => kernel-shark/trace-view.c | 0 trace-xml.c => kernel-shark/trace-xml.c | 0 scripts/utils.mk | 21 +++ 18 files changed, 140 insertions(+), 155 deletions(-) create mode 100644 kernel-shark/Makefile rename kernel-shark.c => kernel-shark/kernel-shark.c (100%) rename trace-capture.c => kernel-shark/trace-capture.c (100%) rename trace-compat.c => kernel-shark/trace-compat.c (100%) rename trace-dialog.c => kernel-shark/trace-dialog.c (100%) rename trace-filter-hash.c => kernel-shark/trace-filter-hash.c (100%) rename trace-filter.c => kernel-shark/trace-filter.c (100%) rename trace-graph-main.c => kernel-shark/trace-graph-main.c (100%) rename trace-graph.c => kernel-shark/trace-graph.c (100%) rename trace-plot-cpu.c => kernel-shark/trace-plot-cpu.c (100%) rename trace-plot-task.c => kernel-shark/trace-plot-task.c (100%) rename trace-plot.c => kernel-shark/trace-plot.c (100%) rename trace-view-main.c => kernel-shark/trace-view-main.c (100%) rename trace-view-store.c => kernel-shark/trace-view-store.c (100%) rename trace-view.c => kernel-shark/trace-view.c (100%) rename trace-xml.c => kernel-shark/trace-xml.c (100%) diff --git a/Makefile b/Makefile index a72a2c9..aaf7c72 100644 --- a/Makefile +++ b/Makefile @@ -3,11 +3,6 @@ TC_VERSION = 2 TC_PATCHLEVEL = 7 TC_EXTRAVERSION = dev -# Kernel Shark version -KS_VERSION = 0 -KS_PATCHLEVEL = 2 -KS_EXTRAVERSION = - # file format version FILE_VERSION = 6 @@ -146,27 +141,9 @@ BUILD_OUTPUT := $(shell cd $(BUILD_OUTPUT) && /bin/pwd) $(if $(BUILD_OUTPUT),, \ $(error output directory "$(saved-output)" does not exist)) -all: sub-make - -gui: force - $(call build_output, all_cmd) - $(call build_output, BUILDGUI=1 all_gui) - -$(filter-out gui,$(MAKECMDGOALS)): sub-make - -sub-make: force - $(call build_output, $(MAKECMDGOALS)) - - -# Leave processing to above invocation of make -skip-makefile := 1 - endif # BUILD_OUTPUT endif # BUILD_SRC -# We process the rest of the Makefile if this is the final invocation of make -ifeq ($(skip-makefile),) - srctree := $(if $(BUILD_SRC),$(BUILD_SRC),$(CURDIR)) objtree := $(CURDIR) src := $(srctree) @@ -180,7 +157,8 @@ bindir_relative_SQ = $(subst ','\'',$(bindir_relative)) plugin_dir_SQ = $(subst ','\'',$(plugin_dir)) python_dir_SQ = $(subst ','\'',$(python_dir)) -LIBS = -L. -ldl +LIBS = -ldl + LIBTRACEEVENT_DIR = $(obj)/lib/traceevent LIBTRACEEVENT_STATIC = $(LIBTRACEEVENT_DIR)/libtraceevent.a LIBTRACEEVENT_SHARED = $(LIBTRACEEVENT_DIR)/libtraceevent.so @@ -189,32 +167,8 @@ LIBTRACECMD_DIR = $(obj)/lib/trace-cmd LIBTRACECMD_STATIC = $(LIBTRACECMD_DIR)/libtracecmd.a LIBTRACECMD_SHARED = $(LIBTRACECMD_DIR)/libtracecmd.so -PACKAGES= gtk+-2.0 libxml-2.0 gthread-2.0 - -ifndef BUILDGUI - BUILDGUI = 0 -endif - -ifeq ($(BUILDGUI), 1) - -CONFIG_INCLUDES = $(shell pkg-config --cflags $(PACKAGES)) -I$(obj) - -CONFIG_FLAGS = -DBUILDGUI \ - -DGTK_VERSION=$(shell pkg-config --modversion gtk+-2.0 | \ - awk 'BEGIN{FS="."}{ a = ($$1 * (2^16)) + $$2 * (2^8) + $$3; printf ("%d", a);}') - -CONFIG_LIBS = $(shell pkg-config --libs $(PACKAGES)) - -VERSION = $(KS_VERSION) -PATCHLEVEL = $(KS_PATCHLEVEL) -EXTRAVERSION = $(KS_EXTRAVERSION) - -REBUILD_GUI = /bin/true -G = -N = @/bin/true || - -CONFIG_FLAGS += $(HELP_DIR_SQ) -else +export LIBS +export LIBTRACEEVENT_DIR LIBTRACECMD_DIR CONFIG_INCLUDES = CONFIG_LIBS = @@ -224,18 +178,14 @@ VERSION = $(TC_VERSION) PATCHLEVEL = $(TC_PATCHLEVEL) EXTRAVERSION = $(TC_EXTRAVERSION) -REBUILD_GUI = $(MAKE) -f $(src)/Makefile BUILDGUI=1 $@ -G = $(REBUILD_GUI); /bin/true || N = -endif -export Q VERBOSE +export Q VERBOSE EXT # Include the utils include scripts/utils.mk TRACECMD_VERSION = $(TC_VERSION).$(TC_PATCHLEVEL).$(TC_EXTRAVERSION) -KERNELSHARK_VERSION = $(KS_VERSION).$(KS_PATCHLEVEL).$(KS_EXTRAVERSION) INCLUDES = -I$(src) -I $(src)/include -I $(srctree)/../../include $(CONFIG_INCLUDES) INCLUDES += -I$(src)/include/traceevent @@ -252,6 +202,7 @@ CPPFLAGS ?= LDFLAGS ?= export CFLAGS +export INCLUDES # Required CFLAGS override CFLAGS += -D_GNU_SOURCE @@ -284,34 +235,21 @@ endif override CFLAGS += $(CONFIG_FLAGS) $(INCLUDES) $(PLUGIN_DIR_SQ) $(VAR_DIR) override CFLAGS += $(udis86-flags) $(blk-flags) -define check_gui - if [ $(BUILDGUI) -ne 1 -a ! -z "$(filter $(gui_objs),$(@))" ]; then \ - $(REBUILD_GUI); \ - else \ - $(print_compile) \ - $(CC) -c $(CPPFLAGS) $(CFLAGS) $(EXT) $< -o $(obj)/$@; \ - fi; -endef - $(obj)/%.o: $(src)/%.c - $(Q)$(call check_gui) + $(Q)$(call do_compile) %.o: $(src)/%.c - $(Q)$(call check_gui) + $(Q)$(call do_compile) + +TRACE_VIEW_OBJS = +TRACE_VIEW_OBJS += $(obj)/kernel-shark/trace-view.o +TRACE_VIEW_OBJS += $(obj)/kernel-shark/trace-view-store.o -TRACE_GUI_OBJS = trace-filter.o trace-compat.o trace-filter-hash.o trace-dialog.o \ - trace-xml.o TRACE_CMD_OBJS = trace-cmd.o trace-record.o trace-read.o trace-split.o trace-listen.o \ trace-stack.o trace-hist.o trace-mem.o trace-snapshot.o trace-stat.o \ trace-profile.o trace-stream.o trace-record.o trace-restore.o \ trace-check-events.o trace-show.o trace-list.o \ trace-output.o trace-usage.o trace-msg.o -TRACE_VIEW_OBJS = trace-view.o trace-view-store.o -TRACE_GRAPH_OBJS = trace-graph.o trace-plot.o trace-plot-cpu.o trace-plot-task.o -TRACE_VIEW_MAIN_OBJS = trace-view-main.o $(TRACE_VIEW_OBJS) $(TRACE_GUI_OBJS) -TRACE_GRAPH_MAIN_OBJS = trace-graph-main.o $(TRACE_GRAPH_OBJS) $(TRACE_GUI_OBJS) -KERNEL_SHARK_OBJS = $(TRACE_VIEW_OBJS) $(TRACE_GRAPH_OBJS) $(TRACE_GUI_OBJS) \ - trace-capture.o kernel-shark.o PLUGIN_OBJS = PLUGIN_OBJS += plugin_jbd2.o @@ -329,15 +267,13 @@ PLUGIN_OBJS += plugin_tlb.o PLUGINS := $(PLUGIN_OBJS:.o=.so) -ALL_OBJS = $(TRACE_CMD_OBJS) $(KERNEL_SHARK_OBJS) $(TRACE_VIEW_MAIN_OBJS) \ - $(TRACE_GRAPH_MAIN_OBJS) $(PLUGIN_OBJS) +ALL_OBJS = $(TRACE_CMD_OBJS) $(PLUGIN_OBJS) CMD_TARGETS = trace_plugin_dir trace_python_dir tc_version.h \ trace-cmd $(PLUGINS) $(BUILD_PYTHON) -GUI_TARGETS = ks_version.h trace-graph trace-view kernelshark -TARGETS = $(CMD_TARGETS) $(GUI_TARGETS) +TARGETS = $(CMD_TARGETS) # cpp $(INCLUDES) @@ -352,31 +288,23 @@ all: all_cmd show_gui_make all_cmd: $(CMD_TARGETS) -gui: $(CMD_TARGETS) - $(Q)$(MAKE) -f $(src)/Makefile BUILDGUI=1 all_gui - -all_gui: $(GUI_TARGETS) show_gui_done - -GUI_OBJS = $(KERNEL_SHARK_OBJS) $(TRACE_VIEW_MAIN_OBJS) $(TRACE_GRAPH_MAIN_OBJS) - -gui_objs := $(sort $(GUI_OBJS)) +gui: force $(CMD_TARGETS) + $(Q)$(MAKE) -C $(src)/kernel-shark; \ + echo "gui build complete" trace-cmd: $(TRACE_CMD_OBJS) $(Q)$(do_app_build) -kernelshark: $(KERNEL_SHARK_OBJS) - $(Q)$(G)$(do_app_build) - -trace-view: $(TRACE_VIEW_MAIN_OBJS) - $(Q)$(G)$(do_app_build) - -trace-graph: $(TRACE_GRAPH_MAIN_OBJS) - $(Q)$(G)$(do_app_build) - trace-cmd: $(LIBTRACECMD_STATIC) $(LIBTRACEEVENT_STATIC) -kernelshark: $(LIBTRACECMD_STATIC) $(LIBTRACEEVENT_STATIC) -trace-view: $(LIBTRACECMD_STATIC) $(LIBTRACEEVENT_STATIC) -trace-graph: $(LIBTRACECMD_STATIC) $(LIBTRACEEVENT_STATIC) + +kernelshark: force $(CMD_TARGETS) + $(Q)$(MAKE) -C $(src)/kernel-shark $@ + +trace-view: force $(CMD_TARGETS) + $(Q)$(MAKE) -C $(src)/kernel-shark $@ + +trace-graph: force $(CMD_TARGETS) + $(Q)$(MAKE) -C $(src)/kernel-shark $@ $(LIBTRACEEVENT_SHARED): force $(Q)$(MAKE) -C $(src)/lib/traceevent libtraceevent.so @@ -403,29 +331,6 @@ $(PLUGIN_OBJS): %.o : $(src)/%.c $(PLUGINS): %.so: %.o $(Q)$(do_plugin_build) -define make_version.h - (echo '/* This file is automatically generated. Do not modify. */'; \ - echo \#define VERSION_CODE $(shell \ - expr $(VERSION) \* 256 + $(PATCHLEVEL)); \ - echo '#define EXTRAVERSION ' $(EXTRAVERSION); \ - echo '#define VERSION_STRING "'$(VERSION).$(PATCHLEVEL).$(EXTRAVERSION)'"'; \ - echo '#define FILE_VERSION '$(FILE_VERSION); \ - ) > $1 -endef - -define update_version.h - ($(call make_version.h, $@.tmp); \ - if [ -r $@ ] && cmp -s $@ $@.tmp; then \ - rm -f $@.tmp; \ - else \ - echo ' UPDATE $@'; \ - mv -f $@.tmp $@; \ - fi); -endef - -ks_version.h: force - $(Q)$(G)$(call update_version.h) - tc_version.h: force $(Q)$(N)$(call update_version.h) @@ -449,36 +354,15 @@ trace_python_dir: force all_objs := $(sort $(ALL_OBJS)) all_deps := $(all_objs:%.o=.%.d) -gui_deps := $(gui_objs:%.o=.%.d) -non_gui_deps = $(filter-out $(gui_deps),$(all_deps)) -define check_gui_deps - if [ ! -z "$(filter $(gui_deps),$(@))" ]; then \ - if [ $(BUILDGUI) -ne 1 ]; then \ - $(REBUILD_GUI); \ - else \ - $(CC) -M $(CPPFLAGS) $(CFLAGS) $< > $@; \ - fi \ - elif [ $(BUILDGUI) -eq 0 ]; then \ - $(CC) -M $(CPPFLAGS) $(CFLAGS) $< > $@; \ - else \ - echo SKIPPING $@; \ - fi; -endef - -$(gui_deps): ks_version.h -$(non_gui_deps): tc_version.h +$(all_deps): tc_version.h $(all_deps): .%.d: $(src)/%.c - $(Q)$(call check_gui_deps) + $(Q)$(CC) -M $(CPPFLAGS) $(CFLAGS) $< > $@; $(all_objs) : %.o : .%.d -ifeq ($(BUILDGUI), 1) -dep_includes := $(wildcard $(gui_deps)) -else -dep_includes := $(wildcard $(non_gui_deps)) -endif +dep_includes := $(wildcard $(all_deps)) ifneq ($(dep_includes),) include $(dep_includes) @@ -488,9 +372,6 @@ show_gui_make: @echo "Note: to build the gui, type \"make gui\"" @echo " to build man pages, type \"make doc\"" -show_gui_done: - @echo "gui build complete" - PHONY += show_gui_make tags: force @@ -553,9 +434,9 @@ install: install_cmd @echo " to install man pages, type \"make install_doc\"" install_gui: install_cmd gui - $(Q)$(call do_install,trace-view,$(bindir_SQ)) - $(Q)$(call do_install,trace-graph,$(bindir_SQ)) - $(Q)$(call do_install,kernelshark,$(bindir_SQ)) + $(Q)$(call do_install,$(obj)/kernel-shark/trace-view,$(bindir_SQ)) + $(Q)$(call do_install,$(obj)/kernel-shark/trace-graph,$(bindir_SQ)) + $(Q)$(call do_install,$(obj)/kernel-shark/kernelshark,$(bindir_SQ)) install_libs: libs $(Q)$(call do_install,$(LIBTRACECMD_SHARED),$(libdir_SQ)) @@ -577,6 +458,7 @@ clean: $(RM) tags TAGS cscope* $(MAKE) -C $(src)/lib/traceevent clean $(MAKE) -C $(src)/lib/trace-cmd clean + $(MAKE) -C $(src)/kernel-shark clean ##### PYTHON STUFF ##### @@ -596,10 +478,10 @@ ctracecmd.so: $(TCMD_LIB_OBJS) ctracecmd.i $(CC) -fpic -c $(CPPFLAGS) $(CFLAGS) $(PYTHON_INCLUDES) ctracecmd_wrap.c $(CC) --shared $(LIBTRACECMD_STATIC) $(LDFLAGS) ctracecmd_wrap.o -o ctracecmd.so -ctracecmdgui.so: $(TRACE_VIEW_OBJS) $(LIBTRACECMD_STATIC) +ctracecmdgui.so: trace-view $(LIBTRACECMD_STATIC) swig -Wall -python -noproxy -I$(src)/kernel-shark/include ctracecmdgui.i $(CC) -fpic -c $(CPPFLAGS) $(CFLAGS) $(INCLUDES) $(PYTHON_INCLUDES) $(PYGTK_CFLAGS) ctracecmdgui_wrap.c - $(CC) --shared $^ $(LDFLAGS) $(LIBS) $(CONFIG_LIBS) ctracecmdgui_wrap.o -o ctracecmdgui.so + $(CC) --shared $(TRACE_VIEW_OBJS) $(LIBTRACECMD_STATIC) $(LDFLAGS) $(LIBS) $(CONFIG_LIBS) ctracecmdgui_wrap.o -o ctracecmdgui.so PHONY += python python: $(PYTHON) @@ -626,8 +508,6 @@ plugin_python.o: %.o : $(src)/%.c trace_python_dir plugin_python.so: %.so: %.o $(Q)$(do_python_plugin_build) -endif # skip-makefile - dist: git archive --format=tar --prefix=trace-cmd-$(TRACECMD_VERSION)/ HEAD \ > ../trace-cmd-$(TRACECMD_VERSION).tar diff --git a/kernel-shark/Makefile b/kernel-shark/Makefile new file mode 100644 index 0000000..247f4d1 --- /dev/null +++ b/kernel-shark/Makefile @@ -0,0 +1,84 @@ +# Kernel Shark version + +VERSION = 0 +PATCHLEVEL = 2 +EXTRAVERSION = +KERNELSHARK_VERSION = $(VERSION).$(PATCHLEVEL).$(EXTRAVERSION) + +BUILDGUI := 1 +include $(src)/scripts/utils.mk + + +PACKAGES = gtk+-2.0 libxml-2.0 gthread-2.0 + +CONFIG_INCLUDES = $(shell pkg-config --cflags $(PACKAGES)) -I$(obj) + +CONFIG_FLAGS = -DBUILDGUI \ + -DGTK_VERSION=$(shell pkg-config --modversion gtk+-2.0 | \ + awk 'BEGIN{FS="."}{ a = ($$1 * (2^16)) + $$2 * (2^8) + $$3; printf ("%d", a);}') + +CONFIG_LIBS = $(shell pkg-config --libs $(PACKAGES)) + +CONFIG_FLAGS += $(HELP_DIR_SQ) + +KS_VERSION := $(obj)/kernel-shark/include/ks_version.h + +GUI_TARGETS = $(KS_VERSION) trace-graph trace-view kernelshark + +TRACE_GUI_OBJS = trace-filter.o trace-compat.o trace-filter-hash.o \ + trace-dialog.o trace-xml.o +TRACE_VIEW_OBJS = trace-view.o trace-view-store.o +TRACE_GRAPH_OBJS = trace-graph.o trace-plot.o trace-plot-cpu.o trace-plot-task.o +TRACE_VIEW_MAIN_OBJS = trace-view-main.o $(TRACE_VIEW_OBJS) $(TRACE_GUI_OBJS) +TRACE_GRAPH_MAIN_OBJS = trace-graph-main.o $(TRACE_GRAPH_OBJS) $(TRACE_GUI_OBJS) +KERNEL_SHARK_OBJS = $(TRACE_VIEW_OBJS) $(TRACE_GRAPH_OBJS) $(TRACE_GUI_OBJS) \ + trace-capture.o kernel-shark.o + +GUI_OBJS = $(KERNEL_SHARK_OBJS) $(TRACE_VIEW_MAIN_OBJS) $(TRACE_GRAPH_MAIN_OBJS) + +all_objs := $(sort $(GUI_OBJS)) +all_deps := $(all_objs:%.o=.%.d) + +# Temporary HACK! +# This hack is OK only until the non-gui builds do not have any config_includes +# nor config flags. In case they do, keeping this hack might be a problem. +override CFLAGS += $(CONFIG_INCLUDES) $(CONFIG_FLAGS) + +LIBS += -L$(LIBTRACEEVENT_DIR) -L$(LIBTRACECMD_DIR) +LIBS += -ltracecmd -ltraceevent -ldl + +all: $(GUI_TARGETS) + +$(KS_VERSION): force + $(Q)$(call update_version.h) + +kernelshark: $(KERNEL_SHARK_OBJS) + $(Q)$(do_app_build) + +trace-view: $(TRACE_VIEW_MAIN_OBJS) + $(Q)$(do_app_build) + +trace-graph: $(TRACE_GRAPH_MAIN_OBJS) + $(Q)$(do_app_build) + +%.o: %.c + $(Q)$(call do_compile) + +$(all_deps): .%.d: %.c + $(Q)$(CC) -M $(CPPFLAGS) $(CFLAGS) $< > $@ + +$(all_deps): $(KS_VERSION) + +$(GUI_OBJS): %.o : .%.d + +dep_includes := $(wildcard $(DEPS)) + +ifneq ($(dep_includes),) + include $(dep_includes) +endif + +clean: + $(RM) *.a *.so *.o .*.d $(GUI_TARGETS) + +force: +.PHONY: clean diff --git a/kernel-shark.c b/kernel-shark/kernel-shark.c similarity index 100% rename from kernel-shark.c rename to kernel-shark/kernel-shark.c diff --git a/trace-capture.c b/kernel-shark/trace-capture.c similarity index 100% rename from trace-capture.c rename to kernel-shark/trace-capture.c diff --git a/trace-compat.c b/kernel-shark/trace-compat.c similarity index 100% rename from trace-compat.c rename to kernel-shark/trace-compat.c diff --git a/trace-dialog.c b/kernel-shark/trace-dialog.c similarity index 100% rename from trace-dialog.c rename to kernel-shark/trace-dialog.c diff --git a/trace-filter-hash.c b/kernel-shark/trace-filter-hash.c similarity index 100% rename from trace-filter-hash.c rename to kernel-shark/trace-filter-hash.c diff --git a/trace-filter.c b/kernel-shark/trace-filter.c similarity index 100% rename from trace-filter.c rename to kernel-shark/trace-filter.c diff --git a/trace-graph-main.c b/kernel-shark/trace-graph-main.c similarity index 100% rename from trace-graph-main.c rename to kernel-shark/trace-graph-main.c diff --git a/trace-graph.c b/kernel-shark/trace-graph.c similarity index 100% rename from trace-graph.c rename to kernel-shark/trace-graph.c diff --git a/trace-plot-cpu.c b/kernel-shark/trace-plot-cpu.c similarity index 100% rename from trace-plot-cpu.c rename to kernel-shark/trace-plot-cpu.c diff --git a/trace-plot-task.c b/kernel-shark/trace-plot-task.c similarity index 100% rename from trace-plot-task.c rename to kernel-shark/trace-plot-task.c diff --git a/trace-plot.c b/kernel-shark/trace-plot.c similarity index 100% rename from trace-plot.c rename to kernel-shark/trace-plot.c diff --git a/trace-view-main.c b/kernel-shark/trace-view-main.c similarity index 100% rename from trace-view-main.c rename to kernel-shark/trace-view-main.c diff --git a/trace-view-store.c b/kernel-shark/trace-view-store.c similarity index 100% rename from trace-view-store.c rename to kernel-shark/trace-view-store.c diff --git a/trace-view.c b/kernel-shark/trace-view.c similarity index 100% rename from trace-view.c rename to kernel-shark/trace-view.c diff --git a/trace-xml.c b/kernel-shark/trace-xml.c similarity index 100% rename from trace-xml.c rename to kernel-shark/trace-xml.c diff --git a/scripts/utils.mk b/scripts/utils.mk index 39cb387..abfe115 100644 --- a/scripts/utils.mk +++ b/scripts/utils.mk @@ -62,3 +62,24 @@ do_plugin_build = \ ($(print_plugin_build) \ $(CC) $(CFLAGS) $(LDFLAGS) -shared -nostartfiles -o $@ $<) + +define make_version.h + (echo '/* This file is automatically generated. Do not modify. */'; \ + echo \#define VERSION_CODE $(shell \ + expr $(VERSION) \* 256 + $(PATCHLEVEL)); \ + echo '#define EXTRAVERSION ' $(EXTRAVERSION); \ + echo '#define VERSION_STRING "'$(VERSION).$(PATCHLEVEL).$(EXTRAVERSION)'"'; \ + echo '#define FILE_VERSION '$(FILE_VERSION); \ + ) > $1 +endef + +define update_version.h + ($(call make_version.h, $@.tmp); \ + if [ -r $@ ] && cmp -s $@ $@.tmp; then \ + rm -f $@.tmp; \ + else \ + echo ' UPDATE $@'; \ + mv -f $@.tmp $@; \ + fi); +endef + From patchwork Wed Dec 20 18:07:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vladislav Valtchev (VMware)" X-Patchwork-Id: 10758343 Return-Path: linux-trace-devel-owner@vger.kernel.org Received: from mail-wm0-f41.google.com ([74.125.82.41]:47038 "EHLO mail-wm0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755979AbdLTSIO (ORCPT ); Wed, 20 Dec 2017 13:08:14 -0500 From: "Vladislav Valtchev (VMware)" To: rostedt@goodmis.org Cc: y.karadz@gmail.com, linux-trace-devel@vger.kernel.org, linux-kernel@vger.kernel.org, "Vladislav Valtchev (VMware)" Subject: [PATCH 11/18] trace-cmd: Move plugin_* files in plugins/ Date: Wed, 20 Dec 2017 20:07:41 +0200 Message-Id: <20171220180748.17273-12-vladislav.valtchev@gmail.com> In-Reply-To: <20171220180748.17273-1-vladislav.valtchev@gmail.com> References: <20171220180748.17273-1-vladislav.valtchev@gmail.com> Sender: linux-trace-devel-owner@vger.kernel.org List-ID: Content-Length: 13906 This patch moves the source files of all plugins to a dedicated directory, as part of a bigger restructuring plan of trace-cmd's code base. The build system has been updated to support this new directory structure by adding a separate Makefile in plugins/ and by making the parent Makefile to invoke it. Signed-off-by: Vladislav Valtchev (VMware) --- Makefile | 115 ++++++--------------- lib/trace-cmd/Makefile | 2 + plugins/Makefile | 69 +++++++++++++ plugin_blk.c => plugins/plugin_blk.c | 0 plugin_cfg80211.c => plugins/plugin_cfg80211.c | 0 plugin_function.c => plugins/plugin_function.c | 0 plugin_hrtimer.c => plugins/plugin_hrtimer.c | 0 plugin_jbd2.c => plugins/plugin_jbd2.c | 0 plugin_kmem.c => plugins/plugin_kmem.c | 0 plugin_kvm.c => plugins/plugin_kvm.c | 0 plugin_mac80211.c => plugins/plugin_mac80211.c | 0 plugin_python.c => plugins/plugin_python.c | 0 .../plugin_sched_switch.c | 0 plugin_scsi.c => plugins/plugin_scsi.c | 0 plugin_tlb.c => plugins/plugin_tlb.c | 0 plugin_xen.c => plugins/plugin_xen.c | 0 scripts/utils.mk | 32 ++++++ 17 files changed, 135 insertions(+), 83 deletions(-) create mode 100644 plugins/Makefile rename plugin_blk.c => plugins/plugin_blk.c (100%) rename plugin_cfg80211.c => plugins/plugin_cfg80211.c (100%) rename plugin_function.c => plugins/plugin_function.c (100%) rename plugin_hrtimer.c => plugins/plugin_hrtimer.c (100%) rename plugin_jbd2.c => plugins/plugin_jbd2.c (100%) rename plugin_kmem.c => plugins/plugin_kmem.c (100%) rename plugin_kvm.c => plugins/plugin_kvm.c (100%) rename plugin_mac80211.c => plugins/plugin_mac80211.c (100%) rename plugin_python.c => plugins/plugin_python.c (100%) rename plugin_sched_switch.c => plugins/plugin_sched_switch.c (100%) rename plugin_scsi.c => plugins/plugin_scsi.c (100%) rename plugin_tlb.c => plugins/plugin_tlb.c (100%) rename plugin_xen.c => plugins/plugin_xen.c (100%) diff --git a/Makefile b/Makefile index aaf7c72..7a8ca84 100644 --- a/Makefile +++ b/Makefile @@ -65,6 +65,12 @@ PYTHON_DIR_SQ = '$(subst ','\'',$(PYTHON_DIR))' var_dir = /var endif +# Shell quotes +bindir_SQ = $(subst ','\'',$(bindir)) +bindir_relative_SQ = $(subst ','\'',$(bindir_relative)) +plugin_dir_SQ = $(subst ','\'',$(plugin_dir)) +python_dir_SQ = $(subst ','\'',$(python_dir)) + VAR_DIR = -DVAR_DIR="$(var_dir)" VAR_DIR_SQ = '$(subst ','\'',$(VAR_DIR))' var_dir_SQ = '$(subst ','\'',$(var_dir))' @@ -75,6 +81,10 @@ HELP_DIR_SQ = '$(subst ','\'',$(HELP_DIR))' BASH_COMPLETE_DIR ?= /etc/bash_completion.d +export PLUGIN_DIR +export PYTHON_DIR +export PYTHON_DIR_SQ +export plugin_dir_SQ export var_dir # copy a bit from Linux kbuild @@ -108,6 +118,8 @@ ifeq ($(shell sh -c "pkg-config --cflags $(PYTHON_VERS) > /dev/null 2>&1 && whic endif endif # NO_PYTHON +export PYTHON_PLUGINS + # $(call test-build, snippet, ret) -> ret if snippet compiles # -> empty otherwise test-build = $(if $(shell sh -c 'echo "$(1)" | \ @@ -151,12 +163,6 @@ obj := $(objtree) export prefix bindir src obj -# Shell quotes -bindir_SQ = $(subst ','\'',$(bindir)) -bindir_relative_SQ = $(subst ','\'',$(bindir_relative)) -plugin_dir_SQ = $(subst ','\'',$(plugin_dir)) -python_dir_SQ = $(subst ','\'',$(python_dir)) - LIBS = -ldl LIBTRACEEVENT_DIR = $(obj)/lib/traceevent @@ -251,26 +257,9 @@ TRACE_CMD_OBJS = trace-cmd.o trace-record.o trace-read.o trace-split.o trace-lis trace-check-events.o trace-show.o trace-list.o \ trace-output.o trace-usage.o trace-msg.o -PLUGIN_OBJS = -PLUGIN_OBJS += plugin_jbd2.o -PLUGIN_OBJS += plugin_hrtimer.o -PLUGIN_OBJS += plugin_kmem.o -PLUGIN_OBJS += plugin_kvm.o -PLUGIN_OBJS += plugin_mac80211.o -PLUGIN_OBJS += plugin_sched_switch.o -PLUGIN_OBJS += plugin_function.o -PLUGIN_OBJS += plugin_xen.o -PLUGIN_OBJS += plugin_scsi.o -PLUGIN_OBJS += plugin_cfg80211.o -PLUGIN_OBJS += plugin_blk.o -PLUGIN_OBJS += plugin_tlb.o +ALL_OBJS = $(TRACE_CMD_OBJS) -PLUGINS := $(PLUGIN_OBJS:.o=.so) - -ALL_OBJS = $(TRACE_CMD_OBJS) $(PLUGIN_OBJS) - -CMD_TARGETS = trace_plugin_dir trace_python_dir tc_version.h \ - trace-cmd $(PLUGINS) $(BUILD_PYTHON) +CMD_TARGETS = tc_version.h trace-cmd $(BUILD_PYTHON) TARGETS = $(CMD_TARGETS) @@ -284,7 +273,7 @@ TARGETS = $(CMD_TARGETS) # If you want kernelshark, then do: make gui ### -all: all_cmd show_gui_make +all: all_cmd plugins show_gui_make all_cmd: $(CMD_TARGETS) @@ -312,10 +301,10 @@ $(LIBTRACEEVENT_SHARED): force $(LIBTRACEEVENT_STATIC): force $(Q)$(MAKE) -C $(src)/lib/traceevent libtraceevent.a -$(LIBTRACECMD_STATIC): force trace_plugin_dir +$(LIBTRACECMD_STATIC): force $(obj)/plugins/trace_plugin_dir $(Q)$(MAKE) -C $(src)/lib/trace-cmd libtracecmd.a -$(LIBTRACECMD_SHARED): force trace_plugin_dir +$(LIBTRACECMD_SHARED): force $(obj)/plugins/trace_plugin_dir $(Q)$(MAKE) -C $(src)/lib/trace-cmd libtracecmd.so libtraceevent.so: $(LIBTRACEEVENT_SHARED) @@ -325,30 +314,18 @@ libtracecmd.so: $(LIBTRACECMD_SHARED) libs: $(LIBTRACECMD_SHARED) $(LIBTRACEEVENT_SHARED) -$(PLUGIN_OBJS): %.o : $(src)/%.c - $(Q)$(do_compile_plugin_obj) - -$(PLUGINS): %.so: %.o - $(Q)$(do_plugin_build) +plugins: force $(obj)/plugins/trace_plugin_dir $(obj)/plugins/trace_python_dir + $(Q)$(MAKE) -C $(src)/plugins tc_version.h: force $(Q)$(N)$(call update_version.h) -define update_dir - (echo $1 > $@.tmp; \ - if [ -r $@ ] && cmp -s $@ $@.tmp; then \ - rm -f $@.tmp; \ - else \ - echo ' UPDATE $@'; \ - mv -f $@.tmp $@; \ - fi); -endef +$(obj)/plugins/trace_plugin_dir: force + $(Q)$(MAKE) -C $(src)/plugins trace_plugin_dir -trace_plugin_dir: force - $(Q)$(N)$(call update_dir, 'PLUGIN_DIR=$(PLUGIN_DIR)') +$(obj)/plugins/trace_python_dir: force + $(Q)$(MAKE) -C $(src)/plugins trace_python_dir -trace_python_dir: force - $(Q)$(N)$(call update_dir, 'PYTHON_DIR=$(PYTHON_DIR)') ## make deps @@ -386,28 +363,8 @@ cscope: force $(RM) cscope* find . -name '*.[ch]' | cscope -b -q -PLUGINS_INSTALL = $(subst .so,.install,$(PLUGINS)) $(subst .so,.install,$(PYTHON_PLUGINS)) - -define do_install - $(print_install) \ - if [ ! -d '$(DESTDIR_SQ)$2' ]; then \ - $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$2'; \ - fi; \ - $(INSTALL) $1 '$(DESTDIR_SQ)$2' -endef - -define do_install_data - $(print_install) \ - if [ ! -d '$(DESTDIR_SQ)$2' ]; then \ - $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$2'; \ - fi; \ - $(INSTALL) -m 644 $1 '$(DESTDIR_SQ)$2' -endef - -$(PLUGINS_INSTALL): %.install : %.so force - $(Q)$(call do_install_data,$<,$(plugin_dir_SQ)) - -install_plugins: $(PLUGINS_INSTALL) +install_plugins: force + $(Q)$(MAKE) -C $(src)/plugins $@ $(PYTHON_SO_INSTALL): %.install : %.so force $(Q)$(call do_install_data,$<,$(python_dir_SQ)) @@ -459,6 +416,7 @@ clean: $(MAKE) -C $(src)/lib/traceevent clean $(MAKE) -C $(src)/lib/trace-cmd clean $(MAKE) -C $(src)/kernel-shark clean + $(MAKE) -C $(src)/plugins clean ##### PYTHON STUFF ##### @@ -473,6 +431,10 @@ PYTHON_LDFLAGS = `pkg-config --libs $(PYTHON_VERS)` \ $(shell python2 -c "import distutils.sysconfig; print distutils.sysconfig.get_config_var('LINKFORSHARED')") PYGTK_CFLAGS = `pkg-config --cflags pygtk-2.0` +export PYTHON_INCLUDES +export PYTHON_LDFLAGS +export PYGTK_CFLAGS + ctracecmd.so: $(TCMD_LIB_OBJS) ctracecmd.i swig -Wall -python -noproxy -I$(src)/include/traceevent -I$(src)/include/trace-cmd ctracecmd.i $(CC) -fpic -c $(CPPFLAGS) $(CFLAGS) $(PYTHON_INCLUDES) ctracecmd_wrap.c @@ -492,21 +454,8 @@ python-gui: $(PYTHON_GUI) PHONY += python-plugin python-plugin: $(PYTHON_PLUGINS) -CFLAGS_plugin_python.o += $(PYTHON_DIR_SQ) - -do_compile_python_plugin_obj = \ - ($(print_plugin_obj_compile) \ - $(CC) -c $(CPPFLAGS) $(CFLAGS) $(CFLAGS_$@) $(PYTHON_INCLUDES) -fPIC -o $@ $<) - -do_python_plugin_build = \ - ($(print_plugin_build) \ - $(CC) $< -shared $(LDFLAGS) $(PYTHON_LDFLAGS) -o $@) - -plugin_python.o: %.o : $(src)/%.c trace_python_dir - $(Q)$(do_compile_python_plugin_obj) - -plugin_python.so: %.so: %.o - $(Q)$(do_python_plugin_build) +plugin_python.so: force $(obj)/plugins/trace_python_dir + $(Q)$(MAKE) -C $(src)/plugins plugin_python.so dist: git archive --format=tar --prefix=trace-cmd-$(TRACECMD_VERSION)/ HEAD \ diff --git a/lib/trace-cmd/Makefile b/lib/trace-cmd/Makefile index dcb5cd5..e8fb088 100644 --- a/lib/trace-cmd/Makefile +++ b/lib/trace-cmd/Makefile @@ -28,6 +28,8 @@ libtracecmd.so: $(OBJS) %.o: %.c $(Q)$(call do_fpic_compile) +trace-util.o: $(obj)/plugins/trace_plugin_dir + $(DEPS): .%.d: %.c $(Q)$(CC) -M $(CPPFLAGS) $(CFLAGS) $< > $@ diff --git a/plugins/Makefile b/plugins/Makefile new file mode 100644 index 0000000..7a09b82 --- /dev/null +++ b/plugins/Makefile @@ -0,0 +1,69 @@ +include $(src)/scripts/utils.mk + +PLUGIN_OBJS = +PLUGIN_OBJS += plugin_jbd2.o +PLUGIN_OBJS += plugin_hrtimer.o +PLUGIN_OBJS += plugin_kmem.o +PLUGIN_OBJS += plugin_kvm.o +PLUGIN_OBJS += plugin_mac80211.o +PLUGIN_OBJS += plugin_sched_switch.o +PLUGIN_OBJS += plugin_function.o +PLUGIN_OBJS += plugin_xen.o +PLUGIN_OBJS += plugin_scsi.o +PLUGIN_OBJS += plugin_cfg80211.o +PLUGIN_OBJS += plugin_blk.o +PLUGIN_OBJS += plugin_tlb.o + +PLUGINS := $(PLUGIN_OBJS:.o=.so) +DEPS := $(PLUGIN_OBJS:%.o=.%.d) + +all: $(PLUGINS) + +$(PLUGIN_OBJS): %.o : %.c + $(Q)$(do_compile_plugin_obj) + +$(PLUGINS): %.so: %.o + $(Q)$(do_plugin_build) + +$(DEPS): .%.d: %.c + $(Q)$(CC) -M $(CPPFLAGS) $(CFLAGS) $< > $@ + +$(PLUGIN_OBJS): %.o : .%.d + +CFLAGS_plugin_python.o += $(PYTHON_DIR_SQ) + +plugin_python.o: %.o : %.c trace_python_dir + $(Q)$(do_compile_python_plugin_obj) + +plugin_python.so: %.so: %.o + $(Q)$(do_python_plugin_build) + +PLUGINS_INSTALL = $(subst .so,.install,$(PLUGINS)) $(subst .so,.install,$(PYTHON_PLUGINS)) + +$(PLUGINS_INSTALL): %.install : %.so force + $(Q)$(call do_install_data,$<,$(plugin_dir_SQ)) + +install_plugins: $(PLUGINS_INSTALL) + +# The following targets are necessary to trigger a rebuild when $(PLUGIN_DIR) +# and $(PYTHON_DIR) change. Without them, a full clean build would necessary +# in order to get the binaries updated. + +trace_plugin_dir: force + $(Q)$(N)$(call update_dir, 'PLUGIN_DIR=$(PLUGIN_DIR)') + +trace_python_dir: force + $(Q)$(N)$(call update_dir, 'PYTHON_DIR=$(PYTHON_DIR)') + + +dep_includes := $(wildcard $(DEPS)) + +ifneq ($(dep_includes),) + include $(dep_includes) +endif + +clean: + $(RM) *.a *.so *.o .*.d trace_plugin_dir trace_python_dir + +force: +.PHONY: clean force \ No newline at end of file diff --git a/plugin_blk.c b/plugins/plugin_blk.c similarity index 100% rename from plugin_blk.c rename to plugins/plugin_blk.c diff --git a/plugin_cfg80211.c b/plugins/plugin_cfg80211.c similarity index 100% rename from plugin_cfg80211.c rename to plugins/plugin_cfg80211.c diff --git a/plugin_function.c b/plugins/plugin_function.c similarity index 100% rename from plugin_function.c rename to plugins/plugin_function.c diff --git a/plugin_hrtimer.c b/plugins/plugin_hrtimer.c similarity index 100% rename from plugin_hrtimer.c rename to plugins/plugin_hrtimer.c diff --git a/plugin_jbd2.c b/plugins/plugin_jbd2.c similarity index 100% rename from plugin_jbd2.c rename to plugins/plugin_jbd2.c diff --git a/plugin_kmem.c b/plugins/plugin_kmem.c similarity index 100% rename from plugin_kmem.c rename to plugins/plugin_kmem.c diff --git a/plugin_kvm.c b/plugins/plugin_kvm.c similarity index 100% rename from plugin_kvm.c rename to plugins/plugin_kvm.c diff --git a/plugin_mac80211.c b/plugins/plugin_mac80211.c similarity index 100% rename from plugin_mac80211.c rename to plugins/plugin_mac80211.c diff --git a/plugin_python.c b/plugins/plugin_python.c similarity index 100% rename from plugin_python.c rename to plugins/plugin_python.c diff --git a/plugin_sched_switch.c b/plugins/plugin_sched_switch.c similarity index 100% rename from plugin_sched_switch.c rename to plugins/plugin_sched_switch.c diff --git a/plugin_scsi.c b/plugins/plugin_scsi.c similarity index 100% rename from plugin_scsi.c rename to plugins/plugin_scsi.c diff --git a/plugin_tlb.c b/plugins/plugin_tlb.c similarity index 100% rename from plugin_tlb.c rename to plugins/plugin_tlb.c diff --git a/plugin_xen.c b/plugins/plugin_xen.c similarity index 100% rename from plugin_xen.c rename to plugins/plugin_xen.c diff --git a/scripts/utils.mk b/scripts/utils.mk index abfe115..31fc9e9 100644 --- a/scripts/utils.mk +++ b/scripts/utils.mk @@ -62,6 +62,13 @@ do_plugin_build = \ ($(print_plugin_build) \ $(CC) $(CFLAGS) $(LDFLAGS) -shared -nostartfiles -o $@ $<) +do_compile_python_plugin_obj = \ + ($(print_plugin_obj_compile) \ + $(CC) -c $(CPPFLAGS) $(CFLAGS) $(CFLAGS_$@) $(PYTHON_INCLUDES) -fPIC -o $@ $<) + +do_python_plugin_build = \ + ($(print_plugin_build) \ + $(CC) $< -shared $(LDFLAGS) $(PYTHON_LDFLAGS) -o $@) define make_version.h (echo '/* This file is automatically generated. Do not modify. */'; \ @@ -83,3 +90,28 @@ define update_version.h fi); endef +define update_dir + (echo $1 > $@.tmp; \ + if [ -r $@ ] && cmp -s $@ $@.tmp; then \ + rm -f $@.tmp; \ + else \ + echo ' UPDATE $@'; \ + mv -f $@.tmp $@; \ + fi); +endef + +define do_install + $(print_install) \ + if [ ! -d '$(DESTDIR_SQ)$2' ]; then \ + $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$2'; \ + fi; \ + $(INSTALL) $1 '$(DESTDIR_SQ)$2' +endef + +define do_install_data + $(print_install) \ + if [ ! -d '$(DESTDIR_SQ)$2' ]; then \ + $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$2'; \ + fi; \ + $(INSTALL) -m 644 $1 '$(DESTDIR_SQ)$2' +endef From patchwork Wed Dec 20 18:07:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vladislav Valtchev (VMware)" X-Patchwork-Id: 10758341 Return-Path: linux-trace-devel-owner@vger.kernel.org Received: from mail-wm0-f67.google.com ([74.125.82.67]:43353 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756007AbdLTSIO (ORCPT ); Wed, 20 Dec 2017 13:08:14 -0500 From: "Vladislav Valtchev (VMware)" To: rostedt@goodmis.org Cc: y.karadz@gmail.com, linux-trace-devel@vger.kernel.org, linux-kernel@vger.kernel.org, "Vladislav Valtchev (VMware)" Subject: [PATCH 12/18] trace-cmd: Fix the broken target ctracecmdgui.so Date: Wed, 20 Dec 2017 20:07:42 +0200 Message-Id: <20171220180748.17273-13-vladislav.valtchev@gmail.com> In-Reply-To: <20171220180748.17273-1-vladislav.valtchev@gmail.com> References: <20171220180748.17273-1-vladislav.valtchev@gmail.com> Sender: linux-trace-devel-owner@vger.kernel.org List-ID: Content-Length: 2220 Currenly the ctracecmdgui.so target is broken beacause the object files trace-view.o trace-view-store.o are not built with -fPIC. This patch just fixes the kernel-shark/Makefile in order to those files to be built with -fPIC. Signed-off-by: Vladislav Valtchev (VMware) --- kernel-shark/Makefile | 10 +++++++--- scripts/utils.mk | 10 +++++----- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/kernel-shark/Makefile b/kernel-shark/Makefile index 247f4d1..8e3ba8b 100644 --- a/kernel-shark/Makefile +++ b/kernel-shark/Makefile @@ -34,9 +34,11 @@ TRACE_GRAPH_MAIN_OBJS = trace-graph-main.o $(TRACE_GRAPH_OBJS) $(TRACE_GUI_OBJS) KERNEL_SHARK_OBJS = $(TRACE_VIEW_OBJS) $(TRACE_GRAPH_OBJS) $(TRACE_GUI_OBJS) \ trace-capture.o kernel-shark.o -GUI_OBJS = $(KERNEL_SHARK_OBJS) $(TRACE_VIEW_MAIN_OBJS) $(TRACE_GRAPH_MAIN_OBJS) +ALL_OBJS = $(KERNEL_SHARK_OBJS) $(TRACE_VIEW_MAIN_OBJS) $(TRACE_GRAPH_MAIN_OBJS) +PIC_OBJS = $(TRACE_VIEW_OBJS) -all_objs := $(sort $(GUI_OBJS)) +all_objs := $(sort $(ALL_OBJS)) +pic_objs = $(sort $(PIC_OBJS)) all_deps := $(all_objs:%.o=.%.d) # Temporary HACK! @@ -61,6 +63,8 @@ trace-view: $(TRACE_VIEW_MAIN_OBJS) trace-graph: $(TRACE_GRAPH_MAIN_OBJS) $(Q)$(do_app_build) +$(pic_objs): GENERATE_PIC := 1 + %.o: %.c $(Q)$(call do_compile) @@ -69,7 +73,7 @@ $(all_deps): .%.d: %.c $(all_deps): $(KS_VERSION) -$(GUI_OBJS): %.o : .%.d +$(all_objs): %.o : .%.d dep_includes := $(wildcard $(DEPS)) diff --git a/scripts/utils.mk b/scripts/utils.mk index 31fc9e9..043a68a 100644 --- a/scripts/utils.mk +++ b/scripts/utils.mk @@ -33,15 +33,15 @@ else print_install = echo ' $(GUI)INSTALL '$(GSPACE)$1' to $(DESTDIR_SQ)$2'; endif - -do_compile = \ - ($(print_compile) \ - $(CC) -c $(CPPFLAGS) $(CFLAGS) $(EXT) $< -o $@) - do_fpic_compile = \ ($(print_fpic_compile) \ $(CC) -c $(CPPFLAGS) $(CFLAGS) $(EXT) -fPIC $< -o $@) +do_compile = \ + ($(if $(GENERATE_PIC), $(do_fpic_compile), \ + $(print_compile) \ + $(CC) -c $(CPPFLAGS) $(CFLAGS) $(EXT) $< -o $@)) + do_app_build = \ ($(print_app_build) \ $(CC) $^ -rdynamic -o $@ $(LDFLAGS) $(CONFIG_LIBS) $(LIBS)) From patchwork Wed Dec 20 18:07:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vladislav Valtchev (VMware)" X-Patchwork-Id: 10758337 Return-Path: linux-trace-devel-owner@vger.kernel.org Received: from mail-wm0-f65.google.com ([74.125.82.65]:33658 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756016AbdLTSIQ (ORCPT ); Wed, 20 Dec 2017 13:08:16 -0500 From: "Vladislav Valtchev (VMware)" To: rostedt@goodmis.org Cc: y.karadz@gmail.com, linux-trace-devel@vger.kernel.org, linux-kernel@vger.kernel.org, "Vladislav Valtchev (VMware)" Subject: [PATCH 13/18] trace-cmd: Move python-related files in python/ Date: Wed, 20 Dec 2017 20:07:43 +0200 Message-Id: <20171220180748.17273-14-vladislav.valtchev@gmail.com> In-Reply-To: <20171220180748.17273-1-vladislav.valtchev@gmail.com> References: <20171220180748.17273-1-vladislav.valtchev@gmail.com> Sender: linux-trace-devel-owner@vger.kernel.org List-ID: Content-Length: 7095 This patch moves all the files related with trace-cmd's python support to a dedicated directory, as part of a bigger restructuring plan of trace-cmd's code base. The build system has been updated to support this new directory structure by adding a separate Makefile in python/ and by making the parent Makefile to invoke it. Signed-off-by: Vladislav Valtchev (VMware) --- Makefile | 41 +++++++++---------------------- python/Makefile | 40 ++++++++++++++++++++++++++++++ ctracecmd.i => python/ctracecmd.i | 0 ctracecmdgui.i => python/ctracecmdgui.i | 0 event-viewer.py => python/event-viewer.py | 0 tracecmd.py => python/tracecmd.py | 0 tracecmdgui.py => python/tracecmdgui.py | 0 7 files changed, 51 insertions(+), 30 deletions(-) create mode 100644 python/Makefile rename ctracecmd.i => python/ctracecmd.i (100%) rename ctracecmdgui.i => python/ctracecmdgui.i (100%) rename event-viewer.py => python/event-viewer.py (100%) rename tracecmd.py => python/tracecmd.py (100%) rename tracecmdgui.py => python/tracecmdgui.py (100%) diff --git a/Makefile b/Makefile index 7a8ca84..7c58414 100644 --- a/Makefile +++ b/Makefile @@ -112,13 +112,12 @@ PYTHON_VERS ?= python ifeq ($(shell sh -c "pkg-config --cflags $(PYTHON_VERS) > /dev/null 2>&1 && which swig && echo y"), y) PYTHON_PLUGINS := plugin_python.so BUILD_PYTHON := $(PYTHON) $(PYTHON_PLUGINS) - PYTHON_SO_INSTALL := ctracecmd.install - PYTHON_PY_PROGS := event-viewer.install - PYTHON_PY_LIBS := tracecmd.install tracecmdgui.install + BUILD_PYTHON_WORKS := 1 endif endif # NO_PYTHON export PYTHON_PLUGINS +export BUILD_PYTHON_WORKS # $(call test-build, snippet, ret) -> ret if snippet compiles # -> empty otherwise @@ -175,6 +174,7 @@ LIBTRACECMD_SHARED = $(LIBTRACECMD_DIR)/libtracecmd.so export LIBS export LIBTRACEEVENT_DIR LIBTRACECMD_DIR +export LIBTRACECMD_STATIC LIBTRACECMD_SHARED CONFIG_INCLUDES = CONFIG_LIBS = @@ -247,10 +247,6 @@ $(obj)/%.o: $(src)/%.c %.o: $(src)/%.c $(Q)$(call do_compile) -TRACE_VIEW_OBJS = -TRACE_VIEW_OBJS += $(obj)/kernel-shark/trace-view.o -TRACE_VIEW_OBJS += $(obj)/kernel-shark/trace-view-store.o - TRACE_CMD_OBJS = trace-cmd.o trace-record.o trace-read.o trace-split.o trace-listen.o \ trace-stack.o trace-hist.o trace-mem.o trace-snapshot.o trace-stat.o \ trace-profile.o trace-stream.o trace-record.o trace-restore.o \ @@ -366,19 +362,8 @@ cscope: force install_plugins: force $(Q)$(MAKE) -C $(src)/plugins $@ -$(PYTHON_SO_INSTALL): %.install : %.so force - $(Q)$(call do_install_data,$<,$(python_dir_SQ)) - -$(PYTHON_PY_PROGS): %.install : %.py force - $(Q)$(call do_install,$<,$(python_dir_SQ)) - -$(PYTHON_PY_LIBS): %.install : %.py force - $(Q)$(call do_install_data,$<,$(python_dir_SQ)) - -$(PYTHON_PY_PLUGINS): %.install : %.py force - $(Q)$(call do_install_data,$<,$(plugin_dir_SQ)) - -install_python: $(PYTHON_SO_INSTALL) $(PYTHON_PY_PROGS) $(PYTHON_PY_LIBS) $(PYTHON_PY_PLUGINS) +install_python: force + $(Q)$(MAKE) -C $(src)/python $@ install_bash_completion: force $(Q)$(call do_install_data,trace-cmd.bash,$(BASH_COMPLETE_DIR)) @@ -411,7 +396,7 @@ install_doc: $(MAKE) -C $(src)/Documentation install clean: - $(RM) *.o *~ $(TARGETS) *.a *.so ctracecmd_wrap.c .*.d + $(RM) *.o *~ $(TARGETS) *.a *.so .*.d $(RM) tags TAGS cscope* $(MAKE) -C $(src)/lib/traceevent clean $(MAKE) -C $(src)/lib/trace-cmd clean @@ -423,7 +408,7 @@ clean: report_noswig: force $(Q)echo - $(Q)echo " NO_PYTHON forced: swig not installed, not compling python plugins" + $(Q)echo " NO_PYTHON forced: swig not installed, not compiling python plugins" $(Q)echo PYTHON_INCLUDES = `pkg-config --cflags $(PYTHON_VERS)` @@ -435,15 +420,11 @@ export PYTHON_INCLUDES export PYTHON_LDFLAGS export PYGTK_CFLAGS -ctracecmd.so: $(TCMD_LIB_OBJS) ctracecmd.i - swig -Wall -python -noproxy -I$(src)/include/traceevent -I$(src)/include/trace-cmd ctracecmd.i - $(CC) -fpic -c $(CPPFLAGS) $(CFLAGS) $(PYTHON_INCLUDES) ctracecmd_wrap.c - $(CC) --shared $(LIBTRACECMD_STATIC) $(LDFLAGS) ctracecmd_wrap.o -o ctracecmd.so +ctracecmd.so: force $(LIBTRACECMD_STATIC) + $(Q)$(MAKE) -C $(src)/python $@ -ctracecmdgui.so: trace-view $(LIBTRACECMD_STATIC) - swig -Wall -python -noproxy -I$(src)/kernel-shark/include ctracecmdgui.i - $(CC) -fpic -c $(CPPFLAGS) $(CFLAGS) $(INCLUDES) $(PYTHON_INCLUDES) $(PYGTK_CFLAGS) ctracecmdgui_wrap.c - $(CC) --shared $(TRACE_VIEW_OBJS) $(LIBTRACECMD_STATIC) $(LDFLAGS) $(LIBS) $(CONFIG_LIBS) ctracecmdgui_wrap.o -o ctracecmdgui.so +ctracecmdgui.so: force $(LIBTRACECMD_STATIC) trace-view + $(Q)$(MAKE) -C $(src)/python $@ PHONY += python python: $(PYTHON) diff --git a/python/Makefile b/python/Makefile new file mode 100644 index 0000000..1a2554a --- /dev/null +++ b/python/Makefile @@ -0,0 +1,40 @@ +include $(src)/scripts/utils.mk + +TRACE_VIEW_OBJS = +TRACE_VIEW_OBJS += $(obj)/kernel-shark/trace-view.o +TRACE_VIEW_OBJS += $(obj)/kernel-shark/trace-view-store.o + +ifdef BUILD_PYTHON_WORKS +PYTHON_SO_INSTALL := ctracecmd.install +PYTHON_PY_PROGS := event-viewer.install +PYTHON_PY_LIBS := tracecmd.install tracecmdgui.install +endif + +ctracecmd.so: ctracecmd.i $(LIBTRACECMD_STATIC) + swig -Wall -python -noproxy -I$(src)/include/traceevent -I$(src)/include/trace-cmd ctracecmd.i + $(CC) -fpic -c $(CPPFLAGS) $(CFLAGS) $(PYTHON_INCLUDES) ctracecmd_wrap.c + $(CC) --shared $(LIBTRACECMD_STATIC) $(LDFLAGS) ctracecmd_wrap.o -o ctracecmd.so + +ctracecmdgui.so: ctracecmdgui.i $(LIBTRACECMD_STATIC) $(TRACE_VIEW_OBJS) + swig -Wall -python -noproxy -I$(src)/kernel-shark/include ctracecmdgui.i + $(CC) -fpic -c $(CPPFLAGS) $(CFLAGS) $(INCLUDES) $(PYTHON_INCLUDES) $(PYGTK_CFLAGS) ctracecmdgui_wrap.c + $(CC) --shared $(TRACE_VIEW_OBJS) $(LIBTRACECMD_STATIC) $(LDFLAGS) $(LIBS) $(CONFIG_LIBS) ctracecmdgui_wrap.o -o ctracecmdgui.so + + +$(PYTHON_SO_INSTALL): %.install : %.so force + $(Q)$(call do_install_data,$<,$(python_dir_SQ)) + +$(PYTHON_PY_PROGS): %.install : %.py force + $(Q)$(call do_install,$<,$(python_dir_SQ)) + +$(PYTHON_PY_LIBS): %.install : %.py force + $(Q)$(call do_install_data,$<,$(python_dir_SQ)) + +install_python: $(PYTHON_SO_INSTALL) $(PYTHON_PY_PROGS) $(PYTHON_PY_LIBS) + + +clean: + $(RM) *.a *.so *.o .*.d ctracecmd_wrap.c ctracecmdgui_wrap.c + +force: +.PHONY: clean force diff --git a/ctracecmd.i b/python/ctracecmd.i similarity index 100% rename from ctracecmd.i rename to python/ctracecmd.i diff --git a/ctracecmdgui.i b/python/ctracecmdgui.i similarity index 100% rename from ctracecmdgui.i rename to python/ctracecmdgui.i diff --git a/event-viewer.py b/python/event-viewer.py similarity index 100% rename from event-viewer.py rename to python/event-viewer.py diff --git a/tracecmd.py b/python/tracecmd.py similarity index 100% rename from tracecmd.py rename to python/tracecmd.py diff --git a/tracecmdgui.py b/python/tracecmdgui.py similarity index 100% rename from tracecmdgui.py rename to python/tracecmdgui.py From patchwork Wed Dec 20 18:07:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vladislav Valtchev (VMware)" X-Patchwork-Id: 10758339 Return-Path: linux-trace-devel-owner@vger.kernel.org Received: from mail-wm0-f68.google.com ([74.125.82.68]:36976 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755933AbdLTSIR (ORCPT ); Wed, 20 Dec 2017 13:08:17 -0500 From: "Vladislav Valtchev (VMware)" To: rostedt@goodmis.org Cc: y.karadz@gmail.com, linux-trace-devel@vger.kernel.org, linux-kernel@vger.kernel.org, "Vladislav Valtchev (VMware)" Subject: [PATCH 14/18] trace-cmd: Move tracecmd headers in tracecmd/include Date: Wed, 20 Dec 2017 20:07:44 +0200 Message-Id: <20171220180748.17273-15-vladislav.valtchev@gmail.com> In-Reply-To: <20171220180748.17273-1-vladislav.valtchev@gmail.com> References: <20171220180748.17273-1-vladislav.valtchev@gmail.com> Sender: linux-trace-devel-owner@vger.kernel.org List-ID: Content-Length: 1989 This patch moves trace-cmd's private headers in a dedicated directory called tracecmd/include, as part of a bigger restructuring plan of trace-cmd's code base. Signed-off-by: Vladislav Valtchev (VMware) --- Makefile | 1 + bug.h => tracecmd/include/bug.h | 0 list.h => tracecmd/include/list.h | 0 trace-cmd-local.h => tracecmd/include/trace-cmd-local.h | 0 trace-local.h => tracecmd/include/trace-local.h | 0 trace-msg.h => tracecmd/include/trace-msg.h | 0 6 files changed, 1 insertion(+) rename bug.h => tracecmd/include/bug.h (100%) rename list.h => tracecmd/include/list.h (100%) rename trace-cmd-local.h => tracecmd/include/trace-cmd-local.h (100%) rename trace-local.h => tracecmd/include/trace-local.h (100%) rename trace-msg.h => tracecmd/include/trace-msg.h (100%) diff --git a/Makefile b/Makefile index 7c58414..88daa9f 100644 --- a/Makefile +++ b/Makefile @@ -199,6 +199,7 @@ INCLUDES += -I$(src)/include/trace-cmd INCLUDES += -I$(src)/lib/traceevent/include INCLUDES += -I$(src)/lib/trace-cmd/include INCLUDES += -I$(src)/kernel-shark/include +INCLUDES += -I$(src)/tracecmd/include include $(src)/features.mk diff --git a/bug.h b/tracecmd/include/bug.h similarity index 100% rename from bug.h rename to tracecmd/include/bug.h diff --git a/list.h b/tracecmd/include/list.h similarity index 100% rename from list.h rename to tracecmd/include/list.h diff --git a/trace-cmd-local.h b/tracecmd/include/trace-cmd-local.h similarity index 100% rename from trace-cmd-local.h rename to tracecmd/include/trace-cmd-local.h diff --git a/trace-local.h b/tracecmd/include/trace-local.h similarity index 100% rename from trace-local.h rename to tracecmd/include/trace-local.h diff --git a/trace-msg.h b/tracecmd/include/trace-msg.h similarity index 100% rename from trace-msg.h rename to tracecmd/include/trace-msg.h From patchwork Wed Dec 20 18:07:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vladislav Valtchev (VMware)" X-Patchwork-Id: 10758333 Return-Path: linux-trace-devel-owner@vger.kernel.org Received: from mail-wm0-f68.google.com ([74.125.82.68]:35247 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755918AbdLTSIT (ORCPT ); Wed, 20 Dec 2017 13:08:19 -0500 From: "Vladislav Valtchev (VMware)" To: rostedt@goodmis.org Cc: y.karadz@gmail.com, linux-trace-devel@vger.kernel.org, linux-kernel@vger.kernel.org, "Vladislav Valtchev (VMware)" Subject: [PATCH 15/18] trace-cmd: Move version.h in include/ Date: Wed, 20 Dec 2017 20:07:45 +0200 Message-Id: <20171220180748.17273-16-vladislav.valtchev@gmail.com> In-Reply-To: <20171220180748.17273-1-vladislav.valtchev@gmail.com> References: <20171220180748.17273-1-vladislav.valtchev@gmail.com> Sender: linux-trace-devel-owner@vger.kernel.org List-ID: This trivial patch just moves the only header file remained in project's root directory to the include/ directory, common for all of the trace-cmd's sub-projects. Signed-off-by: Vladislav Valtchev (VMware) --- version.h => include/version.h | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename version.h => include/version.h (100%) diff --git a/version.h b/include/version.h similarity index 100% rename from version.h rename to include/version.h From patchwork Wed Dec 20 18:07:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vladislav Valtchev (VMware)" X-Patchwork-Id: 10758335 Return-Path: linux-trace-devel-owner@vger.kernel.org Received: from mail-wr0-f194.google.com ([209.85.128.194]:35954 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756022AbdLTSIT (ORCPT ); Wed, 20 Dec 2017 13:08:19 -0500 From: "Vladislav Valtchev (VMware)" To: rostedt@goodmis.org Cc: y.karadz@gmail.com, linux-trace-devel@vger.kernel.org, linux-kernel@vger.kernel.org, "Vladislav Valtchev (VMware)" Subject: [PATCH 16/18] trace-cmd: Move trace-cmd app files in tracecmd/ Date: Wed, 20 Dec 2017 20:07:46 +0200 Message-Id: <20171220180748.17273-17-vladislav.valtchev@gmail.com> In-Reply-To: <20171220180748.17273-1-vladislav.valtchev@gmail.com> References: <20171220180748.17273-1-vladislav.valtchev@gmail.com> Sender: linux-trace-devel-owner@vger.kernel.org List-ID: Content-Length: 11449 This patch moves all the remaining C files in the project's root directory to tracecmd, a directory dedicated to the trace-cmd application itself. This patch completes the bigger restructuring plan of trace-cmd's code base. Signed-off-by: Vladislav Valtchev (VMware) --- Makefile | 77 +++++----------------- tracecmd/Makefile | 73 ++++++++++++++++++++ .../trace-check-events.c | 0 trace-cmd.bash => tracecmd/trace-cmd.bash | 0 trace-cmd.c => tracecmd/trace-cmd.c | 0 trace-hist.c => tracecmd/trace-hist.c | 0 trace-list.c => tracecmd/trace-list.c | 0 trace-listen.c => tracecmd/trace-listen.c | 0 trace-mem.c => tracecmd/trace-mem.c | 0 trace-msg.c => tracecmd/trace-msg.c | 0 trace-output.c => tracecmd/trace-output.c | 0 trace-profile.c => tracecmd/trace-profile.c | 0 trace-read.c => tracecmd/trace-read.c | 0 trace-record.c => tracecmd/trace-record.c | 0 trace-restore.c => tracecmd/trace-restore.c | 0 trace-show.c => tracecmd/trace-show.c | 0 trace-snapshot.c => tracecmd/trace-snapshot.c | 0 trace-split.c => tracecmd/trace-split.c | 0 trace-stack.c => tracecmd/trace-stack.c | 0 trace-stat.c => tracecmd/trace-stat.c | 0 trace-stream.c => tracecmd/trace-stream.c | 0 trace-usage.c => tracecmd/trace-usage.c | 0 22 files changed, 88 insertions(+), 62 deletions(-) create mode 100644 tracecmd/Makefile rename trace-check-events.c => tracecmd/trace-check-events.c (100%) rename trace-cmd.bash => tracecmd/trace-cmd.bash (100%) rename trace-cmd.c => tracecmd/trace-cmd.c (100%) rename trace-hist.c => tracecmd/trace-hist.c (100%) rename trace-list.c => tracecmd/trace-list.c (100%) rename trace-listen.c => tracecmd/trace-listen.c (100%) rename trace-mem.c => tracecmd/trace-mem.c (100%) rename trace-msg.c => tracecmd/trace-msg.c (100%) rename trace-output.c => tracecmd/trace-output.c (100%) rename trace-profile.c => tracecmd/trace-profile.c (100%) rename trace-read.c => tracecmd/trace-read.c (100%) rename trace-record.c => tracecmd/trace-record.c (100%) rename trace-restore.c => tracecmd/trace-restore.c (100%) rename trace-show.c => tracecmd/trace-show.c (100%) rename trace-snapshot.c => tracecmd/trace-snapshot.c (100%) rename trace-split.c => tracecmd/trace-split.c (100%) rename trace-stack.c => tracecmd/trace-stack.c (100%) rename trace-stat.c => tracecmd/trace-stat.c (100%) rename trace-stream.c => tracecmd/trace-stream.c (100%) rename trace-usage.c => tracecmd/trace-usage.c (100%) diff --git a/Makefile b/Makefile index 88daa9f..c5da7c8 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,12 @@ TC_VERSION = 2 TC_PATCHLEVEL = 7 TC_EXTRAVERSION = dev +TRACECMD_VERSION = $(TC_VERSION).$(TC_PATCHLEVEL).$(TC_EXTRAVERSION) + +export TC_VERSION +export TC_PATCHLEVEL +export TC_EXTRAVERSION +export TRACECMD_VERSION # file format version FILE_VERSION = 6 @@ -175,25 +181,14 @@ LIBTRACECMD_SHARED = $(LIBTRACECMD_DIR)/libtracecmd.so export LIBS export LIBTRACEEVENT_DIR LIBTRACECMD_DIR export LIBTRACECMD_STATIC LIBTRACECMD_SHARED - -CONFIG_INCLUDES = -CONFIG_LIBS = -CONFIG_FLAGS = - -VERSION = $(TC_VERSION) -PATCHLEVEL = $(TC_PATCHLEVEL) -EXTRAVERSION = $(TC_EXTRAVERSION) - -N = +export LIBTRACEEVENT_STATIC LIBTRACEEVENT_SHARED export Q VERBOSE EXT # Include the utils include scripts/utils.mk -TRACECMD_VERSION = $(TC_VERSION).$(TC_PATCHLEVEL).$(TC_EXTRAVERSION) - -INCLUDES = -I$(src) -I $(src)/include -I $(srctree)/../../include $(CONFIG_INCLUDES) +INCLUDES = -I$(src)/include -I$(src)/../../include INCLUDES += -I$(src)/include/traceevent INCLUDES += -I$(src)/include/trace-cmd INCLUDES += -I$(src)/lib/traceevent/include @@ -242,27 +237,8 @@ endif override CFLAGS += $(CONFIG_FLAGS) $(INCLUDES) $(PLUGIN_DIR_SQ) $(VAR_DIR) override CFLAGS += $(udis86-flags) $(blk-flags) -$(obj)/%.o: $(src)/%.c - $(Q)$(call do_compile) -%.o: $(src)/%.c - $(Q)$(call do_compile) - -TRACE_CMD_OBJS = trace-cmd.o trace-record.o trace-read.o trace-split.o trace-listen.o \ - trace-stack.o trace-hist.o trace-mem.o trace-snapshot.o trace-stat.o \ - trace-profile.o trace-stream.o trace-record.o trace-restore.o \ - trace-check-events.o trace-show.o trace-list.o \ - trace-output.o trace-usage.o trace-msg.o - -ALL_OBJS = $(TRACE_CMD_OBJS) - -CMD_TARGETS = tc_version.h trace-cmd $(BUILD_PYTHON) - - -TARGETS = $(CMD_TARGETS) - - -# cpp $(INCLUDES) +CMD_TARGETS = trace-cmd $(BUILD_PYTHON) ### # Default we just build trace-cmd @@ -278,10 +254,8 @@ gui: force $(CMD_TARGETS) $(Q)$(MAKE) -C $(src)/kernel-shark; \ echo "gui build complete" -trace-cmd: $(TRACE_CMD_OBJS) - $(Q)$(do_app_build) - -trace-cmd: $(LIBTRACECMD_STATIC) $(LIBTRACEEVENT_STATIC) +trace-cmd: force $(LIBTRACEEVENT_STATIC) $(LIBTRACECMD_STATIC) + $(Q)$(MAKE) -C $(src)/tracecmd $@ kernelshark: force $(CMD_TARGETS) $(Q)$(MAKE) -C $(src)/kernel-shark $@ @@ -314,34 +288,12 @@ libs: $(LIBTRACECMD_SHARED) $(LIBTRACEEVENT_SHARED) plugins: force $(obj)/plugins/trace_plugin_dir $(obj)/plugins/trace_python_dir $(Q)$(MAKE) -C $(src)/plugins -tc_version.h: force - $(Q)$(N)$(call update_version.h) - $(obj)/plugins/trace_plugin_dir: force $(Q)$(MAKE) -C $(src)/plugins trace_plugin_dir $(obj)/plugins/trace_python_dir: force $(Q)$(MAKE) -C $(src)/plugins trace_python_dir - -## make deps - -all_objs := $(sort $(ALL_OBJS)) -all_deps := $(all_objs:%.o=.%.d) - -$(all_deps): tc_version.h - -$(all_deps): .%.d: $(src)/%.c - $(Q)$(CC) -M $(CPPFLAGS) $(CFLAGS) $< > $@; - -$(all_objs) : %.o : .%.d - -dep_includes := $(wildcard $(all_deps)) - -ifneq ($(dep_includes),) - include $(dep_includes) -endif - show_gui_make: @echo "Note: to build the gui, type \"make gui\"" @echo " to build man pages, type \"make doc\"" @@ -367,10 +319,10 @@ install_python: force $(Q)$(MAKE) -C $(src)/python $@ install_bash_completion: force - $(Q)$(call do_install_data,trace-cmd.bash,$(BASH_COMPLETE_DIR)) + $(Q)$(call do_install_data,$(src)/tracecmd/trace-cmd.bash,$(BASH_COMPLETE_DIR)) install_cmd: all_cmd install_plugins install_python install_bash_completion - $(Q)$(call do_install,trace-cmd,$(bindir_SQ)) + $(Q)$(call do_install,$(obj)/tracecmd/trace-cmd,$(bindir_SQ)) install: install_cmd @echo "Note: to install the gui, type \"make install_gui\"" @@ -397,12 +349,13 @@ install_doc: $(MAKE) -C $(src)/Documentation install clean: - $(RM) *.o *~ $(TARGETS) *.a *.so .*.d + $(RM) *.o *~ *.a *.so .*.d $(RM) tags TAGS cscope* $(MAKE) -C $(src)/lib/traceevent clean $(MAKE) -C $(src)/lib/trace-cmd clean $(MAKE) -C $(src)/kernel-shark clean $(MAKE) -C $(src)/plugins clean + $(MAKE) -C $(src)/tracecmd clean ##### PYTHON STUFF ##### diff --git a/tracecmd/Makefile b/tracecmd/Makefile new file mode 100644 index 0000000..860dc89 --- /dev/null +++ b/tracecmd/Makefile @@ -0,0 +1,73 @@ + +VERSION := $(TC_VERSION) +PATCHLEVEL := $(TC_PATCHLEVEL) +EXTRAVERSION := $(TC_EXTRAVERSION) + +TC_VERSION := $(obj)/tracecmd/include/tc_version.h +TARGETS = trace-cmd $(TC_VERSION) + +BUILDGUI := 0 +include $(src)/scripts/utils.mk + +TRACE_CMD_OBJS = +TRACE_CMD_OBJS += trace-cmd.o +TRACE_CMD_OBJS += trace-record.o +TRACE_CMD_OBJS += trace-read.o +TRACE_CMD_OBJS += trace-split.o +TRACE_CMD_OBJS += trace-listen.o +TRACE_CMD_OBJS += trace-stack.o +TRACE_CMD_OBJS += trace-hist.o +TRACE_CMD_OBJS += trace-mem.o +TRACE_CMD_OBJS += trace-snapshot.o +TRACE_CMD_OBJS += trace-stat.o +TRACE_CMD_OBJS += trace-profile.o +TRACE_CMD_OBJS += trace-stream.o +TRACE_CMD_OBJS += trace-record.o +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 + +ALL_OBJS = $(TRACE_CMD_OBJS) + +all_objs := $(sort $(ALL_OBJS)) +all_deps := $(all_objs:%.o=.%.d) + +CONFIG_INCLUDES = +CONFIG_LIBS = +CONFIG_FLAGS = + +all: $(TARGETS) + +$(TC_VERSION): force + $(Q)$(call update_version.h) + +trace-cmd: $(ALL_OBJS) + $(Q)$(do_app_build) + +trace-cmd: $(LIBTRACECMD_STATIC) $(LIBTRACEEVENT_STATIC) + +%.o: %.c + $(Q)$(call do_compile) + +$(all_deps): .%.d: %.c + $(Q)$(CC) -M $(CPPFLAGS) $(CFLAGS) $< > $@ + +$(all_deps): $(TC_VERSION) + +$(all_objs): %.o : .%.d + +dep_includes := $(wildcard $(DEPS)) + +ifneq ($(dep_includes),) + include $(dep_includes) +endif + +clean: + $(RM) *.a *.so *.o .*.d $(TARGETS) + +force: +.PHONY: clean diff --git a/trace-check-events.c b/tracecmd/trace-check-events.c similarity index 100% rename from trace-check-events.c rename to tracecmd/trace-check-events.c diff --git a/trace-cmd.bash b/tracecmd/trace-cmd.bash similarity index 100% rename from trace-cmd.bash rename to tracecmd/trace-cmd.bash diff --git a/trace-cmd.c b/tracecmd/trace-cmd.c similarity index 100% rename from trace-cmd.c rename to tracecmd/trace-cmd.c diff --git a/trace-hist.c b/tracecmd/trace-hist.c similarity index 100% rename from trace-hist.c rename to tracecmd/trace-hist.c diff --git a/trace-list.c b/tracecmd/trace-list.c similarity index 100% rename from trace-list.c rename to tracecmd/trace-list.c diff --git a/trace-listen.c b/tracecmd/trace-listen.c similarity index 100% rename from trace-listen.c rename to tracecmd/trace-listen.c diff --git a/trace-mem.c b/tracecmd/trace-mem.c similarity index 100% rename from trace-mem.c rename to tracecmd/trace-mem.c diff --git a/trace-msg.c b/tracecmd/trace-msg.c similarity index 100% rename from trace-msg.c rename to tracecmd/trace-msg.c diff --git a/trace-output.c b/tracecmd/trace-output.c similarity index 100% rename from trace-output.c rename to tracecmd/trace-output.c diff --git a/trace-profile.c b/tracecmd/trace-profile.c similarity index 100% rename from trace-profile.c rename to tracecmd/trace-profile.c diff --git a/trace-read.c b/tracecmd/trace-read.c similarity index 100% rename from trace-read.c rename to tracecmd/trace-read.c diff --git a/trace-record.c b/tracecmd/trace-record.c similarity index 100% rename from trace-record.c rename to tracecmd/trace-record.c diff --git a/trace-restore.c b/tracecmd/trace-restore.c similarity index 100% rename from trace-restore.c rename to tracecmd/trace-restore.c diff --git a/trace-show.c b/tracecmd/trace-show.c similarity index 100% rename from trace-show.c rename to tracecmd/trace-show.c diff --git a/trace-snapshot.c b/tracecmd/trace-snapshot.c similarity index 100% rename from trace-snapshot.c rename to tracecmd/trace-snapshot.c diff --git a/trace-split.c b/tracecmd/trace-split.c similarity index 100% rename from trace-split.c rename to tracecmd/trace-split.c diff --git a/trace-stack.c b/tracecmd/trace-stack.c similarity index 100% rename from trace-stack.c rename to tracecmd/trace-stack.c diff --git a/trace-stat.c b/tracecmd/trace-stat.c similarity index 100% rename from trace-stat.c rename to tracecmd/trace-stat.c diff --git a/trace-stream.c b/tracecmd/trace-stream.c similarity index 100% rename from trace-stream.c rename to tracecmd/trace-stream.c diff --git a/trace-usage.c b/tracecmd/trace-usage.c similarity index 100% rename from trace-usage.c rename to tracecmd/trace-usage.c From patchwork Wed Dec 20 18:07:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vladislav Valtchev (VMware)" X-Patchwork-Id: 10758329 Return-Path: linux-trace-devel-owner@vger.kernel.org Received: from mail-wm0-f67.google.com ([74.125.82.67]:45376 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756029AbdLTSIU (ORCPT ); Wed, 20 Dec 2017 13:08:20 -0500 From: "Vladislav Valtchev (VMware)" To: rostedt@goodmis.org Cc: y.karadz@gmail.com, linux-trace-devel@vger.kernel.org, linux-kernel@vger.kernel.org, "Vladislav Valtchev (VMware)" Subject: [PATCH 17/18] trace-cmd: Fix the logic behind SWIG_DEFINED in the Makefile Date: Wed, 20 Dec 2017 20:07:47 +0200 Message-Id: <20171220180748.17273-18-vladislav.valtchev@gmail.com> In-Reply-To: <20171220180748.17273-1-vladislav.valtchev@gmail.com> References: <20171220180748.17273-1-vladislav.valtchev@gmail.com> Sender: linux-trace-devel-owner@vger.kernel.org List-ID: Content-Length: 1383 At least on Ubuntu, the $(shell ...) command used in the master Makefile to test for the existence of the 'swig' command does not work in the negative case. That causes the build to report ugly errors in case 'swig' is not installed on the system. This one-line patch, fixes the problem by using the POSIX 'comamnd -v {CMD}' in $(shell ...) to detect the presence of the swig and restores this way the fake report_noswig target. Signed-off-by: Vladislav Valtchev (VMware) --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index c5da7c8..0a2a78d 100644 --- a/Makefile +++ b/Makefile @@ -102,7 +102,7 @@ ifndef VERBOSE VERBOSE = 0 endif -SWIG_DEFINED := $(shell if swig -help &> /dev/null; then echo 1; else echo 0; fi) +SWIG_DEFINED := $(shell if command -v swig; then echo 1; else echo 0; fi) ifeq ($(SWIG_DEFINED), 0) BUILD_PYTHON := report_noswig NO_PYTHON = 1 @@ -115,7 +115,7 @@ PYTHON_GUI := ctracecmd.so ctracecmdgui.so PYTHON_VERS ?= python # Can build python? -ifeq ($(shell sh -c "pkg-config --cflags $(PYTHON_VERS) > /dev/null 2>&1 && which swig && echo y"), y) +ifeq ($(shell sh -c "pkg-config --cflags $(PYTHON_VERS) > /dev/null 2>&1 && echo y"), y) PYTHON_PLUGINS := plugin_python.so BUILD_PYTHON := $(PYTHON) $(PYTHON_PLUGINS) BUILD_PYTHON_WORKS := 1 From patchwork Wed Dec 20 18:07:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vladislav Valtchev (VMware)" X-Patchwork-Id: 10758331 Return-Path: linux-trace-devel-owner@vger.kernel.org Received: from mail-wm0-f67.google.com ([74.125.82.67]:40388 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756041AbdLTSIV (ORCPT ); Wed, 20 Dec 2017 13:08:21 -0500 From: "Vladislav Valtchev (VMware)" To: rostedt@goodmis.org Cc: y.karadz@gmail.com, linux-trace-devel@vger.kernel.org, linux-kernel@vger.kernel.org, "Vladislav Valtchev (VMware)" Subject: [PATCH 18/18] trace-cmd: Make the build to tell when python-dev is missing Date: Wed, 20 Dec 2017 20:07:48 +0200 Message-Id: <20171220180748.17273-19-vladislav.valtchev@gmail.com> In-Reply-To: <20171220180748.17273-1-vladislav.valtchev@gmail.com> References: <20171220180748.17273-1-vladislav.valtchev@gmail.com> Sender: linux-trace-devel-owner@vger.kernel.org List-ID: Content-Length: 1301 Currently, the build system will complain when swig is missing, since that will prevent it to build the python C modules, but in case swig is present but python-dev is not installed, the build will just silently skip them. This patch just makes the build to report a message when that happens. Signed-off-by: Vladislav Valtchev (VMware) --- Makefile | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Makefile b/Makefile index 0a2a78d..f463d1f 100644 --- a/Makefile +++ b/Makefile @@ -119,6 +119,8 @@ ifeq ($(shell sh -c "pkg-config --cflags $(PYTHON_VERS) > /dev/null 2>&1 && echo PYTHON_PLUGINS := plugin_python.so BUILD_PYTHON := $(PYTHON) $(PYTHON_PLUGINS) BUILD_PYTHON_WORKS := 1 +else + BUILD_PYTHON := report_nopythondev endif endif # NO_PYTHON @@ -365,6 +367,11 @@ report_noswig: force $(Q)echo " NO_PYTHON forced: swig not installed, not compiling python plugins" $(Q)echo +report_nopythondev: force + $(Q)echo + $(Q)echo " python-dev is not installed, not compiling python plugins" + $(Q)echo + PYTHON_INCLUDES = `pkg-config --cflags $(PYTHON_VERS)` PYTHON_LDFLAGS = `pkg-config --libs $(PYTHON_VERS)` \ $(shell python2 -c "import distutils.sysconfig; print distutils.sysconfig.get_config_var('LINKFORSHARED')")