sampling_prof 0.3.0 → 0.3.1
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 +7 -7
- data/lib/sampling_prof.jar +0 -0
- data/lib/sampling_prof/internal.rb +21 -5
- metadata +50 -49
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
5
|
-
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 79d31489bf4da8c98f0c5e868eaad15001f552dc
|
4
|
+
data.tar.gz: 74e4a7286f56f2ddebd85c527e834dff51e87e9f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2583fd7fb1f8717427015e6df4e87fe30d3ae56a6628b9973bf9a9b9269a1bb9b1cd4a6c6ac8fc89c7d6dab2742377cb37ea45b0e7a2be7de8d98097fd9e7c0d
|
7
|
+
data.tar.gz: 1a480525f226a2a4c780ed44d9c172e1564356fe11bdd0ddd4c01080126fa84480c7ec709b130c39d3fd2f0939856aa1067eb0a83a4f0a0862646804ae756a66
|
data/lib/sampling_prof.jar
CHANGED
Binary file
|
@@ -16,7 +16,7 @@ class SamplingProf
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def result
|
19
|
-
ret = [
|
19
|
+
ret = [@threads.sampling_runtime * 1000]
|
20
20
|
ret << @nodes.map {|node| node.join(',')}.join("\n")
|
21
21
|
ret << @samples.map {|count| count.flatten.join(',')}.join("\n")
|
22
22
|
ret << @call_graph.map {|v| v.flatten.join(',')}.join("\n")
|
@@ -61,8 +61,9 @@ class SamplingProf
|
|
61
61
|
|
62
62
|
class Threads
|
63
63
|
def initialize
|
64
|
-
@
|
64
|
+
@hash = {}
|
65
65
|
@mutex = Mutex.new
|
66
|
+
@remain_sampling_time = 0
|
66
67
|
end
|
67
68
|
|
68
69
|
def each(&block)
|
@@ -70,15 +71,30 @@ class SamplingProf
|
|
70
71
|
end
|
71
72
|
|
72
73
|
def dup
|
73
|
-
@mutex.synchronize { @
|
74
|
+
@mutex.synchronize { @hash.keys.dup }
|
74
75
|
end
|
75
76
|
|
76
77
|
def add(obj)
|
77
|
-
@mutex.synchronize { @
|
78
|
+
@mutex.synchronize { @hash[obj] = Time.now }
|
79
|
+
end
|
80
|
+
|
81
|
+
def sampling_runtime
|
82
|
+
now = Time.now
|
83
|
+
@mutex.synchronize do
|
84
|
+
ret, @remain_sampling_time = @remain_sampling_time, 0
|
85
|
+
@hash.keys.each do |k|
|
86
|
+
ret += now - @hash[k]
|
87
|
+
@hash[k] = now
|
88
|
+
end
|
89
|
+
ret
|
90
|
+
end
|
78
91
|
end
|
79
92
|
|
80
93
|
def delete(obj)
|
81
|
-
@mutex.synchronize
|
94
|
+
@mutex.synchronize do
|
95
|
+
start = @hash.delete(obj)
|
96
|
+
@remain_sampling_time += Time.now - start
|
97
|
+
end
|
82
98
|
end
|
83
99
|
end
|
84
100
|
|
metadata
CHANGED
@@ -1,69 +1,70 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: sampling_prof
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
|
-
authors:
|
7
|
-
- Xiao Li
|
6
|
+
authors:
|
7
|
+
- Xiao Li
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
- - "~>"
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: '0.9'
|
30
|
-
- - ">="
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
version: 0.9.2
|
11
|
+
|
12
|
+
date: 2014-03-27 00:00:00 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rake-compiler
|
16
|
+
prerelease: false
|
17
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: "0.9"
|
22
|
+
- - ">="
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: 0.9.2
|
25
|
+
type: :development
|
26
|
+
version_requirements: *id001
|
33
27
|
description: |
|
34
28
|
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
|
-
|
36
|
-
|
29
|
+
|
30
|
+
email:
|
31
|
+
- swing1979@gmail.com
|
37
32
|
executables: []
|
33
|
+
|
38
34
|
extensions: []
|
35
|
+
|
39
36
|
extra_rdoc_files: []
|
40
|
-
|
41
|
-
|
42
|
-
-
|
43
|
-
- lib/sampling_prof.
|
44
|
-
- lib/sampling_prof
|
37
|
+
|
38
|
+
files:
|
39
|
+
- README.md
|
40
|
+
- lib/sampling_prof.jar
|
41
|
+
- lib/sampling_prof.rb
|
42
|
+
- lib/sampling_prof/internal.rb
|
45
43
|
homepage: https://github.com/xli/sampling_prof
|
46
|
-
licenses:
|
47
|
-
- MIT
|
44
|
+
licenses:
|
45
|
+
- MIT
|
48
46
|
metadata: {}
|
47
|
+
|
49
48
|
post_install_message:
|
50
49
|
rdoc_options: []
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
50
|
+
|
51
|
+
require_paths:
|
52
|
+
- lib
|
53
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- &id002
|
56
|
+
- ">="
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: "0"
|
59
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- *id002
|
63
62
|
requirements: []
|
63
|
+
|
64
64
|
rubyforge_project:
|
65
|
-
rubygems_version: 2.
|
65
|
+
rubygems_version: 2.1.9
|
66
66
|
signing_key:
|
67
67
|
specification_version: 4
|
68
68
|
summary: Simple sampling profiler for ruby
|
69
69
|
test_files: []
|
70
|
+
|