[ntp:questions] NTP + kernel frequency

Andrew Hood ajhood at fl_net_au.invalid
Tue Nov 13 11:52:34 UTC 2007


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
>>MHz.
>>
>>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.

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

You need to sum across all CPUs. A bit more complex:

-------------- snip --------------

#!/usr/bin/perl -w

$cpus=`grep -c processor /proc/cpuinfo`;

$_=`grep timer /proc/interrupts`; @prev=split();

sleep 10;

$_ =`grep timer /proc/interrupts`; @now =split();

for (1..$cpus) { $prev+=$prev[$_]; $now+=$now[$_]}

printf "%dHz\n", int(($now-$prev)/10);

-------------- snip --------------

-- 
2007/11/13:11:39:48UTC Slackware Linux 2.4.32
up 29 days, 23:31,  6 users,  load average: 2.18, 2.26, 2.25




More information about the questions mailing list