3

Unfortunately, it seems that cpufreq indicator is only showing an icon indicating proportional frequency instead of precise number I would like to see.

Is there any indicator showing actual CPU frequency real time? Maybe for each core?

Ideally I would like to see both the frequency and usage per core but answers to this question:

Is there an application indicator for CPU usage by core?

suggest that usage per core is out for reach right now.

3

You may use indicator-sysmonitor for such custom indicator

  1. Install indicator-sysmonitor

    sudo add-apt-repository ppa:fossfreedom/indicator-sysmonitor
    sudo apt-get update
    sudo apt-get install indicator-sysmonitor
    
  2. Run it

  3. Click on its indicator → Preferences → Advanced tab
  4. Click New:

    Sensor:freq Command:awk '/cpu MHz/{printf(" %d",$4)}' /proc/cpuinfo

  5. Change the new sensor to label: cpu: {cpu} mem: {mem} freq:{freq}.
  6. Save

    indicator-sysmonitor cpu cores frequency

References:

1

I followed this tutorial on creating indicator applets:

http://conjurecode.com/create-indicator-applet-for-ubuntu-unity-with-python/

And came up with following script. It displays an indicator with frequency of each core based on cpuinfo output. Not very robust but seems to do the job.

#!/usr/bin/env python

import sys
import gtk
import appindicator
import random
import time
import os
import re

PING_FREQUENCY_MS = 1000
INDICATOR_NAME = "cpu-indicator"
ICON_PATH = "/usr/share/unity/icons/panel-shadow.png"
APP_CATHEGORY = appindicator.CATEGORY_APPLICATION_STATUS

def cpu_freqs_string():
    return os.popen("cat /proc/cpuinfo | grep MHz").read()

def extract_freqs(s):
    return re.sub("[^(0-9|\t|.)]", "", s).strip().split("\t") 

def cpu_freqs():
    freqs_only = extract_freqs(cpu_freqs_string())
    freqs_in_ghz = [float(x) / 1000 for x in freqs_only if x != ""]
    return " | ".join(["%.1f" % freq for freq in freqs_in_ghz]) 

class CpuIndicator:
    def __init__(self):
        self.ind = appindicator.Indicator(INDICATOR_NAME, ICON_PATH, APP_CATHEGORY)
        self.ind.set_status(appindicator.STATUS_ACTIVE)
        self.ind.set_menu(gtk.Menu())

    def main(self):
        gtk.timeout_add(PING_FREQUENCY_MS, self.update_value)
        gtk.main()

    def update_value(self):
       self.ind.set_label(cpu_freqs())
       return True

    def quit(self, widget):
        sys.exit(0)

indicator = CpuIndicator()
indicator.main()

By the way, an idea of extending indicator-multiload to display usage per core can be found here:

https://bugs.launchpad.net/ubuntu/+source/indicator-multiload/+bug/1173972

Not implemented 2 year after request but maybe one day...

1

You can use indicator-multiload to set a custom indicator:

  1. Install indicator-sysmonitor:

    sudo apt-get install indicator-multiload
    
  2. Run it

  3. Click on its IndicatorPreferencesIndicator Items

  4. Click Add and enter:

    freq $(frequency(cpufreq.cur1))
    
  5. Move it to the very top.

  6. Add another freq without a value.

  7. Close by clicking Close

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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