Created
January 27, 2014 23:48
-
-
Save skade/8659778 to your computer and use it in GitHub Desktop.
This systemtap probe measures memory cost per require. Be aware that require sum up, so subrequires form the sum of the initial require.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global before; | |
global after; | |
probe process("ruby").mark("require__entry") | |
{ | |
module = kernel_string($arg1) | |
mem = proc_mem_size_pid(pid()) | |
before [module] = mem; | |
} | |
probe process("ruby").mark("require__return") | |
{ | |
module = kernel_string($arg1) | |
mem = proc_mem_size_pid(pid()) | |
after [module] = mem; | |
} | |
probe end { | |
foreach ([mod-] in after) { | |
printf("%s\t%s\n", pages_to_string(after[mod] - before[mod]), mod); | |
} | |
delete before; | |
delete after; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment