stats.json (6476B)
1 # -*- Mode: Python -*- 2 # vim: filetype=python 3 # 4 # Copyright (c) 2022 Oracle and/or its affiliates. 5 # 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. 8 # 9 # SPDX-License-Identifier: GPL-2.0-or-later 10 11 ## 12 # = Statistics 13 ## 14 15 ## 16 # @StatsType: 17 # 18 # Enumeration of statistics types 19 # 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. 26 # 27 # Since: 7.1 28 ## 29 { 'enum' : 'StatsType', 30 'data' : [ 'cumulative', 'instant', 'peak', 'linear-histogram', 31 'log2-histogram' ] } 32 33 ## 34 # @StatsUnit: 35 # 36 # Enumeration of unit of measurement for statistics 37 # 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. 42 # 43 # Since: 7.1 44 ## 45 { 'enum' : 'StatsUnit', 46 'data' : [ 'bytes', 'seconds', 'cycles', 'boolean' ] } 47 48 ## 49 # @StatsProvider: 50 # 51 # Enumeration of statistics providers. 52 # 53 # Since: 7.1 54 ## 55 { 'enum': 'StatsProvider', 56 'data': [ 'kvm' ] } 57 58 ## 59 # @StatsTarget: 60 # 61 # The kinds of objects on which one can request statistics. 62 # 63 # @vm: statistics that apply to the entire virtual machine or 64 # the entire QEMU process. 65 # 66 # @vcpu: statistics that apply to a single virtual CPU. 67 # 68 # Since: 7.1 69 ## 70 { 'enum': 'StatsTarget', 71 'data': [ 'vm', 'vcpu' ] } 72 73 ## 74 # @StatsRequest: 75 # 76 # Indicates a set of statistics that should be returned by query-stats. 77 # 78 # @provider: provider for which to return statistics. 79 80 # @names: statistics to be returned (all if omitted). 81 # 82 # Since: 7.1 83 ## 84 { 'struct': 'StatsRequest', 85 'data': { 'provider': 'StatsProvider', 86 '*names': [ 'str' ] } } 87 88 ## 89 # @StatsVCPUFilter: 90 # 91 # @vcpus: list of QOM paths for the desired vCPU objects. 92 # 93 # Since: 7.1 94 ## 95 { 'struct': 'StatsVCPUFilter', 96 'data': { '*vcpus': [ 'str' ] } } 97 98 ## 99 # @StatsFilter: 100 # 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 107 # 108 # Since: 7.1 109 ## 110 { 'union': 'StatsFilter', 111 'base': { 112 'target': 'StatsTarget', 113 '*providers': [ 'StatsRequest' ] }, 114 'discriminator': 'target', 115 'data': { 'vcpu': 'StatsVCPUFilter' } } 116 117 ## 118 # @StatsValue: 119 # 120 # @scalar: single unsigned 64-bit integers. 121 # @list: list of unsigned 64-bit integers (used for histograms). 122 # 123 # Since: 7.1 124 ## 125 { 'alternate': 'StatsValue', 126 'data': { 'scalar': 'uint64', 127 'boolean': 'bool', 128 'list': [ 'uint64' ] } } 129 130 ## 131 # @Stats: 132 # 133 # @name: name of stat. 134 # @value: stat value. 135 # 136 # Since: 7.1 137 ## 138 { 'struct': 'Stats', 139 'data': { 'name': 'str', 140 'value' : 'StatsValue' } } 141 142 ## 143 # @StatsResult: 144 # 145 # @provider: provider for this set of statistics. 146 # 147 # @qom-path: Path to the object for which the statistics are returned, 148 # if the object is exposed in the QOM tree 149 # 150 # @stats: list of statistics. 151 # 152 # Since: 7.1 153 ## 154 { 'struct': 'StatsResult', 155 'data': { 'provider': 'StatsProvider', 156 '*qom-path': 'str', 157 'stats': [ 'Stats' ] } } 158 159 ## 160 # @query-stats: 161 # 162 # Return runtime-collected statistics for objects such as the 163 # VM or its vCPUs. 164 # 165 # The arguments are a StatsFilter and specify the provider and objects 166 # to return statistics about. 167 # 168 # Returns: a list of StatsResult, one for each provider and object 169 # (e.g., for each vCPU). 170 # 171 # Since: 7.1 172 ## 173 { 'command': 'query-stats', 174 'data': 'StatsFilter', 175 'boxed': true, 176 'returns': [ 'StatsResult' ] } 177 178 ## 179 # @StatsSchemaValue: 180 # 181 # Schema for a single statistic. 182 # 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. 186 # 187 # @type: kind of statistic. 188 # 189 # @unit: basic unit of measure for the statistic; if missing, the statistic 190 # is a simple number or counter. 191 # 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``) 196 # 197 # @exponent: exponent for the multiple of @unit in which the statistic is 198 # expressed, or 0 for the basic unit 199 # 200 # @bucket-size: Present when @type is "linear-histogram", contains the width 201 # of each bucket of the histogram. 202 # 203 # Since: 7.1 204 ## 205 { 'struct': 'StatsSchemaValue', 206 'data': { 'name': 'str', 207 'type': 'StatsType', 208 '*unit': 'StatsUnit', 209 '*base': 'int8', 210 'exponent': 'int16', 211 '*bucket-size': 'uint32' } } 212 213 ## 214 # @StatsSchema: 215 # 216 # Schema for all available statistics for a provider and target. 217 # 218 # @provider: provider for this set of statistics. 219 # 220 # @target: the kind of object that can be queried through the provider. 221 # 222 # @stats: list of statistics. 223 # 224 # Since: 7.1 225 ## 226 { 'struct': 'StatsSchema', 227 'data': { 'provider': 'StatsProvider', 228 'target': 'StatsTarget', 229 'stats': [ 'StatsSchemaValue' ] } } 230 231 ## 232 # @query-stats-schemas: 233 # 234 # Return the schema for all available runtime-collected statistics. 235 # 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. 246 # 247 # Since: 7.1 248 ## 249 { 'command': 'query-stats-schemas', 250 'data': { '*provider': 'StatsProvider' }, 251 'returns': [ 'StatsSchema' ] }