Skip to contentSkip to conversation

trace: Send "-d trace:help" output to stdout

PATCH Applied Doug Evans via 4 participants 4 messages Nov 25, 2020 – Dec 11, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 trace: Send "-d trace:help" output to stdout

... for consistency with "-d help".

---
 trace/control.c | 12 ++++++------
 trace/control.h |  3 ++-
 2 files changed, 8 insertions(+), 7 deletions(-)
trace/control.c +6 -6
index b82fb87316..cd04dd4e0c 100644
@@ -125,18 +125,18 @@ TraceEvent *trace_event_iter_next(TraceEventIter *iter)
     return NULL;
 }
 
-void trace_list_events(void)
+void trace_list_events(FILE *f)
 {
     TraceEventIter iter;
     TraceEvent *ev;
     trace_event_iter_init(&iter, NULL);
     while ((ev = trace_event_iter_next(&iter)) != NULL) {
-        fprintf(stderr, "%s\n", trace_event_get_name(ev));
+        fprintf(f, "%s\n", trace_event_get_name(ev));
     }
 #ifdef CONFIG_TRACE_DTRACE
-    fprintf(stderr, "This list of names of trace points may be incomplete "
-                    "when using the DTrace/SystemTap backends.\n"
-                    "Run 'qemu-trace-stap list %s' to print the full list.\n",
+    fprintf(f, "This list of names of trace points may be incomplete "
+               "when using the DTrace/SystemTap backends.\n"
+               "Run 'qemu-trace-stap list %s' to print the full list.\n",
             error_get_progname());
 #endif
 }
@@ -176,7 +176,7 @@ static void do_trace_enable_events(const char *line_buf)
 void trace_enable_events(const char *line_buf)
 {
     if (is_help_option(line_buf)) {
-        trace_list_events();
+        trace_list_events(stdout);
         if (monitor_cur() == NULL) {
             exit(0);
         }
trace/control.h +2 -1
index 05b95ea453..9522a7b318 100644
@@ -201,10 +201,11 @@ void trace_fini_vcpu(CPUState *vcpu);
 
 /**
  * trace_list_events:
+ * @f: Where to send output.
  *
  * List all available events.
  */
-void trace_list_events(void);
+void trace_list_events(FILE *f);
 
 /**
  * trace_enable_events:
Signature · 1 line
2.29.2.454.gaff20da3a2-goog
#2 lore raw

Hi Stefan,

Quoted 2 lines · Stefan Hajnoczi
Quoted 1 line · Doug Evans

... for consistency with "-d help".

Do you mind replacing the '...' by the subject:
'Send "-d trace:help" output to stdout', so the
commit description makes more sense?

Thanks,

Phil.

Quoted 12 lines
Quoted 6 lines
---
 trace/control.c | 12 ++++++------
 trace/control.h |  3 ++-
 2 files changed, 8 insertions(+), 7 deletions(-)

Thanks, applied to my tracing tree:
https://gitlab.com/stefanha/qemu/commits/tracing

Stefan

#3 lore raw
In reply to Stefan Hajnoczi

Thanks.
I gather this is a first step in getting the patch into master? If so, OOC, how many separate "staging" trees are there for the master branch? (is there a list?)

Quoted 14 lines · Stefan Hajnoczi
Quoted 7 lines · Doug Evans

... for consistency with "-d help".

---
 trace/control.c | 12 ++++++------
 trace/control.h |  3 ++-
 2 files changed, 8 insertions(+), 7 deletions(-)

Thanks, applied to my tracing tree:
https://gitlab.com/stefanha/qemu/commits/tracing

Stefan