Commit d49b11f0 authored by Jing Zhang's avatar Jing Zhang Committed by Paolo Bonzini

KVM: selftests: Add checks for histogram stats bucket_size field

The bucket_size field should be non-zero for linear histogram stats and
should be zero for other stats types.
Reviewed-by: default avatarDavid Matlack <dmatlack@google.com>
Signed-off-by: default avatarJing Zhang <jingzhangos@google.com>
Message-Id: <20210802165633.1866976-4-jingzhangos@google.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent 0176ec51
...@@ -109,6 +109,18 @@ static void stats_test(int stats_fd) ...@@ -109,6 +109,18 @@ static void stats_test(int stats_fd)
/* Check size field, which should not be zero */ /* Check size field, which should not be zero */
TEST_ASSERT(pdesc->size, "KVM descriptor(%s) with size of 0", TEST_ASSERT(pdesc->size, "KVM descriptor(%s) with size of 0",
pdesc->name); pdesc->name);
/* Check bucket_size field */
switch (pdesc->flags & KVM_STATS_TYPE_MASK) {
case KVM_STATS_TYPE_LINEAR_HIST:
TEST_ASSERT(pdesc->bucket_size,
"Bucket size of Linear Histogram stats (%s) is zero",
pdesc->name);
break;
default:
TEST_ASSERT(!pdesc->bucket_size,
"Bucket size of stats (%s) is not zero",
pdesc->name);
}
size_data += pdesc->size * sizeof(*stats_data); size_data += pdesc->size * sizeof(*stats_data);
} }
/* Check overlap */ /* Check overlap */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment