[Qemu-devel] [PULL 03/42] trace: add build framework for merging trace-events files
From: "Daniel P. Berrange"Switch make rules over to use trace-events-all as the master trace events input file. Add rule that will construct trace-events-all from $(trace-events-y). Signed-off-by: Daniel P. Berrange Message-id: 1466066426-16657-2-git-send-email-berra...@redhat.com Signed-off-by: Stefan Hajnoczi --- .gitignore | 1 + Makefile| 2 +- Makefile.objs | 4 Makefile.target | 6 +++--- docs/tracing.txt| 32 ++-- qemu-options.hx | 8 trace/Makefile.objs | 25 ++--- 7 files changed, 45 insertions(+), 33 deletions(-) diff --git a/.gitignore b/.gitignore index 38ee1c5..9b6a968 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ /config-target.* /config.status /config-temp +/trace-events-all /trace/generated-tracers.h /trace/generated-tracers.c /trace/generated-tracers-dtrace.h diff --git a/Makefile b/Makefile index 53e4119..7087fc2 100644 --- a/Makefile +++ b/Makefile @@ -487,7 +487,7 @@ endif set -e; for x in $(KEYMAPS); do \ $(INSTALL_DATA) $(SRC_PATH)/pc-bios/keymaps/$$x "$(DESTDIR)$(qemu_datadir)/keymaps"; \ done - $(INSTALL_DATA) $(SRC_PATH)/trace-events "$(DESTDIR)$(qemu_datadir)/trace-events" + $(INSTALL_DATA) $(BUILD_DIR)/trace-events-all "$(DESTDIR)$(qemu_datadir)/trace-events-all" for d in $(TARGET_DIRS); do \ $(MAKE) $(SUBDIR_MAKEFLAGS) TARGET_DIR=$$d/ -C $$d $@ || exit 1 ; \ done diff --git a/Makefile.objs b/Makefile.objs index da49b71..697fc66 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -115,3 +115,7 @@ qga-vss-dll-obj-y = qga/ # contrib ivshmem-client-obj-y = contrib/ivshmem-client/ ivshmem-server-obj-y = contrib/ivshmem-server/ + + +## +trace-events-y = trace-events diff --git a/Makefile.target b/Makefile.target index 495b474..d720b3e 100644 --- a/Makefile.target +++ b/Makefile.target @@ -48,7 +48,7 @@ else TARGET_TYPE=system endif -$(QEMU_PROG).stp-installed: $(SRC_PATH)/trace-events +$(QEMU_PROG).stp-installed: $(BUILD_DIR)/trace-events-all $(call quiet-command,$(TRACETOOL) \ --format=stap \ --backends=$(TRACE_BACKENDS) \ @@ -57,7 +57,7 @@ $(QEMU_PROG).stp-installed: $(SRC_PATH)/trace-events --target-type=$(TARGET_TYPE) \ < $< > $@," GEN $(TARGET_DIR)$(QEMU_PROG).stp-installed") -$(QEMU_PROG).stp: $(SRC_PATH)/trace-events +$(QEMU_PROG).stp: $(BUILD_DIR)/trace-events-all $(call quiet-command,$(TRACETOOL) \ --format=stap \ --backends=$(TRACE_BACKENDS) \ @@ -66,7 +66,7 @@ $(QEMU_PROG).stp: $(SRC_PATH)/trace-events --target-type=$(TARGET_TYPE) \ < $< > $@," GEN $(TARGET_DIR)$(QEMU_PROG).stp") -$(QEMU_PROG)-simpletrace.stp: $(SRC_PATH)/trace-events +$(QEMU_PROG)-simpletrace.stp: $(BUILD_DIR)/trace-events-all $(call quiet-command,$(TRACETOOL) \ --format=simpletrace-stap \ --backends=$(TRACE_BACKENDS) \ diff --git a/docs/tracing.txt b/docs/tracing.txt index 0bd6b9c..29f2f9a 100644 --- a/docs/tracing.txt +++ b/docs/tracing.txt @@ -23,20 +23,24 @@ for debugging, profiling, and observing execution. 4. Pretty-print the binary trace file: -./scripts/simpletrace.py trace-events trace-* # Override * with QEMU +./scripts/simpletrace.py trace-events-all trace-* # Override * with QEMU == Trace events == -There is a set of static trace events declared in the "trace-events" source -file. Each trace event declaration names the event, its arguments, and the -format string which can be used for pretty-printing: +Each directory in the source tree can declare a set of static trace events +in a "trace-events" file. Each trace event declaration names the event, its +arguments, and the format string which can be used for pretty-printing: qemu_vmalloc(size_t size, void *ptr) "size %zu ptr %p" qemu_vfree(void *ptr) "ptr %p" -The "trace-events" file is processed by the "tracetool" script during build to -generate code for the trace events. Trace events are invoked directly from -source code like this: +All "trace-events" files must be listed in the "trace-event-y" make variable +in the top level Makefile.objs. During build the individual files are combined +to create a "trace-events-all" file, which is processed by the "tracetool" +script during build to generate code for the trace events. The +"trace-events-all" file is also installed into "/usr/share/qemu". + +Trace events are invoked directly from source code like this: #include "trace.h" /* needed for trace event prototype */ @@ -196,12 +200,12 @@ Restriction: "ftrace" backend is restricted to Linux only. Analyzing trace files The "simple" backend produces binary trace
[Qemu-devel] [PULL 03/42] trace: add build framework for merging trace-events files
From: "Daniel P. Berrange"Switch make rules over to use trace-events-all as the master trace events input file. Add rule that will construct trace-events-all from $(trace-events-y). Signed-off-by: Daniel P. Berrange Message-id: 1466066426-16657-2-git-send-email-berra...@redhat.com Signed-off-by: Stefan Hajnoczi --- .gitignore | 1 + Makefile| 2 +- Makefile.objs | 4 Makefile.target | 6 +++--- docs/tracing.txt| 32 ++-- qemu-options.hx | 8 trace/Makefile.objs | 25 ++--- 7 files changed, 45 insertions(+), 33 deletions(-) diff --git a/.gitignore b/.gitignore index 38ee1c5..9b6a968 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ /config-target.* /config.status /config-temp +/trace-events-all /trace/generated-tracers.h /trace/generated-tracers.c /trace/generated-tracers-dtrace.h diff --git a/Makefile b/Makefile index 53e4119..7087fc2 100644 --- a/Makefile +++ b/Makefile @@ -487,7 +487,7 @@ endif set -e; for x in $(KEYMAPS); do \ $(INSTALL_DATA) $(SRC_PATH)/pc-bios/keymaps/$$x "$(DESTDIR)$(qemu_datadir)/keymaps"; \ done - $(INSTALL_DATA) $(SRC_PATH)/trace-events "$(DESTDIR)$(qemu_datadir)/trace-events" + $(INSTALL_DATA) $(BUILD_DIR)/trace-events-all "$(DESTDIR)$(qemu_datadir)/trace-events-all" for d in $(TARGET_DIRS); do \ $(MAKE) $(SUBDIR_MAKEFLAGS) TARGET_DIR=$$d/ -C $$d $@ || exit 1 ; \ done diff --git a/Makefile.objs b/Makefile.objs index da49b71..697fc66 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -115,3 +115,7 @@ qga-vss-dll-obj-y = qga/ # contrib ivshmem-client-obj-y = contrib/ivshmem-client/ ivshmem-server-obj-y = contrib/ivshmem-server/ + + +## +trace-events-y = trace-events diff --git a/Makefile.target b/Makefile.target index 495b474..d720b3e 100644 --- a/Makefile.target +++ b/Makefile.target @@ -48,7 +48,7 @@ else TARGET_TYPE=system endif -$(QEMU_PROG).stp-installed: $(SRC_PATH)/trace-events +$(QEMU_PROG).stp-installed: $(BUILD_DIR)/trace-events-all $(call quiet-command,$(TRACETOOL) \ --format=stap \ --backends=$(TRACE_BACKENDS) \ @@ -57,7 +57,7 @@ $(QEMU_PROG).stp-installed: $(SRC_PATH)/trace-events --target-type=$(TARGET_TYPE) \ < $< > $@," GEN $(TARGET_DIR)$(QEMU_PROG).stp-installed") -$(QEMU_PROG).stp: $(SRC_PATH)/trace-events +$(QEMU_PROG).stp: $(BUILD_DIR)/trace-events-all $(call quiet-command,$(TRACETOOL) \ --format=stap \ --backends=$(TRACE_BACKENDS) \ @@ -66,7 +66,7 @@ $(QEMU_PROG).stp: $(SRC_PATH)/trace-events --target-type=$(TARGET_TYPE) \ < $< > $@," GEN $(TARGET_DIR)$(QEMU_PROG).stp") -$(QEMU_PROG)-simpletrace.stp: $(SRC_PATH)/trace-events +$(QEMU_PROG)-simpletrace.stp: $(BUILD_DIR)/trace-events-all $(call quiet-command,$(TRACETOOL) \ --format=simpletrace-stap \ --backends=$(TRACE_BACKENDS) \ diff --git a/docs/tracing.txt b/docs/tracing.txt index 0bd6b9c..29f2f9a 100644 --- a/docs/tracing.txt +++ b/docs/tracing.txt @@ -23,20 +23,24 @@ for debugging, profiling, and observing execution. 4. Pretty-print the binary trace file: -./scripts/simpletrace.py trace-events trace-* # Override * with QEMU +./scripts/simpletrace.py trace-events-all trace-* # Override * with QEMU == Trace events == -There is a set of static trace events declared in the "trace-events" source -file. Each trace event declaration names the event, its arguments, and the -format string which can be used for pretty-printing: +Each directory in the source tree can declare a set of static trace events +in a "trace-events" file. Each trace event declaration names the event, its +arguments, and the format string which can be used for pretty-printing: qemu_vmalloc(size_t size, void *ptr) "size %zu ptr %p" qemu_vfree(void *ptr) "ptr %p" -The "trace-events" file is processed by the "tracetool" script during build to -generate code for the trace events. Trace events are invoked directly from -source code like this: +All "trace-events" files must be listed in the "trace-event-y" make variable +in the top level Makefile.objs. During build the individual files are combined +to create a "trace-events-all" file, which is processed by the "tracetool" +script during build to generate code for the trace events. The +"trace-events-all" file is also installed into "/usr/share/qemu". + +Trace events are invoked directly from source code like this: #include "trace.h" /* needed for trace event prototype */ @@ -196,12 +200,12 @@ Restriction: "ftrace" backend is restricted to Linux only. Analyzing trace files The "simple" backend produces binary trace