From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:48150) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RGmLO-0003L4-PF for qemu-devel@nongnu.org; Thu, 20 Oct 2011 02:43:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RGmLJ-0007hF-IV for qemu-devel@nongnu.org; Thu, 20 Oct 2011 02:43:07 -0400 Received: from e28smtp02.in.ibm.com ([122.248.162.2]:35742) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RGmLI-0007gF-CT for qemu-devel@nongnu.org; Thu, 20 Oct 2011 02:43:05 -0400 Received: from d28relay01.in.ibm.com (d28relay01.in.ibm.com [9.184.220.58]) by e28smtp02.in.ibm.com (8.14.4/8.13.1) with ESMTP id p9K6gvGg011847 for ; Thu, 20 Oct 2011 12:12:58 +0530 Received: from d28av01.in.ibm.com (d28av01.in.ibm.com [9.184.220.63]) by d28relay01.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p9K6gvLx4538384 for ; Thu, 20 Oct 2011 12:12:57 +0530 Received: from d28av01.in.ibm.com (loopback [127.0.0.1]) by d28av01.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p9K6gusS004426 for ; Thu, 20 Oct 2011 12:12:56 +0530 From: Mark Wu Date: Thu, 20 Oct 2011 14:42:27 +0800 Message-Id: <1319092947-23864-1-git-send-email-wudxw@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH v2 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: stefanha@linux.vnet.ibm.com Cc: 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..05acee0 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