evt-diagnostics-sample 0.2.0.1 → 0.2.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 134ba02775d5b826e4f3fda67922123d60d71f7a2a7bd9f8a5ab288364f83435
|
4
|
+
data.tar.gz: 88fd2fe5929b34c46d776135a094ea11d0d85ede59596ca03b189bc5f660051e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32e5180484ae331265c2f662163179ed202d2285b8a68ec47b817190f0930c3b17ae143b3a22a989619c4ebd88d4ed6eafa1c74182c27c721b04009150f6ccee
|
7
|
+
data.tar.gz: 39b890d8aeaaa742f557e4cc747803c5efbc5cefa117b8fbf91e6150dca885443ef7aea095e1cd57bd6aaec69440e12546d296116020295d29a7e1882b6a2b0a
|
@@ -2,28 +2,32 @@ module Diagnostics
|
|
2
2
|
class Sample
|
3
3
|
module Controls
|
4
4
|
module Result
|
5
|
+
extend StandardDeviation::Values
|
6
|
+
extend self
|
7
|
+
|
5
8
|
def self.example
|
6
9
|
result = Sample::Result.new
|
7
10
|
|
8
|
-
|
11
|
+
values.each do |value|
|
9
12
|
result.cycle(value)
|
10
13
|
end
|
11
14
|
|
12
15
|
result
|
13
16
|
end
|
14
17
|
|
18
|
+
def standard_deviation
|
19
|
+
StandardDeviation::Result.example
|
20
|
+
end
|
21
|
+
|
15
22
|
module Digest
|
16
|
-
|
17
|
-
|
18
|
-
StandardDeviation::Values.sum,
|
19
|
-
StandardDeviation::Values.mean,
|
20
|
-
StandardDeviation::Result.example,
|
21
|
-
StandardDeviation::Values.frequency
|
22
|
-
]
|
23
|
+
extend StandardDeviation::Values
|
24
|
+
extend Result
|
23
25
|
|
24
|
-
|
25
|
-
|
26
|
-
|
26
|
+
def self.example
|
27
|
+
<<~TEXT % [count, sum, mean, standard_deviation, frequency]
|
28
|
+
Cycles: %d
|
29
|
+
Time: %fms
|
30
|
+
Mean Time: %fms (± %fms)
|
27
31
|
Cycles Per Second: %f
|
28
32
|
TEXT
|
29
33
|
end
|
@@ -4,19 +4,29 @@ module Diagnostics
|
|
4
4
|
module StandardDeviation
|
5
5
|
# Source: https://en.wikipedia.org/wiki/Standard_deviation#Population_standard_deviation_of_grades_of_eight_students (Nathan Ladd, Wed 30 May 2018)
|
6
6
|
module Values
|
7
|
+
extend self
|
8
|
+
|
7
9
|
def self.example
|
10
|
+
values
|
11
|
+
end
|
12
|
+
|
13
|
+
def values
|
8
14
|
[2, 4, 4, 4, 5, 5, 7, 9]
|
9
15
|
end
|
10
16
|
|
11
|
-
def
|
17
|
+
def count
|
18
|
+
values.count
|
19
|
+
end
|
20
|
+
|
21
|
+
def sum
|
12
22
|
40
|
13
23
|
end
|
14
24
|
|
15
|
-
def
|
25
|
+
def mean
|
16
26
|
5
|
17
27
|
end
|
18
28
|
|
19
|
-
def
|
29
|
+
def frequency
|
20
30
|
200
|
21
31
|
end
|
22
32
|
end
|
@@ -11,6 +11,8 @@ module Diagnostics
|
|
11
11
|
attribute :warmup_cycle_time_milliseconds, Float, default: 0.0
|
12
12
|
attribute :warmup_cycle_time_sum_squares, Float, default: 0.0
|
13
13
|
|
14
|
+
alias_method :total_time_milliseconds, :cycle_time_milliseconds
|
15
|
+
|
14
16
|
def cycle(elapsed_time)
|
15
17
|
self.cycle_time_milliseconds += elapsed_time
|
16
18
|
|
@@ -57,9 +59,10 @@ module Diagnostics
|
|
57
59
|
end
|
58
60
|
|
59
61
|
def digest
|
60
|
-
<<~TEXT % [
|
61
|
-
|
62
|
-
|
62
|
+
<<~TEXT % [cycles, total_time_milliseconds, mean_cycle_time_milliseconds, standard_deviation, cycles_per_second]
|
63
|
+
Cycles: %d
|
64
|
+
Time: %fms
|
65
|
+
Mean Time: %fms (± %fms)
|
63
66
|
Cycles Per Second: %f
|
64
67
|
TEXT
|
65
68
|
end
|