Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 10 Jan 2004 00:12:20 +0100
From:      Palle Girgensohn <girgen@pingpong.net>
To:        freebsd-questions@freebsd.org
Subject:   how find out CPU clockrate?
Message-ID:  <300110000.1073689940@palle.girgensohn.se>

next in thread | raw e-mail | index | archive | help
Hi!

How can I programatically find out the CPU frequency?

I'm trying to port a program from Linux, and it uses /proc/cpuinfo.

$ cat /compat/linux/proc/cpuinfo
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 14
stepping        : 2
flags           : fpu vme de pse tsc msr pae mce cx8 sep mtrr pge mca cmov 
pat pse36 mmx fxsr
cpu MHz         : 349.20
bogomips        : 349.20


Pretty neat, but it does not exist in FreeBSD, and sysctl does not give out 
this information. Grepping the dmesg.boot seems somewhat odd for a C 
program:

$ dmesg | grep -i hz
Timecounter "i8254"  frequency 1193182 Hz
CPU: Pentium II/Pentium II Xeon/Celeron (349.20-MHz 686-class CPU)


Better ideas?

/Palle




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?300110000.1073689940>