Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/lukaszkorecki/tiny_timer

really tiny timer for ruby code, nothing fancy
https://github.com/lukaszkorecki/tiny_timer

Last synced: 14 days ago
JSON representation

really tiny timer for ruby code, nothing fancy

Awesome Lists containing this project

README

        

# Tiny Timer

## Usage

Add the gem:

```ruby
gem 'tiny_timer', git: '[email protected]:lukaszkorecki/tiny_timer.git'
, branch: 'stable'

```

use in your code:

```ruby
def needs_fixing
# marker, which IO object wrtie to, do we want rounding or not
# last 2 args are defaults
t = TinyTimer.new('GET /documents', STDOUT, true)

did_something = t.measure('some op') { do_something }
something_else = t.measure('next op') { do_more(did_something) }

t.summarize
something_else
end
```

Will output something like:

```
|GET /documents| Start
|GET /documents| some op: 0.14s
|GET /documents| next op: 2.42s
|GET /documents| Total run time: 2.56s
|GET /documents| some op: 5.36% | next op: 94.51%
```