Skip to content

Commit 942d9e8

Browse files
committed
Documentation: kvm: clarify histogram units
In the case of histogram statistics, the values are always sample counts; the unit instead applies to the bucket range. For example, halt_poll_success_hist is a nanosecond statistic because the buckets are for 0ns, 1ns, 2-3ns, 4-7ns etc. There isn't really any other sensible interpretation, but clarify this anyway in the Documentation. Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 1b870fa commit 942d9e8

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

Documentation/virt/kvm/api.rst

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5703,14 +5703,13 @@ Bits 0-3 of ``flags`` encode the type:
57035703
by the ``hist_param`` field. The range of the Nth bucket (1 <= N < ``size``)
57045704
is [``hist_param``*(N-1), ``hist_param``*N), while the range of the last
57055705
bucket is [``hist_param``*(``size``-1), +INF). (+INF means positive infinity
5706-
value.) The bucket value indicates how many samples fell in the bucket's range.
5706+
value.)
57075707
* ``KVM_STATS_TYPE_LOG_HIST``
57085708
The statistic is reported as a logarithmic histogram. The number of
57095709
buckets is specified by the ``size`` field. The range of the first bucket is
57105710
[0, 1), while the range of the last bucket is [pow(2, ``size``-2), +INF).
57115711
Otherwise, The Nth bucket (1 < N < ``size``) covers
5712-
[pow(2, N-2), pow(2, N-1)). The bucket value indicates how many samples fell
5713-
in the bucket's range.
5712+
[pow(2, N-2), pow(2, N-1)).
57145713

57155714
Bits 4-7 of ``flags`` encode the unit:
57165715

@@ -5731,6 +5730,10 @@ Bits 4-7 of ``flags`` encode the unit:
57315730
statistics can be linear histograms (with two buckets) but not logarithmic
57325731
histograms.
57335732

5733+
Note that, in the case of histograms, the unit applies to the bucket
5734+
ranges, while the bucket value indicates how many samples fell in the
5735+
bucket's range.
5736+
57345737
Bits 8-11 of ``flags``, together with ``exponent``, encode the scale of the
57355738
unit:
57365739

@@ -5752,7 +5755,7 @@ the corresponding statistics data.
57525755

57535756
The ``bucket_size`` field is used as a parameter for histogram statistics data.
57545757
It is only used by linear histogram statistics data, specifying the size of a
5755-
bucket.
5758+
bucket in the unit expressed by bits 4-11 of ``flags`` together with ``exponent``.
57565759

57575760
The ``name`` field is the name string of the statistics data. The name string
57585761
starts at the end of ``struct kvm_stats_desc``. The maximum length including

0 commit comments

Comments
 (0)