Patchwork [RFC,5/5] set-trace-file

login
register
mail settings
Submitter Prerna Saxena
Date Oct. 21, 2010, 9:42 a.m.
Message ID <20101021151200.2d644ca2@zephyr>
Download mbox | patch
Permalink /patch/68558/
State New
Headers show

Comments

Prerna Saxena - Oct. 21, 2010, 9:42 a.m.
set-trace-file : QMP command to:
     - Enable/disable logging traces to file
     - Set a new output file
     - Flush a semi-filled trace-buffer to output file.


Signed-off-by: Prerna Saxena <prerna@linux.vnet.ibm.com>
---
 qmp-commands.hx |   41 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 41 insertions(+), 0 deletions(-)

Patch

diff --git a/qmp-commands.hx b/qmp-commands.hx
index f2008e8..295382f 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -793,6 +793,47 @@  Notes:
 (1) The 'query-trace-events' command should be used to check the new state
     of the trace-event.
 
+EQMP
+
+    {
+        .name       = "set-trace-file",
+        .args_type  = "enable:-e?,flush:-f?,filename:F?",
+        .params     = "[-e] [-f] [filename]",
+        .help       = "Sets a user-specified output file to write traces to",
+        .user_print = monitor_user_noop,
+        .mhandler.cmd_new = do_set_trace_file_qmp,
+    },
+
+SQMP
+set-trace-file
+--------------
+
+Set a new output file to log trace data to.
+
+Arguments:
+
+- "filename": name of new output file to write trace data to.
+                                      (json-string, optional)
+- "enable": if false, traces are not written to file.
+          : Only when this is 'true' that trace buffer contents get logged
+            in a file. (json-bool, optional, defaults to false)
+- "flush": if true, contents of trace buffer are immediately written to file,
+           instead of waiting for the buffer to be full.
+           (json-bool, optional, defaults to false)
+
+Example:
+1. Set a new trace-file:
+-> { "execute": "set-trace-file", "arguments": { "filename": "ABC",
+                                                 "enable":true } }
+<- { "return": {} }
+
+2. Flush the current traces to file:
+-> { "execute": "set-trace-file", "arguments": { "flush": true } }
+
+Notes:
+
+(1) The 'query-trace-file' command should be used to check active trace-file.
+
 3. Query Commands
 =================