All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Denis V. Lunev" <den@openvz.org>
To: qemu-devel@nongnu.org, qemu-block@nongnu.org
Cc: den@openvz.org, Paolo Bonzini <pbonzini@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	Kevin Wolf <kwolf@redhat.com>
Subject: [Qemu-devel] [PATCH 4/7] trace: enable tracing in qemu-io
Date: Fri, 17 Jun 2016 16:48:29 +0300	[thread overview]
Message-ID: <1466171312-23195-5-git-send-email-den@openvz.org> (raw)
In-Reply-To: <1466171312-23195-1-git-send-email-den@openvz.org>

Moving trace_init_backends() into trace_opt_parse() is not possible. This
should be called after daemonize() in vl.c.

Signed-off-by: Denis V. Lunev <den@openvz.org>
Reviewed-by: Eric Blake <eblake@redhat.com>
CC: Paolo Bonzini <pbonzini@redhat.com>
CC: Stefan Hajnoczi <stefanha@redhat.com>
CC: Kevin Wolf <kwolf@redhat.com>
---
 qemu-io.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/qemu-io.c b/qemu-io.c
index d977a6e..0ef28b0 100644
--- a/qemu-io.c
+++ b/qemu-io.c
@@ -18,6 +18,7 @@
 #include "qemu/option.h"
 #include "qemu/config-file.h"
 #include "qemu/readline.h"
+#include "qemu/log.h"
 #include "qapi/qmp/qstring.h"
 #include "qom/object_interfaces.h"
 #include "sysemu/block-backend.h"
@@ -253,7 +254,9 @@ static void usage(const char *name)
 "  -k, --native-aio     use kernel AIO implementation (on Linux only)\n"
 "  -t, --cache=MODE     use the given cache mode for the image\n"
 "  -d, --discard=MODE   use the given discard mode for the image\n"
-"  -T, --trace FILE     enable trace events listed in the given file\n"
+"  -T, --trace [[enable=]<pattern>][,events=<file>][,file=<file>]\n"
+"                       specify tracing options\n"
+"                       see qemu-img(1) man page for full description\n"
 "  -h, --help           display this help and exit\n"
 "  -V, --version        output version information and exit\n"
 "\n"
@@ -458,6 +461,7 @@ int main(int argc, char **argv)
     Error *local_error = NULL;
     QDict *opts = NULL;
     const char *format = NULL;
+    char *trace_file = NULL;
 
 #ifdef CONFIG_POSIX
     signal(SIGPIPE, SIG_IGN);
@@ -470,6 +474,7 @@ int main(int argc, char **argv)
 
     module_call_init(MODULE_INIT_QOM);
     qemu_add_opts(&qemu_object_opts);
+    qemu_add_opts(&qemu_trace_opts);
     bdrv_init();
 
     while ((c = getopt_long(argc, argv, sopt, lopt, &opt_index)) != -1) {
@@ -509,9 +514,7 @@ int main(int argc, char **argv)
             }
             break;
         case 'T':
-            if (!trace_init_backends()) {
-                exit(1); /* error message will have been printed */
-            }
+            trace_file = trace_opt_parse(optarg, trace_file);
             break;
         case 'V':
             printf("%s version %s\n", progname, QEMU_VERSION);
@@ -557,6 +560,12 @@ int main(int argc, char **argv)
         exit(1);
     }
 
+    if (!trace_init_backends()) {
+        exit(1);
+    }
+    trace_init_file(trace_file);
+    qemu_set_log(LOG_TRACE);
+
     /* initialize commands */
     qemuio_add_command(&quit_cmd);
     qemuio_add_command(&open_cmd);
-- 
2.1.4

  parent reply	other threads:[~2016-06-17 13:49 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-17 13:48 [Qemu-devel] [PATCH v8 0/7] trace: enable tracing in qemu-io/qemu-nbd/qemu-img Denis V. Lunev
2016-06-17 13:48 ` [Qemu-devel] [PATCH 1/7] doc: sync help descriprion for --trace with man for qemu.1 Denis V. Lunev
2016-06-17 13:48 ` [Qemu-devel] [PATCH 2/7] doc: move text describing --trace to specific .texi file Denis V. Lunev
2016-06-17 13:48 ` [Qemu-devel] [PATCH 3/7] trace: move qemu_trace_opts to trace/control.c Denis V. Lunev
2016-06-17 13:48 ` Denis V. Lunev [this message]
2016-06-17 13:48 ` [Qemu-devel] [PATCH 5/7] trace: enable tracing in qemu-nbd Denis V. Lunev
2016-06-17 13:48 ` [Qemu-devel] [PATCH 6/7] qemu-img: move common options parsing before commands processing Denis V. Lunev
2016-06-17 13:48 ` [Qemu-devel] [PATCH 7/7] trace: enable tracing in qemu-img Denis V. Lunev
  -- strict thread matches above, loose matches on Subject: below --
2016-06-17 14:44 [Qemu-devel] [PATCH v9 0/7] trace: enable tracing in qemu-io/qemu-nbd/qemu-img Denis V. Lunev
2016-06-17 14:44 ` [Qemu-devel] [PATCH 4/7] trace: enable tracing in qemu-io Denis V. Lunev
2016-06-16  7:15 [Qemu-devel] [PATCH v7 0/7] trace: enable tracing in qemu-io/qemu-nbd/qemu-img Denis V. Lunev
2016-06-16  7:15 ` [Qemu-devel] [PATCH 4/7] trace: enable tracing in qemu-io Denis V. Lunev
2016-06-17 13:55   ` Stefan Hajnoczi
2016-06-14 10:08 [Qemu-devel] [PATCH v6 0/7] trace: enable tracing in qemu-io/qemu-nbd/qemu-img Denis V. Lunev
2016-06-14 10:08 ` [Qemu-devel] [PATCH 4/7] trace: enable tracing in qemu-io Denis V. Lunev
2016-06-14  9:16 [Qemu-devel] [PATCH v5 0/7] trace: enable tracing in qemu-io/qemu-nbd/qemu-img Denis V. Lunev
2016-06-14  9:16 ` [Qemu-devel] [PATCH 4/7] trace: enable tracing in qemu-io Denis V. Lunev

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=1466171312-23195-5-git-send-email-den@openvz.org \
    --to=den@openvz.org \
    --cc=kwolf@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.