0.0
No commit activity in last 3 years
No release in over 3 years
Simple Profiler
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.12
~> 0.8
~> 5.0
~> 0.2
~> 11.0
~> 0.12

Runtime

 Project Readme

SimpleProfiler

Gem Version Build Status Coverage Status Code Climate Dependency Status

Installation

Add this line to your application's Gemfile:

gem 'simple_profiler'

And then execute:

$ bundle

Or install it yourself as:

$ gem install simple_profiler

Usage

class MyClass
  def execute
    ...
  end

  def self.execute!
    ...
  end
end

Configuration

SimpleProfiler.profile_class_methods MyClass, :execute!
SimpleProfiler.profile_instance_methods MyClass, :execute

summary_reporter = SimpleProfiler::Reporters::Summary.new
logger_reporter = SimpleProfiler::Reporters::Logger.new Logger.new('profile.log')

SimpleProfiler.configure do |config|
  config.reporters = [summary_reporter, logger_reporter]
end

Summary

ranking = summary_reporter.summary.ranking
    
ranking[0][:klass] # => 'MyClass'
ranking[0][:method] # => :execute
ranking[0][:hits] # => hits count

Logger

# Logfile created on 2016-05-31 15:12:30 -0300 by profile.rb/41954
D, [2016-05-31T15:12:30.302556 #7582] DEBUG -- : MyClass.execute! -> 0.0 sec. - 0.0MB - (Total Memory: 36.80078125MB)
D, [2016-05-31T15:12:30.302642 #7582] DEBUG -- : MyClass.execute! -> 0.0 sec. - 0.0MB - (Total Memory: 36.80078125MB)
D, [2016-05-31T15:12:30.302694 #7582] DEBUG -- : MyClass.execute! -> 0.0 sec. - 0.0MB - (Total Memory: 36.80078125MB)

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake test to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/gabynaiman/simple_profiler.