[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 06/11] trace: add "-trace help"
From: |
Denis V. Lunev |
Subject: |
[Qemu-devel] [PATCH 06/11] trace: add "-trace help" |
Date: |
Thu, 29 Oct 2015 23:44:12 +0300 |
From: Paolo Bonzini <address@hidden>
Print a list of trace points
Signed-off-by: Paolo Bonzini <address@hidden>
Signed-off-by: Denis V. Lunev <address@hidden>
Acked-by: Christian Borntraeger <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 6e8cc0c..b36d8b9 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -3491,6 +3491,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.1.4
- [Qemu-devel] [PATCH v3 00/11] simplify usage of tracepoints, and connect them to logging, Denis V. Lunev, 2015/10/29
- [Qemu-devel] [PATCH 01/11] trace: fix documentation, Denis V. Lunev, 2015/10/29
- [Qemu-devel] [PATCH 05/11] trace: add "-trace enable=...", Denis V. Lunev, 2015/10/29
- [Qemu-devel] [PATCH 04/11] trace: no need to call trace_backend_init in different branches now, Denis V. Lunev, 2015/10/29
- [Qemu-devel] [PATCH 08/11] log: move qemu-log.c into util/ directory, Denis V. Lunev, 2015/10/29
- [Qemu-devel] [PATCH 02/11] trace: split trace_init_events out of trace_init_backends, Denis V. Lunev, 2015/10/29
- [Qemu-devel] [PATCH 06/11] trace: add "-trace help",
Denis V. Lunev <=
- [Qemu-devel] [PATCH 03/11] trace: split trace_init_file out of trace_init_backends, Denis V. Lunev, 2015/10/29
- [Qemu-devel] [PATCH 07/11] log: do not unnecessarily include qom/cpu.h, Denis V. Lunev, 2015/10/29
- [Qemu-devel] [PATCH 09/11] trace: convert stderr backend to log, Denis V. Lunev, 2015/10/29
- [Qemu-devel] [PATCH 10/11] trace: switch default backend to "log", Denis V. Lunev, 2015/10/29
- [Qemu-devel] [PATCH 11/11] log: add "-d trace:PATTERN", Denis V. Lunev, 2015/10/29