Re: using rdtsc with 64 bits

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Mon, 09 Sep 2002, anton wilson wrote:

> 
> unsigned time, time_low, time_high;
> unsigned mhz = 150000000; // 150 MHz processor
> __asm rdtsc // Read time stamp to EAX
> __asm mov time_low, eax
> __asm mov time_high, edx
> Sleep (35000); // Sleep for 35 seconds
> __asm rdtsc
> __asm sub eax, time_low // Find the difference
> __asm sub edx, time_high
> 
> __asm div mhz // Unsigned divide EDX:EAX by mhz
> 
> __asm mov time, eax
> printf("Seconds: %u\n", time);
> 
> What exactly does the div line do? 
> 
divides the number of cycles measured by the number of hertz which
leads to the seconds consumed ,-)

--lpr

-- 
Lukas Ruf
http://www.lpr.ch                                http://www.maremma.ch    
   http://www.{{topsy,nodeos}.net,{promethos,netbeast,rawip}.org}
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux