Received: from eggs.gnu.org ([140.186.70.92]:41627) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RYOkc-0003mE-IA for qemu-devel@nongnu.org; Wed, 07 Dec 2011 16:10:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RYOkb-0003iD-3C for qemu-devel@nongnu.org; Wed, 07 Dec 2011 16:10:02 -0500 Received: from gw.ac.upc.edu ([147.83.30.3]:52795) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RYOka-0003i4-Ol for qemu-devel@nongnu.org; Wed, 07 Dec 2011 16:10:01 -0500 Received: from localhost (unknown [84.88.53.92]) by gw.ac.upc.edu (Postfix) with ESMTP id B46AB6B0247 for ; Wed, 7 Dec 2011 22:09:59 +0100 (CET) From: =?utf-8?b?TGx1w61z?= Vilanova Date: Wed, 07 Dec 2011 22:09:51 +0100 Message-ID: <20111207210951.24875.43820.stgit@ginnungagap.bsc.es> In-Reply-To: <20111207210936.24875.39375.stgit@ginnungagap.bsc.es> References: <20111207210936.24875.39375.stgit@ginnungagap.bsc.es> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH RFC 1/4] trace: [tracetool] Add 'get_api_name' to construct the name of tracing routines List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org All backends now use 'get_api_name' to build the name of the routines tha= t are used by QEMU code when invoking trace points. This is built based on the = values of 'get_api_name_fmt' and 'get_api_name_fmt_default'. The old 'get_name' is still available to refer to the name of an event. This allows future tracetool options to change the naming of the tracing = API on a per-event basis without having to modify backend-specific code. Signed-off-by: Llu=C3=ADs Vilanova --- scripts/tracetool | 41 +++++++++++++++++++++++++++++------------ 1 files changed, 29 insertions(+), 12 deletions(-) diff --git a/scripts/tracetool b/scripts/tracetool index 701b517..c699801 100755 --- a/scripts/tracetool +++ b/scripts/tracetool @@ -57,6 +57,20 @@ get_name() echo "${name##* }" } =20 +get_api_name_fmt_default=3D"trace_%s" + +# Get the tracepoint name of a trace event (the name of the function QEM= U uses) +# The result is 'printf "$fmt" $name', where 'fmt' is 'get_api_name_fmt'= if set +# or 'get_api_name_fmt_default' otherwise +get_api_name() +{ + local name fmt + name=3D$(get_name "$1") + fmt=3D"$get_api_name_fmt" + [ -n "$fmt" ] || fmt=3D$get_api_name_fmt_default + printf "$fmt" "$name" +} + # Get the given property of a trace event # 1: trace-events line # 2: property name @@ -133,13 +147,13 @@ linetoh_begin_nop() =20 linetoh_nop() { - local name args - name=3D$(get_name "$1") + local api args + api=3D$(get_api_name "$1") args=3D$(get_args "$1") =20 # Define an empty function for the trace event cat <