From patchwork Tue May 25 10:24:11 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 53526 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 27B42B7D40 for ; Tue, 25 May 2010 20:29:31 +1000 (EST) Received: from localhost ([127.0.0.1]:48555 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OGrO3-0007zq-7w for incoming@patchwork.ozlabs.org; Tue, 25 May 2010 06:29:27 -0400 Received: from [140.186.70.92] (port=47848 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OGrJY-0006O2-8q for qemu-devel@nongnu.org; Tue, 25 May 2010 06:24:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OGrJW-0001Uo-EJ for qemu-devel@nongnu.org; Tue, 25 May 2010 06:24:48 -0400 Received: from mtagate5.de.ibm.com ([195.212.17.165]:57854) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OGrJW-0001Rc-6o for qemu-devel@nongnu.org; Tue, 25 May 2010 06:24:46 -0400 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate5.de.ibm.com (8.13.1/8.13.1) with ESMTP id o4PAOYIj021140 for ; Tue, 25 May 2010 10:24:34 GMT Received: from d12av01.megacenter.de.ibm.com (d12av01.megacenter.de.ibm.com [9.149.165.212]) by d12nrmr1607.megacenter.de.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o4PAOYLA864282 for ; Tue, 25 May 2010 12:24:34 +0200 Received: from d12av01.megacenter.de.ibm.com (loopback [127.0.0.1]) by d12av01.megacenter.de.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id o4PAOYMR009006 for ; Tue, 25 May 2010 12:24:34 +0200 Received: from stefan-thinkpad.manchester-maybrook.uk.ibm.com (dyn-9-174-219-32.manchester-maybrook.uk.ibm.com [9.174.219.32]) by d12av01.megacenter.de.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id o4PAOX0d008947; Tue, 25 May 2010 12:24:34 +0200 From: Stefan Hajnoczi To: , Date: Tue, 25 May 2010 11:24:11 +0100 Message-Id: <1274783056-14759-3-git-send-email-stefanha@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1274783056-14759-1-git-send-email-stefanha@linux.vnet.ibm.com> References: <1274783056-14759-1-git-send-email-stefanha@linux.vnet.ibm.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) Cc: Jan Kiszka , Anthony Liguori , Avi Kivity , Stefan Hajnoczi , Prerna Saxena Subject: [Qemu-devel] [PATCH 2/7] trace: Support disabled events in trace-events 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 Sometimes it is useful to disable a trace event. Removing the event from trace-events is not enough since source code will call the trace_*() function for the event. This patch makes it easy to build without specific trace events by marking them disabled in trace-events: disable multiwrite_cb(void *mcb, int ret) "mcb %p ret %d" This builds without the multiwrite_cb trace event. Signed-off-by: Stefan Hajnoczi --- v2: * This patch is new in v2 trace-events | 4 +++- tracetool | 10 ++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/trace-events b/trace-events index a37d3cc..5efaa86 100644 --- a/trace-events +++ b/trace-events @@ -12,10 +12,12 @@ # # Format of a trace event: # -# ( [, ] ...) "" +# [disable] ( [, ] ...) "" # # Example: qemu_malloc(size_t size) "size %zu" # +# The "disable" keyword will build without the trace event. +# # The must be a valid as a C function name. # # Types should be standard C types. Use void * for pointers because the trace diff --git a/tracetool b/tracetool index 766a9ba..53d3612 100755 --- a/tracetool +++ b/tracetool @@ -110,7 +110,7 @@ linetoc_end_nop() # Process stdin by calling begin, line, and end functions for the backend convert() { - local begin process_line end + local begin process_line end str disable begin="lineto$1_begin_$backend" process_line="lineto$1_$backend" end="lineto$1_end_$backend" @@ -123,8 +123,14 @@ convert() str=${str%%#*} test -z "$str" && continue + # Process the line. The nop backend handles disabled lines. + disable=${str%%disable*} echo - "$process_line" "$str" + if test -z "$disable"; then + "lineto$1_nop" "${str##disable}" + else + "$process_line" "$str" + fi done echo