MilchFlasche - 2009-02-12

Hi, I really like the simpleness and flexibility SuperKaramba is offering, especially when the themes are so easy to create and modify for own preferences. Thank you for designing this marvelous gadget framework!

Recently I am trying to customize a theme that sensors the CPU frequency. It uses the "program" sensor, and use the following command to read the statistics:

program="awk '{print $1/1000}' /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq"

Quite neat isn't it? Actually it's from the "cpu-usage-withspeed.theme" of MiniKaramba, made by Moloch and added by Jason Do. Thanks to them.

However, I found that such sensor could only return the digitals of the frequency, and I couldn't find a variable to represent it so to format the output of the "program" sensor. Is there any variable available to represent it? Is it possible to use something like format="%0 MHz" in a program sensor?

I have tried alternatively modifying the program itself, using

program="awk '{print $1/1000." MHz"}' /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq"

The awk command works under sh, but not in a SuperKaramba theme file, because the double quote " in the command would be identified as the end of the program sensor, so the theme would abort and return an "unexpected end of file" error. So it seems impossible to print strings with the program sensor.

The only way to work around which I'm now using is creating another text object with the string "MHz" outside the program sensor object. But I still think that if we could simply allowing formatting the output of program sensor, this could be more flexible and easy.

How do you think about it?