From: Mark Wu <wudxw@linux.vnet.ibm.com>
To: stefanha@linux.vnet.ibm.com
Cc: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH v2 4/6] trace: Add trace events group implementation in the backend "stderr"
Date: Thu, 20 Oct 2011 14:42:33 +0800 [thread overview]
Message-ID: <1319092953-23904-1-git-send-email-wudxw@linux.vnet.ibm.com> (raw)
Signed-off-by: Mark Wu <wudxw@linux.vnet.ibm.com>
---
trace/stderr.c | 32 ++++++++++++++++++++++++++++++++
trace/stderr.h | 7 +++++++
2 files changed, 39 insertions(+), 0 deletions(-)
diff --git a/trace/stderr.c b/trace/stderr.c
index 7107c4a..c55bed4 100644
--- a/trace/stderr.c
+++ b/trace/stderr.c
@@ -12,6 +12,17 @@ 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;
@@ -25,6 +36,27 @@ 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;
+}
+
bool trace_backend_init(const char *events, const char *file)
{
if (file) {
diff --git a/trace/stderr.h b/trace/stderr.h
index d575b61..45499f6 100644
--- a/trace/stderr.h
+++ b/trace/stderr.h
@@ -8,4 +8,11 @@ typedef struct {
bool state;
} TraceEvent;
+typedef struct {
+ const char *gp_name;
+ bool state;
+ int start;
+ int end;
+} TraceEventGroup;
+
#endif /* ! TRACE_STDERR_H */
--
1.7.1
reply other threads:[~2011-10-20 6:43 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1319092953-23904-1-git-send-email-wudxw@linux.vnet.ibm.com \
--to=wudxw@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@linux.vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).