Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm setting up conky and I would like to add the CPU frequency, but if I put

${freq_g cpu0} Ghz

I get 1.2Ghz. Why is that? My CPU is 2.8Ghz.

share|improve this question
add comment

3 Answers 3

up vote 4 down vote accepted

From the conky man page.

cpu (cpuN)

CPU usage in percents. For SMP machines, the CPU number can be provided as an argument. ${cpu cpu0} is the total usage, and ${cpu cpuX} (X >= 1) are individual CPUs.

freq_g (n)

Returns CPU #n's frequency in GHz. CPUs are counted from 1. If omitted, the parameter defaults to 1.

You most likely have something like SpeedStep enabled which is acting like a governor on a car, regulating the speed of the cores inside your CPU.

You can confirm that this is going on by looking at the output of this command:

% less /proc/cpuinfo
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 37
model name      : Intel(R) Core(TM) i5 CPU       M 560  @ 2.67GHz
stepping        : 5
cpu MHz         : 1199.000
...

The 2 numbers that matter are the 2.67GHz, that the GHz that my CPU is rated to operate at followed by the number 1199.00, this is what my CPU is allowed to run at by the governor setup on my Linux laptop.

You can see what governor is currently configured like so:

# available governors
% sudo cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors 
powersave ondemand userspace performance 

# which one am I using?
% sudo cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor 
powersave

# what's my current frequency scaling?
% sudo cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq 
1199000

# what maximum is available?
% sudo cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq 
2667000

# what's the minimum?
% sudo cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq 
1199000

# what scaling frequencies can my CPU support?
% sudo cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies 
2667000 2666000 2533000 2399000 2266000 2133000 1999000 1866000 1733000 1599000 1466000 1333000 1199000 

You can override your governor by doing the following, using one of the governor's listed above:

% sudo sh -c "echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor"

References

share|improve this answer
add comment

In case you want to print the CPU frequency your CPU is capable of, instead of or in addition to the currently used CPU speed try

${pre_exec cat /proc/cpuinfo | grep 'model name' | uniq | awk '{print $10}' }

this will only execute once at the launch of conky, and output the CPU frequency listed in /proc/cpuinfo.

I am not sure if the Output of model name is unified, so if you don't get the right output you have to edit the $10 in awk to a lower or higher number.

share|improve this answer
add comment

That shows the current CPU frequency, you've probably got CPU frequency scaling activated, so your CPU "slows down" when there's not much to do, and if you do something CPU intensive it should speed up to 2.8 and/or something in between, it's normal.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.