Created
April 15, 2013 09:12
-
-
Save dpogorzelski/5386900 to your computer and use it in GitHub Desktop.
Time your Sinatra methods
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
helpers do | |
def measure (&block) | |
start_time = Time.now | |
val = yield | |
end_time = Time.now | |
logger.info "Time elapsed for #{request.path_info} #{(end_time - start_time)*1000} milliseconds" | |
val | |
end | |
end | |
get '/users' do | |
measure do | |
#your stuff here | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment