From patchwork Tue Jul 13 11:34:16 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prerna Saxena X-Patchwork-Id: 58770 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 E234AB6F0E for ; Tue, 13 Jul 2010 21:35:16 +1000 (EST) Received: from localhost ([127.0.0.1]:47100 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OYdlY-0003yA-IP for incoming@patchwork.ozlabs.org; Tue, 13 Jul 2010 07:35:12 -0400 Received: from [140.186.70.92] (port=51783 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OYdkt-0003uR-I2 for qemu-devel@nongnu.org; Tue, 13 Jul 2010 07:34:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OYdks-0006Db-Ez for qemu-devel@nongnu.org; Tue, 13 Jul 2010 07:34:31 -0400 Received: from e28smtp09.in.ibm.com ([122.248.162.9]:37490) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OYdkr-0006Bl-Pv for qemu-devel@nongnu.org; Tue, 13 Jul 2010 07:34:30 -0400 Received: from d28relay03.in.ibm.com (d28relay03.in.ibm.com [9.184.220.60]) by e28smtp09.in.ibm.com (8.14.4/8.13.1) with ESMTP id o6DBUVJM019780 for ; Tue, 13 Jul 2010 17:00:31 +0530 Received: from d28av03.in.ibm.com (d28av03.in.ibm.com [9.184.220.65]) by d28relay03.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o6DBYJpV3756108 for ; Tue, 13 Jul 2010 17:04:19 +0530 Received: from d28av03.in.ibm.com (loopback [127.0.0.1]) by d28av03.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id o6DBYIDm004536 for ; Tue, 13 Jul 2010 21:34:19 +1000 Received: from zephyr (K50wks273921wss.in.ibm.com [9.124.35.83]) by d28av03.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id o6DBYID8004529; Tue, 13 Jul 2010 21:34:18 +1000 Date: Tue, 13 Jul 2010 17:04:16 +0530 From: Prerna Saxena To: qemu-devel Message-ID: <20100713170416.6b852cd1@zephyr> Organization: IBM X-Mailer: Claws Mail 3.7.5 (GTK+ 2.16.6; i586-redhat-linux-gnu) Mime-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) Cc: Maneesh Soni , Ananth Narayan , Stefan Hajnoczi Subject: [Qemu-devel] [Tracing][PATCH] Allow bulk enabling of trace events at compile time. 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 [PATCH] For 'simple' trace backend, allow bulk enabling/disabling of trace events at compile time. Trace events that are preceded by 'disable' keyword are compiled in, but turned off by default. These can individually be turned on using the monitor. All other trace events are enabled by default. TODO : This could be enhanced when the trace-event namespace is partitioned into a group and an ID within that group. In such a case, marking a group as enabled would automatically enable all trace-events listed under it. Signed-off-by: Prerna Saxena --- trace-events | 3 +++ tracetool | 36 ++++++++++++++++++++++++++++++++---- 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/trace-events b/trace-events index a533414..cb5ef00 100644 --- a/trace-events +++ b/trace-events @@ -17,6 +17,9 @@ # Example: qemu_malloc(size_t size) "size %zu" # # The "disable" keyword will build without the trace event. +# In case of 'simple' trace backend, it will allow the trace event to be +# compiled, but this would be turned off by default. It can be toggled on via +# the monitor. # # The must be a valid as a C function name. # diff --git a/tracetool b/tracetool index b7a0499..98d23fb 100755 --- a/tracetool +++ b/tracetool @@ -73,6 +73,20 @@ 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 @@ -155,12 +169,16 @@ cast_args_to_ulong() linetoh_simple() { - local name args argc ulong_args + local name args argc ulong_args state name=$(get_name "$1") args=$(get_args "$1") argc=$(get_argc "$1") ulong_args=$(cast_args_to_ulong "$1") + state=$(get_state "$1") + if [ "$state" = "0" ]; then + name=${name##disable } + fi cat <