CPU Meter

Shows a notification icon indicating current CPU usage. Something like the app OSMonitor does…
It reads out cpu stats file periodically, checks differences between each interval's cpu load and calculates usage in percent.

  1. Open Tasker
  2. Press "+" to create a Profile
  3. select "Event"
  4. name it "CPU Meter"
  5. add new Task "CPU Meter"
  6. add Action "File" "Read Line" File: "/proc/stat" Line: "1" To Var: "%stat"
  7. add Action "Variable Split" Name: "%stat" Delete Base: "Yes"
  8. add Action "Variable Set" Name: "%cputotalnew" To: "%stat2 + %stat3 + %stat4 + %stat5" Do Maths: "Yes"
  9. add Action "Variable Set" Name: "%cputotaldiff" To: "%cputotalnew - %CPUSUM" Do Maths: "Yes"
  10. add Action "Variable Set" Name: "%cpuidlediff" To: "%stat5 - %CPUIDLE" Do Maths: "Yes"
  11. add Action "Variable Set" Name: "%cpuusage" To: "100 - round( %cpuidlediff / %cputotaldiff * 100 )" Do Maths: "Yes"
  12. add Action "Variable Set" Name: "%CPUSUM" To: "%cputotalnew"
  13. add Action "Variable Set" Name: "%CPUIDLE" To: "%stat5"
  14. add Action "IF" "%SCREEN" ~ "on"
  15. add Action "Wait" 3 Seconds (or whatever time interval you want it to update, dont set too low, because it also needs some cpu time!)
  16. add Action "Alert" / "Notify" Title: "CPU" Text: "CPU: %cpuusage%" Icon: (choose what you like, i chose the the % sign) Number: "%cpuusage"
  17. add Action "Perform Task" Name: "CPU Meter" Stop: "yes"

This doesn't work so well on JB since the Notification count isnt displayed on the icon anymore. Instead it is a small number on the right of the notification list entry :/
So on JB I use IF/ELSE to change the Tasker notification icon depending on %cpuusage instead of setting "Notify". E.g. Red icon for high usage, green icon for low usage…

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License