From patchwork Fri Nov 16 13:19:23 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 199589 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id BCAE22C0091 for ; Sat, 17 Nov 2012 00:19:58 +1100 (EST) Received: from localhost ([::1]:39391 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TZLps-0004Wa-Rl for incoming@patchwork.ozlabs.org; Fri, 16 Nov 2012 08:19:56 -0500 Received: from eggs.gnu.org ([208.118.235.92]:45405) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TZLpa-0004Jh-1n for qemu-devel@nongnu.org; Fri, 16 Nov 2012 08:19:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TZLpW-0002ZF-Vx for qemu-devel@nongnu.org; Fri, 16 Nov 2012 08:19:37 -0500 Received: from mx1.redhat.com ([209.132.183.28]:20895) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TZLpW-0002Z1-O2 for qemu-devel@nongnu.org; Fri, 16 Nov 2012 08:19:34 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id qAGDJYNw001678 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 16 Nov 2012 08:19:34 -0500 Received: from localhost (ovpn-112-43.ams2.redhat.com [10.36.112.43]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id qAGDJXrB023371; Fri, 16 Nov 2012 08:19:33 -0500 From: Stefan Hajnoczi To: Date: Fri, 16 Nov 2012 14:19:23 +0100 Message-Id: <1353071965-19804-3-git-send-email-stefanha@redhat.com> In-Reply-To: <1353071965-19804-1-git-send-email-stefanha@redhat.com> References: <1353071965-19804-1-git-send-email-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Gerd Hoffmann , Stefan Hajnoczi Subject: [Qemu-devel] [PATCH 2/4] trace: allow disabling events in events file X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Gerd Hoffmann Disable trace events prefixed with a '-'. Useful to enable a group of tracepoints with exceptions, like this: usb_xhci_port_* -usb_xhci_port_read which will enable all xhci port tracepoints except reads. Signed-off-by: Gerd Hoffmann Signed-off-by: Stefan Hajnoczi --- trace/control.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/trace/control.c b/trace/control.c index 22d5863..be05efb 100644 --- a/trace/control.c +++ b/trace/control.c @@ -12,6 +12,8 @@ void trace_backend_init_events(const char *fname) { + int ret; + if (fname == NULL) { return; } @@ -30,7 +32,12 @@ void trace_backend_init_events(const char *fname) if ('#' == line_buf[0]) { /* skip commented lines */ continue; } - if (!trace_event_set_state(line_buf, true)) { + if ('-' == line_buf[0]) { + ret = trace_event_set_state(line_buf+1, false); + } else { + ret = trace_event_set_state(line_buf, true); + } + if (!ret) { fprintf(stderr, "error: trace event '%s' does not exist\n", line_buf); exit(1);