Re: [PATCH v1 3/4] KVM: selftests: Add checks for histogram stats parameters

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jul 06, 2021 at 06:03:49PM +0000, Jing Zhang wrote:
> The hist_param field should be zero for simple stats and 2 for
> logarithmic histogram. It shouldbe non-zero for linear histogram stats.
> 
> Signed-off-by: Jing Zhang <jingzhangos@xxxxxxxxxx>

Reviewed-by: David Matlack <dmatlack@xxxxxxxxxx>

> ---
>  .../selftests/kvm/kvm_binary_stats_test.c       | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 
> diff --git a/tools/testing/selftests/kvm/kvm_binary_stats_test.c b/tools/testing/selftests/kvm/kvm_binary_stats_test.c
> index 5906bbc08483..03c7842fcb26 100644
> --- a/tools/testing/selftests/kvm/kvm_binary_stats_test.c
> +++ b/tools/testing/selftests/kvm/kvm_binary_stats_test.c
> @@ -109,6 +109,23 @@ static void stats_test(int stats_fd)
>  		/* Check size field, which should not be zero */
>  		TEST_ASSERT(pdesc->size, "KVM descriptor(%s) with size of 0",
>  				pdesc->name);
> +		/* Check hist_param field */
> +		switch (pdesc->flags & KVM_STATS_TYPE_MASK) {
> +		case KVM_STATS_TYPE_LINEAR_HIST:
> +			TEST_ASSERT(pdesc->hist_param,
> +			    "Bucket size of Linear Histogram stats (%s) is zero",
> +			    pdesc->name);
> +			break;
> +		case KVM_STATS_TYPE_LOG_HIST:
> +			TEST_ASSERT(pdesc->hist_param == 2,
> +				"Base of Log Histogram stats (%s) is not 2",
> +				pdesc->name);
> +			break;
> +		default:
> +			TEST_ASSERT(!pdesc->hist_param,
> +			    "Simple stats (%s) with hist_param of nonzero",
> +			    pdesc->name);
> +		}
>  		size_data += pdesc->size * sizeof(*stats_data);
>  	}
>  	/* Check overlap */
> -- 
> 2.32.0.93.g670b81a890-goog
> 



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux