skylight 0.1.3 → 0.1.4.alpha1

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
  SHA1:
3
- metadata.gz: 5fa6f7a23ed460ec9e8a504a7a7037aa6b149b6e
4
- data.tar.gz: b18f06a7640507138ac6b72dd218e7aa6632ee03
3
+ metadata.gz: 6312c24e2ef0a54be711b60410888886646f65a0
4
+ data.tar.gz: a3dc0c4c3e2374722153c9efe12317955a37fc28
5
5
  SHA512:
6
- metadata.gz: 6e1df38e803461a12dad4df99780fbfb93308b47fa7c16304ffaac7073cd13f5e8d4d9bb9d36a084636e15bb4bf516a42042a8809e499369b6c1c9831c6dd88b
7
- data.tar.gz: 48b0b867f8f02c24c7de705040770f9e0b9a72c58260845ca52f5d0e1f5bdb55a521a54cc08b66ad5427cf30e5866c17a81d231626127f7f97b06a4ab6ccd989
6
+ metadata.gz: d1fedcb75d67f27aa003b8926e40ea1b5eab792b07e486f3e7d1387471e388dc97b2ab85ff8239c13e1eaee593ef6a3fea468c2afd48cabbae57243a95a7b2bd
7
+ data.tar.gz: b79ffd3549eb6b0381e86707ae42fbefb2e1e74e05d622681599cfee7c3a1dc37f6edcfd24f353fb7c12546e9d7367c352edc348fb2c76097b2e6205dd84764f
@@ -1,5 +1,7 @@
1
1
  ## unreleased ##
2
2
 
3
+ * [BUG] Fix some errors caused by floating point rounding.
4
+
3
5
  ## 0.1.3 (May 29, 2013)
4
6
 
5
7
  * [BUG] Require net/https and openssl
@@ -17,7 +17,7 @@ module Skylight
17
17
  if win = Thread.current[TH_KEY]
18
18
  win.time
19
19
  else
20
- 0.0
20
+ 0
21
21
  end
22
22
  end
23
23
 
@@ -27,7 +27,7 @@ module Skylight
27
27
  @listeners = []
28
28
  @config = config
29
29
  @lock = Mutex.new
30
- @time = 0.0
30
+ @time = 0
31
31
 
32
32
  if METHODS.all? { |m| profiler.respond_to?(m) }
33
33
  @profiler = profiler
@@ -98,7 +98,7 @@ module Skylight
98
98
  diff = time - @time
99
99
  @time = time
100
100
 
101
- if diff > 0.0
101
+ if diff > 0
102
102
  @listeners.each do |l|
103
103
  l.add(diff)
104
104
  end
@@ -110,7 +110,7 @@ module Skylight
110
110
 
111
111
  def initialize(global)
112
112
  @global = global
113
- @time = 0.0
113
+ @time = 0
114
114
  end
115
115
 
116
116
  def update
@@ -79,7 +79,7 @@ module Skylight
79
79
  return yield(trace)
80
80
  end
81
81
 
82
- trace = Messages::Trace::Builder.new(endpoint, Util::Clock.now, @config)
82
+ trace = Messages::Trace::Builder.new(endpoint, Util::Clock.micros, @config)
83
83
 
84
84
  begin
85
85
 
@@ -112,7 +112,8 @@ module Skylight
112
112
  private
113
113
 
114
114
  def process(trace)
115
- t { fmt "processing trace; spans=%d", trace.spans.length }
115
+ t { fmt "processing trace; spans=%d; duration=%d",
116
+ trace.spans.length, trace.spans[-1].duration }
116
117
  unless @worker.submit(trace)
117
118
  warn "failed to submit trace to worker"
118
119
  end
@@ -19,7 +19,7 @@ module Skylight
19
19
  attr_accessor :endpoint
20
20
  attr_reader :spans, :config
21
21
 
