Re: using rdtsc with 64 bits

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

 



On Monday 09 September 2002 04:01 pm, you wrote:
> 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 ,-)
>

I know that's what it does,
but what is the dividend? Is it the 64-bit number created by combining eax 
and edx? I don't understand where the dividend on that line is coming from. 
And if it is a 64-bit number, how do I change the mull assembly in 
do_fast_getttimeoffset to do the same thing?


Anton
--
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