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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 59bf27312b5e697487459aad5eb87281b9e52ea876187df176ac9a6952032b86
4
- data.tar.gz: 61eb387f63ccb5bef4756759f5596b43f358859d9504c6179ee8a0464781e0f9
3
+ metadata.gz: fceec8cdbf2426618628c146d7f33d7a3bb3c1be1398169a682e9eae52d578d2
4
+ data.tar.gz: 340510785d9cd543f894066a81a1955bc024edd24ef56519c6c1e1dacee400e2
5
5
  SHA512:
6
- metadata.gz: f20e7ce26b8d1aa9c48ac4844e60d4d89f5eb2793a14e6689094b7da419700e3f61ef575666389cce8e0c092dd21fb3fa62b3a4ec703d636e02b9d0eb126ee04
7
- data.tar.gz: 6b3b14cbf089d37d0f0b46118a3db636b840ca7f8f124c346b4330095ec49676d3618119b23ec148e8439ec166d38a853419b02e31d0a6d64ac05d89897d0bf0
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 :cycle_time_milliseconds, Float, default: 0.0
8
- attribute :cycle_time_sum_squares, Float, default: 0.0
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 :warmup_cycle_time_milliseconds, Float, default: 0.0
12
- attribute :warmup_cycle_time_sum_squares, Float, default: 0.0
11
+ attribute :warmup_time_milliseconds, Float, default: 0.0
12
+ attribute :warmup_time_sum_squares, Float, default: 0.0
13
13
 
14
- alias_method :total_time_milliseconds, :cycle_time_milliseconds
14
+ attribute :gc, Boolean, default: false
15
15
 
16
16
  def cycle(elapsed_time)
17
- self.cycle_time_milliseconds += elapsed_time
17
+ self.time_milliseconds += elapsed_time
18
18
 
19
- self.cycle_time_sum_squares += (elapsed_time ** 2)
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
- cycle_time_milliseconds / cycles
25
+ time_milliseconds / cycles
26
26
  end
27
27
 
28
28
  def cycles_per_second
29
- cycles / (cycle_time_milliseconds / 1_000)
29
+ cycles / (time_milliseconds / 1_000)
30
30
  end
31
31
 
32
- def cycle_time_standard_deviation
33
- variance = (cycle_time_sum_squares / cycles) - (mean_cycle_time_milliseconds ** 2)
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, :cycle_time_standard_deviation
37
+ alias_method :standard_deviation, :time_standard_deviation
38
38
 
39
39
  def warmup_cycle(elapsed_time)
40
- self.warmup_cycle_time_milliseconds += elapsed_time
40
+ self.warmup_time_milliseconds += elapsed_time
41
41
 
42
- self.warmup_cycle_time_sum_squares += (elapsed_time ** 2)
42
+ self.warmup_time_sum_squares += (elapsed_time ** 2)
43
43
 
44
44
  self.warmup_cycles += 1
45
45
  end
46
46
 
47
- def mean_warmup_cycle_time_milliseconds
48
- warmup_cycle_time_milliseconds / warmup_cycles
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 / (warmup_cycle_time_milliseconds / 1_000)
52
+ warmup_cycles / (warmup_time_milliseconds / 1_000)
53
53
  end
54
54
 
55
- def warmup_cycle_time_standard_deviation
56
- variance = (warmup_cycle_time_sum_squares / warmup_cycles) - (mean_warmup_cycle_time_milliseconds ** 2)
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, total_time_milliseconds, mean_cycle_time_milliseconds, standard_deviation, cycles_per_second]
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
- def configure(action: nil, gc: nil)
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
- instance = new
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.2.2.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-05-30 00:00:00.000000000 Z
11
+ date: 2018-06-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: evt-log