22
- def initialize(endpoint = "Unknown", start = Util::Clock.now, config = nil)
22
+ def initialize(endpoint = "Unknown", start = Util::Clock.micros, config = nil)
23
23
  @endpoint = endpoint
24
24
  @busted = false
25
25
  @config = config
@@ -44,12 +44,13 @@ module Skylight
44
44
  yield
45
45
  ensure
46
46
  unless @busted
47
- now = Util::Clock.now
47
+ now = Util::Clock.micros
48
48
 
49
49
  GC.update
50
50
  gc_time = GC.time
51
51
 
52
52
  if gc_time > 0
53
+ t { fmt "tracking GC time; duration=%d", gc_time }
53
54
  start(now - gc_time, 'noise.gc')
54
55
  stop(now)
55
56
  end
@@ -170,9 +171,9 @@ module Skylight
170
171
 
171
172
  def relativize(time)
172
173
  if parent = @parents[-1]
173
- (10_000 * (time - parent.absolute_time)).to_i
174
+ ((time - parent.absolute_time) / 100).to_i
174
175
  else
175
- (10_000 * (time - @start)).to_i
176
+ ((time - @start) / 100).to_i
176
177
  end
177
178
  end
178
179
 
@@ -54,7 +54,7 @@ module Skylight
54
54
  end
55
55
 
56
56
  def now
57
- Util::Clock.default.now
57
+ Util::Clock.micros
58
58
  end
59
59
 
60
60
  end
@@ -2,13 +2,21 @@ module Skylight
2
2
  module Util
3
3
  class Clock
4
4
 
5
- def now
5
+ def micros
6
6
  n = Time.now
7
- n.to_i + n.usec.to_f / 1_000_000
7
+ n.to_i * 1_000_000 + n.usec
8
8
  end
9
9
 
10
- def self.now
11
- default.now
10
+ def secs
11
+ micros / 1_000_000
12
+ end
13
+
14
+ def self.micros
15
+ default.micros
16
+ end
17
+
18
+ def self.secs
19
+ default.secs
12
20
  end
13
21
 
14
22
  def self.default
@@ -1,4 +1,4 @@
1
1
  module Skylight
2
- VERSION = '0.1.3'
2
+ VERSION = '0.1.4.alpha1'
3
3
  end
4
4
 
@@ -31,7 +31,7 @@ module Skylight
31
31
 
32
32
  class GC
33
33
  def initialize
34
- @total = 0.0
34
+ @total = 0
35
35
  end
36
36
 
37
37
  def enable
@@ -39,7 +39,8 @@ module Skylight
39
39
  end
40
40
 
41
41
  def total_time
42
- run = ::GC::Profiler.total_time
42
+ # Reported in seconds
43
+ run = (::GC::Profiler.total_time * 1_000_000).to_i
43
44
 
44
45
  if run > 0
45
46
  ::GC::Profiler.clear
@@ -59,7 +60,7 @@ module Skylight
59
60
  end
60
61
 
61
62
  def total_time
62
- 0.0
63
+ 0
63
64
  end
64
65
  end
65
66
 
@@ -22,7 +22,7 @@ module Skylight
22
22
  t { fmt "starting collector; interval=%d; size=%d", @interval, @size }
23
23
  end
24
24
 
25
- def handle(msg, now = Util::Clock.now)
25
+ def handle(msg, now = Util::Clock.secs)
26
26
  @batch ||= new_batch(now)
27
27
 
28
28
  if @batch.should_flush?(now)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: skylight
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4.alpha1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tilde, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-05-29 00:00:00.000000000 Z
11
+ date: 2013-05-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -156,9 +156,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
156
156
  version: 1.9.2
157
157
  required_rubygems_version: !ruby/object:Gem::Requirement
158
158
  requirements:
159
- - - '>='
159
+ - - '>'
160
160
  - !ruby/object:Gem::Version
161
- version: '0'
161
+ version: 1.3.1
162
162
  requirements: []
163
163
  rubyforge_project:
164
164
  rubygems_version: 2.0.3