Collect memory usage profiling informations from CRuby runtime and Linux pseudo filesystems.
Originally written by @_ko1.
Add this line to your application's Gemfile:
And then execute:
Or install it yourself as:
$ gem install ruby-memory-usage-profiler
To run profiler itself (without any other ruby code):
This program writes profiler result in 'memory-profile-result' of current directory, in each 1 second.
$ run_ruby_memory_usage_profiler [DURATION sec] [OUTPUT PATH]
For stdout, specify '-'
$ run_ruby_memory_usage_profiler 5 -
From your own code
MemoryUsageProfiler#kick with block how to process results each time you want.
labels = MemoryUsageProfiler.banner each_time_you_want do MemoryUsageProfiler.kick('my_program_label') do |result| result_hash = Hash[ [labels, result].transpose ] send_to_anywhere_by_myself(result_hash) end end
- Fork it
- Create your feature branch (
git checkout -b my-new-feature)
- Commit your changes (
git commit -am 'Add some feature')
- Push to the branch (
git push origin my-new-feature)
- Create new Pull Request
- This is licensed by the license ruby itself