evt-diagnostics-sample 0.1.0.0 → 0.1.1.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/result.rb +27 -8
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d0bfa71e7155d416e8b5919a510eb42a29ad47e5eda3ea83301892f8bcc418be
|
4
|
+
data.tar.gz: d61d62a639d2d6984682a364133be0e33af4509fe59f3387c7a39acd0a9a23de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6220de6b74d5bd569917279c26ee0a656b29eca1dc290206af36091cb6811cd697770906e3efcbba24569d6c13e41ed851f6c5be82fb147a6c3df1130be8c2c2
|
7
|
+
data.tar.gz: dd3c09a188c28ef3aef40003763a6475273e6e277001e3f0017cd985501a994cd74388d6fa7b1209d0b226fd3847a0f71c71943aab6d99698429833e1f02274c
|
@@ -5,36 +5,55 @@ module Diagnostics
|
|
5
5
|
|
6
6
|
attribute :cycles, Integer, default: 0
|
7
7
|
attribute :cycle_time_milliseconds, Float, default: 0.0
|
8
|
+
attribute :cycle_time_sum_squares, Float, default: 0.0
|
9
|
+
|
8
10
|
attribute :warmup_cycles, Integer, default: 0
|
9
11
|
attribute :warmup_cycle_time_milliseconds, Float, default: 0.0
|
12
|
+
attribute :warmup_cycle_time_sum_squares, Float, default: 0.0
|
10
13
|
|
11
14
|
def cycle(elapsed_time)
|
12
15
|
self.cycle_time_milliseconds += elapsed_time
|
13
16
|
|
17
|
+
self.cycle_time_sum_squares += (elapsed_time ** 2)
|
18
|
+
|
14
19
|
self.cycles += 1
|
15
20
|
end
|
16
21
|
|
22
|
+
def mean_cycle_time_milliseconds
|
23
|
+
cycle_time_milliseconds / cycles
|
24
|
+
end
|
25
|
+
|
26
|
+
def cycle_frequency
|
27
|
+
cycles / (cycle_time_milliseconds / 1_000)
|
28
|
+
end
|
29
|
+
|
30
|
+
def cycle_time_standard_deviation
|
31
|
+
variance = (cycle_time_sum_squares / cycles) - (mean_cycle_time_milliseconds ** 2)
|
32
|
+
|
33
|
+
Math.sqrt(variance)
|
34
|
+
end
|
35
|
+
|
17
36
|
def warmup_cycle(elapsed_time)
|
18
37
|
self.warmup_cycle_time_milliseconds += elapsed_time
|
19
38
|
|
20
|
-
self.
|
21
|
-
end
|
39
|
+
self.warmup_cycle_time_sum_squares += (elapsed_time ** 2)
|
22
40
|
|
23
|
-
|
24
|
-
cycle_time_milliseconds / cycles
|
41
|
+
self.warmup_cycles += 1
|
25
42
|
end
|
26
43
|
|
27
44
|
def mean_warmup_cycle_time_milliseconds
|
28
45
|
warmup_cycle_time_milliseconds / warmup_cycles
|
29
46
|
end
|
30
47
|
|
31
|
-
def cycle_frequency
|
32
|
-
cycles / (cycle_time_milliseconds / 1_000)
|
33
|
-
end
|
34
|
-
|
35
48
|
def warmup_cycle_frequency
|
36
49
|
warmup_cycles / (warmup_cycle_time_milliseconds / 1_000)
|
37
50
|
end
|
51
|
+
|
52
|
+
def warmup_cycle_time_standard_deviation
|
53
|
+
variance = (warmup_cycle_time_sum_squares / warmup_cycles) - (mean_warmup_cycle_time_milliseconds ** 2)
|
54
|
+
|
55
|
+
Math.sqrt(variance)
|
56
|
+
end
|
38
57
|
end
|
39
58
|
end
|
40
59
|
end
|