From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: Paul Mackerras <paulus@samba.org>
Cc: Ingo Molnar <mingo@elte.hu>, Thomas Gleixner <tglx@linutronix.de>,
linux-kernel@vger.kernel.org
Subject: Re: Test program for counters in groups
Date: Thu, 19 Mar 2009 18:41:35 +0100 [thread overview]
Message-ID: <1237484495.24626.24.camel@twins> (raw)
In-Reply-To: <18880.12797.758764.128252@cargo.ozlabs.ibm.com>
On Wed, 2009-03-18 at 10:27 +1100, Paul Mackerras wrote:
> Here's a little test program that checks whether software counters
> (specifically, the task clock counter) work correctly when they're in
> a group with hardware counters.
>
> What it does is to create several groups, each with one hardware
> counter, counting instructions, plus a task clock counter. It needs
> to know an upper bound N on the number of hardware counters you have
> (N defaults to 8), and it creates N+4 groups to force them to be
> multiplexed. It also creates an overall task clock counter.
>
> Then it spins for a while, and then stops all the counters and reads
> them. It takes the total of the task clock counters in the groups and
> computes the ratio of that total to the overall execution time from
> the overall task clock counter.
>
> That ratio should be equal to the number of actual hardware counters
> that can count instructions. If the task clock counters in the groups
> don't stop when their group gets taken off the PMU, the ratio will
> instead be close to N+4. The program will declare that the test fails
> if the ratio is greater than N (actually, N + 0.0001 to allow for FP
> rounding errors).
>
> Could someone run this on x86 on the latest PCL tree and let me know
> what happens? I don't have an x86 crash box easily to hand. On
> powerpc, it passes, but I think that is because I am missing setting
> counter->prev_count in arch/powerpc/kernel/perf_counter.c, and I think
> that means that enabling/disabling a group with a task clock counter
> in it won't work correctly (I'll do a test program for that next).
>
> Usage is: swsched-test [-c num-hw-counters] [-v]
>
> Use -c N if you have more than 8 hardware counters. The -v flag makes
> it print out the values of each counter.
Adapted the thing a little for the latest ABI, but it seems to work:
[root@opteron ~]# ./swsched-test
overall task clock: 3211403572
hw sum: 12150279972, task clock sum: 12845614288
ratio: 4.00
test passed
prev parent reply other threads:[~2009-03-19 17:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-17 23:27 Test program for counters in groups Paul Mackerras
2009-03-17 23:55 ` Peter Zijlstra
2009-03-19 17:41 ` Peter Zijlstra [this message]
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=1237484495.24626.24.camel@twins \
--to=a.p.zijlstra@chello.nl \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=paulus@samba.org \
--cc=tglx@linutronix.de \
/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