evt-diagnostics-sample 0.2.2.0 → 0.3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/diagnostics/sample/controls/result.rb +7 -2
- data/lib/diagnostics/sample/result.rb +22 -21
- data/lib/diagnostics/sample/sample.rb +9 -6
- 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: fceec8cdbf2426618628c146d7f33d7a3bb3c1be1398169a682e9eae52d578d2
|
4
|
+
data.tar.gz: 340510785d9cd543f894066a81a1955bc024edd24ef56519c6c1e1dacee400e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 66659c35976fcd2ecdcbf1deb8b0b26bd02239ca2c49ee0349bf8dcf6cd759fdddc49c1184168400730ab51fffdb81639289641ba16a0b1f05163d27ca601ac3
|
7
|
+
data.tar.gz: 768e566410325c1a127074302fa3c961498cc83fa1922a1433f585d769ea81c872ace762e3adc2c7242792617bc7dda084b65c8bb5d503df964ed4870bff8118
|
@@ -23,12 +23,17 @@ module Diagnostics
|
|
23
23
|
extend StandardDeviation::Values
|
24
24
|
extend Result
|
25
25
|
|
26
|
+
def self.gc
|
27
|
+
false
|
28
|
+
end
|
29
|
+
|
26
30
|
def self.example
|
27
|
-
<<~TEXT % [count, sum, mean, standard_deviation, frequency]
|
31
|
+
<<~TEXT % [count, sum, mean, standard_deviation, frequency, gc]
|
28
32
|
Cycles: %d
|
29
33
|
Time: %fms
|
30
|
-
Mean Time: %fms (± %fms)
|
34
|
+
Mean Cycle Time: %fms (± %fms)
|
31
35
|
Cycles Per Second: %f
|
36
|
+
GC: #{gc ? 'on' : 'off'}
|
32
37
|
TEXT
|
33
38
|
end
|
34
39
|
end
|
@@ -4,66 +4,67 @@ module Diagnostics
|
|
4
4
|
include Schema::DataStructure
|
5
5
|
|
6
6
|
attribute :cycles, Integer, default: 0
|
7
|
-
attribute :
|
8
|
-
attribute :
|
7
|
+
attribute :time_milliseconds, Float, default: 0.0
|
8
|
+
attribute :time_sum_squares, Float, default: 0.0
|
9
9
|
|
10
10
|
attribute :warmup_cycles, Integer, default: 0
|
11
|
-
attribute :
|
12
|
-
attribute :
|
11
|
+
attribute :warmup_time_milliseconds, Float, default: 0.0
|
12
|
+
attribute :warmup_time_sum_squares, Float, default: 0.0
|
13
13
|
|
14
|
-
|
14
|
+
attribute :gc, Boolean, default: false
|
15
15
|
|
16
16
|
def cycle(elapsed_time)
|
17
|
-
self.
|
17
|
+
self.time_milliseconds += elapsed_time
|
18
18
|
|
19
|
-
self.
|
19
|
+
self.time_sum_squares += (elapsed_time ** 2)
|
20
20
|
|
21
21
|
self.cycles += 1
|
22
22
|
end
|
23
23
|
|
24
24
|
def mean_cycle_time_milliseconds
|
25
|
-
|
25
|
+
time_milliseconds / cycles
|
26
26
|
end
|
27
27
|
|
28
28
|
def cycles_per_second
|
29
|
-
cycles / (
|
29
|
+
cycles / (time_milliseconds / 1_000)
|
30
30
|
end
|
31
31
|
|
32
|
-
def
|
33
|
-
variance = (
|
32
|
+
def time_standard_deviation
|
33
|
+
variance = (time_sum_squares / cycles) - (mean_cycle_time_milliseconds ** 2)
|
34
34
|
|
35
35
|
Math.sqrt(variance)
|
36
36
|
end
|
37
|
-
alias_method :standard_deviation, :
|
37
|
+
alias_method :standard_deviation, :time_standard_deviation
|
38
38
|
|
39
39
|
def warmup_cycle(elapsed_time)
|
40
|
-
self.
|
40
|
+
self.warmup_time_milliseconds += elapsed_time
|
41
41
|
|
42
|
-
self.
|
42
|
+
self.warmup_time_sum_squares += (elapsed_time ** 2)
|
43
43
|
|
44
44
|
self.warmup_cycles += 1
|
45
45
|
end
|
46
46
|
|
47
|
-
def
|
48
|
-
|
47
|
+
def mean_warmup_time_milliseconds
|
48
|
+
warmup_time_milliseconds / warmup_cycles
|
49
49
|
end
|
50
50
|
|
51
51
|
def warmup_cycles_per_second
|
52
|
-
warmup_cycles / (
|
52
|
+
warmup_cycles / (warmup_time_milliseconds / 1_000)
|
53
53
|
end
|
54
54
|
|
55
|
-
def
|
56
|
-
variance = (
|
55
|
+
def warmup_time_standard_deviation
|
56
|
+
variance = (warmup_time_sum_squares / warmup_cycles) - (mean_warmup_time_milliseconds ** 2)
|
57
57
|
|
58
58
|
Math.sqrt(variance)
|
59
59
|
end
|
60
60
|
|
61
61
|
def digest
|
62
|
-
<<~TEXT % [cycles,
|
62
|
+
<<~TEXT % [cycles, time_milliseconds, mean_cycle_time_milliseconds, standard_deviation, cycles_per_second, gc]
|
63
63
|
Cycles: %d
|
64
64
|
Time: %fms
|
65
|
-
Mean Time: %fms (± %fms)
|
65
|
+
Mean Cycle Time: %fms (± %fms)
|
66
66
|
Cycles Per Second: %f
|
67
|
+
GC: #{gc ? 'on' : 'off'}
|
67
68
|
TEXT
|
68
69
|
end
|
69
70
|
alias_method :to_s, :digest
|
@@ -4,7 +4,9 @@ module Diagnostics
|
|
4
4
|
|
5
5
|
dependency :measure, Measure
|
6
6
|
|
7
|
-
|
7
|
+
initializer :result
|
8
|
+
|
9
|
+
def configure(action: nil, gc: gc)
|
8
10
|
Measure.configure(self, action: action, gc: gc)
|
9
11
|
end
|
10
12
|
|
@@ -18,12 +20,13 @@ module Diagnostics
|
|
18
20
|
@warmup_cycles ||= Defaults.warmup_cycles
|
19
21
|
end
|
20
22
|
|
21
|
-
def result
|
22
|
-
@result ||= Result.new
|
23
|
-
end
|
24
|
-
|
25
23
|
def self.build(cycles=nil, warmup_cycles: nil, gc: nil, &action)
|
26
|
-
|
24
|
+
gc = Defaults.gc if gc.nil?
|
25
|
+
|
26
|
+
result = Result.new
|
27
|
+
result.gc = gc
|
28
|
+
|
29
|
+
instance = new(result)
|
27
30
|
|
28
31
|
instance.cycles = cycles unless cycles.nil?
|
29
32
|
instance.warmup_cycles = warmup_cycles unless warmup_cycles.nil?
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: evt-diagnostics-sample
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- The Eventide Project
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-06-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: evt-log
|