test-prof 0.1.0.beta4 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/guides/event_prof.md +30 -0
- data/lib/test_prof/tag_prof/rspec.rb +2 -2
- data/lib/test_prof/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 29df0c008d08c25f6924b35fd76cf02e7747c116
|
|
4
|
+
data.tar.gz: 1216e9ee73060c8d20e2caa94b2d1fd5f9c70292
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d0b7e7e899c7a81512d686e4bfac89937f8c37df476ffc94daf7e351476b131c6301c8528731e263fc36a4c1397be5876fc053cf837cb51777a2dcb5ae1687f5
|
|
7
|
+
data.tar.gz: 143c0eb3c07ecbad124299395e06bc4174bda227a5ec36c4e71eb5c8d67eb6079e7f62a138c24da98d6dbc1c887529bf8105dc3c2e46b4df1cd4bbd06a65144b
|
data/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
[](https://rubygems.org/gems/test-prof) [](https://travis-ci.org/palkan/test-prof) [](https://rubygems.org/gems/test-prof) [](https://travis-ci.org/palkan/test-prof) [](https://circleci.com/gh/palkan/test-prof)
|
|
2
2
|
|
|
3
3
|
# Ruby Tests Profiling Toolbox
|
|
4
4
|
|
|
@@ -53,7 +53,7 @@ Checkout our guides for each specific tool:
|
|
|
53
53
|
|
|
54
54
|
- [StackProf Integration](https://github.com/palkan/test-prof/tree/master/guides/stack_prof.md)
|
|
55
55
|
|
|
56
|
-
- [
|
|
56
|
+
- [Event Profiler](https://github.com/palkan/test-prof/tree/master/guides/event_prof.md) (e.g. ActiveSupport notifications)
|
|
57
57
|
|
|
58
58
|
- [Tag Profiler](https://github.com/palkan/test-prof/tree/master/guides/tag_prof.md)
|
|
59
59
|
|
data/guides/event_prof.md
CHANGED
|
@@ -64,6 +64,36 @@ EVENT_PROF_RANK=count EVENT_PROF='instantiation.active_record' be rspec
|
|
|
64
64
|
|
|
65
65
|
See [event_prof.rb](https://github.com/palkan/test-prof/tree/master/lib/test_prof/event_prof.rb) for all available configuration options and their usage.
|
|
66
66
|
|
|
67
|
+
## Custom Instrumentation
|
|
68
|
+
|
|
69
|
+
To use EventProf with your instrumentation engine just complete the two following steps:
|
|
70
|
+
|
|
71
|
+
- Add a wrapper for your instrumentation:
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
```ruby
|
|
75
|
+
# Wrapper over your instrumentation
|
|
76
|
+
module MyEventsWrapper
|
|
77
|
+
# Should contain the only one method
|
|
78
|
+
def self.subscribe(event)
|
|
79
|
+
raise ArgumentError, 'Block is required!' unless block_given?
|
|
80
|
+
|
|
81
|
+
::MyEvents.subscribe(event) do |start, finish, *|
|
|
82
|
+
yield (finish - start)
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
- Set instrumenter in the config:
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
```ruby
|
|
92
|
+
TestProf::EventProf.configure do |config|
|
|
93
|
+
config.instrumenter = MyEventsWrapper
|
|
94
|
+
end
|
|
95
|
+
```
|
|
96
|
+
|
|
67
97
|
## Custom Events
|
|
68
98
|
|
|
69
99
|
### `"factory.create"`
|
|
@@ -49,8 +49,8 @@ module TestProf
|
|
|
49
49
|
|
|
50
50
|
msgs << ""
|
|
51
51
|
|
|
52
|
-
total = @tags.values.
|
|
53
|
-
total_time = @tags.values.
|
|
52
|
+
total = @tags.values.inject(0) { |acc, v| acc + v[:count] }
|
|
53
|
+
total_time = @tags.values.inject(0) { |acc, v| acc + v[:time] }
|
|
54
54
|
|
|
55
55
|
@tags.values.sort_by { |v| -v[:time] }.each do |tag|
|
|
56
56
|
msgs << format(
|
data/lib/test_prof/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: test-prof
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.0
|
|
4
|
+
version: 0.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Vladimir Dementyev
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2017-08-
|
|
11
|
+
date: 2017-08-15 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -236,12 +236,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
236
236
|
requirements:
|
|
237
237
|
- - ">="
|
|
238
238
|
- !ruby/object:Gem::Version
|
|
239
|
-
version:
|
|
239
|
+
version: 2.3.0
|
|
240
240
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
241
241
|
requirements:
|
|
242
|
-
- - "
|
|
242
|
+
- - ">="
|
|
243
243
|
- !ruby/object:Gem::Version
|
|
244
|
-
version:
|
|
244
|
+
version: '0'
|
|
245
245
|
requirements: []
|
|
246
246
|
rubyforge_project:
|
|
247
247
|
rubygems_version: 2.6.11
|