Re: gettimeofday() vs. /proc/rtc

Andi Kleen (ak@muc.de)
20 Jul 1998 14:05:26 +0200


MOLNAR Ingo <mingo@chiara.csoma.elte.hu> writes:

> with that stuff, gettimeofday() takes ~300 cycles, thats under 1
> microsecond too. (unless you have CONFIG_APM turned on, but people have
> posted patches to fix that case too)

.. But when you already run on a Pentium or up then it is faster to just
read the cycle register in user space directly[1]. This even works without
any kernel patches :)

Of course this won't help the original poster running a 486.

-Andi

[1] And also is fun to use when some other user encrypts something with
his PGP private key at the same time, but that's another thing.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html