On Nov 29, 2005, at 11:51 AM, Laurent GUERBY wrote:
On Mon, 2005-11-28 at 17:55 -0800, Mike Stump wrote:
My feeling is that we should have such a suite. I'd favor a micro
style, where we are measuring clock cycles (on machines that can
expose them x86/v9), [...]
A while ago I looked at rdtsc on x86-linux, but I couldn't find a way,
other than statistical / multiple runs and take minimum, to known
how many context switch happened between two points in the measured
code. Is this number available in some ways?
Nope, not portably. An OS is free to save out the tick count for
user land ticks, and make that available to the program. The idea
would be you take the tick counter add in this bias, and then presto,
you have user ticks for the process/thread. Just file a bug report
against your favorite OS for the feature, or ask an OS expert if it
exists.
When not available, just run 5, or 10 times, and take the minimum and
don't worry. interrupts are rare events, they don't happen but 1 in
a million clock cycles. :-)