Display clock frequency per core using Conky [duplicate]

I am using Conky to display a lot of information of my system. I managed to display the load percentage per core. But I do not know how to display the clock frequency of each core. What I have now is:

${font sans-serif:bold:size=8}PROCESSORS ${hr 2}${font}
CPU1: ${cpu cpu1}% $alignr ${freq} MHz $alignr ${cpubar cpu1 8,60}
CPU2: ${cpu cpu2}% $alignr ${freq} MHz $alignr ${cpubar cpu2 8,60}
CPU3: ${cpu cpu3}% $alignr ${freq} MHz $alignr ${cpubar cpu3 8,60}
CPU4: ${cpu cpu4}% $alignr ${freq} MHz $alignr ${cpubar cpu4 8,60}
CPU5: ${cpu cpu5}% $alignr ${freq} MHz $alignr ${cpubar cpu5 8,60}
CPU6: ${cpu cpu6}% $alignr ${freq} MHz $alignr ${cpubar cpu6 8,60}
CPU7: ${cpu cpu7}% $alignr ${freq} MHz $alignr ${cpubar cpu7 8,60}
CPU8: ${cpu cpu8}% $alignr ${freq} MHz $alignr ${cpubar cpu8 8,60}

But this only gives me the global clock frequency and not the individual clock frequency per core. Does someone know how to get the individual clock frequency per core?

System information

  • Linux Mint 13 KDE, 64 bit (based on Ubuntu 12.04)
  • Intel i7-2670QM (quad core with multithreading)

With conky you can execute an external command. So /proc/cpuinfo has all the info you need. see:

root@host:~$ cat /proc/cpuinfo | grep "cpu MHz"
cpu MHz         : 2667.000
cpu MHz         : 1998.000
cpu MHz         : 1998.000
cpu MHz         : 2667.000

In my case there are 4 cores and two of them are one step down. You can find out which steps your CPU allows with a tool called cpufreq-info:

root@host:~$ cpufreq-info | grep "available frequency steps"
  available frequency steps: 2.67 GHz, 2.00 GHz
  available frequency steps: 2.67 GHz, 2.00 GHz
  available frequency steps: 2.67 GHz, 2.00 GHz
  available frequency steps: 2.67 GHz, 2.00 GHz

This package can be installed by the command:

apt-get install cpufrequtils

With this information I would write your conky.conf like this

${font sans-serif:bold:size=8}PROCESSORS ${hr 2}${font}
CPU1: ${cpu cpu1}% $alignr ${exec awk '/cpu MHz/{i++}i==1{printf "%.f",$4; exit}' /proc/cpuinfo} MHz $alignr ${cpubar cpu1 8,60}
CPU2: ${cpu cpu2}% $alignr ${exec awk '/cpu MHz/{i++}i==2{printf "%.f",$4; exit}' /proc/cpuinfo} MHz $alignr ${cpubar cpu2 8,60}
CPU3: ${cpu cpu3}% $alignr ${exec awk '/cpu MHz/{i++}i==3{printf "%.f",$4; exit}' /proc/cpuinfo} MHz $alignr ${cpubar cpu3 8,60}
CPU4: ${cpu cpu4}% $alignr ${exec awk '/cpu MHz/{i++}i==4{printf "%.f",$4; exit}' /proc/cpuinfo} MHz $alignr ${cpubar cpu4 8,60}
CPU5: ${cpu cpu5}% $alignr ${exec awk '/cpu MHz/{i++}i==5{printf "%.f",$4; exit}' /proc/cpuinfo} MHz $alignr ${cpubar cpu5 8,60}
CPU6: ${cpu cpu6}% $alignr ${exec awk '/cpu MHz/{i++}i==6{printf "%.f",$4; exit}' /proc/cpuinfo} MHz $alignr ${cpubar cpu6 8,60}
CPU7: ${cpu cpu7}% $alignr ${exec awk '/cpu MHz/{i++}i==7{printf "%.f",$4; exit}' /proc/cpuinfo} MHz $alignr ${cpubar cpu7 8,60}
CPU8: ${cpu cpu8}% $alignr ${exec awk '/cpu MHz/{i++}i==8{printf "%.f",$4; exit}' /proc/cpuinfo} MHz $alignr ${cpubar cpu8 8,60}

In my case it worked, but i had only 4 cores.