Cpu usage

From Buzztard

Jump to: navigation, search

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.

Links

Support Us

Collaboration

SourceForge Logo
GStreamer Logo
Become a Friend of GNOME
Linux Sound Logo
MediaWiki
Valgrind
GNU Library Public Licence
GNU Free Documentation License 1.2