aboutsummaryrefslogtreecommitdiff
path: root/trace
diff options
context:
space:
mode:
authorDaniel P. Berrange <berrange@redhat.com>2017-01-25 16:14:15 +0000
committerStefan Hajnoczi <stefanha@redhat.com>2017-01-31 17:11:18 +0000
commit0ab8ed18a6fe98bfc82705b0f041fbf2a8ca5b60 (patch)
tree1b4150d07362a5f3782c81a6b4c972bae62f0641 /trace
parent2098c56a9bc5901e145fa5d4759f075808811685 (diff)
trace: switch to modular code generation for sub-directories
Introduce rules in the top level Makefile that are able to generate trace.[ch] files in every subdirectory which has a trace-events file. The top level directory is handled specially, so instead of creating trace.h, it creates trace-root.h. This allows sub-directories to include the top level trace-root.h file, without ambiguity wrt to the trace.g file in the current sub-dir. Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 20170125161417.31949-7-berrange@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'trace')
-rw-r--r--trace/Makefile.objs94
-rw-r--r--trace/control-target.c2
-rw-r--r--trace/control.c2
-rw-r--r--trace/ftrace.c2
-rw-r--r--trace/simple.c1
5 files changed, 8 insertions, 93 deletions
diff --git a/trace/Makefile.objs b/trace/Makefile.objs
index d3b47da9ab..7de840ad7e 100644
--- a/trace/Makefile.objs
+++ b/trace/Makefile.objs
@@ -8,98 +8,16 @@
tracetool-y = $(SRC_PATH)/scripts/tracetool.py
tracetool-y += $(shell find $(SRC_PATH)/scripts/tracetool -name "*.py")
-$(BUILD_DIR)/trace-events-all: $(trace-events-y:%=$(SRC_PATH)/%)
+$(BUILD_DIR)/trace-events-all: $(trace-events-files)
$(call quiet-command,cat $^ > $@)
-######################################################################
-# Auto-generated event descriptions for LTTng ust code
-
-ifeq ($(findstring ust,$(TRACE_BACKENDS)),ust)
-
-$(obj)/generated-ust-provider.h: $(obj)/generated-ust-provider.h-timestamp
- @cmp $< $@ >/dev/null 2>&1 || cp $< $@
-$(obj)/generated-ust-provider.h-timestamp: $(BUILD_DIR)/trace-events-all $(tracetool-y)
- $(call quiet-command,$(TRACETOOL) \
- --group=all \
- --format=ust-events-h \
- --backends=$(TRACE_BACKENDS) \
- $< > $@,"GEN","$(patsubst %-timestamp,%,$@)")
-
-$(obj)/generated-ust.c: $(obj)/generated-ust.c-timestamp $(BUILD_DIR)/config-host.mak
- @cmp $< $@ >/dev/null 2>&1 || cp $< $@
-$(obj)/generated-ust.c-timestamp: $(BUILD_DIR)/trace-events-all $(tracetool-y)
- $(call quiet-command,$(TRACETOOL) \
- --group=all \
- --format=ust-events-c \
- --backends=$(TRACE_BACKENDS) \
- $< > $@,"GEN","$(patsubst %-timestamp,%,$@)")
-
-$(obj)/generated-tracers.h: $(obj)/generated-ust-provider.h
-$(obj)/generated-tracers.c: $(obj)/generated-ust.c
-
-endif
-
-
-######################################################################
-# Auto-generated tracing routines
-
-##################################################
-# Execution level
-
-$(obj)/generated-tracers.h: $(obj)/generated-tracers.h-timestamp
- @cmp -s $< $@ || cp $< $@
-$(obj)/generated-tracers.h-timestamp: $(BUILD_DIR)/trace-events-all $(BUILD_DIR)/config-host.mak $(tracetool-y)
- $(call quiet-command,$(TRACETOOL) \
- --group=all \
- --format=h \
- --backends=$(TRACE_BACKENDS) \
- $< > $@,"GEN","$(patsubst %-timestamp,%,$@)")
-
-##############################
-# non-DTrace
-
-$(obj)/generated-tracers.c: $(obj)/generated-tracers.c-timestamp
- @cmp -s $< $@ || cp $< $@
-$(obj)/generated-tracers.c-timestamp: $(BUILD_DIR)/trace-events-all $(BUILD_DIR)/config-host.mak $(tracetool-y)
- $(call quiet-command,$(TRACETOOL) \
- --group=all \
- --format=c \
- --backends=$(TRACE_BACKENDS) \
- $< > $@,"GEN","$(patsubst %-timestamp,%,$@)")
-
-$(obj)/generated-tracers.o: $(obj)/generated-tracers.c $(obj)/generated-tracers.h
-
-##############################
-# DTrace
-
-# Normal practice is to name DTrace probe file with a '.d' extension
-# but that gets picked up by QEMU's Makefile as an external dependency
-# rule file. So we use '.dtrace' instead
-ifeq ($(findstring dtrace,$(TRACE_BACKENDS)),dtrace)
-
-$(obj)/generated-tracers-dtrace.dtrace: $(obj)/generated-tracers-dtrace.dtrace-timestamp
- @cmp $< $@ >/dev/null 2>&1 || cp $< $@
-$(obj)/generated-tracers-dtrace.dtrace-timestamp: $(BUILD_DIR)/trace-events-all $(BUILD_DIR)/config-host.mak $(tracetool-y)
- $(call quiet-command,$(TRACETOOL) \
- --group=all \
- --format=d \
- --backends=$(TRACE_BACKENDS) \
- $< > $@,"GEN","$(patsubst %-timestamp,%,$@)")
-
-$(obj)/generated-tracers-dtrace.h: $(obj)/generated-tracers-dtrace.dtrace
- $(call quiet-command,dtrace -o $@ -h -s $<,"GEN","$@")
-
-$(obj)/generated-tracers-dtrace.o: $(obj)/generated-tracers-dtrace.dtrace
-
-util-obj-y += generated-tracers-dtrace.o
-endif
##################################################
# Translation level
$(obj)/generated-helpers-wrappers.h: $(obj)/generated-helpers-wrappers.h-timestamp
@cmp $< $@ >/dev/null 2>&1 || cp $< $@
-$(obj)/generated-helpers-wrappers.h-timestamp: $(BUILD_DIR)/trace-events-all $(BUILD_DIR)/config-host.mak $(tracetool-y)
+$(obj)/generated-helpers-wrappers.h-timestamp: $(trace-events-files) $(BUILD_DIR)/config-host.mak $(tracetool-y)
$(call quiet-command,$(TRACETOOL) \
--group=all \
--format=tcg-helper-wrapper-h \
@@ -108,7 +26,7 @@ $(obj)/generated-helpers-wrappers.h-timestamp: $(BUILD_DIR)/trace-events-all $(B
$(obj)/generated-helpers.h: $(obj)/generated-helpers.h-timestamp
@cmp $< $@ >/dev/null 2>&1 || cp $< $@
-$(obj)/generated-helpers.h-timestamp: $(BUILD_DIR)/trace-events-all $(BUILD_DIR)/config-host.mak $(tracetool-y)
+$(obj)/generated-helpers.h-timestamp: $(trace-events-files) $(BUILD_DIR)/config-host.mak $(tracetool-y)
$(call quiet-command,$(TRACETOOL) \
--group=all \
--format=tcg-helper-h \
@@ -117,7 +35,7 @@ $(obj)/generated-helpers.h-timestamp: $(BUILD_DIR)/trace-events-all $(BUILD_DIR)
$(obj)/generated-helpers.c: $(obj)/generated-helpers.c-timestamp
@cmp $< $@ >/dev/null 2>&1 || cp $< $@
-$(obj)/generated-helpers.c-timestamp: $(BUILD_DIR)/trace-events-all $(BUILD_DIR)/config-host.mak $(tracetool-y)
+$(obj)/generated-helpers.c-timestamp: $(trace-events-files) $(BUILD_DIR)/config-host.mak $(tracetool-y)
$(call quiet-command,$(TRACETOOL) \
--group=all \
--format=tcg-helper-c \
@@ -131,7 +49,7 @@ target-obj-y += generated-helpers.o
$(obj)/generated-tcg-tracers.h: $(obj)/generated-tcg-tracers.h-timestamp
@cmp $< $@ >/dev/null 2>&1 || cp $< $@
-$(obj)/generated-tcg-tracers.h-timestamp: $(BUILD_DIR)/trace-events-all $(BUILD_DIR)/config-host.mak $(tracetool-y)
+$(obj)/generated-tcg-tracers.h-timestamp: $(trace-events-files) $(BUILD_DIR)/config-host.mak $(tracetool-y)
$(call quiet-command,$(TRACETOOL) \
--group=all \
--format=tcg-h \
@@ -142,10 +60,8 @@ $(obj)/generated-tcg-tracers.h-timestamp: $(BUILD_DIR)/trace-events-all $(BUILD_
######################################################################
# Backend code
-util-obj-y += generated-tracers.o
util-obj-$(CONFIG_TRACE_SIMPLE) += simple.o
util-obj-$(CONFIG_TRACE_FTRACE) += ftrace.o
-util-obj-$(CONFIG_TRACE_UST) += generated-ust.o
util-obj-y += control.o
target-obj-y += control-target.o
util-obj-y += qmp.o
diff --git a/trace/control-target.c b/trace/control-target.c
index e2e138a3f0..6266e6380d 100644
--- a/trace/control-target.c
+++ b/trace/control-target.c
@@ -9,7 +9,7 @@
#include "qemu/osdep.h"
#include "cpu.h"
-#include "trace.h"
+#include "trace-root.h"
#include "trace/control.h"
#include "translate-all.h"
diff --git a/trace/control.c b/trace/control.c
index 56a2632584..9b157b0ca7 100644
--- a/trace/control.c
+++ b/trace/control.c
@@ -26,7 +26,7 @@
#include "qemu/error-report.h"
#include "qemu/config-file.h"
#include "monitor/monitor.h"
-#include "trace.h"
+#include "trace-root.h"
int trace_events_enabled_count;
diff --git a/trace/ftrace.c b/trace/ftrace.c
index 3588bb0eb4..7de104deba 100644
--- a/trace/ftrace.c
+++ b/trace/ftrace.c
@@ -10,8 +10,8 @@
*/
#include "qemu/osdep.h"
-#include "trace.h"
#include "trace/control.h"
+#include "trace/ftrace.h"
int trace_marker_fd;
diff --git a/trace/simple.c b/trace/simple.c
index b263622fa9..a221a3f703 100644
--- a/trace/simple.c
+++ b/trace/simple.c
@@ -13,7 +13,6 @@
#include <pthread.h>
#endif
#include "qemu/timer.h"
-#include "trace.h"
#include "trace/control.h"
#include "trace/simple.h"