memory - Looking for something like getrusage() in C++ -
getrusage() can display amount of memory used children of process. creating shell launch several child programs. getrusage() report total sum of memory of these children using, not want. want know how memory each child using. getrusage() looks use except doesn't work individual child processes. can used?
maybe fork off children 1 @ time , use getrusage(rusage_children...)
find out each child's usage independently.
the obvious drawback approach if children need running simultaneously. in case, custom-written intermediary program it. instead of executing children directly, execute program which:
- forks
exec
s requested program, perhaps passed command line arguments (program , arguments) in style ofnice
ortime
commands- the parent executes
getrusage()
children. since there one, desired result. use mechanism pass information main program, perhaps status file.
then that's needed master fork off each of children through intermediary directed run intended child , report memory usage.
the point rejigger hierarchy of child processes program calling getrusage()
has 1 child. master program can't because has many children , there no system call memory usage pid.
i suppose snoop around in /proc/<pid>/mem
well, if linux or compatible.
Comments
Post a Comment