FreeBSD CPU Information

by on January 13, 2007 · 10 comments· LAST UPDATED January 17, 2014

in , ,

How do I get more information about CPU under FreeBSD operating systems such as CPU Speed and model?

Tutorial details
DifficultyEasy (rss)
Root privilegesYes
RequirementsNone
Estimated completion timeN/A
You can use the dmesg utility displays the contents of the system message buffer when FreeBSD comes up. For accuracy I recommend querying /var/run/dmesg.boot file. Usually a snapshot of the buffer contents taken soon after file systems are mounted at startup time and dumped to /var/run/dmesg.boot file.

Check CPU Speed in FreeBSD using sysctl command

Type the following command at a shell prompt as root user:
# sysctl -a | egrep -i 'hw.machine|hw.model|hw.ncpu'
Sample outputs:

hw.machine: amd64
hw.model: Intel(R) Xeon(R) CPU           X3220  @ 2.40GHz
hw.ncpu: 4
hw.machine_arch: amd64

So I've Intel Xeon quad core processor running at 2.40GHz speed.

FreeBSD CPUINFO using dmesg command

Type the following command:
# dmesg | grep -i cpu
Or directly query /var/run/dmesg.boot file
# grep -i cpu /var/run/dmesg.boot
Output:

CPU: Dual Core AMD Opteron(tm) Processor 170 (1999.08-MHz 686-class CPU)
FreeBSD/SMP: Multiprocessor System Detected: 2 CPUs
 cpu0 (BSP): APIC ID:  0
 cpu1 (AP): APIC ID:  1
cpu0:  on acpi0
acpi_throttle0:  on cpu0
cpu1:  on acpi0
acpi_throttle1:  on cpu1
SMP: AP CPU #1 Launched!

You can also dump more information using sysctl command:
# sysctl -a | grep -i cpu | less

Tweet itFacebook itG+ itDownload PDF versionFound an error/typo on this page?

{ 10 comments… read them below or add one }

1 Eugene Markow August 2, 2008 at 4:39 am

In ‘dmesg -a’, my cpu speed is clearly displayed as “CPU: AMD Athlon(tm) Processor (998.07-MHz 686-class CPU)”.

When I used:

‘sysctl -a | egrep -i ‘hw.machine|hw.model|hw.ncpu’.

the following was displayed:

hw.machine: i386
hw.model: AMD Athlon(tm) Processor
hw.ncpu: 1
hw.machine_arch: i386

Why wasn’t the ‘speed’ of my processor displayed. It isn’t present anywhere in ‘sysctl -a’ either. Anyone know why? Thanks.

Reply

2 Paul March 12, 2009 at 11:28 pm

Thanks for the info, while the sysctl line didn’t work b/c it lacked the CPU speed grepping dmesg.boot worked like a charm.

Reply

3 Casey Hillman May 3, 2009 at 7:21 pm

Clockspeed is in sysctl, it is hw.clockrate

‘sysctl -a | grep hw.clockrate’

Reply

4 Chris LaFond August 5, 2009 at 3:59 am

Quick question,
my output shows:
palamon# sysctl -a | egrep -i ‘hw.machine|hw.model|hw.ncpu’
hw.machine: i386
hw.model: Intel(R) Pentium(R) 4 CPU 2.00GHz
hw.ncpu: 1
hw.machine_arch: i386

with this, will my programs run slower for being compiled to run on a 386?
should it be at least 686?
Thanks

Reply

5 dev September 4, 2009 at 5:54 pm

is i386 32 and 64 bit capable?

Reply

6 Mr. Mead January 17, 2011 at 3:35 pm

‘sysctl -a | grep hw.clockrate’
seriously!?

sysctl hw.clockrate

kthxbye

Reply

7 me August 3, 2013 at 1:25 pm

no dude, you DON’T HAVE a cpu running at 2.4G
you have a cpu that can run at 2.4G
what’s the difference … hmmm … in linux

cat /proc/cpuinfo | grep -i cpu
cpu family : 6
model name : Intel(R) Core(TM)2 Duo CPU T8300 @ 2.40GHz
cpu MHz : 800.000
cpu cores : 2
cpuid level : 10
cpu family : 6
model name : Intel(R) Core(TM)2 Duo CPU T8300 @ 2.40GHz
cpu MHz : 800.000
cpu cores : 2
cpuid level : 10

so, it is running at 800MHz not 2.4GHz …

Reply

8 theManda January 17, 2014 at 11:55 am

more simple way

sysctl hw.model hw.machine hw.ncpu
hw.model: Intel(R) Core(TM) i7-3930K CPU @ 3.20GHz
hw.machine: amd64
hw.ncpu: 8

Reply

9 Aakaash August 4, 2014 at 4:09 am

In that output:

hw.machine: amd64
hw.model: Intel(R) Xeon(R) CPU X3220 @ 2.40GHz
hw.ncpu: 4
hw.machine_arch: amd64

Why AMD and Intel are coming together? Sorry if this question is silly.

Reply

10 Ruben Schade December 20, 2014 at 11:10 pm

There’s a lot of confusion in the comments here. Given this page ranks highly in The Google, I’ll throw in my 20 cents (adjusted for inflation).

“i386″ means 32bit, “amd64″ means 64bit. In brief, this is due to AMD having designed the original 64bit extensions for x86. Intel Core CPUs will still be listed as amd64 on the BSDs.

In Linux, “/proc/cpuinfo” shows the capabilities of a CPU, but it may be throttling down for power saving. When you require the performance, it will revert to its full performance.

There aren’t any silly questions. We learn by researching and asking :).

Reply

Leave a Comment

Tagged as: , , , , , ,

Previous Faq:

Next Faq: