micro_bench 0.2.3 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/micro_bench.rb +22 -5
- data/lib/micro_bench/version.rb +1 -1
- data/spec/micro_bench_spec.rb +5 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e9068ede1d935d958f8344187512f2dbb8bac9bcf1b0e35a921d95934cbbda6
|
4
|
+
data.tar.gz: 55b81809280ad1d3904c3ac00a0547226649d6d77251b71ab57c4584a5070361
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a63891d4771d0cc6747f86abe71766cd239669b5c7d2cbe1da7cee91455ee9d61cf9d0420b077db5550d7cbe5ccb3a3825dbf1e85ff2ba1809042e7e920f0a03
|
7
|
+
data.tar.gz: 2b564cd15d145762f9478560c796c38d4b89b018addf00bd2df4faa9bdfe647ff96b02e9f76aa333365442af2af4295d46a68a2ad150191847ee3d49052f677c
|
data/lib/micro_bench.rb
CHANGED
@@ -59,15 +59,32 @@ module MicroBench
|
|
59
59
|
# Identifier of the benchmark
|
60
60
|
#
|
61
61
|
# == Returns:
|
62
|
-
#
|
62
|
+
# Formatted duration of the given benchmark, or nil if benchmark is unknown.
|
63
63
|
#
|
64
64
|
# == Example usage:
|
65
|
-
# MicroBench.
|
65
|
+
# MicroBench.duration(:my_benchmark)
|
66
66
|
#
|
67
67
|
def duration(bench_id = nil)
|
68
|
-
|
69
|
-
|
70
|
-
|
68
|
+
raw = raw_duration(bench_id)
|
69
|
+
return nil if raw.nil?
|
70
|
+
|
71
|
+
configurations.formatter.call(raw)
|
72
|
+
end
|
73
|
+
|
74
|
+
# Give raw duration of the benchmark
|
75
|
+
#
|
76
|
+
# == Parameters:
|
77
|
+
# bench_id::
|
78
|
+
# Identifier of the benchmark
|
79
|
+
#
|
80
|
+
# == Returns:
|
81
|
+
# Duration of the given benchmark, or nil if benchmark is unknown.
|
82
|
+
#
|
83
|
+
# == Example usage:
|
84
|
+
# MicroBench.raw_duration(:my_benchmark)
|
85
|
+
#
|
86
|
+
def raw_duration(bench_id = nil)
|
87
|
+
benchmarks[benchmark_key(bench_id)]&.duration
|
71
88
|
end
|
72
89
|
|
73
90
|
private
|
data/lib/micro_bench/version.rb
CHANGED
data/spec/micro_bench_spec.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: micro_bench
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cyrille Courtière
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-06-
|
11
|
+
date: 2020-06-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: byebug
|