* [Qemu-devel] [PATCH 1/5] trace: Add trace-events file for declaring trace events
2010-05-22 21:08 [Qemu-devel] [RFC 0/5] Tracing backends Stefan Hajnoczi
@ 2010-05-22 21:08 ` Stefan Hajnoczi
2010-05-24 22:07 ` Anthony Liguori
2010-05-24 22:20 ` Anthony Liguori
2010-05-22 21:08 ` [Qemu-devel] [PATCH 2/5] trace: Add simple built-in tracing backend Stefan Hajnoczi
` (4 subsequent siblings)
5 siblings, 2 replies; 12+ messages in thread
From: Stefan Hajnoczi @ 2010-05-22 21:08 UTC (permalink / raw)
To: qemu-devel, kvm
Cc: Jan Kiszka, Anthony Liguori, Stefan Hajnoczi, Prerna Saxena
This patch introduces the trace-events file where trace events can be
declared like so:
qemu_malloc(size_t size) "size %zu"
qemu_free(void *ptr) "ptr %p"
These trace event declarations are processed by a new tool called
tracetool to generate code for the trace events. Trace event
declarations are independent of the backend tracing system (LTTng User
Space Tracing, kernel markers, DTrace).
The default "nop" backend generates empty trace event functions.
Therefore trace events are disabled by default.
The trace-events file serves to purposes:
1. Adding trace events is easy. It is not necessary to understand the
details of a backend tracing system. The trace-events file is a
single location where trace events can be declared without code
duplication.
2. QEMU is not tightly coupled to one particular backend tracing system.
In order to support tracing across QEMU host platforms and to
anticipate new backend tracing systems that are currently maturing,
it is important to be flexible and not tied to one system.
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
---
.gitignore | 2 +
Makefile | 17 +++++--
Makefile.objs | 5 ++
Makefile.target | 1 +
configure | 19 +++++++
trace-events | 24 ++++++++
tracetool | 162 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
7 files changed, 226 insertions(+), 4 deletions(-)
create mode 100644 trace-events
create mode 100755 tracetool
diff --git a/.gitignore b/.gitignore
index fdfe2f0..4644557 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,8 @@ config-devices.*
config-all-devices.*
config-host.*
config-target.*
+trace.h
+trace.c
*-softmmu
*-darwin-user
*-linux-user
diff --git a/Makefile b/Makefile
index 306a1a4..ff57845 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
# Makefile for QEMU.
-GENERATED_HEADERS = config-host.h
+GENERATED_HEADERS = config-host.h trace.h
ifneq ($(wildcard config-host.mak),)
# Put the all: rule here so that config-host.mak can contain dependencies.
@@ -130,16 +130,24 @@ bt-host.o: QEMU_CFLAGS += $(BLUEZ_CFLAGS)
iov.o: iov.c iov.h
+trace.h: trace-events
+ $(call quiet-command,sh $(SRC_PATH)/tracetool --$(TRACE_BACKEND) -h < $< > $@," GEN $@")
+
+trace.c: trace-events
+ $(call quiet-command,sh $(SRC_PATH)/tracetool --$(TRACE_BACKEND) -c < $< > $@," GEN $@")
+
+trace.o: trace.c
+
######################################################################
qemu-img.o: qemu-img-cmds.h
qemu-img.o qemu-tool.o qemu-nbd.o qemu-io.o: $(GENERATED_HEADERS)
-qemu-img$(EXESUF): qemu-img.o qemu-tool.o qemu-error.o $(block-obj-y) $(qobject-obj-y)
+qemu-img$(EXESUF): qemu-img.o qemu-tool.o qemu-error.o $(trace-obj-y) $(block-obj-y) $(qobject-obj-y)
-qemu-nbd$(EXESUF): qemu-nbd.o qemu-tool.o qemu-error.o $(block-obj-y) $(qobject-obj-y)
+qemu-nbd$(EXESUF): qemu-nbd.o qemu-tool.o qemu-error.o $(trace-obj-y) $(block-obj-y) $(qobject-obj-y)
-qemu-io$(EXESUF): qemu-io.o cmd.o qemu-tool.o qemu-error.o $(block-obj-y) $(qobject-obj-y)
+qemu-io$(EXESUF): qemu-io.o cmd.o qemu-tool.o qemu-error.o $(trace-obj-y) $(block-obj-y) $(qobject-obj-y)
qemu-img-cmds.h: $(SRC_PATH)/qemu-img-cmds.hx
$(call quiet-command,sh $(SRC_PATH)/hxtool -h < $< > $@," GEN $@")
@@ -157,6 +165,7 @@ clean:
rm -f *.o *.d *.a $(TOOLS) TAGS cscope.* *.pod *~ */*~
rm -f slirp/*.o slirp/*.d audio/*.o audio/*.d block/*.o block/*.d net/*.o net/*.d
rm -f qemu-img-cmds.h
+ rm -f trace.c trace.h
$(MAKE) -C tests clean
for d in $(ALL_SUBDIRS) libhw32 libhw64 libuser libdis libdis-user; do \
if test -d $$d; then $(MAKE) -C $$d $@ || exit 1; fi; \
diff --git a/Makefile.objs b/Makefile.objs
index acbaf22..9bbdf6f 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -248,6 +248,11 @@ libdis-$(CONFIG_S390_DIS) += s390-dis.o
libdis-$(CONFIG_SH4_DIS) += sh4-dis.o
libdis-$(CONFIG_SPARC_DIS) += sparc-dis.o
+######################################################################
+# trace
+
+trace-obj-y = trace.o
+
vl.o: QEMU_CFLAGS+=$(GPROF_CFLAGS)
vl.o: QEMU_CFLAGS+=$(SDL_CFLAGS)
diff --git a/Makefile.target b/Makefile.target
index a22484e..4e63c02 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -294,6 +294,7 @@ $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y): $(GENERATED_HEADERS)
obj-y += $(addprefix ../, $(common-obj-y))
obj-y += $(addprefix ../libdis/, $(libdis-y))
+obj-y += $(addprefix ../, $(trace-obj-y))
obj-y += $(libobj-y)
obj-y += $(addprefix $(HWDIR)/, $(hw-obj-y))
diff --git a/configure b/configure
index 3cd2c5f..5e66f3a 100755
--- a/configure
+++ b/configure
@@ -299,6 +299,7 @@ pkgversion=""
check_utests="no"
user_pie="no"
zero_malloc=""
+trace_backend="nop"
# OS specific
if check_define __linux__ ; then
@@ -494,6 +495,8 @@ for opt do
;;
--target-list=*) target_list="$optarg"
;;
+ --trace-backend=*) trace_backend="$optarg"
+ ;;
--enable-gprof) gprof="yes"
;;
--static)
@@ -826,6 +829,7 @@ echo " --enable-docs enable documentation build"
echo " --disable-docs disable documentation build"
echo " --disable-vhost-net disable vhost-net acceleration support"
echo " --enable-vhost-net enable vhost-net acceleration support"
+echo " --trace-backend=B Trace backend nop"
echo ""
echo "NOTE: The object files are built at the place where configure is launched"
exit 1
@@ -1914,6 +1918,18 @@ if compile_prog "" "" ; then
fdatasync=yes
fi
+##########################################
+# check if trace backend exists
+
+sh tracetool "--$trace_backend" --check-backend > /dev/null 2> /dev/null
+if test "$?" -ne 0 ; then
+ echo
+ echo "Error: invalid trace backend"
+ echo "Please choose a supported trace backend."
+ echo
+ exit 1
+fi
+
# End of CC checks
# After here, no more $cc or $ld runs
@@ -2041,6 +2057,7 @@ echo "preadv support $preadv"
echo "fdatasync $fdatasync"
echo "uuid support $uuid"
echo "vhost-net support $vhost_net"
+echo "Trace backend $trace_backend"
if test $sdl_too_old = "yes"; then
echo "-> Your SDL version is too old - please upgrade to have SDL support"
@@ -2284,6 +2301,8 @@ bsd)
;;
esac
+echo "TRACE_BACKEND=$trace_backend" >> $config_host_mak
+
tools=
if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools"
diff --git a/trace-events b/trace-events
new file mode 100644
index 0000000..a37d3cc
--- /dev/null
+++ b/trace-events
@@ -0,0 +1,24 @@
+# Trace events for debugging and performance instrumentation
+#
+# This file is processed by the tracetool script during the build.
+#
+# To add a new trace event:
+#
+# 1. Choose a name for the trace event. Declare its arguments and format
+# string.
+#
+# 2. Call the trace event from code using trace_##name, e.g. multiwrite_cb() ->
+# trace_multiwrite_cb(). The source file must #include "trace.h".
+#
+# Format of a trace event:
+#
+# <name>(<type1> <arg1>[, <type2> <arg2>] ...) "<format-string>"
+#
+# Example: qemu_malloc(size_t size) "size %zu"
+#
+# The <name> must be a valid as a C function name.
+#
+# Types should be standard C types. Use void * for pointers because the trace
+# system may not have the necessary headers included.
+#
+# The <format-string> should be a sprintf()-compatible format string.
diff --git a/tracetool b/tracetool
new file mode 100755
index 0000000..e243d42
--- /dev/null
+++ b/tracetool
@@ -0,0 +1,162 @@
+#!/bin/sh
+
+usage()
+{
+ cat >&2 <<EOF
+usage: $0 --nop [-h | -c]
+Generate tracing code for a file on stdin.
+
+Backends:
+ --nop Tracing disabled
+
+Output formats:
+ -h Generate .h file
+ -c Generate .c file
+EOF
+ exit 1
+}
+
+# Get the name of a trace event
+get_name()
+{
+ echo ${1%%(*}
+}
+
+# Get the argument list of a trace event, including types and names
+get_args()
+{
+ local args
+ args=${1#*(}
+ args=${args%)*}
+ echo "$args"
+}
+
+# Get the argument name list of a trace event
+get_argnames()
+{
+ local first field name
+ for field in $(get_args "$1"); do
+ # Drop pointer star
+ field=${field#\*}
+
+ # Only argument names have commas at the end
+ name=${field%,}
+ test "$field" = "$name" && continue
+
+ echo -n "$name, "
+ done
+ echo -n "$name"
+}
+
+# Get the format string for a trace event
+get_fmt()
+{
+ local fmt
+ fmt=${1#*\"}
+ fmt=${fmt%\"*}
+ echo "$fmt"
+}
+
+warn_autogen_c()
+{
+ echo "/* This file is autogenerated by tracetool, do not edit. */"
+}
+
+warn_autogen_h()
+{
+ echo "/* This file is autogenerated by tracetool, do not edit. */"
+}
+
+linetoh_begin_nop()
+{
+ return
+}
+
+linetoh_nop()
+{
+ local name args
+ name=$(get_name "$1")
+ args=$(get_args "$1")
+
+ # Define an empty function for the trace event
+ cat <<EOF
+static inline void trace_$name($args)
+{
+}
+EOF
+}
+
+linetoh_end_nop()
+{
+ return
+}
+
+linetoc_begin_nop()
+{
+ return
+}
+
+linetoc_nop()
+{
+ # No need for function definitions in nop backend
+ return
+}
+
+linetoc_end_nop()
+{
+ return
+}
+
+# Process stdin by calling begin, line, and end functions for the backend
+convert()
+{
+ local begin process_line end
+ begin="lineto$1_begin_$backend"
+ process_line="lineto$1_$backend"
+ end="lineto$1_end_$backend"
+
+ warn_autogen_$1
+ "$begin"
+
+ while read -r str; do
+ # Skip comments and empty lines
+ str=${str%%#*}
+ test -z "$str" && continue
+
+ echo
+ "$process_line" "$str"
+ done
+
+ echo
+ "$end"
+}
+
+tracetoh()
+{
+ echo "#ifndef TRACE_H"
+ echo "#define TRACE_H"
+ echo
+ convert h
+ echo "#endif /* TRACE_H */"
+}
+
+tracetoc()
+{
+ convert c
+}
+
+# Choose backend
+case "$1" in
+"--nop") backend="${1#--}" ;;
+*) usage ;;
+esac
+shift
+
+case "$1" in
+"-h") tracetoh ;;
+"-c") tracetoc ;;
+"--check-backend") exit 0 ;; # used by ./configure to test for backend
+*) usage ;;
+esac
+
+exit 0
--
1.7.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [Qemu-devel] [PATCH 1/5] trace: Add trace-events file for declaring trace events
2010-05-22 21:08 ` [Qemu-devel] [PATCH 1/5] trace: Add trace-events file for declaring trace events Stefan Hajnoczi
@ 2010-05-24 22:07 ` Anthony Liguori
2010-05-25 9:11 ` Avi Kivity
2010-05-24 22:20 ` Anthony Liguori
1 sibling, 1 reply; 12+ messages in thread
From: Anthony Liguori @ 2010-05-24 22:07 UTC (permalink / raw)
To: Stefan Hajnoczi; +Cc: Jan Kiszka, qemu-devel, kvm, Prerna Saxena
On 05/22/2010 04:08 PM, Stefan Hajnoczi wrote:
> This patch introduces the trace-events file where trace events can be
> declared like so:
>
> qemu_malloc(size_t size) "size %zu"
> qemu_free(void *ptr) "ptr %p"
>
> These trace event declarations are processed by a new tool called
> tracetool to generate code for the trace events. Trace event
> declarations are independent of the backend tracing system (LTTng User
> Space Tracing, kernel markers, DTrace).
>
> The default "nop" backend generates empty trace event functions.
> Therefore trace events are disabled by default.
>
> The trace-events file serves to purposes:
>
> 1. Adding trace events is easy. It is not necessary to understand the
> details of a backend tracing system. The trace-events file is a
> single location where trace events can be declared without code
> duplication.
>
> 2. QEMU is not tightly coupled to one particular backend tracing system.
> In order to support tracing across QEMU host platforms and to
> anticipate new backend tracing systems that are currently maturing,
> it is important to be flexible and not tied to one system.
>
> Signed-off-by: Stefan Hajnoczi<stefanha@linux.vnet.ibm.com>
>
Interesting approach as it lets us defer the tracing backend decision.
Regards,
Anthony Liguori
> ---
> .gitignore | 2 +
> Makefile | 17 +++++--
> Makefile.objs | 5 ++
> Makefile.target | 1 +
> configure | 19 +++++++
> trace-events | 24 ++++++++
> tracetool | 162 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 7 files changed, 226 insertions(+), 4 deletions(-)
> create mode 100644 trace-events
> create mode 100755 tracetool
>
> diff --git a/.gitignore b/.gitignore
> index fdfe2f0..4644557 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -2,6 +2,8 @@ config-devices.*
> config-all-devices.*
> config-host.*
> config-target.*
> +trace.h
> +trace.c
> *-softmmu
> *-darwin-user
> *-linux-user
> diff --git a/Makefile b/Makefile
> index 306a1a4..ff57845 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1,6 +1,6 @@
> # Makefile for QEMU.
>
> -GENERATED_HEADERS = config-host.h
> +GENERATED_HEADERS = config-host.h trace.h
>
> ifneq ($(wildcard config-host.mak),)
> # Put the all: rule here so that config-host.mak can contain dependencies.
> @@ -130,16 +130,24 @@ bt-host.o: QEMU_CFLAGS += $(BLUEZ_CFLAGS)
>
> iov.o: iov.c iov.h
>
> +trace.h: trace-events
> + $(call quiet-command,sh $(SRC_PATH)/tracetool --$(TRACE_BACKEND) -h< $< > $@," GEN $@")
> +
> +trace.c: trace-events
> + $(call quiet-command,sh $(SRC_PATH)/tracetool --$(TRACE_BACKEND) -c< $< > $@," GEN $@")
> +
> +trace.o: trace.c
> +
> ######################################################################
>
> qemu-img.o: qemu-img-cmds.h
> qemu-img.o qemu-tool.o qemu-nbd.o qemu-io.o: $(GENERATED_HEADERS)
>
> -qemu-img$(EXESUF): qemu-img.o qemu-tool.o qemu-error.o $(block-obj-y) $(qobject-obj-y)
> +qemu-img$(EXESUF): qemu-img.o qemu-tool.o qemu-error.o $(trace-obj-y) $(block-obj-y) $(qobject-obj-y)
>
> -qemu-nbd$(EXESUF): qemu-nbd.o qemu-tool.o qemu-error.o $(block-obj-y) $(qobject-obj-y)
> +qemu-nbd$(EXESUF): qemu-nbd.o qemu-tool.o qemu-error.o $(trace-obj-y) $(block-obj-y) $(qobject-obj-y)
>
> -qemu-io$(EXESUF): qemu-io.o cmd.o qemu-tool.o qemu-error.o $(block-obj-y) $(qobject-obj-y)
> +qemu-io$(EXESUF): qemu-io.o cmd.o qemu-tool.o qemu-error.o $(trace-obj-y) $(block-obj-y) $(qobject-obj-y)
>
> qemu-img-cmds.h: $(SRC_PATH)/qemu-img-cmds.hx
> $(call quiet-command,sh $(SRC_PATH)/hxtool -h< $< > $@," GEN $@")
> @@ -157,6 +165,7 @@ clean:
> rm -f *.o *.d *.a $(TOOLS) TAGS cscope.* *.pod *~ */*~
> rm -f slirp/*.o slirp/*.d audio/*.o audio/*.d block/*.o block/*.d net/*.o net/*.d
> rm -f qemu-img-cmds.h
> + rm -f trace.c trace.h
> $(MAKE) -C tests clean
> for d in $(ALL_SUBDIRS) libhw32 libhw64 libuser libdis libdis-user; do \
> if test -d $$d; then $(MAKE) -C $$d $@ || exit 1; fi; \
> diff --git a/Makefile.objs b/Makefile.objs
> index acbaf22..9bbdf6f 100644
> --- a/Makefile.objs
> +++ b/Makefile.objs
> @@ -248,6 +248,11 @@ libdis-$(CONFIG_S390_DIS) += s390-dis.o
> libdis-$(CONFIG_SH4_DIS) += sh4-dis.o
> libdis-$(CONFIG_SPARC_DIS) += sparc-dis.o
>
> +######################################################################
> +# trace
> +
> +trace-obj-y = trace.o
> +
> vl.o: QEMU_CFLAGS+=$(GPROF_CFLAGS)
>
> vl.o: QEMU_CFLAGS+=$(SDL_CFLAGS)
> diff --git a/Makefile.target b/Makefile.target
> index a22484e..4e63c02 100644
> --- a/Makefile.target
> +++ b/Makefile.target
> @@ -294,6 +294,7 @@ $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y): $(GENERATED_HEADERS)
>
> obj-y += $(addprefix ../, $(common-obj-y))
> obj-y += $(addprefix ../libdis/, $(libdis-y))
> +obj-y += $(addprefix ../, $(trace-obj-y))
> obj-y += $(libobj-y)
> obj-y += $(addprefix $(HWDIR)/, $(hw-obj-y))
>
> diff --git a/configure b/configure
> index 3cd2c5f..5e66f3a 100755
> --- a/configure
> +++ b/configure
> @@ -299,6 +299,7 @@ pkgversion=""
> check_utests="no"
> user_pie="no"
> zero_malloc=""
> +trace_backend="nop"
>
> # OS specific
> if check_define __linux__ ; then
> @@ -494,6 +495,8 @@ for opt do
> ;;
> --target-list=*) target_list="$optarg"
> ;;
> + --trace-backend=*) trace_backend="$optarg"
> + ;;
> --enable-gprof) gprof="yes"
> ;;
> --static)
> @@ -826,6 +829,7 @@ echo " --enable-docs enable documentation build"
> echo " --disable-docs disable documentation build"
> echo " --disable-vhost-net disable vhost-net acceleration support"
> echo " --enable-vhost-net enable vhost-net acceleration support"
> +echo " --trace-backend=B Trace backend nop"
> echo ""
> echo "NOTE: The object files are built at the place where configure is launched"
> exit 1
> @@ -1914,6 +1918,18 @@ if compile_prog "" "" ; then
> fdatasync=yes
> fi
>
> +##########################################
> +# check if trace backend exists
> +
> +sh tracetool "--$trace_backend" --check-backend> /dev/null 2> /dev/null
> +if test "$?" -ne 0 ; then
> + echo
> + echo "Error: invalid trace backend"
> + echo "Please choose a supported trace backend."
> + echo
> + exit 1
> +fi
> +
> # End of CC checks
> # After here, no more $cc or $ld runs
>
> @@ -2041,6 +2057,7 @@ echo "preadv support $preadv"
> echo "fdatasync $fdatasync"
> echo "uuid support $uuid"
> echo "vhost-net support $vhost_net"
> +echo "Trace backend $trace_backend"
>
> if test $sdl_too_old = "yes"; then
> echo "-> Your SDL version is too old - please upgrade to have SDL support"
> @@ -2284,6 +2301,8 @@ bsd)
> ;;
> esac
>
> +echo "TRACE_BACKEND=$trace_backend">> $config_host_mak
> +
> tools=
> if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
> tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools"
> diff --git a/trace-events b/trace-events
> new file mode 100644
> index 0000000..a37d3cc
> --- /dev/null
> +++ b/trace-events
> @@ -0,0 +1,24 @@
> +# Trace events for debugging and performance instrumentation
> +#
> +# This file is processed by the tracetool script during the build.
> +#
> +# To add a new trace event:
> +#
> +# 1. Choose a name for the trace event. Declare its arguments and format
> +# string.
> +#
> +# 2. Call the trace event from code using trace_##name, e.g. multiwrite_cb() ->
> +# trace_multiwrite_cb(). The source file must #include "trace.h".
> +#
> +# Format of a trace event:
> +#
> +#<name>(<type1> <arg1>[,<type2> <arg2>] ...) "<format-string>"
> +#
> +# Example: qemu_malloc(size_t size) "size %zu"
> +#
> +# The<name> must be a valid as a C function name.
> +#
> +# Types should be standard C types. Use void * for pointers because the trace
> +# system may not have the necessary headers included.
> +#
> +# The<format-string> should be a sprintf()-compatible format string.
> diff --git a/tracetool b/tracetool
> new file mode 100755
> index 0000000..e243d42
> --- /dev/null
> +++ b/tracetool
> @@ -0,0 +1,162 @@
> +#!/bin/sh
> +
> +usage()
> +{
> + cat>&2<<EOF
> +usage: $0 --nop [-h | -c]
> +Generate tracing code for a file on stdin.
> +
> +Backends:
> + --nop Tracing disabled
> +
> +Output formats:
> + -h Generate .h file
> + -c Generate .c file
> +EOF
> + exit 1
> +}
> +
> +# Get the name of a trace event
> +get_name()
> +{
> + echo ${1%%(*}
> +}
> +
> +# Get the argument list of a trace event, including types and names
> +get_args()
> +{
> + local args
> + args=${1#*(}
> + args=${args%)*}
> + echo "$args"
> +}
> +
> +# Get the argument name list of a trace event
> +get_argnames()
> +{
> + local first field name
> + for field in $(get_args "$1"); do
> + # Drop pointer star
> + field=${field#\*}
> +
> + # Only argument names have commas at the end
> + name=${field%,}
> + test "$field" = "$name"&& continue
> +
> + echo -n "$name, "
> + done
> + echo -n "$name"
> +}
> +
> +# Get the format string for a trace event
> +get_fmt()
> +{
> + local fmt
> + fmt=${1#*\"}
> + fmt=${fmt%\"*}
> + echo "$fmt"
> +}
> +
> +warn_autogen_c()
> +{
> + echo "/* This file is autogenerated by tracetool, do not edit. */"
> +}
> +
> +warn_autogen_h()
> +{
> + echo "/* This file is autogenerated by tracetool, do not edit. */"
> +}
> +
> +linetoh_begin_nop()
> +{
> + return
> +}
> +
> +linetoh_nop()
> +{
> + local name args
> + name=$(get_name "$1")
> + args=$(get_args "$1")
> +
> + # Define an empty function for the trace event
> + cat<<EOF
> +static inline void trace_$name($args)
> +{
> +}
> +EOF
> +}
> +
> +linetoh_end_nop()
> +{
> + return
> +}
> +
> +linetoc_begin_nop()
> +{
> + return
> +}
> +
> +linetoc_nop()
> +{
> + # No need for function definitions in nop backend
> + return
> +}
> +
> +linetoc_end_nop()
> +{
> + return
> +}
> +
> +# Process stdin by calling begin, line, and end functions for the backend
> +convert()
> +{
> + local begin process_line end
> + begin="lineto$1_begin_$backend"
> + process_line="lineto$1_$backend"
> + end="lineto$1_end_$backend"
> +
> + warn_autogen_$1
> + "$begin"
> +
> + while read -r str; do
> + # Skip comments and empty lines
> + str=${str%%#*}
> + test -z "$str"&& continue
> +
> + echo
> + "$process_line" "$str"
> + done
> +
> + echo
> + "$end"
> +}
> +
> +tracetoh()
> +{
> + echo "#ifndef TRACE_H"
> + echo "#define TRACE_H"
> + echo
> + convert h
> + echo "#endif /* TRACE_H */"
> +}
> +
> +tracetoc()
> +{
> + convert c
> +}
> +
> +# Choose backend
> +case "$1" in
> +"--nop") backend="${1#--}" ;;
> +*) usage ;;
> +esac
> +shift
> +
> +case "$1" in
> +"-h") tracetoh ;;
> +"-c") tracetoc ;;
> +"--check-backend") exit 0 ;; # used by ./configure to test for backend
> +*) usage ;;
> +esac
> +
> +exit 0
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Qemu-devel] [PATCH 1/5] trace: Add trace-events file for declaring trace events
2010-05-22 21:08 ` [Qemu-devel] [PATCH 1/5] trace: Add trace-events file for declaring trace events Stefan Hajnoczi
2010-05-24 22:07 ` Anthony Liguori
@ 2010-05-24 22:20 ` Anthony Liguori
2010-05-25 8:22 ` Stefan Hajnoczi
1 sibling, 1 reply; 12+ messages in thread
From: Anthony Liguori @ 2010-05-24 22:20 UTC (permalink / raw)
To: Stefan Hajnoczi
Cc: Jan Kiszka, Anthony Liguori, qemu-devel, kvm, Prerna Saxena
On 05/22/2010 04:08 PM, Stefan Hajnoczi wrote:
> This patch introduces the trace-events file where trace events can be
> declared like so:
>
> qemu_malloc(size_t size) "size %zu"
> qemu_free(void *ptr) "ptr %p"
>
> These trace event declarations are processed by a new tool called
> tracetool to generate code for the trace events. Trace event
> declarations are independent of the backend tracing system (LTTng User
> Space Tracing, kernel markers, DTrace).
>
> The default "nop" backend generates empty trace event functions.
> Therefore trace events are disabled by default.
>
> The trace-events file serves to purposes:
>
> 1. Adding trace events is easy. It is not necessary to understand the
> details of a backend tracing system. The trace-events file is a
> single location where trace events can be declared without code
> duplication.
>
> 2. QEMU is not tightly coupled to one particular backend tracing system.
> In order to support tracing across QEMU host platforms and to
> anticipate new backend tracing systems that are currently maturing,
> it is important to be flexible and not tied to one system.
>
> Signed-off-by: Stefan Hajnoczi<stefanha@linux.vnet.ibm.com>
> ---
> .gitignore | 2 +
> Makefile | 17 +++++--
> Makefile.objs | 5 ++
> Makefile.target | 1 +
> configure | 19 +++++++
> trace-events | 24 ++++++++
> tracetool | 162 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 7 files changed, 226 insertions(+), 4 deletions(-)
> create mode 100644 trace-events
> create mode 100755 tracetool
>
> diff --git a/.gitignore b/.gitignore
> index fdfe2f0..4644557 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -2,6 +2,8 @@ config-devices.*
> config-all-devices.*
> config-host.*
> config-target.*
> +trace.h
> +trace.c
> *-softmmu
> *-darwin-user
> *-linux-user
> diff --git a/Makefile b/Makefile
> index 306a1a4..ff57845 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1,6 +1,6 @@
> # Makefile for QEMU.
>
> -GENERATED_HEADERS = config-host.h
> +GENERATED_HEADERS = config-host.h trace.h
>
> ifneq ($(wildcard config-host.mak),)
> # Put the all: rule here so that config-host.mak can contain dependencies.
> @@ -130,16 +130,24 @@ bt-host.o: QEMU_CFLAGS += $(BLUEZ_CFLAGS)
>
> iov.o: iov.c iov.h
>
> +trace.h: trace-events
> + $(call quiet-command,sh $(SRC_PATH)/tracetool --$(TRACE_BACKEND) -h< $< > $@," GEN $@")
> +
> +trace.c: trace-events
> + $(call quiet-command,sh $(SRC_PATH)/tracetool --$(TRACE_BACKEND) -c< $< > $@," GEN $@")
> +
> +trace.o: trace.c
> +
> ######################################################################
>
> qemu-img.o: qemu-img-cmds.h
> qemu-img.o qemu-tool.o qemu-nbd.o qemu-io.o: $(GENERATED_HEADERS)
>
> -qemu-img$(EXESUF): qemu-img.o qemu-tool.o qemu-error.o $(block-obj-y) $(qobject-obj-y)
> +qemu-img$(EXESUF): qemu-img.o qemu-tool.o qemu-error.o $(trace-obj-y) $(block-obj-y) $(qobject-obj-y)
>
> -qemu-nbd$(EXESUF): qemu-nbd.o qemu-tool.o qemu-error.o $(block-obj-y) $(qobject-obj-y)
> +qemu-nbd$(EXESUF): qemu-nbd.o qemu-tool.o qemu-error.o $(trace-obj-y) $(block-obj-y) $(qobject-obj-y)
>
> -qemu-io$(EXESUF): qemu-io.o cmd.o qemu-tool.o qemu-error.o $(block-obj-y) $(qobject-obj-y)
> +qemu-io$(EXESUF): qemu-io.o cmd.o qemu-tool.o qemu-error.o $(trace-obj-y) $(block-obj-y) $(qobject-obj-y)
>
> qemu-img-cmds.h: $(SRC_PATH)/qemu-img-cmds.hx
> $(call quiet-command,sh $(SRC_PATH)/hxtool -h< $< > $@," GEN $@")
> @@ -157,6 +165,7 @@ clean:
> rm -f *.o *.d *.a $(TOOLS) TAGS cscope.* *.pod *~ */*~
> rm -f slirp/*.o slirp/*.d audio/*.o audio/*.d block/*.o block/*.d net/*.o net/*.d
> rm -f qemu-img-cmds.h
> + rm -f trace.c trace.h
> $(MAKE) -C tests clean
> for d in $(ALL_SUBDIRS) libhw32 libhw64 libuser libdis libdis-user; do \
> if test -d $$d; then $(MAKE) -C $$d $@ || exit 1; fi; \
> diff --git a/Makefile.objs b/Makefile.objs
> index acbaf22..9bbdf6f 100644
> --- a/Makefile.objs
> +++ b/Makefile.objs
> @@ -248,6 +248,11 @@ libdis-$(CONFIG_S390_DIS) += s390-dis.o
> libdis-$(CONFIG_SH4_DIS) += sh4-dis.o
> libdis-$(CONFIG_SPARC_DIS) += sparc-dis.o
>
> +######################################################################
> +# trace
> +
> +trace-obj-y = trace.o
> +
> vl.o: QEMU_CFLAGS+=$(GPROF_CFLAGS)
>
> vl.o: QEMU_CFLAGS+=$(SDL_CFLAGS)
> diff --git a/Makefile.target b/Makefile.target
> index a22484e..4e63c02 100644
> --- a/Makefile.target
> +++ b/Makefile.target
> @@ -294,6 +294,7 @@ $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y): $(GENERATED_HEADERS)
>
> obj-y += $(addprefix ../, $(common-obj-y))
> obj-y += $(addprefix ../libdis/, $(libdis-y))
> +obj-y += $(addprefix ../, $(trace-obj-y))
> obj-y += $(libobj-y)
> obj-y += $(addprefix $(HWDIR)/, $(hw-obj-y))
>
> diff --git a/configure b/configure
> index 3cd2c5f..5e66f3a 100755
> --- a/configure
> +++ b/configure
> @@ -299,6 +299,7 @@ pkgversion=""
> check_utests="no"
> user_pie="no"
> zero_malloc=""
> +trace_backend="nop"
>
> # OS specific
> if check_define __linux__ ; then
> @@ -494,6 +495,8 @@ for opt do
> ;;
> --target-list=*) target_list="$optarg"
> ;;
> + --trace-backend=*) trace_backend="$optarg"
> + ;;
> --enable-gprof) gprof="yes"
> ;;
> --static)
> @@ -826,6 +829,7 @@ echo " --enable-docs enable documentation build"
> echo " --disable-docs disable documentation build"
> echo " --disable-vhost-net disable vhost-net acceleration support"
> echo " --enable-vhost-net enable vhost-net acceleration support"
> +echo " --trace-backend=B Trace backend nop"
> echo ""
> echo "NOTE: The object files are built at the place where configure is launched"
> exit 1
> @@ -1914,6 +1918,18 @@ if compile_prog "" "" ; then
> fdatasync=yes
> fi
>
> +##########################################
> +# check if trace backend exists
> +
> +sh tracetool "--$trace_backend" --check-backend> /dev/null 2> /dev/null
>
This will fail if objdir != srcdir. You have to qualify tracetool with
the path to srcdir.
Regards,
Anthony Liguori
> +if test "$?" -ne 0 ; then
> + echo
> + echo "Error: invalid trace backend"
> + echo "Please choose a supported trace backend."
> + echo
> + exit 1
> +fi
> +
> # End of CC checks
> # After here, no more $cc or $ld runs
>
> @@ -2041,6 +2057,7 @@ echo "preadv support $preadv"
> echo "fdatasync $fdatasync"
> echo "uuid support $uuid"
> echo "vhost-net support $vhost_net"
> +echo "Trace backend $trace_backend"
>
> if test $sdl_too_old = "yes"; then
> echo "-> Your SDL version is too old - please upgrade to have SDL support"
> @@ -2284,6 +2301,8 @@ bsd)
> ;;
> esac
>
> +echo "TRACE_BACKEND=$trace_backend">> $config_host_mak
> +
> tools=
> if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
> tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools"
> diff --git a/trace-events b/trace-events
> new file mode 100644
> index 0000000..a37d3cc
> --- /dev/null
> +++ b/trace-events
> @@ -0,0 +1,24 @@
> +# Trace events for debugging and performance instrumentation
> +#
> +# This file is processed by the tracetool script during the build.
> +#
> +# To add a new trace event:
> +#
> +# 1. Choose a name for the trace event. Declare its arguments and format
> +# string.
> +#
> +# 2. Call the trace event from code using trace_##name, e.g. multiwrite_cb() ->
> +# trace_multiwrite_cb(). The source file must #include "trace.h".
> +#
> +# Format of a trace event:
> +#
> +#<name>(<type1> <arg1>[,<type2> <arg2>] ...) "<format-string>"
> +#
> +# Example: qemu_malloc(size_t size) "size %zu"
> +#
> +# The<name> must be a valid as a C function name.
> +#
> +# Types should be standard C types. Use void * for pointers because the trace
> +# system may not have the necessary headers included.
> +#
> +# The<format-string> should be a sprintf()-compatible format string.
> diff --git a/tracetool b/tracetool
> new file mode 100755
> index 0000000..e243d42
> --- /dev/null
> +++ b/tracetool
> @@ -0,0 +1,162 @@
> +#!/bin/sh
> +
> +usage()
> +{
> + cat>&2<<EOF
> +usage: $0 --nop [-h | -c]
> +Generate tracing code for a file on stdin.
> +
> +Backends:
> + --nop Tracing disabled
> +
> +Output formats:
> + -h Generate .h file
> + -c Generate .c file
> +EOF
> + exit 1
> +}
> +
> +# Get the name of a trace event
> +get_name()
> +{
> + echo ${1%%(*}
> +}
> +
> +# Get the argument list of a trace event, including types and names
> +get_args()
> +{
> + local args
> + args=${1#*(}
> + args=${args%)*}
> + echo "$args"
> +}
> +
> +# Get the argument name list of a trace event
> +get_argnames()
> +{
> + local first field name
> + for field in $(get_args "$1"); do
> + # Drop pointer star
> + field=${field#\*}
> +
> + # Only argument names have commas at the end
> + name=${field%,}
> + test "$field" = "$name"&& continue
> +
> + echo -n "$name, "
> + done
> + echo -n "$name"
> +}
> +
> +# Get the format string for a trace event
> +get_fmt()
> +{
> + local fmt
> + fmt=${1#*\"}
> + fmt=${fmt%\"*}
> + echo "$fmt"
> +}
> +
> +warn_autogen_c()
> +{
> + echo "/* This file is autogenerated by tracetool, do not edit. */"
> +}
> +
> +warn_autogen_h()
> +{
> + echo "/* This file is autogenerated by tracetool, do not edit. */"
> +}
> +
> +linetoh_begin_nop()
> +{
> + return
> +}
> +
> +linetoh_nop()
> +{
> + local name args
> + name=$(get_name "$1")
> + args=$(get_args "$1")
> +
> + # Define an empty function for the trace event
> + cat<<EOF
> +static inline void trace_$name($args)
> +{
> +}
> +EOF
> +}
> +
> +linetoh_end_nop()
> +{
> + return
> +}
> +
> +linetoc_begin_nop()
> +{
> + return
> +}
> +
> +linetoc_nop()
> +{
> + # No need for function definitions in nop backend
> + return
> +}
> +
> +linetoc_end_nop()
> +{
> + return
> +}
> +
> +# Process stdin by calling begin, line, and end functions for the backend
> +convert()
> +{
> + local begin process_line end
> + begin="lineto$1_begin_$backend"
> + process_line="lineto$1_$backend"
> + end="lineto$1_end_$backend"
> +
> + warn_autogen_$1
> + "$begin"
> +
> + while read -r str; do
> + # Skip comments and empty lines
> + str=${str%%#*}
> + test -z "$str"&& continue
> +
> + echo
> + "$process_line" "$str"
> + done
> +
> + echo
> + "$end"
> +}
> +
> +tracetoh()
> +{
> + echo "#ifndef TRACE_H"
> + echo "#define TRACE_H"
> + echo
> + convert h
> + echo "#endif /* TRACE_H */"
> +}
> +
> +tracetoc()
> +{
> + convert c
> +}
> +
> +# Choose backend
> +case "$1" in
> +"--nop") backend="${1#--}" ;;
> +*) usage ;;
> +esac
> +shift
> +
> +case "$1" in
> +"-h") tracetoh ;;
> +"-c") tracetoc ;;
> +"--check-backend") exit 0 ;; # used by ./configure to test for backend
> +*) usage ;;
> +esac
> +
> +exit 0
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Qemu-devel] [PATCH 1/5] trace: Add trace-events file for declaring trace events
2010-05-24 22:20 ` Anthony Liguori
@ 2010-05-25 8:22 ` Stefan Hajnoczi
0 siblings, 0 replies; 12+ messages in thread
From: Stefan Hajnoczi @ 2010-05-25 8:22 UTC (permalink / raw)
To: Anthony Liguori
Cc: Anthony Liguori, Stefan Hajnoczi, kvm, Jan Kiszka, qemu-devel,
Prerna Saxena
On Mon, May 24, 2010 at 11:20 PM, Anthony Liguori
<aliguori@linux.vnet.ibm.com> wrote:
>> +# check if trace backend exists
>> +
>> +sh tracetool "--$trace_backend" --check-backend> /dev/null 2> /dev/null
>>
>
> This will fail if objdir != srcdir. You have to qualify tracetool with the
> path to srcdir.
Thanks Anthony, fixed on my branch. I'll resend a v2 together with other fixes.
Stefan
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Qemu-devel] [PATCH 2/5] trace: Add simple built-in tracing backend
2010-05-22 21:08 [Qemu-devel] [RFC 0/5] Tracing backends Stefan Hajnoczi
2010-05-22 21:08 ` [Qemu-devel] [PATCH 1/5] trace: Add trace-events file for declaring trace events Stefan Hajnoczi
@ 2010-05-22 21:08 ` Stefan Hajnoczi
2010-05-22 21:08 ` [Qemu-devel] [PATCH 3/5] trace: Add LTTng Userspace Tracer backend Stefan Hajnoczi
` (3 subsequent siblings)
5 siblings, 0 replies; 12+ messages in thread
From: Stefan Hajnoczi @ 2010-05-22 21:08 UTC (permalink / raw)
To: qemu-devel, kvm
Cc: Jan Kiszka, Anthony Liguori, Stefan Hajnoczi, Prerna Saxena
This patch adds a simple tracer which produces binary trace files and is
built into QEMU. The main purpose of this patch is to show how new
tracing backends can be added to tracetool.
To try out the simple backend:
./configure --trace-backend=simple
make
After running QEMU you can pretty-print the trace:
./tracetool --simple --py <trace-events >events.py # first time only
./simpletrace.py /tmp/trace.log
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
---
This is the same trivial tracer that I posted previously.
.gitignore | 2 +
Makefile.objs | 3 +
configure | 2 +-
simpletrace.c | 64 ++++++++++++++++++++++++++++
simpletrace.py | 38 +++++++++++++++++
tracetool | 127 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
6 files changed, 232 insertions(+), 4 deletions(-)
create mode 100644 simpletrace.c
create mode 100755 simpletrace.py
diff --git a/.gitignore b/.gitignore
index 4644557..68fb21d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,6 +4,7 @@ config-host.*
config-target.*
trace.h
trace.c
+events.py
*-softmmu
*-darwin-user
*-linux-user
@@ -39,6 +40,7 @@ qemu-monitor.texi
*.log
*.pdf
*.pg
+*.pyc
*.toc
*.tp
*.vr
diff --git a/Makefile.objs b/Makefile.objs
index 9bbdf6f..d870767 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -252,6 +252,9 @@ libdis-$(CONFIG_SPARC_DIS) += sparc-dis.o
# trace
trace-obj-y = trace.o
+ifeq ($(TRACE_BACKEND),simple)
+trace-obj-y += simpletrace.o
+endif
vl.o: QEMU_CFLAGS+=$(GPROF_CFLAGS)
diff --git a/configure b/configure
index 5e66f3a..d599879 100755
--- a/configure
+++ b/configure
@@ -829,7 +829,7 @@ echo " --enable-docs enable documentation build"
echo " --disable-docs disable documentation build"
echo " --disable-vhost-net disable vhost-net acceleration support"
echo " --enable-vhost-net enable vhost-net acceleration support"
-echo " --trace-backend=B Trace backend nop"
+echo " --trace-backend=B Trace backend nop simple"
echo ""
echo "NOTE: The object files are built at the place where configure is launched"
exit 1
diff --git a/simpletrace.c b/simpletrace.c
new file mode 100644
index 0000000..2fec4d3
--- /dev/null
+++ b/simpletrace.c
@@ -0,0 +1,64 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include "trace.h"
+
+typedef struct {
+ unsigned long event;
+ unsigned long x1;
+ unsigned long x2;
+ unsigned long x3;
+ unsigned long x4;
+ unsigned long x5;
+} TraceRecord;
+
+enum {
+ TRACE_BUF_LEN = 64 * 1024 / sizeof(TraceRecord),
+};
+
+static TraceRecord trace_buf[TRACE_BUF_LEN];
+static unsigned int trace_idx;
+static FILE *trace_fp;
+
+static void trace(TraceEvent event, unsigned long x1,
+ unsigned long x2, unsigned long x3,
+ unsigned long x4, unsigned long x5) {
+ TraceRecord *rec = &trace_buf[trace_idx];
+ rec->event = event;
+ rec->x1 = x1;
+ rec->x2 = x2;
+ rec->x3 = x3;
+ rec->x4 = x4;
+ rec->x5 = x5;
+
+ if (++trace_idx == TRACE_BUF_LEN) {
+ trace_idx = 0;
+
+ if (!trace_fp) {
+ trace_fp = fopen("/tmp/trace.log", "w");
+ }
+ if (trace_fp) {
+ size_t result = fwrite(trace_buf, sizeof trace_buf, 1, trace_fp);
+ result = result;
+ }
+ }
+}
+
+void trace1(TraceEvent event, unsigned long x1) {
+ trace(event, x1, 0, 0, 0, 0);
+}
+
+void trace2(TraceEvent event, unsigned long x1, unsigned long x2) {
+ trace(event, x1, x2, 0, 0, 0);
+}
+
+void trace3(TraceEvent event, unsigned long x1, unsigned long x2, unsigned long x3) {
+ trace(event, x1, x2, x3, 0, 0);
+}
+
+void trace4(TraceEvent event, unsigned long x1, unsigned long x2, unsigned long x3, unsigned long x4) {
+ trace(event, x1, x2, x3, x4, 0);
+}
+
+void trace5(TraceEvent event, unsigned long x1, unsigned long x2, unsigned long x3, unsigned long x4, unsigned long x5) {
+ trace(event, x1, x2, x3, x4, x5);
+}
diff --git a/simpletrace.py b/simpletrace.py
new file mode 100755
index 0000000..70609cf
--- /dev/null
+++ b/simpletrace.py
@@ -0,0 +1,38 @@
+#!/usr/bin/env python
+import sys
+import struct
+
+try:
+ from events import events
+except ImportError:
+ sys.stderr.write('''Unable to import trace events from current working directory. Please run:
+tracetool --simple --py <trace-events >events.py\n''')
+ sys.exit(1)
+
+trace_fmt = 'LLLLLL'
+trace_len = struct.calcsize(trace_fmt)
+
+def read_record(fobj):
+ s = fobj.read(trace_len)
+ if len(s) != trace_len:
+ return None
+ return struct.unpack(trace_fmt, s)
+
+def format_record(rec):
+ event = events[rec[0]]
+ fields = [event[0]]
+ for i in xrange(1, len(event)):
+ fields.append('%s=0x%x' % (event[i], rec[i]))
+ return ' '.join(fields)
+
+if len(sys.argv) != 2:
+ sys.stderr.write('usage: %s <trace-file>\n' % sys.argv[0])
+ sys.exit(1)
+
+f = open(sys.argv[1], 'rb')
+while True:
+ rec = read_record(f)
+ if rec is None:
+ break
+
+ print format_record(rec)
diff --git a/tracetool b/tracetool
index e243d42..bcd163e 100755
--- a/tracetool
+++ b/tracetool
@@ -3,15 +3,17 @@
usage()
{
cat >&2 <<EOF
-usage: $0 --nop [-h | -c]
+usage: $0 [--nop | --simple] [-h | -c | --py]
Generate tracing code for a file on stdin.
Backends:
- --nop Tracing disabled
+ --nop Tracing disabled
+ --simple Simple built-in backend
Output formats:
-h Generate .h file
-c Generate .c file
+ --py Generate .py file (simple backend only)
EOF
exit 1
}
@@ -48,6 +50,17 @@ get_argnames()
echo -n "$name"
}
+# Get the number of arguments to a trace event
+get_argc()
+{
+ local name argc
+ argc=0
+ for name in $(get_argnames "$1"); do
+ argc=$((argc + 1))
+ done
+ echo $argc
+}
+
# Get the format string for a trace event
get_fmt()
{
@@ -67,6 +80,11 @@ warn_autogen_h()
echo "/* This file is autogenerated by tracetool, do not edit. */"
}
+warn_autogen_py()
+{
+ echo "# This file is autogenerated by tracetool, do not edit."
+}
+
linetoh_begin_nop()
{
return
@@ -107,6 +125,101 @@ linetoc_end_nop()
return
}
+linetoh_begin_simple()
+{
+ cat <<EOF
+typedef unsigned int TraceEvent;
+
+void trace1(TraceEvent event, unsigned long x1);
+void trace2(TraceEvent event, unsigned long x1, unsigned long x2);
+void trace3(TraceEvent event, unsigned long x1, unsigned long x2, unsigned long x3);
+void trace4(TraceEvent event, unsigned long x1, unsigned long x2, unsigned long x3, unsigned long x4);
+void trace5(TraceEvent event, unsigned long x1, unsigned long x2, unsigned long x3, unsigned long x4, unsigned long x5);
+EOF
+
+ simple_event_num=0
+}
+
+cast_args_to_ulong()
+{
+ local arg
+ for arg in $(get_argnames "$1"); do
+ echo -n "(unsigned long)$arg"
+ done
+}
+
+linetoh_simple()
+{
+ local name args argc ulong_args
+ name=$(get_name "$1")
+ args=$(get_args "$1")
+ argc=$(get_argc "$1")
+ ulong_args=$(cast_args_to_ulong "$1")
+
+ cat <<EOF
+static inline void trace_$name($args) {
+ trace$argc($simple_event_num, $ulong_args);
+}
+EOF
+
+ simple_event_num=$((simple_event_num + 1))
+}
+
+linetoh_end_simple()
+{
+ return
+}
+
+linetoc_begin_simple()
+{
+ return
+}
+
+linetoc_simple()
+{
+ return
+}
+
+linetoc_end_simple()
+{
+ return
+}
+
+linetopy_begin_simple()
+{
+ echo "events = {"
+
+ simple_event_num=0
+}
+
+quote_args()
+{
+ local arg first
+ first=""
+ for arg in $(get_argnames "$1"); do
+ echo -n "$first'${arg%,}'"
+ first=", "
+ done
+}
+
+linetopy_simple()
+{
+ local name quoted_args
+ name=$(get_name "$1")
+ quoted_args=$(quote_args "$1")
+
+ cat <<EOF
+ $simple_event_num: ('$name', $quoted_args),
+EOF
+
+ simple_event_num=$((simple_event_num + 1))
+}
+
+linetopy_end_simple()
+{
+ echo "}"
+}
+
# Process stdin by calling begin, line, and end functions for the backend
convert()
{
@@ -145,9 +258,16 @@ tracetoc()
convert c
}
+tracetopy()
+{
+ test "$backend" = "simple" || usage
+
+ convert py
+}
+
# Choose backend
case "$1" in
-"--nop") backend="${1#--}" ;;
+"--nop" | "--simple") backend="${1#--}" ;;
*) usage ;;
esac
shift
@@ -155,6 +275,7 @@ shift
case "$1" in
"-h") tracetoh ;;
"-c") tracetoc ;;
+"--py") tracetopy ;;
"--check-backend") exit 0 ;; # used by ./configure to test for backend
*) usage ;;
esac
--
1.7.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Qemu-devel] [PATCH 3/5] trace: Add LTTng Userspace Tracer backend
2010-05-22 21:08 [Qemu-devel] [RFC 0/5] Tracing backends Stefan Hajnoczi
2010-05-22 21:08 ` [Qemu-devel] [PATCH 1/5] trace: Add trace-events file for declaring trace events Stefan Hajnoczi
2010-05-22 21:08 ` [Qemu-devel] [PATCH 2/5] trace: Add simple built-in tracing backend Stefan Hajnoczi
@ 2010-05-22 21:08 ` Stefan Hajnoczi
2010-05-23 15:50 ` [Qemu-devel] " Jan Kiszka
2010-05-22 21:08 ` [Qemu-devel] [PATCH 4/5] trace: Trace qemu_malloc() and qemu_vmalloc() Stefan Hajnoczi
` (2 subsequent siblings)
5 siblings, 1 reply; 12+ messages in thread
From: Stefan Hajnoczi @ 2010-05-22 21:08 UTC (permalink / raw)
To: qemu-devel, kvm
Cc: Jan Kiszka, Anthony Liguori, Stefan Hajnoczi, Prerna Saxena
This patch adds LTTng Userspace Tracer (UST) backend support. The UST
system requires no kernel support but libust and liburcu must be
installed.
$ ./configure --trace-backend ust
$ make
Start the UST daemon:
$ ustd &
List available tracepoints and enable some:
$ ustctl --list-markers $(pgrep qemu)
[...]
{PID: 5458, channel/marker: ust/paio_submit, state: 0, fmt: "acb %p
opaque %p sector_num %lu nb_sectors %lu type %lu" 0x4b32ba}
$ ustctl --enable-marker "ust/paio_submit" $(pgrep qemu)
Run the trace:
$ ustctl --create-trace $(pgrep qemu)
$ ustctl --start-trace $(pgrep qemu)
[...]
$ ustctl --stop-trace $(pgrep qemu)
$ ustctl --destroy-trace $(pgrep qemu)
Trace results can be viewed using lttv-gui.
More information about UST:
http://lttng.org/ust
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
---
I wrote this as part of trying out UST. Although UST is promising, the
usability is poor at the moment.
The dependencies include the lttv trace viewer which I had to build from source
(and it required a makefile tweak to build). Luckily libust, liburcu, and
ust-bin are packaged on my distro.
Error messages are periodically printed by the UST code when running QEMU. I
haven't investigated but this is may be due to signals interrupting UST's
thread in poll().
Finally, the UST header files include some userspace ported kernel
infrastructure and pollute the namespace. I had to add some #undefs to get
QEMU to build after including UST headers.
I don't see LTTng UST as a default option at the moment. Hopefully this will
change in the future.
configure | 5 +++-
tracetool | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 79 insertions(+), 3 deletions(-)
diff --git a/configure b/configure
index d599879..307dbcb 100755
--- a/configure
+++ b/configure
@@ -829,7 +829,7 @@ echo " --enable-docs enable documentation build"
echo " --disable-docs disable documentation build"
echo " --disable-vhost-net disable vhost-net acceleration support"
echo " --enable-vhost-net enable vhost-net acceleration support"
-echo " --trace-backend=B Trace backend nop simple"
+echo " --trace-backend=B Trace backend nop simple ust"
echo ""
echo "NOTE: The object files are built at the place where configure is launched"
exit 1
@@ -2302,6 +2302,9 @@ bsd)
esac
echo "TRACE_BACKEND=$trace_backend" >> $config_host_mak
+if test "$trace_backend" = "ust"; then
+ LIBS="-lust $LIBS"
+fi
tools=
if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
diff --git a/tracetool b/tracetool
index bcd163e..72beb20 100755
--- a/tracetool
+++ b/tracetool
@@ -3,12 +3,13 @@
usage()
{
cat >&2 <<EOF
-usage: $0 [--nop | --simple] [-h | -c | --py]
+usage: $0 [--nop | --simple | --ust] [-h | -c | --py]
Generate tracing code for a file on stdin.
Backends:
--nop Tracing disabled
--simple Simple built-in backend
+ --ust LTTng User Space Tracing backend
Output formats:
-h Generate .h file
@@ -220,6 +221,78 @@ linetopy_end_simple()
echo "}"
}
+linetoh_begin_ust()
+{
+ echo "#include <ust/tracepoint.h>"
+}
+
+linetoh_ust()
+{
+ local name args argnames
+ name=$(get_name "$1")
+ args=$(get_args "$1")
+ argnames=$(get_argnames "$1")
+
+ cat <<EOF
+DECLARE_TRACE(ust_$name, TPPROTO($args), TPARGS($argnames));
+#define trace_$name trace_ust_$name
+EOF
+}
+
+linetoh_end_ust()
+{
+ # Clean up after UST headers which pollute the namespace
+ cat <<EOF
+#undef mutex_lock
+#undef mutex_unlock
+EOF
+}
+
+linetoc_begin_ust()
+{
+ cat <<EOF
+#include <ust/marker.h>
+#include "trace.h"
+EOF
+}
+
+linetoc_ust()
+{
+ local name args argnames fmt
+ name=$(get_name "$1")
+ args=$(get_args "$1")
+ argnames=$(get_argnames "$1")
+ fmt=$(get_fmt "$1")
+
+ cat <<EOF
+DEFINE_TRACE(ust_$name);
+
+static void ust_${name}_probe($args)
+{
+ trace_mark(ust, $name, "$fmt", $argnames);
+}
+EOF
+
+ # Collect names for later
+ names="$names $name"
+}
+
+linetoc_end_ust()
+{
+ cat <<EOF
+static void __attribute__((constructor)) trace_init(void)
+{
+EOF
+
+ for name in $names; do
+ cat <<EOF
+ register_trace_ust_$name(ust_${name}_probe);
+EOF
+ done
+
+ echo "}"
+}
+
# Process stdin by calling begin, line, and end functions for the backend
convert()
{
@@ -267,7 +340,7 @@ tracetopy()
# Choose backend
case "$1" in
-"--nop" | "--simple") backend="${1#--}" ;;
+"--nop" | "--simple" | "--ust") backend="${1#--}" ;;
*) usage ;;
esac
shift
--
1.7.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Qemu-devel] Re: [PATCH 3/5] trace: Add LTTng Userspace Tracer backend
2010-05-22 21:08 ` [Qemu-devel] [PATCH 3/5] trace: Add LTTng Userspace Tracer backend Stefan Hajnoczi
@ 2010-05-23 15:50 ` Jan Kiszka
0 siblings, 0 replies; 12+ messages in thread
From: Jan Kiszka @ 2010-05-23 15:50 UTC (permalink / raw)
To: Stefan Hajnoczi; +Cc: Anthony Liguori, qemu-devel, kvm, Prerna Saxena
[-- Attachment #1: Type: text/plain, Size: 2002 bytes --]
Stefan Hajnoczi wrote:
> This patch adds LTTng Userspace Tracer (UST) backend support. The UST
> system requires no kernel support but libust and liburcu must be
> installed.
>
> $ ./configure --trace-backend ust
> $ make
>
> Start the UST daemon:
> $ ustd &
>
> List available tracepoints and enable some:
> $ ustctl --list-markers $(pgrep qemu)
> [...]
> {PID: 5458, channel/marker: ust/paio_submit, state: 0, fmt: "acb %p
> opaque %p sector_num %lu nb_sectors %lu type %lu" 0x4b32ba}
> $ ustctl --enable-marker "ust/paio_submit" $(pgrep qemu)
>
> Run the trace:
> $ ustctl --create-trace $(pgrep qemu)
> $ ustctl --start-trace $(pgrep qemu)
> [...]
> $ ustctl --stop-trace $(pgrep qemu)
> $ ustctl --destroy-trace $(pgrep qemu)
>
> Trace results can be viewed using lttv-gui.
>
> More information about UST:
> http://lttng.org/ust
>
> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
> ---
> I wrote this as part of trying out UST. Although UST is promising, the
> usability is poor at the moment.
I was hoping it would be better, but I'm not really surprised.
>
> The dependencies include the lttv trace viewer which I had to build from source
> (and it required a makefile tweak to build). Luckily libust, liburcu, and
> ust-bin are packaged on my distro.
>
> Error messages are periodically printed by the UST code when running QEMU. I
> haven't investigated but this is may be due to signals interrupting UST's
> thread in poll().
>
> Finally, the UST header files include some userspace ported kernel
> infrastructure and pollute the namespace. I had to add some #undefs to get
> QEMU to build after including UST headers.
>
> I don't see LTTng UST as a default option at the moment. Hopefully this will
> change in the future.
Unless you already did, please report this to LTTng. I bet they will be
interested in your feedback and maybe also in the fact that they gained
another use/test case.
Jan
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 257 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Qemu-devel] [PATCH 4/5] trace: Trace qemu_malloc() and qemu_vmalloc()
2010-05-22 21:08 [Qemu-devel] [RFC 0/5] Tracing backends Stefan Hajnoczi
` (2 preceding siblings ...)
2010-05-22 21:08 ` [Qemu-devel] [PATCH 3/5] trace: Add LTTng Userspace Tracer backend Stefan Hajnoczi
@ 2010-05-22 21:08 ` Stefan Hajnoczi
2010-05-22 21:08 ` [Qemu-devel] [PATCH 5/5] trace: Trace virtio-blk, multiwrite, and paio_submit Stefan Hajnoczi
2010-05-23 15:48 ` [Qemu-devel] Re: [RFC 0/5] Tracing backends Jan Kiszka
5 siblings, 0 replies; 12+ messages in thread
From: Stefan Hajnoczi @ 2010-05-22 21:08 UTC (permalink / raw)
To: qemu-devel, kvm
Cc: Jan Kiszka, Anthony Liguori, Stefan Hajnoczi, Prerna Saxena
It is often useful to instrument memory management functions in order to
find leaks or performance problems. This patch adds trace events for
the memory allocation primitives.
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
---
An example of adding trace events.
osdep.c | 9 +++++++++
qemu-malloc.c | 4 ++++
trace-events | 10 ++++++++++
3 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/osdep.c b/osdep.c
index abbc8a2..8e4b8ea 100644
--- a/osdep.c
+++ b/osdep.c
@@ -50,6 +50,7 @@
#endif
#include "qemu-common.h"
+#include "trace.h"
#include "sysemu.h"
#include "qemu_socket.h"
@@ -71,6 +72,8 @@ static void *oom_check(void *ptr)
#if defined(_WIN32)
void *qemu_memalign(size_t alignment, size_t size)
{
+ trace_qemu_memalign(alignment, size);
+
if (!size) {
abort();
}
@@ -79,6 +82,8 @@ void *qemu_memalign(size_t alignment, size_t size)
void *qemu_vmalloc(size_t size)
{
+ trace_qemu_vmalloc(size);
+
/* FIXME: this is not exactly optimal solution since VirtualAlloc
has 64Kb granularity, but at least it guarantees us that the
memory is page aligned. */
@@ -90,6 +95,7 @@ void *qemu_vmalloc(size_t size)
void qemu_vfree(void *ptr)
{
+ trace_qemu_vfree(ptr);
VirtualFree(ptr, 0, MEM_RELEASE);
}
@@ -97,6 +103,8 @@ void qemu_vfree(void *ptr)
void *qemu_memalign(size_t alignment, size_t size)
{
+ trace_qemu_memalign(alignment, size);
+
#if defined(_POSIX_C_SOURCE) && !defined(__sun__)
int ret;
void *ptr;
@@ -122,6 +130,7 @@ void *qemu_vmalloc(size_t size)
void qemu_vfree(void *ptr)
{
+ trace_qemu_vfree(ptr);
free(ptr);
}
diff --git a/qemu-malloc.c b/qemu-malloc.c
index 6cdc5de..69fc3cf 100644
--- a/qemu-malloc.c
+++ b/qemu-malloc.c
@@ -22,6 +22,7 @@
* THE SOFTWARE.
*/
#include "qemu-common.h"
+#include "trace.h"
#include <stdlib.h>
static void *oom_check(void *ptr)
@@ -39,6 +40,7 @@ void *get_mmap_addr(unsigned long size)
void qemu_free(void *ptr)
{
+ trace_qemu_free(ptr);
free(ptr);
}
@@ -53,6 +55,7 @@ static int allow_zero_malloc(void)
void *qemu_malloc(size_t size)
{
+ trace_qemu_malloc(size);
if (!size && !allow_zero_malloc()) {
abort();
}
@@ -61,6 +64,7 @@ void *qemu_malloc(size_t size)
void *qemu_realloc(void *ptr, size_t size)
{
+ trace_qemu_realloc(ptr, size);
if (!size && !allow_zero_malloc()) {
abort();
}
diff --git a/trace-events b/trace-events
index a37d3cc..a93ea29 100644
--- a/trace-events
+++ b/trace-events
@@ -22,3 +22,13 @@
# system may not have the necessary headers included.
#
# The <format-string> should be a sprintf()-compatible format string.
+
+# qemu-malloc.c
+qemu_malloc(size_t size) "size %zu"
+qemu_realloc(void *ptr, size_t size) "ptr %p size %zu"
+qemu_free(void *ptr) "ptr %p"
+
+# osdep.c
+qemu_memalign(size_t alignment, size_t size) "alignment %zu size %zu"
+qemu_valloc(size_t size) "size %zu"
+qemu_vfree(void *ptr) "ptr %p"
--
1.7.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Qemu-devel] [PATCH 5/5] trace: Trace virtio-blk, multiwrite, and paio_submit
2010-05-22 21:08 [Qemu-devel] [RFC 0/5] Tracing backends Stefan Hajnoczi
` (3 preceding siblings ...)
2010-05-22 21:08 ` [Qemu-devel] [PATCH 4/5] trace: Trace qemu_malloc() and qemu_vmalloc() Stefan Hajnoczi
@ 2010-05-22 21:08 ` Stefan Hajnoczi
2010-05-23 15:48 ` [Qemu-devel] Re: [RFC 0/5] Tracing backends Jan Kiszka
5 siblings, 0 replies; 12+ messages in thread
From: Stefan Hajnoczi @ 2010-05-22 21:08 UTC (permalink / raw)
To: qemu-devel, kvm
Cc: Jan Kiszka, Anthony Liguori, Stefan Hajnoczi, Prerna Saxena
This patch adds trace events that make it possible to observe
virtio-blk.
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
---
block.c | 7 +++++++
hw/virtio-blk.c | 7 +++++++
posix-aio-compat.c | 2 ++
trace-events | 14 ++++++++++++++
4 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/block.c b/block.c
index bfe46e3..86fe7f5 100644
--- a/block.c
+++ b/block.c
@@ -23,6 +23,7 @@
*/
#include "config-host.h"
#include "qemu-common.h"
+#include "trace.h"
#include "monitor.h"
#include "block_int.h"
#include "module.h"
@@ -1913,6 +1914,8 @@ static void multiwrite_cb(void *opaque, int ret)
{
MultiwriteCB *mcb = opaque;
+ trace_multiwrite_cb(mcb, ret);
+
if (ret < 0 && !mcb->error) {
mcb->error = ret;
multiwrite_user_cb(mcb);
@@ -2044,6 +2047,8 @@ int bdrv_aio_multiwrite(BlockDriverState *bs, BlockRequest *reqs, int num_reqs)
// Check for mergable requests
num_reqs = multiwrite_merge(bs, reqs, num_reqs, mcb);
+ trace_bdrv_aio_multiwrite(mcb, mcb->num_callbacks, num_reqs);
+
// Run the aio requests
for (i = 0; i < num_reqs; i++) {
acb = bdrv_aio_writev(bs, reqs[i].sector, reqs[i].qiov,
@@ -2054,9 +2059,11 @@ int bdrv_aio_multiwrite(BlockDriverState *bs, BlockRequest *reqs, int num_reqs)
// submitted yet. Otherwise we'll wait for the submitted AIOs to
// complete and report the error in the callback.
if (mcb->num_requests == 0) {
+ trace_bdrv_aio_multiwrite_earlyfail(mcb);
reqs[i].error = -EIO;
goto fail;
} else {
+ trace_bdrv_aio_multiwrite_latefail(mcb, i);
mcb->num_requests++;
multiwrite_cb(mcb, -EIO);
break;
diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c
index b05d15e..ef384e0 100644
--- a/hw/virtio-blk.c
+++ b/hw/virtio-blk.c
@@ -13,6 +13,7 @@
#include <qemu-common.h>
#include <sysemu.h>
+#include "trace.h"
#include "virtio-blk.h"
#include "block_int.h"
#ifdef __linux__
@@ -50,6 +51,8 @@ static void virtio_blk_req_complete(VirtIOBlockReq *req, int status)
{
VirtIOBlock *s = req->dev;
+ trace_virtio_blk_req_complete(req, status);
+
req->in->status = status;
virtqueue_push(s->vq, &req->elem, req->qiov.size + sizeof(*req->in));
virtio_notify(&s->vdev, s->vq);
@@ -87,6 +90,8 @@ static void virtio_blk_rw_complete(void *opaque, int ret)
{
VirtIOBlockReq *req = opaque;
+ trace_virtio_blk_rw_complete(req, ret);
+
if (ret) {
int is_read = !(req->out->type & VIRTIO_BLK_T_OUT);
if (virtio_blk_handle_rw_error(req, -ret, is_read))
@@ -251,6 +256,8 @@ static void virtio_blk_handle_flush(VirtIOBlockReq *req)
static void virtio_blk_handle_write(BlockRequest *blkreq, int *num_writes,
VirtIOBlockReq *req, BlockDriverState **old_bs)
{
+ trace_virtio_blk_handle_write(req, req->out->sector, req->qiov.size / 512);
+
if (req->out->sector & req->dev->sector_mask) {
virtio_blk_rw_complete(req, -EIO);
return;
diff --git a/posix-aio-compat.c b/posix-aio-compat.c
index b43c531..c2200fe 100644
--- a/posix-aio-compat.c
+++ b/posix-aio-compat.c
@@ -25,6 +25,7 @@
#include "qemu-queue.h"
#include "osdep.h"
#include "qemu-common.h"
+#include "trace.h"
#include "block_int.h"
#include "block/raw-posix-aio.h"
@@ -583,6 +584,7 @@ BlockDriverAIOCB *paio_submit(BlockDriverState *bs, int fd,
acb->next = posix_aio_state->first_aio;
posix_aio_state->first_aio = acb;
+ trace_paio_submit(acb, opaque, sector_num, nb_sectors, type);
qemu_paio_submit(acb);
return &acb->common;
}
diff --git a/trace-events b/trace-events
index a93ea29..4d96b8e 100644
--- a/trace-events
+++ b/trace-events
@@ -32,3 +32,17 @@ qemu_free(void *ptr) "ptr %p"
qemu_memalign(size_t alignment, size_t size) "alignment %zu size %zu"
qemu_valloc(size_t size) "size %zu"
qemu_vfree(void *ptr) "ptr %p"
+
+# block.c
+multiwrite_cb(void *mcb, int ret) "mcb %p ret %d"
+bdrv_aio_multiwrite(void *mcb, int num_callbacks, int num_reqs) "mcb %p num_callbacks %d num_reqs %d"
+bdrv_aio_multiwrite_earlyfail(void *mcb) "mcb %p"
+bdrv_aio_multiwrite_latefail(void *mcb, int i) "mcb %p i %d"
+
+# hw/virtio-blk.c
+virtio_blk_req_complete(void *req, int status) "req %p status %d"
+virtio_blk_rw_complete(void *req, int ret) "req %p ret %d"
+virtio_blk_handle_write(void *req, unsigned long sector, unsigned long nsectors) "req %p sector %lu nsectors %lu"
+
+# posix-aio-compat.c
+paio_submit(void *acb, void *opaque, unsigned long sector_num, unsigned long nb_sectors, unsigned long type) "acb %p opaque %p sector_num %lu nb_sectors %lu type %lu"
--
1.7.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Qemu-devel] Re: [RFC 0/5] Tracing backends
2010-05-22 21:08 [Qemu-devel] [RFC 0/5] Tracing backends Stefan Hajnoczi
` (4 preceding siblings ...)
2010-05-22 21:08 ` [Qemu-devel] [PATCH 5/5] trace: Trace virtio-blk, multiwrite, and paio_submit Stefan Hajnoczi
@ 2010-05-23 15:48 ` Jan Kiszka
5 siblings, 0 replies; 12+ messages in thread
From: Jan Kiszka @ 2010-05-23 15:48 UTC (permalink / raw)
To: Stefan Hajnoczi; +Cc: Anthony Liguori, qemu-devel, kvm, Prerna Saxena
[-- Attachment #1: Type: text/plain, Size: 1110 bytes --]
Stefan Hajnoczi wrote:
> The following patches against qemu.git allow static trace events to be declared
> in QEMU. Trace events use a lightweight syntax and are independent of the
> backend tracing system (e.g. LTTng UST).
>
> Supported backends are:
> * my trivial tracer ("simple")
> * LTTng Userspace Tracer ("ust")
> * no tracer ("nop", the default)
>
> The ./configure option to choose a backend is --trace-backend=.
>
> Main point of this patchset: adding new trace events is easy and we can switch
> between backends without modifying the code.
>
> Prerna: Would you like to add your tracing system as a backend? This would be
> similar to my patches to add "simple" and "ust" backend support.
>
> Jan: Adding kernel marker backend support should be straightforward if you are
> interested.
>
> These patches are also available at:
> http://repo.or.cz/w/qemu/stefanha.git/shortlog/refs/heads/tracing
>
Nice! Will have a closer look once timer permits, specifically to check
how ftrace can be added to this. Looks indeed straightforward on first
sight.
Jan
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 257 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread