Cpu usage
From Buzztard
Like its done in buzz we would like to show to amount of CPU usage.
proc filesystem
get general cpuinfo:
cat /proc/cpuinfo
get cpu (not)usage of a process:
#!/bin/sh
root_pid=$1
while true; do
clear
for pid in /proc/$root_pid/task/*; do
grep "Sleep" /proc/$pid/status
done
sleep 1
done
getrusage
get CPU & memory consumtion among some more things.
int getrusage(int who, struct rusage *usage);
Problem #1 is that we also need total application run-time and #2 that it is not easy to calculate a current CPU usage.



