Saturday, May 22, 2010

Unix/Linux & C/C++. Printing stats about system resources used by a command?

I need to print some statistics that show some of the system resources a command has used. To be more specific...





the amount of CPU time used (both user and system time) (in milliseconds)





I got some tips so far which indicate the use of: getrusage() but I have never seen getrusage() in action. The biggest problem is that I have to use it inside a C/C++ which will then be compiled and executed in Unix/Linux.


I know this is a long question but I really appreciate any kind of help and I thank to whoever took the time to read the question.


Code Snippets are also appreciated.

Unix/Linux %26amp; C/C++. Printing stats about system resources used by a command?
Try some of these sites...


http://www.faqs.org/docs/Linux-HOWTO/C++...


http://www.perpetualpc.net/srtd_commands...


http://www.linuxjournal.com/article/4897


http://www.ssc.upenn.edu/HELP/unix/Comma...


http://www.cs.unc.edu/cgi-bin/howto?howt...


http://www.sikh-history.com/computers/un...





Good Luck... sorry, that's about all I can do right now.
Reply:getrusage looks pretty straighforward. A wordy definition of the structure it uses is


http://www.tnt.uni-hannover.de/soft/case...


No comments:

Post a Comment