OK so for a programming assignment that I have (Yes, we are all allowed to turn to any source we find suitable for help) I have to find out how much time processes spend blocking/sleeping/running.
My first attempt was creating a bash script... that looked something like this:
for i in `ls /proc/ | egrep [0-9]+`
do
cat /proc/$i/status | grep State
done
but then all of the problems are reporting the sleeping state. Plus this method would require me to poll like crazy... So running the test will probably change the results... (ugh)
Now compiling a new version of a linux with syscalls or a way to keep tracking of processes states isn't out of the question. My only worry is trying to find out how to keep track of changing process states and making sure that I don't miss anything...
OK, any ideas? Thank you!