On Wed, Sep 30, 2009 at 09:17:24PM -0700, Lynn W. Taylor wrote:

> I would be perfectly happy with:
> 
>    time(&t);
>    unsigned long i;
>    for(i=0;i<4294967295;i++);
>    speed=1/time(NULL)-t;

With a modern compiler you'd get a "division by zero" error, since the
compiler can figure out that the loop does nothing and can optimize it
out. You _must_ do something non-trivial inside the loop, and then we're
back at arguing about the ratio of int/FP/mmx/etc. instructions inside
the loop.

Actually, if you want something quick, why not just use the Linux
BogoMips value? On many Linux architectures it can be read from
/proc/cpuinfo so it's essentially free; and the code can be ported to
other architectures/operating systems.

Gabor

-- 
     ---------------------------------------------------------
     MTA SZTAKI Computer and Automation Research Institute
                Hungarian Academy of Sciences
     ---------------------------------------------------------
_______________________________________________
boinc_dev mailing list
boinc_dev@ssl.berkeley.edu
http://lists.ssl.berkeley.edu/mailman/listinfo/boinc_dev
To unsubscribe, visit the above URL and
(near bottom of page) enter your email address.

Reply via email to