qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Lluís <xscript@gmx.net>
To: qemu-devel@nongnu.org
Cc: stefanha@gmail.com, chouteau@adacore.com
Subject: [Qemu-devel] [PATCH v3 05/10] trace-state: always compile support for controlling	and querying trace event states
Date: Mon, 02 May 2011 15:12:10 +0200	[thread overview]
Message-ID: <20110502131210.24596.95254.stgit@ginnungagap.bsc.es> (raw)
In-Reply-To: <20110502131131.24596.1053.stgit@ginnungagap.bsc.es>

The current interface is generic for this small set of operations, and thus
other backends can easily modify the "trace/control.c" file to add their own
implementation.

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
---
 docs/tracing.txt |   28 +++++++++++++++++++++-------
 hmp-commands.hx  |    7 +++++--
 monitor.c        |    8 ++++----
 3 files changed, 30 insertions(+), 13 deletions(-)

diff --git a/docs/tracing.txt b/docs/tracing.txt
index 1ad106a..470b12e 100644
--- a/docs/tracing.txt
+++ b/docs/tracing.txt
@@ -108,6 +108,27 @@ portability macros, ensure they are preceded and followed by double quotes:
    of trace events.  Marking trace events disabled by default saves the user
    from having to manually disable noisy trace events.
 
+== Generic interface and monitor commands ==
+
+You can programmatically query and control the dynamic state of trace events
+through a backend-agnostic interface:
+
+* trace_print_events
+
+* trace_event_set_state
+
+Note that some of the backends do not provide and implementation for this
+interface, in which case QEMU will just print a warning.
+
+This functionality is also provided through monitor commands:
+
+* info trace-events
+  View available trace events and their state.  State 1 means enabled, state 0
+  means disabled.
+
+* trace-event NAME on|off
+  Enable/disable a given trace event.
+
 == Trace backends ==
 
 The "tracetool" script automates tedious trace event code generation and also
@@ -157,13 +178,6 @@ unless you have specific needs for more advanced backends.
   flushed and emptied.  This means the 'info trace' will display few or no
   entries if the buffer has just been flushed.
 
-* info trace-events
-  View available trace events and their state.  State 1 means enabled, state 0
-  means disabled.
-
-* trace-event NAME on|off
-  Enable/disable a given trace event.
-
 * trace-file on|off|flush|set <path>
   Enable/disable/flush the trace file or set the trace file name.
 
diff --git a/hmp-commands.hx b/hmp-commands.hx
index 5eec93e..25148c2 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -180,7 +180,6 @@ STEXI
 Output logs to @var{filename}.
 ETEXI
 
-#ifdef CONFIG_SIMPLE_TRACE
     {
         .name       = "trace-event",
         .args_type  = "name:s,option:b",
@@ -195,6 +194,7 @@ STEXI
 changes status of a trace event
 ETEXI
 
+#if defined(CONFIG_SIMPLE_TRACE)
     {
         .name       = "trace-file",
         .args_type  = "op:s?,arg:F?",
@@ -1359,10 +1359,13 @@ ETEXI
 STEXI
 @item info trace
 show contents of trace buffer
+ETEXI
+#endif
+
+STEXI
 @item info trace-events
 show available trace events and their state
 ETEXI
-#endif
 
 STEXI
 @end table
diff --git a/monitor.c b/monitor.c
index b6f78ef..1d9bddd 100644
--- a/monitor.c
+++ b/monitor.c
@@ -57,9 +57,9 @@
 #include "json-parser.h"
 #include "osdep.h"
 #include "exec-all.h"
+#include "trace/control.h"
 #ifdef CONFIG_SIMPLE_TRACE
 #include "trace/simple.h"
-#include "trace/control.h"
 #endif
 #include "ui/qemu-spice.h"
 
@@ -593,7 +593,6 @@ static void do_help_cmd(Monitor *mon, const QDict *qdict)
     help_cmd(mon, qdict_get_try_str(qdict, "name"));
 }
 
-#ifdef CONFIG_SIMPLE_TRACE
 static void do_trace_event_set_state(Monitor *mon, const QDict *qdict)
 {
     const char *tp_name = qdict_get_str(qdict, "name");
@@ -605,6 +604,7 @@ static void do_trace_event_set_state(Monitor *mon, const QDict *qdict)
     }
 }
 
+#ifdef CONFIG_SIMPLE_TRACE
 static void do_trace_file(Monitor *mon, const QDict *qdict)
 {
     const char *op = qdict_get_try_str(qdict, "op");
@@ -1002,12 +1002,12 @@ static void do_info_trace(Monitor *mon)
 {
     st_print_trace((FILE *)mon, &monitor_fprintf);
 }
+#endif
 
 static void do_trace_print_events(Monitor *mon)
 {
     trace_print_events((FILE *)mon, &monitor_fprintf);
 }
-#endif
 
 /**
  * do_quit(): Quit QEMU execution
@@ -3093,6 +3093,7 @@ static const mon_cmd_t info_cmds[] = {
         .help       = "show current contents of trace buffer",
         .mhandler.info = do_info_trace,
     },
+#endif
     {
         .name       = "trace-events",
         .args_type  = "",
@@ -3100,7 +3101,6 @@ static const mon_cmd_t info_cmds[] = {
         .help       = "show available trace-events & their state",
         .mhandler.info = do_trace_print_events,
     },
-#endif
     {
         .name       = NULL,
     },

  parent reply	other threads:[~2011-05-02 13:11 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-02 13:11 [Qemu-devel] [RFC][PATCH v3 00/10] trace-state: make the behaviour of "disable" consistent across all backends Lluís
2011-05-02 13:11 ` [Qemu-devel] [PATCH v3 01/10] trace: move backend-specific code into the trace/ directory Lluís
2011-05-02 13:11 ` [Qemu-devel] [PATCH v3 02/10] trace: avoid conditional code compilation during option parsing Lluís
2011-05-02 13:11 ` [Qemu-devel] [PATCH v3 03/10] trace: generalize the "property" concept in the trace-events file Lluís
2011-05-02 13:12 ` [Qemu-devel] [PATCH v3 04/10] trace-state: separate trace event control and query routines from the simple backend Lluís
2011-05-02 13:12 ` Lluís [this message]
2011-05-03 18:44   ` [Qemu-devel] [PATCH v3 05/10] trace-state: always compile support for controlling and querying trace event states Lluís
2011-05-03 18:53     ` Lluís
2011-05-02 13:12 ` [Qemu-devel] [PATCH v3 06/10] trace-state: add "-trace events" argument to control initial state Lluís
2011-05-02 13:12 ` [Qemu-devel] [PATCH v3 07/10] trace-state: always use the "nop" backend on events with the "disable" keyword Lluís
2011-05-02 13:12 ` [Qemu-devel] [PATCH v3 08/10] trace-state: [simple] disable all trace points by default Lluís
2011-05-02 13:12 ` [Qemu-devel] [PATCH v3 09/10] trace-state: [stderr] add support for dynamically enabling/disabling events Lluís
2011-05-03 19:31   ` Lluís
2011-05-03 19:38     ` Lluís
2011-05-02 13:12 ` [Qemu-devel] [PATCH v3 10/10] trace: enable all events Lluís
2011-05-03 20:09 ` [Qemu-devel] [RFC][PATCH v3 00/10] trace-state: make the behaviour of "disable" consistent across all backends Lluís

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=20110502131210.24596.95254.stgit@ginnungagap.bsc.es \
    --to=xscript@gmx.net \
    --cc=chouteau@adacore.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.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).