Re: Timers and timing, was: MySQL Performance 6.0rc1

From: Poul-Henning Kamp <phk_at_phk.freebsd.dk>
Date: Fri, 28 Oct 2005 12:14:48 +0200
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.
Received on Fri Oct 28 2005 - 08:14:50 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:46 UTC