Timers and timing, was: MySQL Performance 6.0rc1
Poul-Henning Kamp
phk at phk.freebsd.dk
Fri Oct 28 03:14:50 PDT 2005
In message <c21e92e20510280248g6b47a7c6t79cb07e53a7db118 at mail.gmail.com>, Jiawe
i Ye writes:
Very typical numbers...
>kern.timecounter.hardware: ACPI-fast -> TSC
> getpid(): 0.94267
> gettimeofday(): 1.25332
So timekeeping "as such" takes no more than 310nsec and that
includes a TSC read of unknown duration.
I consider the 310 nsec acceptable, but if this is a really
big problem for people, somebody is welcome to start looking
at doing inline assembler code to speed it up
>kern.timecounter.hardware: TSC -> ACPI-fast
> getpid(): 0.94788
> gettimeofday(): 2.29598
ACPI-fast does an inl() which seems to take a microsecond longer
than rdtsc().
One microsecond is disgusting considering that the hardware lives
in the chipset and was meant to improve timekeeping performance.
>kern.timecounter.hardware: ACPI-fast -> i8254
> getpid(): 0.96921
> gettimeofday(): 5.01292
And i8254 does a outb() and several 8 bit inb on a simulated ISA
bus and therefore takes 3.75 usec longer than rdtsc().
--
Poul-Henning Kamp | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG | TCP/IP since RFC 956
FreeBSD committer | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.
More information about the freebsd-current
mailing list