[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 5/9] trace: add "-trace help"
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PATCH 5/9] trace: add "-trace help" |
Date: |
Sun, 25 Oct 2015 14:32:05 +0100 |
Print a list of trace points
Signed-off-by: Paolo Bonzini <address@hidden>
---
qemu-options.hx | 2 ++
trace/control.c | 21 ++++++++++++++++++++-
trace/control.h | 7 +++++++
3 files changed, 29 insertions(+), 1 deletion(-)
diff --git a/qemu-options.hx b/qemu-options.hx
index 6613911..6729a72 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -3490,6 +3490,8 @@ available if QEMU has been compiled with the
@var{simple}, @var{stderr}
or @var{ftrace} tracing backend. To specify multiple events or patterns,
specify the @option{-trace} option multiple times.
+Use @code{-trace help} to print a list of names of trace points.
+
@item address@hidden
Immediately enable events listed in @var{file}.
The file must contain one event name (as listed in the @file{trace-events}
file)
diff --git a/trace/control.c b/trace/control.c
index 715b5b7..7c84795 100644
--- a/trace/control.c
+++ b/trace/control.c
@@ -85,7 +85,16 @@ TraceEvent *trace_event_pattern(const char *pat, TraceEvent
*ev)
return NULL;
}
-void trace_enable_events(const char *line_buf)
+void trace_list_events(void)
+{
+ int i;
+ for (i = 0; i < trace_event_count(); i++) {
+ TraceEvent *res = trace_event_id(i);
+ fprintf(stderr, "%s\n", trace_event_get_name(res));
+ }
+}
+
+static void do_trace_enable_events(const char *line_buf)
{
const bool enable = ('-' != line_buf[0]);
const char *line_ptr = enable ? line_buf : line_buf + 1;
@@ -111,6 +120,16 @@ void trace_enable_events(const char *line_buf)
}
}
+void trace_enable_events(const char *line_buf)
+{
+ if (is_help_option(line_buf)) {
+ trace_list_events();
+ exit(0);
+ } else {
+ do_trace_enable_events(line_buf);
+ }
+}
+
void trace_init_events(const char *fname)
{
Location loc;
diff --git a/trace/control.h b/trace/control.h
index 32a66ce..3707b3b 100644
--- a/trace/control.h
+++ b/trace/control.h
@@ -182,6 +182,13 @@ void trace_init_events(const char *file);
void trace_init_file(const char *file);
/**
+ * trace_list_events:
+ *
+ * List all available events.
+ */
+void trace_list_events(void);
+
+/**
* trace_enable_events:
* @line_buf: A string with a glob pattern of events to be enabled or,
* if the string starts with '-', disabled.
--
2.5.0
- [Qemu-devel] [PATCH 0/9] simplify usage of tracepoints, and connect them to logging, Paolo Bonzini, 2015/10/25
- [Qemu-devel] [PATCH 1/9] trace: fix documentation, Paolo Bonzini, 2015/10/25
- [Qemu-devel] [PATCH 2/9] trace: split trace_init_events out of trace_init_backends, Paolo Bonzini, 2015/10/25
- [Qemu-devel] [PATCH 3/9] trace: split trace_init_file out of trace_init_backends, Paolo Bonzini, 2015/10/25
- [Qemu-devel] [PATCH 5/9] trace: add "-trace help",
Paolo Bonzini <=
- [Qemu-devel] [PATCH 4/9] trace: add "-trace enable=...", Paolo Bonzini, 2015/10/25
- [Qemu-devel] [PATCH 6/9] log: do not unnecessarily include qom/cpu.h, Paolo Bonzini, 2015/10/25
- [Qemu-devel] [PATCH 7/9] trace: convert stderr backend to log, Paolo Bonzini, 2015/10/25
- [Qemu-devel] [PATCH 8/9] trace: switch default backend to "log", Paolo Bonzini, 2015/10/25
- [Qemu-devel] [PATCH 9/9] log: add "-d trace:PATTERN", Paolo Bonzini, 2015/10/25
- Re: [Qemu-devel] [PATCH 0/9] simplify usage of tracepoints, and connect them to logging, Peter Maydell, 2015/10/25
- Re: [Qemu-devel] [PATCH 0/9] simplify usage of tracepoints, and connect them to logging, Christian Borntraeger, 2015/10/25
- Re: [Qemu-devel] [PATCH 0/9] simplify usage of tracepoints, and connect them to logging, Christian Borntraeger, 2015/10/25