From: Christoffer Dall <christoffer.dall@linaro.org>
To: Shih-Wei Li <shihwei@cs.columbia.edu>
Cc: Yury Norov <ynorov@caviumnetworks.com>,
Andrew Jones <drjones@redhat.com>,
kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu,
Marc Zyngier <marc.zyngier@arm.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Christoffer Dall <cdall@cs.columbia.edu>
Subject: Re: [PATCH v3 2/2] arm64: add micro test
Date: Wed, 24 Jan 2018 09:17:55 +0100 [thread overview]
Message-ID: <20180124081755.GO21802@cbox> (raw)
In-Reply-To: <CAO+sbHHKyYHjGqmS5uM=C6bCnUQ2CbHmmFBTAb=WanQsWdLU2Q@mail.gmail.com>
Hi Shih-Wei,
On Fri, Jan 19, 2018 at 04:57:55PM -0500, Shih-Wei Li wrote:
> Thanks for the feedback about the mistakes in math and some issues in
> naming, print msg, and coding style. I'll be careful and try to avoid
> the same problems the next patch set. Sorry for all of the confusion.
>
> So we now skip the test when "sample == 0" happens over 1000 times.
> This is only due to the case that "cost is < 1/cntfrq" since it's not
> possible for the tick to overflow for that many times. Did I miss
> something here? I do agree that we should output better msgs to tell
> users that the cost of a certain test is constantly smaller than a
> tick.
>
I think for things like vmexit counts, it's very likely that all the
samples will result in 0 ticks on many systems (fast CPU and slow arch
counter; the architecture doesn't give us any guarantees here). For
example, a system with a 2 GHz CPU and a 1 MHz counter will give you a
granularity of 2000 cycles for each counter tick, which is not that
useful for low-level tuning of KVM.
So what I thought we were going to do was:
main_test_function()
{
long ntimes = NTIMES;
long cost, total_cost;
cnt1 = read_cnt();
do {
run_test();
} while(ntimes--);
cnt2 = read_cnt();
if (verify_sane_counter(cnt1, cnt2))
return;
total_cost = to_nanoseconds(cnt2 - cnt1);
cost = total_cost / NTIMES;
printf("testname: %l (%l)\n", cost, total_cost);
}
And in that way amortize the potential lack of precision over all the
iterations. Did I miss some prior discussion about why that was a bad
idea?
It would also be possible to have two functions, one that does the above
and one that does a per-run measurement, in case the user wants to know
min/max/stddev and is running on a system with sufficient precision.
The method could be chosen via an argument.
Thanks,
-Christoffer
next prev parent reply other threads:[~2018-01-24 8:17 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-17 21:46 [PATCH v3 0/2] Support micro operation measurement on arm64 Shih-Wei Li
2018-01-17 21:46 ` [PATCH v3 1/2] arm/arm64: add GICD_IIDR definition Shih-Wei Li
2018-01-17 21:46 ` [PATCH v3 2/2] arm64: add micro test Shih-Wei Li
2018-01-18 9:30 ` Andrew Jones
2018-01-18 10:09 ` Yury Norov
2018-01-18 10:37 ` Andrew Jones
2018-01-18 11:39 ` Yury Norov
2018-01-19 21:57 ` Shih-Wei Li
2018-01-20 11:26 ` Yury Norov
2018-01-22 8:48 ` Andrew Jones
2018-01-23 18:48 ` Shih-Wei Li
2018-01-23 19:54 ` Andrew Jones
2018-01-24 8:17 ` Christoffer Dall [this message]
2018-01-24 8:30 ` Andrew Jones
2018-01-24 9:23 ` Christoffer Dall
2018-01-25 2:55 ` Shih-Wei Li
2018-01-25 8:52 ` Christoffer Dall
2018-01-25 13:45 ` Shih-Wei Li
2018-01-18 8:45 ` [PATCH v3 0/2] Support micro operation measurement on arm64 Yury Norov
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=20180124081755.GO21802@cbox \
--to=christoffer.dall@linaro.org \
--cc=cdall@cs.columbia.edu \
--cc=drjones@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=marc.zyngier@arm.com \
--cc=pbonzini@redhat.com \
--cc=shihwei@cs.columbia.edu \
--cc=ynorov@caviumnetworks.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.