lkml.org 
[lkml]   [1998]   [Apr]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: How do i read the clock cycle counter?
From
Date

Thomas Jensen <kauf@cs.auc.dk> writes:

> Hi!
>
> I'm using Linux RedHat 5.0 (Kernel 2.0.33), and i have to do some time
> measurements. How do i read the clock cycle counter register in a
> pentium / Pentium II CPU ??
>
> Thomas Kaufmann Jensen / kauf@cs.auc.dk
>
> .
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.rutgers.edu


unsigned int count[2];
asm("rdtsc"
:"=a" (count[0]),
"=d" (count[1]));

Should do it, you need a gas recent enough to understabd the rdtsc
opcode. If not there's an example somewhere in the kernel code which
uses the opcodes.

--
Paul

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu

\
 
 \ /
  Last update: 2005-03-22 13:42    [W:0.110 / U:0.160 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site