Re: rdtscll and jiffies

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

 




I have one doubt.

Can we use do_gettimeofday(struct timeval *) for measuring time for higher precision as to current_kernel_time?

"As per Linux device drivers book it gives granulity upto what part of the current jiffy has elapsed as compared to current_kernel_time which gives only till jiffy granulity."


Thanks
Titus




On 6/30/06, Fernando Apesteguía <fernando.apesteguia@xxxxxxxxx > wrote:
Yeah, you're right, for some processors (Centrino, AMD64, etc..) cpu_khz is re-calibrated. Since this is for a test in a Pentium IV without HT I think the cpu_khz doesn't change. About the idle loop, I read (part of) the Intel Architecture Software Developer Manual volume 3B. They ensure the time-stamp is increased at a constant-rate and don't say anything about stopping the counter while into the idle loop. I hope this is safe for this purpose because this code doesn't intend to be very portable (there is other part of the code that deals with Pentium IV MSRs and this is even less portable).

However I'll be watching for the results in order to catch possible anomalies.

Many thanks Arjan for answer _all_ of my noob questions :)

Regards


---------- Forwarded message ----------
From: Arjan van de Ven <arjan@xxxxxxxxxxxxx>
Date: Jun 29, 2006 8:09 PM
Subject: Re: rdtscll and jiffies
To: Fernando Apesteguía < fernando.apesteguia@xxxxxxxxx>
Cc: kernelnewbies < kernelnewbies@xxxxxxxxxxxx>

On Thu, 2006-06-29 at 19:15 +0200, Fernando Apesteguía wrote:
> Thanks to both of you.
>
> If I use jiffies global variable, very often I get two identical
> values before and after the function call. I need more accurate
> stamps. Now, with rdtscll I get these values but in cycles. This
> measurement is for the same machine, so if I could have the cpu MHz I
> could do the division. Am I right?
>
> Now the question is how to get cpu MHz. The cpuinfo_x86 structure has
> not this field. I try to keep track for the value showed
> by /proc/cpuinfo. But at arc/i383/kernel/cpu/proc.c I see the
> following sentence:
>
> if ( cpu_has(c, X86_FEATURE_TSC) ) {
>                 seq_printf(m, "cpu MHz\t\t: %u.%03u\n",
>                         cpu_khz / 1000, (cpu_khz % 1000));
>
> But cpu_khz is not declared in this file.... even as extern.
>
> Any ideas to get cpu MHz (or KHz) in order to convert cycles to time
> units?

it'll be in a header
BUT
cpu_khz is NOT a constant.. power management will change the actual
frequency all the time..

and.. as I said, some processors entirely stop the tsc in the idle
loop..




[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