* [Qemu-devel] [PATCH v2 5/6] trace: Enable "-trace events" argument to control initial state of groups
@ 2011-10-20 6:42 Mark Wu
0 siblings, 0 replies; only message in thread
From: Mark Wu @ 2011-10-20 6:42 UTC (permalink / raw)
To: stefanha; +Cc: qemu-devel
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 <wudxw@linux.vnet.ibm.com>
---
trace/control.c | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/trace/control.c b/trace/control.c
index 4c5527d..18e14a1 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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2011-10-20 6:43 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-20 6:42 [Qemu-devel] [PATCH v2 5/6] trace: Enable "-trace events" argument to control initial state of groups Mark Wu
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).