[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC PATCH 17/21] hmp: expose status of plugins to the moni
From: |
Alex Bennée |
Subject: |
[Qemu-devel] [RFC PATCH 17/21] hmp: expose status of plugins to the monitor |
Date: |
Fri, 5 Oct 2018 16:49:06 +0100 |
Signed-off-by: Alex Bennée <address@hidden>
---
hmp-commands-info.hx | 17 +++++++++++++++++
include/qemu/plugins.h | 1 +
monitor.c | 14 ++++++++++++++
trace/plugins.c | 15 +++++++++++++++
4 files changed, 47 insertions(+)
diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx
index cbee8b944d..e245a852ae 100644
--- a/hmp-commands-info.hx
+++ b/hmp-commands-info.hx
@@ -683,6 +683,23 @@ STEXI
Show available trace-events & their state.
ETEXI
+#if defined(CONFIG_TRACE_PLUGIN)
+ {
+ .name = "trace-plugins",
+ .args_type = "name:s?",
+ .params = "[name]",
+ .help = "show available plugins and any extra info "
+ "(name: plugin name pattern)",
+ .cmd = hmp_info_trace_plugins,
+ },
+
+STEXI
address@hidden info trace-plugins
address@hidden info trace-plugins
+Show available trace-plugins & their state.
+ETEXI
+#endif
+
{
.name = "tpm",
.args_type = "",
diff --git a/include/qemu/plugins.h b/include/qemu/plugins.h
index c86bb7ae67..44f2ec8c98 100644
--- a/include/qemu/plugins.h
+++ b/include/qemu/plugins.h
@@ -6,6 +6,7 @@
void qemu_plugin_parse_cmd_args(const char *optarg);
void qemu_plugin_load(const char *filename, const char *args);
void qemu_plugins_init(void);
+GString *qemu_plugin_status(const char *name);
#else
diff --git a/monitor.c b/monitor.c
index d8229cd2b0..0d0de9ece7 100644
--- a/monitor.c
+++ b/monitor.c
@@ -67,6 +67,9 @@
#ifdef CONFIG_TRACE_SIMPLE
#include "trace/simple.h"
#endif
+#ifdef CONFIG_TRACE_PLUGIN
+#include "qemu/plugins.h"
+#endif
#include "exec/memory.h"
#include "exec/exec-all.h"
#include "qemu/log.h"
@@ -1429,6 +1432,17 @@ static void hmp_info_trace_events(Monitor *mon, const
QDict *qdict)
qapi_free_TraceEventInfoList(events);
}
+#ifdef CONFIG_TRACE_PLUGIN
+static void hmp_info_trace_plugins(Monitor *mon, const QDict *qdict)
+{
+ const char *name = qdict_get_try_str(qdict, "name");
+ GString *status = qemu_plugin_status(name);
+
+ monitor_printf(mon, "%s", status->str);
+ g_string_free(status, true);
+}
+#endif
+
void qmp_client_migrate_info(const char *protocol, const char *hostname,
bool has_port, int64_t port,
bool has_tls_port, int64_t tls_port,
diff --git a/trace/plugins.c b/trace/plugins.c
index 25aec2ff70..05630b02e6 100644
--- a/trace/plugins.c
+++ b/trace/plugins.c
@@ -58,6 +58,21 @@ void qemu_plugin_parse_cmd_args(const char *optarg)
qemu_opt_get(opts, "args"));
}
+GString *qemu_plugin_status(const char *name)
+{
+ QemuPluginInfo *info;
+ GString *status = g_string_new("");
+
+ QLIST_FOREACH(info, &qemu_plugins, next) {
+ if (info->status) {
+ char *pstatus = info->status();
+ g_string_append_printf(status, "%s: %s\n", info->filename,
pstatus);
+ g_free(pstatus);
+ }
+ }
+ return status;
+}
+
static int bind_to_tracepoints(GModule *g_module, GPtrArray *events)
{
int count = 0;
--
2.17.1
- [Qemu-devel] [RFC PATCH 15/21] trace: add linux-user plugin support, (continued)
- [Qemu-devel] [RFC PATCH 15/21] trace: add linux-user plugin support, Alex Bennée, 2018/10/05
- [Qemu-devel] [RFC PATCH 19/21] plugins: add an example hotblocks plugin, Alex Bennée, 2018/10/05
- [Qemu-devel] [RFC PATCH 21/21] plugin: add tlbflush stats plugin, Alex Bennée, 2018/10/05
- [Qemu-devel] [RFC PATCH 20/21] plugins: add hotness summary to hotblocks, Alex Bennée, 2018/10/05
- [Qemu-devel] [RFC PATCH 17/21] hmp: expose status of plugins to the monitor,
Alex Bennée <=
- Re: [Qemu-devel] [RFC PATCH 00/21] Trace updates and plugin RFC, Emilio G. Cota, 2018/10/06
- Re: [Qemu-devel] [RFC PATCH 00/21] Trace updates and plugin RFC, Pavel Dovgalyuk, 2018/10/09