From patchwork Thu Mar 28 13:25:45 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 232022 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 D73282C00C0 for ; Fri, 29 Mar 2013 00:34:22 +1100 (EST) Received: from localhost ([::1]:34386 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ULCyC-0006kg-UL for incoming@patchwork.ozlabs.org; Thu, 28 Mar 2013 09:34:20 -0400 Received: from eggs.gnu.org ([208.118.235.92]:52332) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ULCvF-0003lx-Kf for qemu-devel@nongnu.org; Thu, 28 Mar 2013 09:31:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ULCvC-0001sw-PB for qemu-devel@nongnu.org; Thu, 28 Mar 2013 09:31:17 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47912) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ULCqI-00088m-4M for qemu-devel@nongnu.org; Thu, 28 Mar 2013 09:26:10 -0400 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 r2SDQ8kV017189 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 28 Mar 2013 09:26:08 -0400 Received: from localhost (ovpn-112-23.ams2.redhat.com [10.36.112.23]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r2SDQ7IN004062; Thu, 28 Mar 2013 09:26:07 -0400 From: Stefan Hajnoczi To: Date: Thu, 28 Mar 2013 14:25:45 +0100 Message-Id: <1364477152-26994-5-git-send-email-stefanha@redhat.com> In-Reply-To: <1364477152-26994-1-git-send-email-stefanha@redhat.com> References: <1364477152-26994-1-git-send-email-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-MIME-Autoconverted: from 8bit to quoted-printable by mx1.redhat.com id r2SDQ8kV017189 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Anthony Liguori , =?UTF-8?q?Llu=C3=ADs=20Vilanova?= , Stefan Hajnoczi Subject: [Qemu-devel] [PATCH 04/11] trace: [monitor] Use new event control interface 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: Lluís Vilanova Signed-off-by: Lluís Vilanova Signed-off-by: Stefan Hajnoczi --- monitor.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/monitor.c b/monitor.c index 5dfae2a..4ec1db9 100644 --- a/monitor.c +++ b/monitor.c @@ -761,9 +761,18 @@ static void do_trace_event_set_state(Monitor *mon, const QDict *qdict) { const char *tp_name = qdict_get_str(qdict, "name"); bool new_state = qdict_get_bool(qdict, "option"); - int ret = trace_event_set_state(tp_name, new_state); - if (!ret) { + bool found = false; + TraceEvent *ev = NULL; + while ((ev = trace_event_pattern(tp_name, ev)) != NULL) { + found = true; + if (!trace_event_get_state_static(ev)) { + monitor_printf(mon, "event \"%s\" is not traceable\n", tp_name); + } else { + trace_event_set_state_dynamic(ev, new_state); + } + } + if (!trace_event_is_pattern(tp_name) && !found) { monitor_printf(mon, "unknown event name \"%s\"\n", tp_name); } }