qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Mark Wu <wudxw@linux.vnet.ibm.com>
To: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Cc: Mark Wu <wudxw@linux.vnet.ibm.com>, qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 5/6] trace: Enable "-trace events" argument to control initial state of groups
Date: Thu, 13 Oct 2011 01:14:18 +0800	[thread overview]
Message-ID: <1318439659-7525-6-git-send-email-wudxw@linux.vnet.ibm.com> (raw)
In-Reply-To: <1318439659-7525-1-git-send-email-wudxw@linux.vnet.ibm.com>

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..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

  parent reply	other threads:[~2011-10-12 17:15 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-12 17:14 [Qemu-devel] [PATCH 0/6] trace: Add support for trace events grouping Mark Wu
2011-10-12 17:14 ` [Qemu-devel] [PATCH 1/6] trace: Make "tracetool" generate a group list Mark Wu
2011-10-14  1:48   ` Sheldon
2011-10-12 17:14 ` [Qemu-devel] [PATCH 2/6] trace: Add HMP monitor commands for trace events group Mark Wu
2011-10-12 17:14 ` [Qemu-devel] [PATCH 3/6] trace: Add trace events group implementation in the backend "simple" Mark Wu
2011-10-12 20:46   ` Ryan Harper
2011-10-12 17:14 ` [Qemu-devel] [PATCH 4/6] trace: Add trace events group implementation in the backend "stderr" Mark Wu
2011-10-12 17:14 ` Mark Wu [this message]
2011-10-12 17:14 ` [Qemu-devel] [PATCH 6/6] trace: Update doc for trace events group Mark Wu
2011-10-13  8:10 ` [Qemu-devel] [PATCH 0/6] trace: Add support for trace events grouping Mark Wu
2011-10-14 12:16   ` Stefan Hajnoczi

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=1318439659-7525-6-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).