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 <time.h>
#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.
<title> | 769 Basque Way
[EMAIL PROTECTED] | Carson City, NV 89706
775-886-6477 | www.matriplex.com
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message