From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=49046 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PjJfz-0008Mr-2n for qemu-devel@nongnu.org; Sat, 29 Jan 2011 17:53:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PjJfx-0008Hn-MJ for qemu-devel@nongnu.org; Sat, 29 Jan 2011 17:53:50 -0500 Received: from mail-px0-f173.google.com ([209.85.212.173]:49025) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PjJfx-0008Hf-2D for qemu-devel@nongnu.org; Sat, 29 Jan 2011 17:53:49 -0500 Received: by pxi16 with SMTP id 16so752017pxi.4 for ; Sat, 29 Jan 2011 14:53:48 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <00f9ac47200684b4a0061dce755af0a280ebd648.1296120144.git.chouteau@adacore.com> References: <00f9ac47200684b4a0061dce755af0a280ebd648.1296120144.git.chouteau@adacore.com> From: Blue Swirl Date: Sat, 29 Jan 2011 22:53:27 +0000 Message-ID: Subject: Re: [Qemu-devel] [PATCH v4] New trace-event backend: stderr Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fabien Chouteau Cc: qemu-devel@nongnu.org Thanks, applied. On Thu, Jan 27, 2011 at 9:24 AM, Fabien Chouteau wro= te: > This backend sends trace events to standard error output during the emula= tion. > > Also add a "--list-backends" option to tracetool, so configure script can > display the list of available backends. > > Signed-off-by: Fabien Chouteau > --- > =C2=A0configure =C2=A0 =C2=A0 =C2=A0 =C2=A0 | =C2=A0 =C2=A03 +- > =C2=A0docs/tracing.txt =C2=A0| =C2=A0 =C2=A05 ++++ > =C2=A0scripts/tracetool | =C2=A0 60 +++++++++++++++++++++++++++++++++++++= ++++++++++++++- > =C2=A03 files changed, 65 insertions(+), 3 deletions(-) > > diff --git a/configure b/configure > index 210670c..fcc5a71 100755 > --- a/configure > +++ b/configure > @@ -907,7 +907,8 @@ echo " =C2=A0--enable-docs =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0enable documentation build" > =C2=A0echo " =C2=A0--disable-docs =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 disa= ble documentation build" > =C2=A0echo " =C2=A0--disable-vhost-net =C2=A0 =C2=A0 =C2=A0disable vhost-= net acceleration support" > =C2=A0echo " =C2=A0--enable-vhost-net =C2=A0 =C2=A0 =C2=A0 enable vhost-n= et acceleration support" > -echo " =C2=A0--enable-trace-backend=3DB Trace backend nop simple ust dtr= ace" > +echo " =C2=A0--enable-trace-backend=3DB Set trace backend" > +echo " =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 Available backends:" $("$source_path"/scripts/t= racetool --list-backends) > =C2=A0echo " =C2=A0--with-trace-file=3DNAME =C2=A0 Full PATH,NAME of file= to store traces" > =C2=A0echo " =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Default:trace-" > =C2=A0echo " =C2=A0--disable-spice =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0disa= ble spice" > diff --git a/docs/tracing.txt b/docs/tracing.txt > index 963c504..21183f9 100644 > --- a/docs/tracing.txt > +++ b/docs/tracing.txt > @@ -133,6 +133,11 @@ source tree. =C2=A0It may not be as powerful as plat= form-specific or third-party > =C2=A0trace backends but it is portable. =C2=A0This is the recommended tr= ace backend > =C2=A0unless you have specific needs for more advanced backends. > > +=3D=3D=3D Stderr =3D=3D=3D > + > +The "stderr" backend sends trace events directly to standard error outpu= t > +during emulation. > + > =C2=A0=3D=3D=3D=3D Monitor commands =3D=3D=3D=3D > > =C2=A0* info trace > diff --git a/scripts/tracetool b/scripts/tracetool > index fce491c..e046683 100755 > --- a/scripts/tracetool > +++ b/scripts/tracetool > @@ -13,12 +13,13 @@ set -f > =C2=A0usage() > =C2=A0{ > =C2=A0 =C2=A0 cat >&2 < -usage: $0 [--nop | --simple | --ust] [-h | -c] > +usage: $0 [--nop | --simple | --stderr | --ust | --dtrace] [-h | -c] > =C2=A0Generate tracing code for a file on stdin. > > =C2=A0Backends: > =C2=A0 --nop =C2=A0 =C2=A0 Tracing disabled > =C2=A0 --simple =C2=A0Simple built-in backend > + =C2=A0--stderr =C2=A0Stderr built-in backend > =C2=A0 --ust =C2=A0 =C2=A0 LTTng User Space Tracing backend > =C2=A0 --dtrace =C2=A0DTrace/SystemTAP backend > > @@ -236,6 +237,56 @@ linetoc_end_simple() > =C2=A0EOF > =C2=A0} > > +#STDERR > +linetoh_begin_stderr() > +{ > + =C2=A0 =C2=A0cat < +#include > +EOF > +} > + > +linetoh_stderr() > +{ > + =C2=A0 =C2=A0local name args argnames argc fmt > + =C2=A0 =C2=A0name=3D$(get_name "$1") > + =C2=A0 =C2=A0args=3D$(get_args "$1") > + =C2=A0 =C2=A0argnames=3D$(get_argnames "$1" ",") > + =C2=A0 =C2=A0argc=3D$(get_argc "$1") > + =C2=A0 =C2=A0fmt=3D$(get_fmt "$1") > + > + =C2=A0 =C2=A0if [ "$argc" -gt 0 ]; then > + =C2=A0 =C2=A0 =C2=A0 =C2=A0argnames=3D", $argnames" > + =C2=A0 =C2=A0fi > + > + =C2=A0 =C2=A0cat < +static inline void trace_$name($args) > +{ > + =C2=A0 =C2=A0fprintf(stderr, "$name $fmt\n" $argnames); > +} > +EOF > +} > + > +linetoh_end_stderr() > +{ > +return > +} > + > +linetoc_begin_stderr() > +{ > +return > +} > + > +linetoc_stderr() > +{ > +return > +} > + > +linetoc_end_stderr() > +{ > +return > +} > +#END OF STDERR > + > =C2=A0# Clean up after UST headers which pollute the namespace > =C2=A0ust_clean_namespace() { > =C2=A0 =C2=A0 cat < @@ -546,7 +597,7 @@ targetarch=3D > =C2=A0until [ -z "$1" ] > =C2=A0do > =C2=A0 case "$1" in > - =C2=A0 =C2=A0"--nop" | "--simple" | "--ust" | "--dtrace") backend=3D"${= 1#--}" ;; > + =C2=A0 =C2=A0"--nop" | "--simple" | "--stderr" | "--ust" | "--dtrace") = backend=3D"${1#--}" ;; > > =C2=A0 =C2=A0 "--binary") shift ; binary=3D"$1" ;; > =C2=A0 =C2=A0 "--target-arch") shift ; targetarch=3D"$1" ;; > @@ -557,6 +608,11 @@ do > > =C2=A0 =C2=A0 "--check-backend") exit 0 ;; # used by ./configure to test = for backend > > + =C2=A0 =C2=A0"--list-backends") # used by ./configure to list available= backends > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0echo "nop simple stderr ust dtrace" > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0exit 0 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0;; > + > =C2=A0 =C2=A0 *) > =C2=A0 =C2=A0 =C2=A0 usage;; > =C2=A0 esac > -- > 1.7.1 > > >