Task to busy one CPU 100% for a period of time?
smithi at nimnet.asn.au
Sun Jan 10 15:57:38 UTC 2016
Hi crew, hopefully refreshed and sharp as tacks from a holiday!
I've been doing extensive testing of load average reporting using
different eventtimers (HPET and LAPIC) on stable/9 on a Lenovo X200,
2.4GHz Core2Duo, at idle and with one, two and four fully CPU-bound
processes that are configured to run for ~15.5 minutes on my system.
When load averages are being correctly accounted, this produces results
for one-minute averages of 0.00 at idle, 0.99-1.00 with one such task
running, 1.99-2.00 for two and 3.99-4.00 for four, as expected. 5 and
15 minute LAs respectively take longer to get up toward the same points,
and correspondingly much longer to sink back to 0.00, also as expected.
When not being correctly accounted, in otherwise the same environment,
this method provides good clues to the extent of errors over this range.
For this I've been using a program of mine that I know only does a very
large number of fixed and floating point operations, and beyond reading
a config file and around 7 1/2 KB records, uses no I/O nor other system
calls at all in its main loop, when configured with 'nowrite' - or each
instance would generate a 2.4GB 72-minute 96kHz 24-bit stereo .wav file!
However it's a large Pascal program, not ready for release nor in a form
that others could readily use to reproduce my results, and I'm at the
point where I need to be able to post a method of doing just that.
So I'm looking for some utility, preferably in the base system but a
port/pkg could do, that can just burn one CPU (ie is single-threaded)
for a specified number of iterations. And not for a specified time -
which would use system time to query time - nor in any interpreted
A little pre- and/or post-loop reporting is not a problem.
I'm likely missing something quite obvious; suggestions welcome.
cheers, Ian (please cc me, I'm subscribed to the daily digest)
More information about the freebsd-questions