Merge tag 'pull-request-2024-06-12' of https://gitlab.com/thuth/qemu into staging
[qemu/kevin.git] / include / sysemu / stats.h
blob42c236c7959db4e9c965a0b0a69236971d27dc59
1 /*
2 * Copyright (c) 2022 Oracle and/or its affiliates.
4 * This work is licensed under the terms of the GNU GPL, version 2.
5 * See the COPYING file in the top-level directory.
6 */
8 #ifndef STATS_H
9 #define STATS_H
11 #include "qapi/qapi-types-stats.h"
13 typedef void StatRetrieveFunc(StatsResultList **result, StatsTarget target,
14 strList *names, strList *targets, Error **errp);
15 typedef void SchemaRetrieveFunc(StatsSchemaList **result, Error **errp);
18 * Register callbacks for the QMP query-stats command.
20 * @provider: stats provider checked against QMP command arguments
21 * @stats_fn: routine to query stats:
22 * @schema_fn: routine to query stat schemas:
24 void add_stats_callbacks(StatsProvider provider,
25 StatRetrieveFunc *stats_fn,
26 SchemaRetrieveFunc *schemas_fn);
29 * Helper routines for adding stats entries to the results lists.
31 void add_stats_entry(StatsResultList **, StatsProvider, const char *id,
32 StatsList *stats_list);
33 void add_stats_schema(StatsSchemaList **, StatsProvider, StatsTarget,
34 StatsSchemaValueList *);
37 * True if a string matches the filter passed to the stats_fn callback,
38 * false otherwise.
40 * Note that an empty list means no filtering, i.e. all strings will
41 * return true.
43 bool apply_str_list_filter(const char *string, strList *list);
45 #endif /* STATS_H */