Sorry, I should have mentioned that I need to get this information thru C++ code. I can't ask the Unix Admn to manually check it for me. My program itself has to fetch it.
there are different ways to start a command and read the result in the program.
e.g the 'popen' command is one of them (search this forum for explanation on usage).
execvp is also a command execute a program,theres much info on the web and on this forum (I wrote it )
1)execute the command ps|grep yourprog1
2)parse the line and get the pid of your program
3 & 4)do the same for your other program
5)execute ps v pid for both your programs and read in the
memory usage.
another way is:
execute:
1)top -1 -b>tempfile //this will dump top in a file
2) read the file and make your conclusions
Hope this helps. Greetz,
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.