Last active
January 9, 2017 21:40
-
-
Save stratigos/d97c7afbab2eef59b9574181e1501c72 to your computer and use it in GitHub Desktop.
Example Tool for Profiling Memory Use in Ruby Scripts and Applications
This file contains hidden or 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
################################# | |
# GEMFILE: gem 'get_process_mem' | |
################################# | |
require 'get_process_mem' | |
def profile_mem(description=nil) | |
mb = GetProcessMem.new.mb | |
puts "\n\n---- #{ description } - MEMORY USAGE(MB): #{ mb.round } ----\n\n" | |
end | |
# Before some block/procedure to profile: | |
profile_mem 'BEFORE PROCEDURE' | |
# Procedure executes... | |
# After some block/procedure to profile: | |
profile_mem 'AFTER PROCEDURE' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment