* [Qemu-devel] [PATCH][RFC] New trace-event backend: stdio
@ 2011-01-24 17:33 Fabien Chouteau
2011-01-26 8:59 ` Fabien Chouteau
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Fabien Chouteau @ 2011-01-24 17:33 UTC (permalink / raw)
To: qemu-devel; +Cc: Fabien Chouteau
This backend sends trace events to standard output during the emulation.
Signed-off-by: Fabien Chouteau <chouteau@adacore.com>
---
configure | 2 +-
docs/tracing.txt | 5 +++++
scripts/tracetool | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++-
3 files changed, 57 insertions(+), 2 deletions(-)
diff --git a/configure b/configure
index 210670c..2672f2a 100755
--- a/configure
+++ b/configure
@@ -907,7 +907,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 " --enable-trace-backend=B Trace backend nop simple ust dtrace"
+echo " --enable-trace-backend=B Trace backend nop simple stdio ust dtrace"
echo " --with-trace-file=NAME Full PATH,NAME of file to store traces"
echo " Default:trace-<pid>"
echo " --disable-spice disable spice"
diff --git a/docs/tracing.txt b/docs/tracing.txt
index 963c504..de033ad 100644
--- a/docs/tracing.txt
+++ b/docs/tracing.txt
@@ -133,6 +133,11 @@ source tree. It may not be as powerful as platform-specific or third-party
trace backends but it is portable. This is the recommended trace backend
unless you have specific needs for more advanced backends.
+=== Stdio ===
+
+The "stdio" backend sends trace events directly to standard output during
+emulation.
+
==== Monitor commands ====
* info trace
diff --git a/scripts/tracetool b/scripts/tracetool
index fce491c..01f81a1 100755
--- a/scripts/tracetool
+++ b/scripts/tracetool
@@ -19,6 +19,7 @@ Generate tracing code for a file on stdin.
Backends:
--nop Tracing disabled
--simple Simple built-in backend
+ --stdio Stdio built-in backend
--ust LTTng User Space Tracing backend
--dtrace DTrace/SystemTAP backend
@@ -236,6 +237,55 @@ linetoc_end_simple()
EOF
}
+#STDIO
+linetoh_begin_stdio()
+{
+ return
+}
+
+linetoh_stdio()
+{
+ local name args argnamess argc fmt
+ name=$(get_name "$1")
+ args=$(get_args "$1")
+ argnames=$(get_argnames "$1" ",")
+ argc=$(get_argc "$1")
+ state=$(get_state "$1")
+ fmt=$(get_fmt "$1")
+
+ if [ "$argc" -gt 0 ]; then
+ argnames=", $argnames"
+ fi
+
+ cat <<EOF
+static inline void trace_$name($args)
+{
+ printf("$name $fmt\n" $argnames);
+}
+EOF
+}
+
+linetoh_end_stdio()
+{
+return
+}
+
+linetoc_begin_stdio()
+{
+return
+}
+
+linetoc_stdio()
+{
+return
+}
+
+linetoc_end_stdio()
+{
+return
+}
+#END OF STDIO
+
# Clean up after UST headers which pollute the namespace
ust_clean_namespace() {
cat <<EOF
@@ -546,7 +596,7 @@ targetarch=
until [ -z "$1" ]
do
case "$1" in
- "--nop" | "--simple" | "--ust" | "--dtrace") backend="${1#--}" ;;
+ "--nop" | "--simple" | "--stdio" | "--ust" | "--dtrace") backend="${1#--}" ;;
"--binary") shift ; binary="$1" ;;
"--target-arch") shift ; targetarch="$1" ;;
--
1.7.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH][RFC] New trace-event backend: stdio
2011-01-24 17:33 [Qemu-devel] [PATCH][RFC] New trace-event backend: stdio Fabien Chouteau
@ 2011-01-26 8:59 ` Fabien Chouteau
2011-01-26 9:50 ` Stefan Hajnoczi
2011-01-26 10:18 ` Stefan Hajnoczi
2 siblings, 0 replies; 4+ messages in thread
From: Fabien Chouteau @ 2011-01-26 8:59 UTC (permalink / raw)
To: qemu-devel
On 01/24/2011 06:33 PM, Fabien Chouteau wrote:
> This backend sends trace events to standard output during the emulation.
>
Any comments?
--
Fabien Chouteau
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH][RFC] New trace-event backend: stdio
2011-01-24 17:33 [Qemu-devel] [PATCH][RFC] New trace-event backend: stdio Fabien Chouteau
2011-01-26 8:59 ` Fabien Chouteau
@ 2011-01-26 9:50 ` Stefan Hajnoczi
2011-01-26 10:18 ` Stefan Hajnoczi
2 siblings, 0 replies; 4+ messages in thread
From: Stefan Hajnoczi @ 2011-01-26 9:50 UTC (permalink / raw)
To: Fabien Chouteau; +Cc: qemu-devel
On Mon, Jan 24, 2011 at 5:33 PM, Fabien Chouteau <chouteau@adacore.com> wrote:
> diff --git a/docs/tracing.txt b/docs/tracing.txt
> index 963c504..de033ad 100644
> --- a/docs/tracing.txt
> +++ b/docs/tracing.txt
> @@ -133,6 +133,11 @@ source tree. It may not be as powerful as platform-specific or third-party
> trace backends but it is portable. This is the recommended trace backend
> unless you have specific needs for more advanced backends.
>
> +=== Stdio ===
> +
> +The "stdio" backend sends trace events directly to standard output during
> +emulation.
> +
This is a reasonable backend for development/debugging. It's just a
small step from DPRINTF() and that might work well with people's
existing development workflows.
Since most other QEMU diagnostics go to stderr, please use it here
too. Also please change the name to "stderr" so it is immediately
obvious what this backend does.
> @@ -236,6 +237,55 @@ linetoc_end_simple()
> EOF
> }
>
> +#STDIO
> +linetoh_begin_stdio()
> +{
> + return
> +}
> +
> +linetoh_stdio()
> +{
> + local name args argnamess argc fmt
local name args argnames argc state fmt
Stefan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH][RFC] New trace-event backend: stdio
2011-01-24 17:33 [Qemu-devel] [PATCH][RFC] New trace-event backend: stdio Fabien Chouteau
2011-01-26 8:59 ` Fabien Chouteau
2011-01-26 9:50 ` Stefan Hajnoczi
@ 2011-01-26 10:18 ` Stefan Hajnoczi
2 siblings, 0 replies; 4+ messages in thread
From: Stefan Hajnoczi @ 2011-01-26 10:18 UTC (permalink / raw)
To: Fabien Chouteau; +Cc: qemu-devel
On Mon, Jan 24, 2011 at 5:33 PM, Fabien Chouteau <chouteau@adacore.com> wrote:
> @@ -236,6 +237,55 @@ linetoc_end_simple()
> EOF
> }
>
> +#STDIO
> +linetoh_begin_stdio()
> +{
> + return
> +}
> +
> +linetoh_stdio()
> +{
> + local name args argnamess argc fmt
> + name=$(get_name "$1")
> + args=$(get_args "$1")
> + argnames=$(get_argnames "$1" ",")
> + argc=$(get_argc "$1")
> + state=$(get_state "$1")
> + fmt=$(get_fmt "$1")
> +
> + if [ "$argc" -gt 0 ]; then
> + argnames=", $argnames"
> + fi
> +
> + cat <<EOF
> +static inline void trace_$name($args)
> +{
> + printf("$name $fmt\n" $argnames);
Forgot to mention this but the generated header file needs to #include
<stdio.h>.
Stefan
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-01-26 10:18 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-24 17:33 [Qemu-devel] [PATCH][RFC] New trace-event backend: stdio Fabien Chouteau
2011-01-26 8:59 ` Fabien Chouteau
2011-01-26 9:50 ` Stefan Hajnoczi
2011-01-26 10:18 ` Stefan Hajnoczi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).