Cpu usage
From Buzztard
Like its done in buzz we would like to show to amount of CPU usage.
[edit] 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 `ls /proc/$root_pid/task/`; do
cat /proc/$pid/status | grep "Sleep";
done
sleep 1s
done
[edit] 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.



