[ntp:questions] NTP + kernel frequency

Per Hedeland per at hedeland.org
Wed Nov 14 19:43:47 UTC 2007

In article <pan.2007. at fl_net_au.invalid> Andrew
Hood <ajhood at fl_net_au.invalid> writes:
>On Sat, 10 Nov 2007 00:38:23 +0000, Per Hedeland wrote:
>> In article <k7mdnaWnzZTu6q7anZ2dnUVZWhednZ2d at megapath.net>
>> hal-usenet at ip-64-139-1-69.sjc.megapath.net (Hal Murray) writes:
>>>>I known now, in the "recen"t kernel the internal frequency will be to
>>>>250 Mhz...
>>>>With my gentoo it's not a problem for me because i make myself my kernel
>>>>... but if i take Mandriva or a another distribution how find this
>>>>values ?
>>>I assume you mean the scheduling clock which would be 250 Hz rather than
>>>One way is to look in the kernel souces.
>>>Another way is to measure it.  Write a program that usleeps for a
>>>microsecond and see how long it really takes.  (Do it in a loop for 1000
>>>tries and print out a histogram.)
>> On Linux, a simpler way can be to look at /proc/interrupts - e.g.
>> (probably Linux-version- and possibly config-specific):
>> $ (cat /proc/interrupts; sleep 10; cat /proc/interrupts) | \
>>   awk '/timer/{prev=now; now=$2} END{printf "%dHz\n", int((now-prev)/10)}'
>This doesn't work on multi-CPU systems.

Actually the system I verified it on (mentioned elsewhere in the thread)
was dual-CPU...

>: cat /proc/interrupts |grep timer 
>  0:  129602418  129428516    IO-APIC-edge  timer

...but you're right of course - it just so happened that all the "timer"
interrupts were fielded on CPU 0 on the system where I tried it:

$ cat /proc/interrupts |grep timer 
  0: 3845082271          0   IO-APIC-edge      timer

(Probably not a random thing, but I don't know what causes it - there's
certainly no "end user" config to make it so.)

>You need to sum across all CPUs. A bit more complex:
>-------------- snip --------------
>#!/usr/bin/perl -w

It's still possible to do with a one-liner awk, just that the line gets
a tad longer.:-) Left as an exercise etc...

--Per Hedeland
per at hedeland.org

More information about the questions mailing list