Skip to content
/ mstat Public

fine-grained, cgroup-based tool for profiling memory usage over time of a process tree

License

Notifications You must be signed in to change notification settings

bpowers/mstat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mstat -- measure memory usage of a program over time

This tool runs on Linux, taking advantage of the cgroups kernel API (also used by container infrastructure like Docker) to record memory usage of a set of processes over time. Because mstat builds on groups, we automatically track memory usage of any child-processes spawned by the original program.

Additionally, the Memory API we are using not only gives us detailed information about userspace memory usage, but also about kernel memory allocated on behalf of the program. (such as memory used to mange a process's page tables).

This tool only runs on Linux, and requires being installed installed set-UID. Build it the normal way:

$ git clone https://github.com/bpowers/mstat
$ cd mstat
$ make; sudo make install

Then, use it to measure memory usage over time (freq specifies the sampling frequency in Hz, bump it up for short-lived programs or fine grained reporting):

$ mstat -o data/mem.tsv -freq 59 -- ./test

And there is even a handy flag to modify the environment:

$ mstat -o data/mem.tsv -freq 59 -env LD_PRELOAD=libawesome.so -- ./test

About

fine-grained, cgroup-based tool for profiling memory usage over time of a process tree

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published