From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=42238 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q7TlV-0006dW-PQ for qemu-devel@nongnu.org; Wed, 06 Apr 2011 10:31:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q7TlQ-00049Y-3I for qemu-devel@nongnu.org; Wed, 06 Apr 2011 10:31:25 -0400 Received: from mel.act-europe.fr ([194.98.77.210]:47583) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q7TlP-00047v-Lr for qemu-devel@nongnu.org; Wed, 06 Apr 2011 10:31:20 -0400 Message-ID: <4D9C791E.20505@adacore.com> Date: Wed, 06 Apr 2011 16:30:54 +0200 From: Fabien Chouteau MIME-Version: 1.0 References: <20110404214900.9761.49418.stgit@ginnungagap.bsc.es> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] Re: [RFC][PATCH 0/6] trace-state: make the behaviour of "disable" consistent across all backends List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Prerna Saxena , =?ISO-8859-1?Q?Llu=EDs?= , qemu-devel@nongnu.org On 04/06/2011 01:42 PM, Stefan Hajnoczi wrote: > On Tue, Apr 5, 2011 at 2:30 PM, Stefan Hajnoczi wr= ote: >> On Mon, Apr 4, 2011 at 10:49 PM, Llu=EDs wrote: >>> This patch defines the "disable" trace event state to always use the = "nop" >>> backend. >>> >>> As a side-effect, all events are now enabled (without "disable") by d= efault, as >>> all backends (except "stderr") have programmatic support for dynamica= lly >>> (de)activating each trace event. >>> >>> In order to make this true, the "simple" backend now has a "-trace >>> events=3D" argument to let the user select which events must be= enabled from >>> the very beginning. >>> >>> Signed-off-by: Llu=EDs Vilanova >>> --- >>> >>> Llu=EDs Vilanova (6): >>> trace: [ust] fix generation of 'trace.c' on events without args >>> trace: generalize the "property" concept in the trace-events fil= e >>> trace-state: always use the "nop" backend on events with the "di= sable" keyword >>> trace-state: [simple] disable all trace points by default >>> trace-state: [simple] add "-trace events" argument to control in= itial state >>> trace: enable all events >>> >>> >>> docs/tracing.txt | 12 +- >>> qemu-config.c | 5 + >>> qemu-options.hx | 18 ++ >>> scripts/tracetool | 88 +++++------- >>> trace-events | 385 ++++++++++++++++++++++++++-----------------= ---------- >>> vl.c | 94 ++++++++----- >>> 6 files changed, 313 insertions(+), 289 deletions(-) >> >> Excellent, thanks for implementing this. I'll review the patches in >> detail shortly. >=20 > I've left feedback on the individual patches. This is a nice cleanup, > thanks for doing this work! >=20 > The stderr backend is impacted - but not severely. You now need to > disable all trace events that should not generate output. Previously > it was the opposite; you needed to enable all trace events that should > generate output. >=20 > Adding Prerna (simpletrace) and Fabien (stderr) on CC so they can take = a look. Patches look good to me, it will be very useful to change event selection= s without recompiling (I didn't know that trace-events could be enabled/dis= abled in the monitor...). I attach a patch that adds event selection to stderr based on what is don= e for the simple backend. Llu=EDs can you please add it in your patch set? >>From 71fd4ae792aea78691415241be5cec5f2e9afbca Mon Sep 17 00:00:00 2001 From: Fabien Chouteau Date: Wed, 6 Apr 2011 16:15:53 +0200 Subject: [PATCH 1/1] Add trace-event selection from monitor in the stderr= backend Signed-off-by: Fabien Chouteau --- Makefile.objs | 5 +++++ configure | 3 +++ monitor.c | 6 ++++-- qemu-config.c | 2 +- qemu-options.hx | 2 +- scripts/tracetool | 33 ++++++++++++++++++++++++++++----- stderrtrace.c | 14 ++++++++++++++ stderrtrace.h | 13 +++++++++++++ vl.c | 10 ++++++++-- 9 files changed, 77 insertions(+), 11 deletions(-) create mode 100644 stderrtrace.c create mode 100644 stderrtrace.h diff --git a/Makefile.objs b/Makefile.objs index c05f5e5..d58565a 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -342,6 +342,7 @@ trace-dtrace.o: trace-dtrace.dtrace $(GENERATED_HEADE= RS) $(call quiet-command,dtrace -o $@ -G -s $<, " GEN trace-dtrace.o") =20 simpletrace.o: simpletrace.c $(GENERATED_HEADERS) +stderrtrace.o: stderrtrace.c $(GENERATED_HEADERS) =20 ifeq ($(TRACE_BACKEND),dtrace) trace-obj-y =3D trace-dtrace.o @@ -351,6 +352,10 @@ ifeq ($(TRACE_BACKEND),simple) trace-obj-y +=3D simpletrace.o user-obj-y +=3D qemu-timer-common.o endif + +ifeq ($(TRACE_BACKEND),stderr) +trace-obj-y +=3D stderrtrace.o +endif endif =20 ###################################################################### diff --git a/configure b/configure index faaed60..d80bb38 100755 --- a/configure +++ b/configure @@ -2933,6 +2933,9 @@ echo "TRACE_BACKEND=3D$trace_backend" >> $config_ho= st_mak if test "$trace_backend" =3D "simple"; then echo "CONFIG_SIMPLE_TRACE=3Dy" >> $config_host_mak fi +if test "$trace_backend" =3D "stderr"; then + echo "CONFIG_STDERR_TRACE=3Dy" >> $config_host_mak +fi # Set the appropriate trace file. if test "$trace_backend" =3D "simple"; then trace_file=3D"\"$trace_file-%u\"" diff --git a/monitor.c b/monitor.c index f1a08dc..cb695c6 100644 --- a/monitor.c +++ b/monitor.c @@ -57,7 +57,7 @@ #include "json-parser.h" #include "osdep.h" #include "exec-all.h" -#ifdef CONFIG_SIMPLE_TRACE +#if defined(CONFIG_SIMPLE_TRACE) || defined(CONFIG_STDERR_TRACE) #include "trace.h" #endif #include "ui/qemu-spice.h" @@ -592,7 +592,7 @@ static void do_help_cmd(Monitor *mon, const QDict *qd= ict) help_cmd(mon, qdict_get_try_str(qdict, "name")); } =20 -#ifdef CONFIG_SIMPLE_TRACE +#if defined(CONFIG_SIMPLE_TRACE) || defined(CONFIG_STDERR_TRACE) static void do_change_trace_event_state(Monitor *mon, const QDict *qdict= ) { const char *tp_name =3D qdict_get_str(qdict, "name"); @@ -603,7 +603,9 @@ static void do_change_trace_event_state(Monitor *mon,= const QDict *qdict) monitor_printf(mon, "unknown event name \"%s\"\n", tp_name); } } +#endif =20 +#ifdef CONFIG_SIMPLE_TRACE static void do_trace_file(Monitor *mon, const QDict *qdict) { const char *op =3D qdict_get_try_str(qdict, "op"); diff --git a/qemu-config.c b/qemu-config.c index 0a00081..a524680 100644 --- a/qemu-config.c +++ b/qemu-config.c @@ -297,7 +297,7 @@ static QemuOptsList qemu_mon_opts =3D { }, }; =20 -#ifdef CONFIG_SIMPLE_TRACE +#if defined(CONFIG_SIMPLE_TRACE) || defined(CONFIG_STDERR_TRACE) static QemuOptsList qemu_trace_opts =3D { .name =3D "trace", .implied_opt_name =3D "file", diff --git a/qemu-options.hx b/qemu-options.hx index e7b93b5..13e3d71 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -2356,7 +2356,7 @@ Normally QEMU loads a configuration file from @var{= sysconfdir}/qemu.conf and @var{sysconfdir}/target-@var{ARCH}.conf on startup. The @code{-nodefcon= fig} option will prevent QEMU from loading these configuration files at start= up. ETEXI -#ifdef CONFIG_SIMPLE_TRACE +#if defined(CONFIG_SIMPLE_TRACE) || defined(CONFIG_STDERR_TRACE) DEF("trace", HAS_ARG, QEMU_OPTION_trace, "-trace [file=3D][,events=3D]\n" " specify tracing options\n", diff --git a/scripts/tracetool b/scripts/tracetool index e3aec89..d43fbf0 100755 --- a/scripts/tracetool +++ b/scripts/tracetool @@ -241,7 +241,12 @@ linetoh_begin_stderr() { cat < +#include "stderrtrace.h" + +extern TraceEvent trace_list[]; EOF + + simple_event_num=3D0 } =20 linetoh_stderr() @@ -260,29 +265,47 @@ linetoh_stderr() cat <