Skip to content

Commit

Permalink
trace: pass trace-events to tracetool as a positional param
Browse files Browse the repository at this point in the history
Instead of reading the contents of 'trace-events' from stdin,
accept the filename as a positional parameter. This also
allows for reading from multiple files, though this facility
is not used at this time.

Reviewed-by: Stefan Hajnoczi <[email protected]>
Reviewed-by: Lluís Vilanova <[email protected]>
Signed-off-by: Daniel P. Berrange <[email protected]>
Message-id: [email protected]
Signed-off-by: Stefan Hajnoczi <[email protected]>
  • Loading branch information
berrange authored and stefanhaRH committed Oct 12, 2016
1 parent 9096b78 commit 0bc6484
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
6 changes: 3 additions & 3 deletions Makefile.target
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ $(QEMU_PROG).stp-installed: $(BUILD_DIR)/trace-events-all
--binary=$(bindir)/$(QEMU_PROG) \
--target-name=$(TARGET_NAME) \
--target-type=$(TARGET_TYPE) \
< $< > $@,"GEN","$(TARGET_DIR)$(QEMU_PROG).stp-installed")
$< > $@,"GEN","$(TARGET_DIR)$(QEMU_PROG).stp-installed")

$(QEMU_PROG).stp: $(BUILD_DIR)/trace-events-all
$(call quiet-command,$(TRACETOOL) \
Expand All @@ -64,14 +64,14 @@ $(QEMU_PROG).stp: $(BUILD_DIR)/trace-events-all
--binary=$(realpath .)/$(QEMU_PROG) \
--target-name=$(TARGET_NAME) \
--target-type=$(TARGET_TYPE) \
< $< > $@,"GEN","$(TARGET_DIR)$(QEMU_PROG).stp")
$< > $@,"GEN","$(TARGET_DIR)$(QEMU_PROG).stp")

$(QEMU_PROG)-simpletrace.stp: $(BUILD_DIR)/trace-events-all
$(call quiet-command,$(TRACETOOL) \
--format=simpletrace-stap \
--backends=$(TRACE_BACKENDS) \
--probe-prefix=qemu.$(TARGET_TYPE).$(TARGET_NAME) \
< $< > $@,"GEN","$(TARGET_DIR)$(QEMU_PROG)-simpletrace.stp")
$< > $@,"GEN","$(TARGET_DIR)$(QEMU_PROG)-simpletrace.stp")

else
stap:
Expand Down
5 changes: 4 additions & 1 deletion scripts/tracetool.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,10 @@ def main(args):
if probe_prefix is None:
probe_prefix = ".".join(["qemu", target_type, target_name])

events = tracetool.read_events(sys.stdin)
if len(args) != 1:
error_opt("missing trace-events filepath")
with open(args[0], "r") as fh:
events = tracetool.read_events(fh)

try:
tracetool.generate(events, arg_format, arg_backends,
Expand Down
18 changes: 9 additions & 9 deletions trace/Makefile.objs
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ $(obj)/generated-ust-provider.h-timestamp: $(BUILD_DIR)/trace-events-all $(trace
$(call quiet-command,$(TRACETOOL) \
--format=ust-events-h \
--backends=$(TRACE_BACKENDS) \
< $< > $@,"GEN","$(patsubst %-timestamp,%,$@)")
$< > $@,"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) \
--format=ust-events-c \
--backends=$(TRACE_BACKENDS) \
< $< > $@,"GEN","$(patsubst %-timestamp,%,$@)")
$< > $@,"GEN","$(patsubst %-timestamp,%,$@)")

$(obj)/generated-tracers.h: $(obj)/generated-ust-provider.h
$(obj)/generated-tracers.c: $(obj)/generated-ust.c
Expand All @@ -50,7 +50,7 @@ $(obj)/generated-tracers.h-timestamp: $(BUILD_DIR)/trace-events-all $(BUILD_DIR)
$(call quiet-command,$(TRACETOOL) \
--format=h \
--backends=$(TRACE_BACKENDS) \
< $< > $@,"GEN","$(patsubst %-timestamp,%,$@)")
$< > $@,"GEN","$(patsubst %-timestamp,%,$@)")

##############################
# non-DTrace
Expand All @@ -61,7 +61,7 @@ $(obj)/generated-tracers.c-timestamp: $(BUILD_DIR)/trace-events-all $(BUILD_DIR)
$(call quiet-command,$(TRACETOOL) \
--format=c \
--backends=$(TRACE_BACKENDS) \
< $< > $@,"GEN","$(patsubst %-timestamp,%,$@)")
$< > $@,"GEN","$(patsubst %-timestamp,%,$@)")

$(obj)/generated-tracers.o: $(obj)/generated-tracers.c $(obj)/generated-tracers.h

Expand All @@ -79,7 +79,7 @@ $(obj)/generated-tracers-dtrace.dtrace-timestamp: $(BUILD_DIR)/trace-events-all
$(call quiet-command,$(TRACETOOL) \
--format=d \
--backends=$(TRACE_BACKENDS) \
< $< > $@,"GEN","$(patsubst %-timestamp,%,$@)")
$< > $@,"GEN","$(patsubst %-timestamp,%,$@)")

$(obj)/generated-tracers-dtrace.h: $(obj)/generated-tracers-dtrace.dtrace
$(call quiet-command,dtrace -o $@ -h -s $<,"GEN","$@")
Expand All @@ -98,23 +98,23 @@ $(obj)/generated-helpers-wrappers.h-timestamp: $(BUILD_DIR)/trace-events-all $(B
$(call quiet-command,$(TRACETOOL) \
--format=tcg-helper-wrapper-h \
--backend=$(TRACE_BACKENDS) \
< $< > $@,"GEN","$(patsubst %-timestamp,%,$@)")
$< > $@,"GEN","$(patsubst %-timestamp,%,$@)")

$(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)
$(call quiet-command,$(TRACETOOL) \
--format=tcg-helper-h \
--backend=$(TRACE_BACKENDS) \
< $< > $@,"GEN","$(patsubst %-timestamp,%,$@)")
$< > $@,"GEN","$(patsubst %-timestamp,%,$@)")

$(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)
$(call quiet-command,$(TRACETOOL) \
--format=tcg-helper-c \
--backend=$(TRACE_BACKENDS) \
< $< > $@,"GEN","$(patsubst %-timestamp,%,$@)")
$< > $@,"GEN","$(patsubst %-timestamp,%,$@)")

$(obj)/generated-helpers.o: $(obj)/generated-helpers.c

Expand All @@ -127,7 +127,7 @@ $(obj)/generated-tcg-tracers.h-timestamp: $(BUILD_DIR)/trace-events-all $(BUILD_
$(call quiet-command,$(TRACETOOL) \
--format=tcg-h \
--backend=$(TRACE_BACKENDS) \
< $< > $@,"GEN","$(patsubst %-timestamp,%,$@)")
$< > $@,"GEN","$(patsubst %-timestamp,%,$@)")


######################################################################
Expand Down

0 comments on commit 0bc6484

Please sign in to comment.