README.md in koine-profiler-0.1.0 vs README.md in koine-profiler-2.0.0
- old
+ new
@@ -3,12 +3,10 @@
Simple profiler
[![Build Status](https://travis-ci.org/mjacobus/koine-profiler.svg?branch=master)](https://travis-ci.org/mjacobus/koine-profiler)
[![Code Coverage](https://scrutinizer-ci.com/g/mjacobus/koine-profiler/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/mjacobus/koine-profiler/?branch=master)
[![Code Climate](https://codeclimate.com/github/mjacobus/koine-profiler/badges/gpa.svg)](https://codeclimate.com/github/mjacobus/koine-profiler)
-[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/mjacobus/koine-profiler/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/mjacobus/koine-profiler/?branch=master)
-[![Dependency Status](https://gemnasium.com/mjacobus/koine-profiler.svg)](https://gemnasium.com/mjacobus/koine-profiler)
[![Gem Version](https://badge.fury.io/rb/koine-profiler.svg)](https://badge.fury.io/rb/koine-profiler)
## Installation
Add this line to your application's Gemfile:
@@ -26,10 +24,12 @@
$ gem install koine-profiler
## Usage
```ruby
+profiler = Koine::Profiler.new
+
profiler.profile('some potentially slow task') do
potentially_slow()
end
profiler.profile('require rails/all') do
@@ -42,15 +42,19 @@
```ruby
require 'koine/profiler/reporters/cli'
reporter = Koine::Profiler::Reporters::Cli.new
-# all
-reporter.report(entries)
+reporter.report(reporter.entries)
+```
-# 5 slowest
-five_slowest = profile.entries.slowest.limit(5)
-reporter.report(five_slowest)
+Output example:
+
+```text
++----------------------------+-------------------+--------------+---------+
+| Entry | Elapsed Time | Memory | # hits |
+| some potentially slow task | 48.59363997100241 | 7.5625 | 1000000 |
++----------------------------+-------------------+--------------+---------+
```
## Development
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.