aboutsummaryrefslogtreecommitdiff
path: root/include/monitor/stats.h
blob: 912eeadb2fa4c442ab2d8d6316890f6501c79b4a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*
 * 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,
                              Error **errp);
typedef void SchemaRetrieveFunc(StatsSchemaList **result, Error **errp);

/*
 * Register callbacks for the QMP query-stats command.
 *
 * @stats_fn: routine to query stats:
 * @schema_fn: routine to query stat schemas:
 */
void add_stats_callbacks(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 *);

#endif /* STATS_H */