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 From: =?utf-8?b?TGx1w61z?= Date: Mon, 08 Nov 2010 23:35:39 +0100 Message-ID: <20101108223539.8577.36493.stgit@ginnungagap.bsc.es> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] [PATCH 1/2] trace: always use the "nop" backend on events with the "disable" keyword List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@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 <