Re: kernel 2.6 speed

From: Brice Goglin
Date: Sun Jul 24 2005 - 14:43:50 EST

Le 24.07.2005 21:12, Ciprian a écrit :
> while((testTime-initialTime) < 30)
> {
> time(&testTime);
> test /= 10;
> test *= 10;
> test += 10;
> test -= 10;
> counter ++;
> }

> In windows were performed about 300 millions cycles,
> while in Linux about 10 millions. This test was run on
> Fedora 4 and Suse 9.2 as Linux machines, and Windows
> XP Pro with VS .Net 2003 on the MS side. My CPU is a
> P4 @3GHz HT 800MHz bus.


This test gives you the price of the time function on each OS
since the 4 arithmetical operations are shorter to compute
(several cycles against tons of cycles). It appears that the time
function costs about 3 us on Linux against 0.1 us on Windows.
This function is probably very OS-dependant since it depends on
how the kernel handles timing. You can't compare anything as small
as these arithmetical operations like this. Using rdtsc would be
much better.

Anyway, if you just want to measure the cost of arithmetic
operations, there shouldn't be any difference in the results
between Linux and Windows (with a safe timing method).

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at