aboutsummaryrefslogtreecommitdiff
path: root/include/sysemu
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2023-01-24 13:19:36 +0100
committerMarkus Armbruster <armbru@redhat.com>2023-02-04 07:56:54 +0100
commitaa09b3d5f8e2819d53a6fd81e655ddb3ef107a47 (patch)
tree5be9fd0f0c2fe1c31fbbd66ccb2f76c4c78cf0e4 /include/sysemu
parentbab46b8180fdb0cf9a7adb7598f371d4457f51ca (diff)
downloadqemu-aa09b3d5f8e2819d53a6fd81e655ddb3ef107a47.zip
qemu-aa09b3d5f8e2819d53a6fd81e655ddb3ef107a47.tar.gz
qemu-aa09b3d5f8e2819d53a6fd81e655ddb3ef107a47.tar.bz2
stats: Move QMP commands from monitor/ to stats/
This moves these commands from MAINTAINERS section "QMP" to new section "Stats". Status is Orphan. Volunteers welcome! Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20230124121946.1139465-23-armbru@redhat.com>
Diffstat (limited to 'include/sysemu')
-rw-r--r--include/sysemu/stats.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/include/sysemu/stats.h b/include/sysemu/stats.h
new file mode 100644
index 0000000..fcf0983
--- /dev/null
+++ b/include/sysemu/stats.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2022 Oracle and/or its affiliates.
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.
+ * See the COPYING file in the top-level directory.
+ */
+
+#ifndef STATS_H
+#define STATS_H
+
+#include "qapi/qapi-types-stats.h"
+
+typedef void StatRetrieveFunc(StatsResultList **result, StatsTarget target,
+ strList *names, strList *targets, Error **errp);
+typedef void SchemaRetrieveFunc(StatsSchemaList **result, Error **errp);
+
+/*
+ * Register callbacks for the QMP query-stats command.
+ *
+ * @provider: stats provider checked against QMP command arguments
+ * @stats_fn: routine to query stats:
+ * @schema_fn: routine to query stat schemas:
+ */
+void add_stats_callbacks(StatsProvider provider,
+ StatRetrieveFunc *stats_fn,
+ SchemaRetrieveFunc *schemas_fn);
+
+/*
+ * Helper routines for adding stats entries to the results lists.
+ */
+void add_stats_entry(StatsResultList **, StatsProvider, const char *id,
+ StatsList *stats_list);
+void add_stats_schema(StatsSchemaList **, StatsProvider, StatsTarget,
+ StatsSchemaValueList *);
+
+/*
+ * True if a string matches the filter passed to the stats_fn callabck,
+ * false otherwise.
+ *
+ * Note that an empty list means no filtering, i.e. all strings will
+ * return true.
+ */
+bool apply_str_list_filter(const char *string, strList *list);
+
+#endif /* STATS_H */