On Mon, 28 Nov 2005 12:10:46 -0500
"Stephen C. Tweedie" <sct@xxxxxxxxxx> wrote:
> Hi,
>
> On Mon, 2005-11-28 at 10:27 -0600, xuehai zhang wrote:
>
> > Your questioning makes sense to me. But I am not very sure about how to
> > effectively count how many these operations can be completed in a second.
> > Can you give me some hint?
>
> Here's a quick-and-dirty wrapper for timing "something" over the space
> of a few seconds (default 10) and working out how fast it went.
> Obviously, you want to be running this on an otherwise-idle machine, and
> with CPU frequency management disabled. It's really, really dumb, but
> it only uses "time()", not any subsecond time sourcing, for its work.
>
> Cheers,
> Stephen
Hi, this is cool. I was trying different calls in the 'timeme_dosomething'
procedure, is there something about sleep that would be problematic?
void timeme_dosomething(void)
{
sleep(1);
}
Waiting for fresh timer tick... done.
Timing noop for 10 seconds: completed 34319333 cycles in 10 seconds
Timing something for 10 seconds: completed 10 cycles in 10 seconds
Average time for something: 0.000000 seconds (291.381042 ns).
It gets the 10 cycles in 10 seconds right, but shouldn't the average be 1.0?
Thanks,
Tim
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|