From owner-freebsd-hackers Wed Jul 17 12:26:41 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CCBF537B401 for ; Wed, 17 Jul 2002 12:26:37 -0700 (PDT) Received: from PIKES.panasas.com (gw2.panasas.com [65.194.124.178]) by mx1.FreeBSD.org (Postfix) with ESMTP id EF93A43E4A for ; Wed, 17 Jul 2002 12:26:36 -0700 (PDT) (envelope-from deepankar.das@panasas.com) Received: from panasas.com ([172.17.132.153]) by PIKES.panasas.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) id 3M3CQMFT; Wed, 17 Jul 2002 15:26:35 -0400 Message-ID: <3D35C4EA.3050408@panasas.com> Date: Wed, 17 Jul 2002 12:26:34 -0700 From: Deepankar Das User-Agent: Mozilla/5.0 (X11; U; Linux i386; en-US; rv:0.9.4) Gecko/20011126 Netscape6/6.2.1 X-Accept-Language: en-us MIME-Version: 1.0 To: Andrei Cojocaru Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: Counting the clock cycles References: <00d501c22dc4$57d08b00$0200a8c0@twothousand> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG rdtsc() will give you cycle counts since system boot. It reads a Pentium internal register which is incremented at every CPU internal clock cycle. Deepankar Andrei Cojocaru wrote: > I was asking around in #freebsdhelp on EFNet what the equivalent of > GetTickCount() in the Win32 API is in FreeBSD. > > I need a way to properly determine passage of time that is not affected if I > change the system clock for example. The only way I'm aware that you can do > that is by counting the number of clock cycles since system startup. What > function does that in FreeBSD? I'd also like a Linux way if possible. (that > is a way that will work across all UNIX clones). Thanks and please include > my email in the reply directly since I'm not signed up to this mailing list. > Thanks once again. > ---- > Andrei Cojocaru > spinlock_lists@empirequest.com > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-hackers" in the body of the message > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message