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...