Skip to content

Instantly share code, notes, and snippets.

@dpogorzelski
Created April 15, 2013 09:12
Show Gist options
  • Save dpogorzelski/5386900 to your computer and use it in GitHub Desktop.
Save dpogorzelski/5386900 to your computer and use it in GitHub Desktop.
Time your Sinatra methods
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