kvm-ppc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jing Zhang <jingzhangos@google.com>
To: KVM <kvm@vger.kernel.org>, KVMPPC <kvm-ppc@vger.kernel.org>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Sean Christopherson <seanjc@google.com>,
	Jim Mattson <jmattson@google.com>,
	Peter Shier <pshier@google.com>, Oliver Upton <oupton@google.com>,
	David Rientjes <rientjes@google.com>,
	David Matlack <dmatlack@google.com>
Cc: Jing Zhang <jingzhangos@google.com>
Subject: [PATCH v1 3/4] KVM: selftests: Add checks for histogram stats parameters
Date: Tue, 06 Jul 2021 18:03:49 +0000	[thread overview]
Message-ID: <20210706180350.2838127-4-jingzhangos@google.com> (raw)
In-Reply-To: <20210706180350.2838127-1-jingzhangos@google.com>

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@google.com>
---
 .../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

  parent reply	other threads:[~2021-07-06 18:03 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-06 18:03 [PATCH v1 0/4] Linear and Logarithmic histogram statistics Jing Zhang
2021-07-06 18:03 ` [PATCH v1 1/4] KVM: stats: Support linear and logarithmic " Jing Zhang
2021-07-08 21:01   ` David Matlack
2021-07-08 21:40     ` Jing Zhang
2021-07-08 21:45       ` David Matlack
2021-07-12 14:10   ` kernel test robot
2021-07-12 16:16     ` Jing Zhang
2021-07-12 18:53   ` kernel test robot
2021-07-28 12:39   ` Paolo Bonzini
2021-07-30 17:31     ` Jing Zhang
2021-07-06 18:03 ` [PATCH v1 2/4] KVM: stats: Update doc for " Jing Zhang
2021-07-07 23:31   ` David Matlack
2021-07-08 14:29     ` Jing Zhang
2021-07-28 12:42     ` Paolo Bonzini
2021-07-30 17:32       ` Jing Zhang
2021-07-08 21:14   ` David Matlack
2021-07-08 21:16     ` David Matlack
2021-07-08 21:43       ` Jing Zhang
2021-07-06 18:03 ` Jing Zhang [this message]
2021-07-08 21:26   ` [PATCH v1 3/4] KVM: selftests: Add checks for histogram stats parameters David Matlack
2021-07-06 18:03 ` [PATCH v1 4/4] KVM: stats: Add halt polling related histogram stats Jing Zhang
2021-07-08 21:42   ` David Matlack
2021-07-09 15:18     ` Jing Zhang
2021-07-09 15:25       ` David Matlack
2021-07-28 12:45   ` Paolo Bonzini
2021-07-30 17:34     ` Jing Zhang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210706180350.2838127-4-jingzhangos@google.com \
    --to=jingzhangos@google.com \
    --cc=dmatlack@google.com \
    --cc=jmattson@google.com \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=oupton@google.com \
    --cc=pbonzini@redhat.com \
    --cc=pshier@google.com \
    --cc=rientjes@google.com \
    --cc=seanjc@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).