vernier 1.4.0 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/examples/fiber_stalls.rb +51 -0
- data/exe/vernier +11 -52
- data/ext/vernier/extconf.rb +2 -0
- data/ext/vernier/memory.cc +144 -0
- data/ext/vernier/periodic_thread.hh +141 -0
- data/ext/vernier/signal_safe_semaphore.hh +72 -0
- data/ext/vernier/timestamp.hh +138 -0
- data/ext/vernier/vernier.cc +138 -338
- data/ext/vernier/vernier.hh +4 -0
- data/lib/vernier/autorun.rb +17 -1
- data/lib/vernier/collector.rb +37 -9
- data/lib/vernier/hooks/memory_usage.rb +37 -0
- data/lib/vernier/hooks.rb +1 -0
- data/lib/vernier/marker.rb +2 -0
- data/lib/vernier/output/file_listing.rb +113 -0
- data/lib/vernier/output/filename_filter.rb +30 -0
- data/lib/vernier/output/firefox.rb +29 -20
- data/lib/vernier/output/top.rb +60 -8
- data/lib/vernier/parsed_profile.rb +102 -0
- data/lib/vernier/result.rb +4 -92
- data/lib/vernier/stack_table.rb +3 -42
- data/lib/vernier/stack_table_helpers.rb +129 -0
- data/lib/vernier/version.rb +1 -1
- data/lib/vernier.rb +3 -0
- metadata +12 -2
data/lib/vernier/stack_table.rb
CHANGED
@@ -1,46 +1,7 @@
|
|
1
|
+
require_relative "stack_table_helpers"
|
2
|
+
|
1
3
|
module Vernier
|
2
4
|
class StackTable
|
3
|
-
|
4
|
-
"#<#{self.class.name} #{stack_count} stacks, #{frame_count} frames, #{func_count} funcs>"
|
5
|
-
end
|
6
|
-
|
7
|
-
def to_h
|
8
|
-
{
|
9
|
-
stack_table: {
|
10
|
-
parent: stack_count.times.map { stack_parent_idx(_1) },
|
11
|
-
frame: stack_count.times.map { stack_frame_idx(_1) }
|
12
|
-
},
|
13
|
-
frame_table: {
|
14
|
-
func: frame_count.times.map { frame_func_idx(_1) },
|
15
|
-
line: frame_count.times.map { frame_line_no(_1) }
|
16
|
-
},
|
17
|
-
func_table: {
|
18
|
-
name: func_count.times.map { func_name(_1) },
|
19
|
-
filename: func_count.times.map { func_filename(_1) },
|
20
|
-
first_line: func_count.times.map { func_first_lineno(_1) }
|
21
|
-
}
|
22
|
-
}
|
23
|
-
end
|
24
|
-
|
25
|
-
def backtrace(stack_idx)
|
26
|
-
full_stack(stack_idx).map do |stack_idx|
|
27
|
-
frame_idx = stack_frame_idx(stack_idx)
|
28
|
-
func_idx = frame_func_idx(frame_idx)
|
29
|
-
line = frame_line_no(frame_idx)
|
30
|
-
name = func_name(func_idx);
|
31
|
-
filename = func_filename(func_idx);
|
32
|
-
|
33
|
-
"#{filename}:#{line}:in '#{name}'"
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
def full_stack(stack_idx)
|
38
|
-
full_stack = []
|
39
|
-
while stack_idx
|
40
|
-
full_stack << stack_idx
|
41
|
-
stack_idx = stack_parent_idx(stack_idx)
|
42
|
-
end
|
43
|
-
full_stack
|
44
|
-
end
|
5
|
+
include StackTableHelpers
|
45
6
|
end
|
46
7
|
end
|
@@ -0,0 +1,129 @@
|
|
1
|
+
module Vernier
|
2
|
+
module StackTableHelpers
|
3
|
+
def inspect
|
4
|
+
"#<#{self.class.name} #{stack_count} stacks, #{frame_count} frames, #{func_count} funcs>"
|
5
|
+
end
|
6
|
+
|
7
|
+
def to_h
|
8
|
+
{
|
9
|
+
stack_table: {
|
10
|
+
parent: stack_count.times.map { stack_parent_idx(_1) },
|
11
|
+
frame: stack_count.times.map { stack_frame_idx(_1) }
|
12
|
+
},
|
13
|
+
frame_table: {
|
14
|
+
func: frame_count.times.map { frame_func_idx(_1) },
|
15
|
+
line: frame_count.times.map { frame_line_no(_1) }
|
16
|
+
},
|
17
|
+
func_table: {
|
18
|
+
name: func_count.times.map { func_name(_1) },
|
19
|
+
filename: func_count.times.map { func_filename(_1) },
|
20
|
+
first_line: func_count.times.map { func_first_lineno(_1) }
|
21
|
+
}
|
22
|
+
}
|
23
|
+
end
|
24
|
+
|
25
|
+
def backtrace(stack_idx)
|
26
|
+
full_stack(stack_idx).map do |stack_idx|
|
27
|
+
frame_idx = stack_frame_idx(stack_idx)
|
28
|
+
func_idx = frame_func_idx(frame_idx)
|
29
|
+
line = frame_line_no(frame_idx)
|
30
|
+
name = func_name(func_idx);
|
31
|
+
filename = func_filename(func_idx);
|
32
|
+
|
33
|
+
"#{filename}:#{line}:in '#{name}'"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def full_stack(stack_idx)
|
38
|
+
full_stack = []
|
39
|
+
while stack_idx
|
40
|
+
full_stack << stack_idx
|
41
|
+
stack_idx = stack_parent_idx(stack_idx)
|
42
|
+
end
|
43
|
+
full_stack
|
44
|
+
end
|
45
|
+
|
46
|
+
class BaseType
|
47
|
+
attr_reader :stack_table, :idx
|
48
|
+
def initialize(stack_table, idx)
|
49
|
+
@stack_table = stack_table
|
50
|
+
@idx = idx
|
51
|
+
end
|
52
|
+
|
53
|
+
def inspect
|
54
|
+
"#<#{self.class}\n#{to_s}>"
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
class Func < BaseType
|
59
|
+
def label
|
60
|
+
stack_table.func_name(idx)
|
61
|
+
end
|
62
|
+
alias name label
|
63
|
+
|
64
|
+
def filename
|
65
|
+
stack_table.func_filename(idx)
|
66
|
+
end
|
67
|
+
|
68
|
+
def to_s
|
69
|
+
"#{name} at #{filename}"
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
class Frame < BaseType
|
74
|
+
def label; func.label; end
|
75
|
+
def filename; func.filename; end
|
76
|
+
alias name label
|
77
|
+
|
78
|
+
def func
|
79
|
+
func_idx = stack_table.frame_func_idx(idx)
|
80
|
+
Func.new(stack_table, func_idx)
|
81
|
+
end
|
82
|
+
|
83
|
+
def line
|
84
|
+
stack_table.frame_line_no(idx)
|
85
|
+
end
|
86
|
+
|
87
|
+
def to_s
|
88
|
+
"#{func}:#{line}"
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
class Stack < BaseType
|
93
|
+
def each_frame
|
94
|
+
return enum_for(__method__) unless block_given?
|
95
|
+
|
96
|
+
stack_idx = idx
|
97
|
+
while stack_idx
|
98
|
+
frame_idx = stack_table.stack_frame_idx(stack_idx)
|
99
|
+
yield Frame.new(stack_table, frame_idx)
|
100
|
+
stack_idx = stack_table.stack_parent_idx(stack_idx)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
def leaf_frame_idx
|
105
|
+
stack_table.stack_frame_idx(idx)
|
106
|
+
end
|
107
|
+
|
108
|
+
def leaf_frame
|
109
|
+
Frame.new(stack_table, leaf_frame_idx)
|
110
|
+
end
|
111
|
+
|
112
|
+
def frames
|
113
|
+
each_frame.to_a
|
114
|
+
end
|
115
|
+
|
116
|
+
def to_s
|
117
|
+
arr = []
|
118
|
+
each_frame do |frame|
|
119
|
+
arr << frame.to_s
|
120
|
+
end
|
121
|
+
arr.join("\n")
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
def stack(idx)
|
126
|
+
Stack.new(self, idx)
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
data/lib/vernier/version.rb
CHANGED
data/lib/vernier.rb
CHANGED
@@ -3,11 +3,14 @@
|
|
3
3
|
require_relative "vernier/version"
|
4
4
|
require_relative "vernier/collector"
|
5
5
|
require_relative "vernier/stack_table"
|
6
|
+
require_relative "vernier/parsed_profile"
|
6
7
|
require_relative "vernier/result"
|
7
8
|
require_relative "vernier/hooks"
|
8
9
|
require_relative "vernier/vernier"
|
9
10
|
require_relative "vernier/output/firefox"
|
10
11
|
require_relative "vernier/output/top"
|
12
|
+
require_relative "vernier/output/file_listing"
|
13
|
+
require_relative "vernier/output/filename_filter"
|
11
14
|
|
12
15
|
module Vernier
|
13
16
|
class Error < StandardError; end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vernier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Hawthorn
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-12-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -70,6 +70,7 @@ files:
|
|
70
70
|
- bin/console
|
71
71
|
- bin/setup
|
72
72
|
- bin/vernier
|
73
|
+
- examples/fiber_stalls.rb
|
73
74
|
- examples/gvl_sleep.rb
|
74
75
|
- examples/measure_overhead.rb
|
75
76
|
- examples/minitest.rb
|
@@ -78,7 +79,11 @@ files:
|
|
78
79
|
- examples/threaded_http_requests.rb
|
79
80
|
- exe/vernier
|
80
81
|
- ext/vernier/extconf.rb
|
82
|
+
- ext/vernier/memory.cc
|
83
|
+
- ext/vernier/periodic_thread.hh
|
81
84
|
- ext/vernier/ruby_type_names.h
|
85
|
+
- ext/vernier/signal_safe_semaphore.hh
|
86
|
+
- ext/vernier/timestamp.hh
|
82
87
|
- ext/vernier/vernier.cc
|
83
88
|
- ext/vernier/vernier.hh
|
84
89
|
- lib/vernier.rb
|
@@ -86,12 +91,17 @@ files:
|
|
86
91
|
- lib/vernier/collector.rb
|
87
92
|
- lib/vernier/hooks.rb
|
88
93
|
- lib/vernier/hooks/active_support.rb
|
94
|
+
- lib/vernier/hooks/memory_usage.rb
|
89
95
|
- lib/vernier/marker.rb
|
90
96
|
- lib/vernier/middleware.rb
|
97
|
+
- lib/vernier/output/file_listing.rb
|
98
|
+
- lib/vernier/output/filename_filter.rb
|
91
99
|
- lib/vernier/output/firefox.rb
|
92
100
|
- lib/vernier/output/top.rb
|
101
|
+
- lib/vernier/parsed_profile.rb
|
93
102
|
- lib/vernier/result.rb
|
94
103
|
- lib/vernier/stack_table.rb
|
104
|
+
- lib/vernier/stack_table_helpers.rb
|
95
105
|
- lib/vernier/thread_names.rb
|
96
106
|
- lib/vernier/version.rb
|
97
107
|
- vernier.gemspec
|