[LLVMdev] getting process memory info

Jakob Praher jp at hapra.at
Sun Dec 24 09:03:55 PST 2006

Hi Ralph,

thanks for your pointer.

what i did now was :

write a simple application, which forks and execs the app to be
monitored in the child process.

the parent installs an alaram (with ualarm) and wait for the child pid.
periodically after the alarm goes on a simple os specific code is
executed to get the rss.

the arithmetic average of the rss value is then computed and at the end
of the parent process, the average is printed out to stderr.

this way you can execute it within the TEST scripts.
it works accross gcc as well as llc built binaries and with the lli. (i
know the lli could be used to -track-memory, but that was too specific
to the requirements of LLVM's runtime passes).

-- jakob

Ralph Corderoy wrote:
> Hi Jakob,
>> do you have a nice way to measure memory info like time(1) measures
>> execution time?
> Is acct(5) any good?  It has some low-overhead memory details.
> Cheers,
> Ralph.

More information about the llvm-dev mailing list