From owner-freebsd-hackers Thu Nov 2 12:17:32 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from mail.matriplex.com (ns1.matriplex.com [208.131.42.8]) by hub.freebsd.org (Postfix) with ESMTP id 3E74C37B479 for ; Thu, 2 Nov 2000 12:17:30 -0800 (PST) Received: from mail.matriplex.com (mail.matriplex.com [208.131.42.9]) by mail.matriplex.com (8.9.2/8.9.2) with ESMTP id MAA09757; Thu, 2 Nov 2000 12:17:16 -0800 (PST) (envelope-from rh@matriplex.com) Date: Thu, 2 Nov 2000 12:17:15 -0800 (PST) From: Richard Hodges To: Hao Zhang Cc: "'freebsd-hackers@FreeBSD.ORG'" Subject: Re: high speed timestamp counter In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Thu, 2 Nov 2000, Hao Zhang wrote: > Hi there, > > I am trying to read the on board Pentium Time Stamp Counter. Is there an API > in Unix that allows me to read it directly? > Or some assembly language line that I can drop into my code? > > I need the high speed counters to profile some code. I don't want to use the > classical time API that is provided in #define GET_RDTSC(var) {__asm__ volatile("rdtsc":"=A"(var)); } { long long timeval1, timeval2, diff; GET_RDTSC(timeval1); do_something(); GET_RDTSC(timeval2); diff = timeval2 - timeval1; } Is this what you had in mind? All the best, -Richard ------------------------------------------- Richard Hodges | Matriplex, inc. | 769 Basque Way rh@matriplex.com | Carson City, NV 89706 775-886-6477 | www.matriplex.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message