Date: Fri, 28 Oct 2005 12:14:48 +0200 From: "Poul-Henning Kamp" <phk@phk.freebsd.dk> To: Jiawei Ye <leafy7382@gmail.com> Cc: Mark Kirkwood <markir@paradise.net.nz>, Pawel Jakub Dawidek <pjd@freebsd.org>, David Xu <davidxu@freebsd.org>, "Yuriy N. Shkandybin" <jura@networks.ru>, current@freebsd.org Subject: Re: Timers and timing, was: MySQL Performance 6.0rc1 Message-ID: <30832.1130494488@critter.freebsd.dk> In-Reply-To: Your message of "Fri, 28 Oct 2005 17:48:19 %2B0800." <c21e92e20510280248g6b47a7c6t79cb07e53a7db118@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
In message <c21e92e20510280248g6b47a7c6t79cb07e53a7db118@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@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.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?30832.1130494488>