hw/gpio/omap_gpio: Use CamelCase for TYPE_OMAP1_GPIO type name
[qemu.git] / qapi / stats.json
blob57db5b1c741c8e40e8b3cbae2bd294757ee3a79e
1 # -*- Mode: Python -*-
2 # vim: filetype=python
4 # Copyright (c) 2022 Oracle and/or its affiliates.
6 # This work is licensed under the terms of the GNU GPL, version 2 or later.
7 # See the COPYING file in the top-level directory.
9 # SPDX-License-Identifier: GPL-2.0-or-later
12 # = Statistics
16 # @StatsType:
18 # Enumeration of statistics types
20 # @cumulative: stat is cumulative; value can only increase.
21 # @instant: stat is instantaneous; value can increase or decrease.
22 # @peak: stat is the peak value; value can only increase.
23 # @linear-histogram: stat is a linear histogram.
24 # @log2-histogram: stat is a logarithmic histogram, with one bucket
25 #                  for each power of two.
27 # Since: 7.1
29 { 'enum' : 'StatsType',
30   'data' : [ 'cumulative', 'instant', 'peak', 'linear-histogram',
31              'log2-histogram' ] }
34 # @StatsUnit:
36 # Enumeration of unit of measurement for statistics
38 # @bytes: stat reported in bytes.
39 # @seconds: stat reported in seconds.
40 # @cycles: stat reported in clock cycles.
41 # @boolean: stat is a boolean value.
43 # Since: 7.1
45 { 'enum' : 'StatsUnit',
46   'data' : [ 'bytes', 'seconds', 'cycles', 'boolean' ] }
49 # @StatsProvider:
51 # Enumeration of statistics providers.
53 # Since: 7.1
55 { 'enum': 'StatsProvider',
56   'data': [ 'kvm' ] }
59 # @StatsTarget:
61 # The kinds of objects on which one can request statistics.
63 # @vm: statistics that apply to the entire virtual machine or
64 #      the entire QEMU process.
66 # @vcpu: statistics that apply to a single virtual CPU.
68 # Since: 7.1
70 { 'enum': 'StatsTarget',
71   'data': [ 'vm', 'vcpu' ] }
74 # @StatsRequest:
76 # Indicates a set of statistics that should be returned by query-stats.
78 # @provider: provider for which to return statistics.
80 # @names: statistics to be returned (all if omitted).
82 # Since: 7.1
84 { 'struct': 'StatsRequest',
85   'data': { 'provider': 'StatsProvider',
86             '*names': [ 'str' ] } }
89 # @StatsVCPUFilter:
91 # @vcpus: list of QOM paths for the desired vCPU objects.
93 # Since: 7.1
95 { 'struct': 'StatsVCPUFilter',
96   'data': { '*vcpus': [ 'str' ] } }
99 # @StatsFilter:
101 # The arguments to the query-stats command; specifies a target for which to
102 # request statistics and optionally the required subset of information for
103 # that target:
104 # - which vCPUs to request statistics for
105 # - which providers to request statistics from
106 # - which named values to return within each provider
108 # Since: 7.1
110 { 'union': 'StatsFilter',
111   'base': {
112       'target': 'StatsTarget',
113       '*providers': [ 'StatsRequest' ] },
114   'discriminator': 'target',
115   'data': { 'vcpu': 'StatsVCPUFilter' } }
118 # @StatsValue:
120 # @scalar: single unsigned 64-bit integers.
121 # @list: list of unsigned 64-bit integers (used for histograms).
123 # Since: 7.1
125 { 'alternate': 'StatsValue',
126   'data': { 'scalar': 'uint64',
127             'boolean': 'bool',
128             'list': [ 'uint64' ] } }
131 # @Stats:
133 # @name: name of stat.
134 # @value: stat value.
136 # Since: 7.1
138 { 'struct': 'Stats',
139   'data': { 'name': 'str',
140             'value' : 'StatsValue' } }
143 # @StatsResult:
145 # @provider: provider for this set of statistics.
147 # @qom-path: Path to the object for which the statistics are returned,
148 #            if the object is exposed in the QOM tree
150 # @stats: list of statistics.
152 # Since: 7.1
154 { 'struct': 'StatsResult',
155   'data': { 'provider': 'StatsProvider',
156             '*qom-path': 'str',
157             'stats': [ 'Stats' ] } }
160 # @query-stats:
162 # Return runtime-collected statistics for objects such as the
163 # VM or its vCPUs.
165 # The arguments are a StatsFilter and specify the provider and objects
166 # to return statistics about.
168 # Returns: a list of StatsResult, one for each provider and object
169 #          (e.g., for each vCPU).
171 # Since: 7.1
173 { 'command': 'query-stats',
174   'data': 'StatsFilter',
175   'boxed': true,
176   'returns': [ 'StatsResult' ] }
179 # @StatsSchemaValue:
181 # Schema for a single statistic.
183 # @name: name of the statistic; each element of the schema is uniquely
184 #        identified by a target, a provider (both available in @StatsSchema)
185 #        and the name.
187 # @type: kind of statistic.
189 # @unit: basic unit of measure for the statistic; if missing, the statistic
190 #        is a simple number or counter.
192 # @base: base for the multiple of @unit in which the statistic is measured.
193 #        Only present if @exponent is non-zero; @base and @exponent together
194 #        form a SI prefix (e.g., _nano-_ for ``base=10`` and ``exponent=-9``)
195 #        or IEC binary prefix (e.g. _kibi-_ for ``base=2`` and ``exponent=10``)
197 # @exponent: exponent for the multiple of @unit in which the statistic is
198 #            expressed, or 0 for the basic unit
200 # @bucket-size: Present when @type is "linear-histogram", contains the width
201 #               of each bucket of the histogram.
203 # Since: 7.1
205 { 'struct': 'StatsSchemaValue',
206   'data': { 'name': 'str',
207             'type': 'StatsType',
208             '*unit': 'StatsUnit',
209             '*base': 'int8',
210             'exponent': 'int16',
211             '*bucket-size': 'uint32' } }
214 # @StatsSchema:
216 # Schema for all available statistics for a provider and target.
218 # @provider: provider for this set of statistics.
220 # @target: the kind of object that can be queried through the provider.
222 # @stats: list of statistics.
224 # Since: 7.1
226 { 'struct': 'StatsSchema',
227   'data': { 'provider': 'StatsProvider',
228             'target': 'StatsTarget',
229             'stats': [ 'StatsSchemaValue' ] } }
232 # @query-stats-schemas:
234 # Return the schema for all available runtime-collected statistics.
236 # Note: runtime-collected statistics and their names fall outside QEMU's usual
237 #       deprecation policies.  QEMU will try to keep the set of available data
238 #       stable, together with their names, but will not guarantee stability
239 #       at all costs; the same is true of providers that source statistics
240 #       externally, e.g. from Linux.  For example, if the same value is being
241 #       tracked with different names on different architectures or by different
242 #       providers, one of them might be renamed.  A statistic might go away if
243 #       an algorithm is changed or some code is removed; changing a default
244 #       might cause previously useful statistics to always report 0.  Such
245 #       changes, however, are expected to be rare.
247 # Since: 7.1
249 { 'command': 'query-stats-schemas',
250   'data': { '*provider': 'StatsProvider' },
251   'returns': [ 'StatsSchema' ] }