mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-27 04:13:53 -06:00
trace: move setting of group name into Makefiles
Having tracetool.py figure out the right group name from just the input filename is not practical when considering the different build vs src path combinations. Instead simply take the group name as a command line arg from the Makefile, which can trivially provide the right name. Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 20170125161417.31949-6-berrange@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
parent
9c5826306d
commit
2098c56a9b
3 changed files with 21 additions and 14 deletions
|
@ -50,6 +50,7 @@ endif
|
||||||
|
|
||||||
$(QEMU_PROG).stp-installed: $(BUILD_DIR)/trace-events-all
|
$(QEMU_PROG).stp-installed: $(BUILD_DIR)/trace-events-all
|
||||||
$(call quiet-command,$(TRACETOOL) \
|
$(call quiet-command,$(TRACETOOL) \
|
||||||
|
--group=all \
|
||||||
--format=stap \
|
--format=stap \
|
||||||
--backends=$(TRACE_BACKENDS) \
|
--backends=$(TRACE_BACKENDS) \
|
||||||
--binary=$(bindir)/$(QEMU_PROG) \
|
--binary=$(bindir)/$(QEMU_PROG) \
|
||||||
|
@ -59,6 +60,7 @@ $(QEMU_PROG).stp-installed: $(BUILD_DIR)/trace-events-all
|
||||||
|
|
||||||
$(QEMU_PROG).stp: $(BUILD_DIR)/trace-events-all
|
$(QEMU_PROG).stp: $(BUILD_DIR)/trace-events-all
|
||||||
$(call quiet-command,$(TRACETOOL) \
|
$(call quiet-command,$(TRACETOOL) \
|
||||||
|
--group=all \
|
||||||
--format=stap \
|
--format=stap \
|
||||||
--backends=$(TRACE_BACKENDS) \
|
--backends=$(TRACE_BACKENDS) \
|
||||||
--binary=$(realpath .)/$(QEMU_PROG) \
|
--binary=$(realpath .)/$(QEMU_PROG) \
|
||||||
|
@ -68,6 +70,7 @@ $(QEMU_PROG).stp: $(BUILD_DIR)/trace-events-all
|
||||||
|
|
||||||
$(QEMU_PROG)-simpletrace.stp: $(BUILD_DIR)/trace-events-all
|
$(QEMU_PROG)-simpletrace.stp: $(BUILD_DIR)/trace-events-all
|
||||||
$(call quiet-command,$(TRACETOOL) \
|
$(call quiet-command,$(TRACETOOL) \
|
||||||
|
--group=all \
|
||||||
--format=simpletrace-stap \
|
--format=simpletrace-stap \
|
||||||
--backends=$(TRACE_BACKENDS) \
|
--backends=$(TRACE_BACKENDS) \
|
||||||
--probe-prefix=qemu.$(TARGET_TYPE).$(TARGET_NAME) \
|
--probe-prefix=qemu.$(TARGET_TYPE).$(TARGET_NAME) \
|
||||||
|
|
|
@ -49,6 +49,7 @@ Options:
|
||||||
--binary <path> Full path to QEMU binary.
|
--binary <path> Full path to QEMU binary.
|
||||||
--target-type <type> QEMU emulator target type ('system' or 'user').
|
--target-type <type> QEMU emulator target type ('system' or 'user').
|
||||||
--target-name <name> QEMU emulator target name.
|
--target-name <name> QEMU emulator target name.
|
||||||
|
--group <name> Name of the event group
|
||||||
--probe-prefix <prefix> Prefix for dtrace probe names
|
--probe-prefix <prefix> Prefix for dtrace probe names
|
||||||
(default: qemu-<target-type>-<target-name>).\
|
(default: qemu-<target-type>-<target-name>).\
|
||||||
""" % {
|
""" % {
|
||||||
|
@ -62,22 +63,12 @@ Options:
|
||||||
else:
|
else:
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
def make_group_name(filename):
|
|
||||||
dirname = os.path.realpath(os.path.dirname(filename))
|
|
||||||
basedir = os.path.join(os.path.dirname(__file__), os.pardir)
|
|
||||||
basedir = os.path.realpath(os.path.abspath(basedir))
|
|
||||||
dirname = dirname[len(basedir) + 1:]
|
|
||||||
|
|
||||||
if dirname == "":
|
|
||||||
return "common"
|
|
||||||
return "_" + re.sub(r"[^A-Za-z0-9]", "_", dirname)
|
|
||||||
|
|
||||||
def main(args):
|
def main(args):
|
||||||
global _SCRIPT
|
global _SCRIPT
|
||||||
_SCRIPT = args[0]
|
_SCRIPT = args[0]
|
||||||
|
|
||||||
long_opts = ["backends=", "format=", "help", "list-backends",
|
long_opts = ["backends=", "format=", "help", "list-backends",
|
||||||
"check-backends"]
|
"check-backends", "group="]
|
||||||
long_opts += ["binary=", "target-type=", "target-name=", "probe-prefix="]
|
long_opts += ["binary=", "target-type=", "target-name=", "probe-prefix="]
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -88,6 +79,7 @@ def main(args):
|
||||||
check_backends = False
|
check_backends = False
|
||||||
arg_backends = []
|
arg_backends = []
|
||||||
arg_format = ""
|
arg_format = ""
|
||||||
|
arg_group = None
|
||||||
binary = None
|
binary = None
|
||||||
target_type = None
|
target_type = None
|
||||||
target_name = None
|
target_name = None
|
||||||
|
@ -98,6 +90,8 @@ def main(args):
|
||||||
|
|
||||||
elif opt == "--backends":
|
elif opt == "--backends":
|
||||||
arg_backends = arg.split(",")
|
arg_backends = arg.split(",")
|
||||||
|
elif opt == "--group":
|
||||||
|
arg_group = arg
|
||||||
elif opt == "--format":
|
elif opt == "--format":
|
||||||
arg_format = arg
|
arg_format = arg
|
||||||
|
|
||||||
|
@ -129,6 +123,9 @@ def main(args):
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
|
if arg_group is None:
|
||||||
|
error_opt("group name is required")
|
||||||
|
|
||||||
if arg_format == "stap":
|
if arg_format == "stap":
|
||||||
if binary is None:
|
if binary is None:
|
||||||
error_opt("--binary is required for SystemTAP tapset generator")
|
error_opt("--binary is required for SystemTAP tapset generator")
|
||||||
|
@ -145,10 +142,8 @@ def main(args):
|
||||||
with open(args[0], "r") as fh:
|
with open(args[0], "r") as fh:
|
||||||
events = tracetool.read_events(fh)
|
events = tracetool.read_events(fh)
|
||||||
|
|
||||||
group = make_group_name(args[0])
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
tracetool.generate(events, group, arg_format, arg_backends,
|
tracetool.generate(events, arg_group, arg_format, arg_backends,
|
||||||
binary=binary, probe_prefix=probe_prefix)
|
binary=binary, probe_prefix=probe_prefix)
|
||||||
except tracetool.TracetoolError as e:
|
except tracetool.TracetoolError as e:
|
||||||
error_opt(str(e))
|
error_opt(str(e))
|
||||||
|
|
|
@ -20,6 +20,7 @@ $(obj)/generated-ust-provider.h: $(obj)/generated-ust-provider.h-timestamp
|
||||||
@cmp $< $@ >/dev/null 2>&1 || cp $< $@
|
@cmp $< $@ >/dev/null 2>&1 || cp $< $@
|
||||||
$(obj)/generated-ust-provider.h-timestamp: $(BUILD_DIR)/trace-events-all $(tracetool-y)
|
$(obj)/generated-ust-provider.h-timestamp: $(BUILD_DIR)/trace-events-all $(tracetool-y)
|
||||||
$(call quiet-command,$(TRACETOOL) \
|
$(call quiet-command,$(TRACETOOL) \
|
||||||
|
--group=all \
|
||||||
--format=ust-events-h \
|
--format=ust-events-h \
|
||||||
--backends=$(TRACE_BACKENDS) \
|
--backends=$(TRACE_BACKENDS) \
|
||||||
$< > $@,"GEN","$(patsubst %-timestamp,%,$@)")
|
$< > $@,"GEN","$(patsubst %-timestamp,%,$@)")
|
||||||
|
@ -28,6 +29,7 @@ $(obj)/generated-ust.c: $(obj)/generated-ust.c-timestamp $(BUILD_DIR)/config-hos
|
||||||
@cmp $< $@ >/dev/null 2>&1 || cp $< $@
|
@cmp $< $@ >/dev/null 2>&1 || cp $< $@
|
||||||
$(obj)/generated-ust.c-timestamp: $(BUILD_DIR)/trace-events-all $(tracetool-y)
|
$(obj)/generated-ust.c-timestamp: $(BUILD_DIR)/trace-events-all $(tracetool-y)
|
||||||
$(call quiet-command,$(TRACETOOL) \
|
$(call quiet-command,$(TRACETOOL) \
|
||||||
|
--group=all \
|
||||||
--format=ust-events-c \
|
--format=ust-events-c \
|
||||||
--backends=$(TRACE_BACKENDS) \
|
--backends=$(TRACE_BACKENDS) \
|
||||||
$< > $@,"GEN","$(patsubst %-timestamp,%,$@)")
|
$< > $@,"GEN","$(patsubst %-timestamp,%,$@)")
|
||||||
|
@ -48,6 +50,7 @@ $(obj)/generated-tracers.h: $(obj)/generated-tracers.h-timestamp
|
||||||
@cmp -s $< $@ || cp $< $@
|
@cmp -s $< $@ || cp $< $@
|
||||||
$(obj)/generated-tracers.h-timestamp: $(BUILD_DIR)/trace-events-all $(BUILD_DIR)/config-host.mak $(tracetool-y)
|
$(obj)/generated-tracers.h-timestamp: $(BUILD_DIR)/trace-events-all $(BUILD_DIR)/config-host.mak $(tracetool-y)
|
||||||
$(call quiet-command,$(TRACETOOL) \
|
$(call quiet-command,$(TRACETOOL) \
|
||||||
|
--group=all \
|
||||||
--format=h \
|
--format=h \
|
||||||
--backends=$(TRACE_BACKENDS) \
|
--backends=$(TRACE_BACKENDS) \
|
||||||
$< > $@,"GEN","$(patsubst %-timestamp,%,$@)")
|
$< > $@,"GEN","$(patsubst %-timestamp,%,$@)")
|
||||||
|
@ -59,6 +62,7 @@ $(obj)/generated-tracers.c: $(obj)/generated-tracers.c-timestamp
|
||||||
@cmp -s $< $@ || cp $< $@
|
@cmp -s $< $@ || cp $< $@
|
||||||
$(obj)/generated-tracers.c-timestamp: $(BUILD_DIR)/trace-events-all $(BUILD_DIR)/config-host.mak $(tracetool-y)
|
$(obj)/generated-tracers.c-timestamp: $(BUILD_DIR)/trace-events-all $(BUILD_DIR)/config-host.mak $(tracetool-y)
|
||||||
$(call quiet-command,$(TRACETOOL) \
|
$(call quiet-command,$(TRACETOOL) \
|
||||||
|
--group=all \
|
||||||
--format=c \
|
--format=c \
|
||||||
--backends=$(TRACE_BACKENDS) \
|
--backends=$(TRACE_BACKENDS) \
|
||||||
$< > $@,"GEN","$(patsubst %-timestamp,%,$@)")
|
$< > $@,"GEN","$(patsubst %-timestamp,%,$@)")
|
||||||
|
@ -77,6 +81,7 @@ $(obj)/generated-tracers-dtrace.dtrace: $(obj)/generated-tracers-dtrace.dtrace-t
|
||||||
@cmp $< $@ >/dev/null 2>&1 || cp $< $@
|
@cmp $< $@ >/dev/null 2>&1 || cp $< $@
|
||||||
$(obj)/generated-tracers-dtrace.dtrace-timestamp: $(BUILD_DIR)/trace-events-all $(BUILD_DIR)/config-host.mak $(tracetool-y)
|
$(obj)/generated-tracers-dtrace.dtrace-timestamp: $(BUILD_DIR)/trace-events-all $(BUILD_DIR)/config-host.mak $(tracetool-y)
|
||||||
$(call quiet-command,$(TRACETOOL) \
|
$(call quiet-command,$(TRACETOOL) \
|
||||||
|
--group=all \
|
||||||
--format=d \
|
--format=d \
|
||||||
--backends=$(TRACE_BACKENDS) \
|
--backends=$(TRACE_BACKENDS) \
|
||||||
$< > $@,"GEN","$(patsubst %-timestamp,%,$@)")
|
$< > $@,"GEN","$(patsubst %-timestamp,%,$@)")
|
||||||
|
@ -96,6 +101,7 @@ $(obj)/generated-helpers-wrappers.h: $(obj)/generated-helpers-wrappers.h-timesta
|
||||||
@cmp $< $@ >/dev/null 2>&1 || cp $< $@
|
@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: $(BUILD_DIR)/trace-events-all $(BUILD_DIR)/config-host.mak $(tracetool-y)
|
||||||
$(call quiet-command,$(TRACETOOL) \
|
$(call quiet-command,$(TRACETOOL) \
|
||||||
|
--group=all \
|
||||||
--format=tcg-helper-wrapper-h \
|
--format=tcg-helper-wrapper-h \
|
||||||
--backend=$(TRACE_BACKENDS) \
|
--backend=$(TRACE_BACKENDS) \
|
||||||
$< > $@,"GEN","$(patsubst %-timestamp,%,$@)")
|
$< > $@,"GEN","$(patsubst %-timestamp,%,$@)")
|
||||||
|
@ -104,6 +110,7 @@ $(obj)/generated-helpers.h: $(obj)/generated-helpers.h-timestamp
|
||||||
@cmp $< $@ >/dev/null 2>&1 || cp $< $@
|
@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: $(BUILD_DIR)/trace-events-all $(BUILD_DIR)/config-host.mak $(tracetool-y)
|
||||||
$(call quiet-command,$(TRACETOOL) \
|
$(call quiet-command,$(TRACETOOL) \
|
||||||
|
--group=all \
|
||||||
--format=tcg-helper-h \
|
--format=tcg-helper-h \
|
||||||
--backend=$(TRACE_BACKENDS) \
|
--backend=$(TRACE_BACKENDS) \
|
||||||
$< > $@,"GEN","$(patsubst %-timestamp,%,$@)")
|
$< > $@,"GEN","$(patsubst %-timestamp,%,$@)")
|
||||||
|
@ -112,6 +119,7 @@ $(obj)/generated-helpers.c: $(obj)/generated-helpers.c-timestamp
|
||||||
@cmp $< $@ >/dev/null 2>&1 || cp $< $@
|
@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: $(BUILD_DIR)/trace-events-all $(BUILD_DIR)/config-host.mak $(tracetool-y)
|
||||||
$(call quiet-command,$(TRACETOOL) \
|
$(call quiet-command,$(TRACETOOL) \
|
||||||
|
--group=all \
|
||||||
--format=tcg-helper-c \
|
--format=tcg-helper-c \
|
||||||
--backend=$(TRACE_BACKENDS) \
|
--backend=$(TRACE_BACKENDS) \
|
||||||
$< > $@,"GEN","$(patsubst %-timestamp,%,$@)")
|
$< > $@,"GEN","$(patsubst %-timestamp,%,$@)")
|
||||||
|
@ -125,6 +133,7 @@ $(obj)/generated-tcg-tracers.h: $(obj)/generated-tcg-tracers.h-timestamp
|
||||||
@cmp $< $@ >/dev/null 2>&1 || cp $< $@
|
@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: $(BUILD_DIR)/trace-events-all $(BUILD_DIR)/config-host.mak $(tracetool-y)
|
||||||
$(call quiet-command,$(TRACETOOL) \
|
$(call quiet-command,$(TRACETOOL) \
|
||||||
|
--group=all \
|
||||||
--format=tcg-h \
|
--format=tcg-h \
|
||||||
--backend=$(TRACE_BACKENDS) \
|
--backend=$(TRACE_BACKENDS) \
|
||||||
$< > $@,"GEN","$(patsubst %-timestamp,%,$@)")
|
$< > $@,"GEN","$(patsubst %-timestamp,%,$@)")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue