sampling_prof 0.4.0 → 0.4.1

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: b3d5e9f4030836370938d494ceb34b7c6a153531
4
- data.tar.gz: c39ad8399c81faa1dc45bbdcb8c99d910e22a6c0
3
+ metadata.gz: 38b88b218151e0d854a3cd7acfd68a00d09798e7
4
+ data.tar.gz: 1b64bde640e0d08c597b13fa7d86cdf2247e6f52
5
5
  SHA512:
6
- metadata.gz: 313981a2ed4edb5cea888052515eb87b7e2fe62271ad951960f8517580a5fb4983ffaddd370152d4e11e0f7a3193f8678b740d80427779c8fb64ec6cbc6d9637
7
- data.tar.gz: 1ae6f1690779efd29ec5633a827a048e5622d9157ea0ef67688838ace40f54b33669060675be3069758e1a88a66257adccdbac34c4b1fdf05b117919767201b3
6
+ metadata.gz: 9afcdf7d910cbe4c2d2a1414c878010882847d35edf1f3be10de5b56809475acb45ee9af7cc3a031d554b6fb58ae2ea7635471a38b75cb1358402df43498e1c7
7
+ data.tar.gz: b991f709c0e1faa49dc11abc423fcfa48f5426af5e5833e10496758fe649059b6b6f6c7bb6e862e17c661196da69ac6eca9be2bb99beb7a8049601c31e007d18
data/README.md CHANGED
@@ -25,6 +25,8 @@ SamplingProf class initializer takes 1 argument:
25
25
 
26
26
  SamplingProf class also takes block as another option to overwite default output handler, the default output handler will write output data to a local file defined by output_file attribute, which is default to SamplingProf::DEFAULT_OUTPUT_FILE
27
27
 
28
+ Notice, the output handler should be called in the context of the thread start profiling. So you can pass parameters to the output handler by Thread local variables.
29
+
28
30
  When a SamplingProf is initialized, a thread will be started to handle sampling process.
29
31
  So you need call SamplingProf#terminate to shutdown the sampling thread after everything is done.
30
32
 
Binary file
@@ -77,7 +77,7 @@ class SamplingProf
77
77
  def stop
78
78
  if @running
79
79
  if sampling = @samplings.delete(Thread.current)
80
- output(sampling)
80
+ output(Thread.current, sampling)
81
81
  true
82
82
  end
83
83
  end
@@ -108,15 +108,18 @@ class SamplingProf
108
108
  sleep @sampling_interval
109
109
  break unless @running
110
110
  end
111
- @samplings.each do |sampling|
112
- output(sampling)
111
+ @samplings.each do |thread, sampling|
112
+ output(thread, sampling)
113
113
  end
114
114
  end
115
115
  end
116
116
 
117
- def output(sampling)
117
+ def output(thread, sampling)
118
118
  if sampling.sampling_data?
119
- @output_handler.call(sampling.result)
119
+ o = @output_handler
120
+ thread.instance_eval do
121
+ o.call(sampling.result)
122
+ end
120
123
  end
121
124
  end
122
125
  end
metadata CHANGED
@@ -1,35 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sampling_prof
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Xiao Li
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-13 00:00:00.000000000 Z
11
+ date: 2014-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler
15
- requirement: !ruby/object:Gem::Requirement
15
+ version_requirements: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0.9'
20
- - - ">="
20
+ - - '>='
21
21
  - !ruby/object:Gem::Version
22
22
  version: 0.9.2
23
- type: :development
24
- prerelease: false
25
- version_requirements: !ruby/object:Gem::Requirement
23
+ requirement: !ruby/object:Gem::Requirement
26
24
  requirements:
27
- - - "~>"
25
+ - - ~>
28
26
  - !ruby/object:Gem::Version
29
27
  version: '0.9'
30
- - - ">="
28
+ - - '>='
31
29
  - !ruby/object:Gem::Version
32
30
  version: 0.9.2
31
+ prerelease: false
32
+ type: :development
33
33
  description: |
34
34
  SamplingProf is a profiling tool that operates by sampling your running thread stacktrace. The result is statistical approximation, but it allows your code to run near full speed
35
35
  email:
@@ -46,24 +46,24 @@ homepage: https://github.com/xli/sampling_prof
46
46
  licenses:
47
47
  - MIT
48
48
  metadata: {}
49
- post_install_message:
49
+ post_install_message:
50
50
  rdoc_options: []
51
51
  require_paths:
52
52
  - lib
53
53
  required_ruby_version: !ruby/object:Gem::Requirement
54
54
  requirements:
55
- - - ">="
55
+ - - '>='
56
56
  - !ruby/object:Gem::Version
57
57
  version: '0'
58
58
  required_rubygems_version: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - ">="
60
+ - - '>='
61
61
  - !ruby/object:Gem::Version
62
62
  version: '0'
63
63
  requirements: []
64
- rubyforge_project:
65
- rubygems_version: 2.2.0
66
- signing_key:
64
+ rubyforge_project:
65
+ rubygems_version: 2.1.9
66
+ signing_key:
67
67
  specification_version: 4
68
68
  summary: Simple sampling profiler for ruby
69
69
  test_files: []