From patchwork Mon Nov 8 22:35:39 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?Q?Llu=C3=ADs?= X-Patchwork-Id: 70472 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id E121CB710D for ; Tue, 9 Nov 2010 09:36:08 +1100 (EST) Received: from localhost ([127.0.0.1]:37021 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PFaJf-00044A-6A for incoming@patchwork.ozlabs.org; Mon, 08 Nov 2010 17:35:55 -0500 Received: from [140.186.70.92] (port=53280 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PFaIh-00043V-Uk for qemu-devel@nongnu.org; Mon, 08 Nov 2010 17:34:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PFaIg-0004gY-PQ for qemu-devel@nongnu.org; Mon, 08 Nov 2010 17:34:55 -0500 Received: from mailout-de.gmx.net ([213.165.64.23]:60865 helo=mail.gmx.net) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1PFaIg-0004gL-Bf for qemu-devel@nongnu.org; Mon, 08 Nov 2010 17:34:54 -0500 Received: (qmail invoked by alias); 08 Nov 2010 22:34:52 -0000 Received: from unknown (EHLO localhost) [84.88.53.92] by mail.gmx.net (mp021) with SMTP; 08 Nov 2010 23:34:52 +0100 X-Authenticated: #12333383 X-Provags-ID: V01U2FsdGVkX19LDyFPW/dLC3bw5oem8y3n02m25VrvzQMJFzJnfv Bopylyx9XTFmwf To: qemu-devel@nongnu.org From: =?utf-8?b?TGx1w61z?= Date: Mon, 08 Nov 2010 23:35:39 +0100 Message-ID: <20101108223539.8577.36493.stgit@ginnungagap.bsc.es> User-Agent: StGit/0.15 MIME-Version: 1.0 X-Y-GMX-Trusted: 0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) Subject: [Qemu-devel] [PATCH 1/2] trace: always use the "nop" backend on events with the "disable" keyword X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Any event with the keyword/property "disable" generates an empty trace event using the "nop" backend, regardless of the current backend. Generalize the "property" concept in the trace-events file, so tracetool now has: * get_name: Get only the event name * get_property: Return if a propery event is set (a keyword before the event name) Signed-off-by: LluĂ­s Vilanova --- tracetool | 66 +++++++++++++++++++++++++++++-------------------------------- 1 files changed, 31 insertions(+), 35 deletions(-) diff --git a/tracetool b/tracetool index 7010858..9b6f801 100755 --- a/tracetool +++ b/tracetool @@ -31,7 +31,31 @@ EOF # Get the name of a trace event get_name() { - echo ${1%%\(*} + local name + name=${1%%\(*} + echo ${name##* } +} + +# Get the given property of a trace event +# 1: trace-events line +# 2: property name +# -> "1" if property is present; "0" otherwise +get_property() +{ + local props prop + props=${1%%\(*} + props=${props% *} + if [ -z "$props" ]; then + echo "0" + return + fi + for prop in $props; do + if [ "$prop" = "$2" ]; then + echo "1" + return + fi + done + echo "0" } # Get the argument list of a trace event, including types and names @@ -88,20 +112,6 @@ get_fmt() echo "$fmt" } -# Get the state of a trace event -get_state() -{ - local str disable state - str=$(get_name "$1") - disable=${str##disable } - if [ "$disable" = "$str" ] ; then - state=1 - else - state=0 - fi - echo "$state" -} - linetoh_begin_nop() { return @@ -161,14 +171,10 @@ cast_args_to_uint64_t() linetoh_simple() { - local name args argc trace_args state + local name args argc trace_args name=$(get_name "$1") args=$(get_args "$1") argc=$(get_argc "$1") - state=$(get_state "$1") - if [ "$state" = "0" ]; then - name=${name##disable } - fi trace_args="$simple_event_num" if [ "$argc" -gt 0 ] @@ -207,14 +213,10 @@ EOF linetoc_simple() { - local name state + local name name=$(get_name "$1") - state=$(get_state "$1") - if [ "$state" = "0" ] ; then - name=${name##disable } - fi cat <