From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:56804) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RE2OW-0005lP-Jx for qemu-devel@nongnu.org; Wed, 12 Oct 2011 13:15:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RE2OV-0003FL-Eu for qemu-devel@nongnu.org; Wed, 12 Oct 2011 13:15:04 -0400 Received: from e23smtp04.au.ibm.com ([202.81.31.146]:51349) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RE2OU-0003F7-Ky for qemu-devel@nongnu.org; Wed, 12 Oct 2011 13:15:03 -0400 Received: from d23relay03.au.ibm.com (d23relay03.au.ibm.com [202.81.31.245]) by e23smtp04.au.ibm.com (8.14.4/8.13.1) with ESMTP id p9CH8FZF008199 for ; Thu, 13 Oct 2011 04:08:15 +1100 Received: from d23av02.au.ibm.com (d23av02.au.ibm.com [9.190.235.138]) by d23relay03.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p9CHF1Gw1159272 for ; Thu, 13 Oct 2011 04:15:01 +1100 Received: from d23av02.au.ibm.com (loopback [127.0.0.1]) by d23av02.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p9CHF0tL030878 for ; Thu, 13 Oct 2011 04:15:01 +1100 From: Mark Wu Date: Thu, 13 Oct 2011 01:14:18 +0800 Message-Id: <1318439659-7525-6-git-send-email-wudxw@linux.vnet.ibm.com> In-Reply-To: <1318439659-7525-1-git-send-email-wudxw@linux.vnet.ibm.com> References: <1318439659-7525-1-git-send-email-wudxw@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH 5/6] trace: Enable "-trace events" argument to control initial state of groups List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Mark Wu , qemu-devel@nongnu.org A group of trace events can be enabled in early running stage through adding its group name prefixed with "group:" to trace events list file which is passed to "-trace events". Signed-off-by: Mark Wu --- trace/control.c | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-) diff --git a/trace/control.c b/trace/control.c index 4c5527d..5043c83 100644 --- a/trace/control.c +++ b/trace/control.c @@ -23,10 +23,27 @@ void trace_backend_init_events(const char *fname) exit(1); } char line_buf[1024]; + char *group; + while (fgets(line_buf, sizeof(line_buf), fp)) { size_t len = strlen(line_buf); if (len > 1) { /* skip empty lines */ line_buf[len - 1] = '\0'; + group = strstr(line_buf, "group:"); + if (group != NULL) { + group += strlen("group:"); + if (group == NULL) { + fprintf(stderr, "error: empty group name\n"); + exit(1); + } + if (!trace_event_group_set_state(group, true)) { + fprintf(stderr, "error: trace event group '%s'" + "does not exist\n", group); + exit(1); + } + continue; + } + if (!trace_event_set_state(line_buf, true)) { fprintf(stderr, "error: trace event '%s' does not exist\n", line_buf); -- 1.7.1