From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:56769) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RE2OR-0005WU-ND for qemu-devel@nongnu.org; Wed, 12 Oct 2011 13:15:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RE2OQ-0003Dt-9J for qemu-devel@nongnu.org; Wed, 12 Oct 2011 13:14:59 -0400 Received: from e23smtp02.au.ibm.com ([202.81.31.144]:55946) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RE2OP-0003D5-KH for qemu-devel@nongnu.org; Wed, 12 Oct 2011 13:14:58 -0400 Received: from d23relay03.au.ibm.com (d23relay03.au.ibm.com [202.81.31.245]) by e23smtp02.au.ibm.com (8.14.4/8.13.1) with ESMTP id p9CH8Gqc023362 for ; Thu, 13 Oct 2011 04:08:16 +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 p9CHEu4v1441898 for ; Thu, 13 Oct 2011 04:14:56 +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 p9CHEtQT030832 for ; Thu, 13 Oct 2011 04:14:56 +1100 From: Mark Wu Date: Thu, 13 Oct 2011 01:14:16 +0800 Message-Id: <1318439659-7525-4-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 3/6] trace: Add trace events group implementation in the backend "simple" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Mark Wu , qemu-devel@nongnu.org Signed-off-by: Mark Wu --- trace/simple.c | 30 ++++++++++++++++++++++++++++++ trace/simple.h | 7 +++++++ 2 files changed, 37 insertions(+), 0 deletions(-) diff --git a/trace/simple.c b/trace/simple.c index b639dda..7aa4c0b 100644 --- a/trace/simple.c +++ b/trace/simple.c @@ -321,6 +321,16 @@ void trace_print_events(FILE *stream, fprintf_function stream_printf) } } +void trace_print_groups(FILE *stream, fprintf_function stream_printf) +{ + unsigned int i; + + for (i = 0; i < NR_TRACE_EVENT_GROUPS; i++) { + stream_printf(stream, "%s [GROUP ID %u] : state %u\n", + trace_group_list[i].gp_name, i, + trace_group_list[i].state); + } +} bool trace_event_set_state(const char *name, bool state) { unsigned int i; @@ -334,6 +344,26 @@ bool trace_event_set_state(const char *name, bool state) return false; } +bool trace_event_group_set_state(const char *gp_name, bool state) +{ + unsigned int i; + unsigned int j; + TraceEventGroup *group; + + for (i = 0; i < NR_TRACE_EVENT_GROUPS; i++) { + group = &trace_group_list[i]; + if (!strcmp(group->gp_name, gp_name)) { + group->state = state; + + for (j = group->start; j <= group->end; j++) { + trace_list[j].state = state; + } + return true; + } + } + return false; +} + /* Helper function to create a thread with signals blocked. Use glib's * portable threads since QEMU abstractions cannot be used due to reentrancy in * the tracer. Also note the signal masking on POSIX hosts so that the thread diff --git a/trace/simple.h b/trace/simple.h index 466e75b..cf119f3 100644 --- a/trace/simple.h +++ b/trace/simple.h @@ -22,6 +22,13 @@ typedef struct { bool state; } TraceEvent; +typedef struct { + const char *gp_name; + bool state; + int start; + int end; +} TraceEventGroup; + void trace0(TraceEventID event); void trace1(TraceEventID event, uint64_t x1); void trace2(TraceEventID event, uint64_t x1, uint64_t x2); -- 1.7.1