From owner-freebsd-net Wed Sep 6 5:15:38 2000 Delivered-To: freebsd-net@freebsd.org Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by hub.freebsd.org (Postfix) with ESMTP id A711037B424 for ; Wed, 6 Sep 2000 05:15:34 -0700 (PDT) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.8.7/8.8.7) with ESMTP id XAA08161; Wed, 6 Sep 2000 23:15:24 +1100 Date: Wed, 6 Sep 2000 23:15:21 +1100 (EST) From: Bruce Evans X-Sender: bde@besplex.bde.org To: Kenjiro Cho Cc: freebsd-net@FreeBSD.ORG Subject: Re: rdtsc overhead (was Re: Running ALTQ) In-Reply-To: <20000906165112Y.kjc@csl.sony.co.jp> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org On Wed, 6 Sep 2000, Kenjiro Cho wrote: > > Bruce Evans wrote: > > main() > > { > > __asm(" > > movl $100000000,%ecx > > .align 4,0x90 > > 1: > > rdtsc > > decl %ecx > > nop > > jne 1b > > "); > > } > > > > and it took 30 cycles on a Celeron and 12 cycles on a P5 (32 and 14 > > cycles, respectively, including 2 cycles of loop overhead). > > Hmmm, I've confirmed the result. If another rdtsc is inserted in the > loop, it almost doubles the execution time, which suggests the loop > overhead is negligible. > > But 30 cycles sound a bit too long. As I understand it, rdtsc is not > a serializing instruction. Is it more than latching the counter plus > reading the 64bit value into 2 32bit registers? I don't know exactly what it does. Apperently the latch operation is slow. 12 cycles was on a P5/133 and 30 cycles was on a Celeron 366 overclocked to 522. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message