I have been looking for standard way of calculating CPU and I/O usage of running a process. I was looking into following options.
Running a Windows program and detect when it ends with C++
How does this code calculate the number of CPU cycles elapsed?
http://www.codeproject.com/KB/threads/Get_CPU_Usage.aspx
I am not able to get the last one working. I need these figures.
usr = userTime - last_userTime;
ker = kernelTime - last_kernelTime;
idl = idleTime - last_idleTime;
I am primarily looking for Windows GCC based solutions. I am using Dev C++ 4 for testing these. I am also interested in similar solution on unix (solaris/Linux with GCC).
Also is there a way for getting cpu, io used by a process when the process is in running state (Like tracking in a graph) along with limiting CPU usage of a process. Note: I am not looking for tools. I am looking for standard C code. If you want to share any standards from other languages like C++, Python you are welcome.