LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices

Reply
 
LinkBack Search this Thread
Old 02-09-2012, 03:22 PM   #1
krauskim
LQ Newbie
 
Registered: Feb 2012
Posts: 2

Rep: Reputation: Disabled
How does the Kernel determine processor speed at boot?


How does the Kernel determine the processor speed displayed in the boost.msg/dmesg log?

<6>Extended CMOS year: 2000
<6>TSC: PIT calibration confirmed by PMTIMER.
<6>TSC: using PIT calibration value
<4>Detected 2593.093 MHz processor.
<7>spurious 8259A interrupt: IRQ7.
<4>Console: colour dummy device 80x25
<6>console [tty0] enabled
<6>Checking aperture...

I would like to get this value and use it in conjunction with TSC for a high resolution / high performance timer. I’m currently using value ready from /proc/cpuinfo, but some recent experiments show that value is not correct; at least the /proc/cpuinfo value is not correct relative to gettimeofday().

Experiments show that the value displayed in /var/log/boot.msg (2.6.27 kernel) and /var/log/dmsg (2.6.32 kernel) is correct relative to gettimeofday().

I’m trying to find an alternative to opening a file in /var/log and reading the value, maybe a system call?

Please don’t flame me on the use of TSC for keeping track of time. I’m well aware of all the related issues. For my use case, TSC is ideal (if I can just get the correct frequency.)

Regards,
Matt
 
Old 02-10-2012, 02:07 AM   #2
bsat
Member
 
Registered: Feb 2009
Posts: 278

Rep: Reputation: 39
You can look into
/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq
 
Old 02-10-2012, 08:47 AM   #3
krauskim
LQ Newbie
 
Registered: Feb 2012
Posts: 2

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by bsat View Post
You can look into
/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq
Value found in /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq is from the cpufreq module. Those values seem to always be nice round numbers, i.e. 2600000, when the actual frequency of processor detected at boot is 2593093. That is enough error to throw off my calculations of time. Also, I actually need the frequency of the TSC, not the CPU frequency, which may be stepped up or down relative to TSC.

The Processor frequency detected at boot does seem to match the TSC frequency.

-Matt
 
Old 02-13-2012, 02:28 PM   #4
nini09
Member
 
Registered: Apr 2009
Posts: 505

Rep: Reputation: 41
You can read code in time.c and find out how to get exact CPU clock.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to determine and remove modules load at kernel boot? Zyndarius Debian 3 07-17-2009 12:19 PM
BIOS settings for processor? Command to get processor speed?? Memory speed? newtovanilla Linux - Newbie 9 12-04-2008 09:23 PM
CLI tool to determine processor type? wanderingmind Linux - Software 3 09-11-2007 06:47 PM
determine webcam speed? win2suse Linux - Software 0 03-19-2007 04:36 AM
Processor clock speed vs. CPU speed moxieman99 Linux - General 4 06-24-2005 10:43 AM


All times are GMT -5. The time now is 12:30 PM.

Main Menu
 
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration