vernier 1.8.0 → 1.8.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 +4 -4
- data/.ruby-version +1 -1
- data/exe/vernier +1 -1
- data/lib/vernier/output/firefox.rb +64 -17
- data/lib/vernier/output/top.rb +6 -4
- data/lib/vernier/version.rb +1 -1
- metadata +2 -3
- data/vernier.gemspec +0 -39
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4be5edc549ea93934096d98e46c4ffcabc140d06e27303f6ec6b01de8201983c
|
4
|
+
data.tar.gz: a6322324723a2f31f15a0b7e98a6de72bf5c555e29e21951b7f466466ecedd6f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 92377006ae54cc5cc89934cc3c393fdfe02746035235b507196ef9d360b6d843c50db4382e0b53ec253f1d08f10f78e28d7daf10979f26187bb7c925933dec56
|
7
|
+
data.tar.gz: 0e963a838d3c319d93d73ae224c9e11caa51562583ef37f2d5fff40781281d30ee714273a9ce021c9e8285942825a3356388d2f68b51315fb5275c5bb96b49a6
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.4.
|
1
|
+
3.4.6
|
data/exe/vernier
CHANGED
@@ -79,7 +79,7 @@ FLAGS:
|
|
79
79
|
|
80
80
|
parsed_profile = Vernier::ParsedProfile.read_file(file)
|
81
81
|
|
82
|
-
puts Vernier::Output::Top.new(parsed_profile).output
|
82
|
+
puts Vernier::Output::Top.new(parsed_profile, top).output
|
83
83
|
puts Vernier::Output::FileListing.new(parsed_profile).output
|
84
84
|
end
|
85
85
|
end
|
@@ -8,35 +8,59 @@ require_relative "filename_filter"
|
|
8
8
|
module Vernier
|
9
9
|
module Output
|
10
10
|
# https://profiler.firefox.com/
|
11
|
-
# https://github.com/firefox-devtools/profiler/blob/main/src/types/profile.
|
11
|
+
# https://github.com/firefox-devtools/profiler/blob/main/src/types/profile.ts
|
12
12
|
class Firefox
|
13
13
|
class Categorizer
|
14
|
+
RAILS_COMPONENTS = %w[ activesupport activemodel activerecord actionview
|
15
|
+
actionpack activejob actionmailer actioncable
|
16
|
+
activestorage actionmailbox actiontext railties ]
|
17
|
+
|
18
|
+
AVAILABLE_COLORS = %w[ transparent purple green orange yellow lightblue
|
19
|
+
blue brown magenta red lightred darkgrey grey ]
|
20
|
+
|
21
|
+
ORDERED_CATEGORIES = %w[ Kernel Rails gem Ruby ] # This is in the order of preference
|
22
|
+
|
14
23
|
attr_reader :categories
|
24
|
+
|
15
25
|
def initialize
|
16
26
|
@categories = []
|
17
27
|
@categories_by_name = {}
|
18
28
|
|
19
|
-
add_category(name: "
|
20
|
-
rails_components = %w[ activesupport activemodel activerecord
|
21
|
-
actionview actionpack activejob actionmailer actioncable
|
22
|
-
activestorage actionmailbox actiontext railties ]
|
29
|
+
add_category(name: "Kernel", color: "magenta") do |c|
|
23
30
|
c.add_subcategory(
|
24
|
-
name: "
|
25
|
-
matcher:
|
31
|
+
name: "Kernel",
|
32
|
+
matcher: starts_with("<internal")
|
26
33
|
)
|
34
|
+
end
|
35
|
+
|
36
|
+
add_category(name: "gem", color: "lightblue") do |c|
|
27
37
|
c.add_subcategory(
|
28
38
|
name: "gem",
|
29
39
|
matcher: starts_with(*Gem.path)
|
30
40
|
)
|
41
|
+
end
|
42
|
+
|
43
|
+
add_category(name: "Rails", color: "red") do |c|
|
44
|
+
RAILS_COMPONENTS.each do |subcategory|
|
45
|
+
c.add_subcategory(
|
46
|
+
name: subcategory,
|
47
|
+
matcher: gem_path(subcategory)
|
48
|
+
)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
add_category(name: "Ruby", color: "purple") do |c|
|
31
53
|
c.add_subcategory(
|
32
54
|
name: "stdlib",
|
33
55
|
matcher: starts_with(RbConfig::CONFIG["rubylibdir"])
|
34
56
|
)
|
35
57
|
end
|
58
|
+
|
36
59
|
add_category(name: "Idle", color: "transparent")
|
37
60
|
add_category(name: "Stalled", color: "transparent")
|
38
61
|
|
39
62
|
add_category(name: "GC", color: "red")
|
63
|
+
|
40
64
|
add_category(name: "cfunc", color: "yellow", matcher: "<cfunc>")
|
41
65
|
|
42
66
|
add_category(name: "Thread", color: "grey")
|
@@ -69,7 +93,10 @@ module Vernier
|
|
69
93
|
|
70
94
|
class Category
|
71
95
|
attr_reader :idx, :name, :color, :matcher, :subcategories
|
96
|
+
|
72
97
|
def initialize(idx, name:, color:, matcher: nil)
|
98
|
+
raise ArgumentError, "invalid color: #{color}" if color && AVAILABLE_COLORS.none?(color)
|
99
|
+
|
73
100
|
@idx = idx
|
74
101
|
@name = name
|
75
102
|
@color = color
|
@@ -315,19 +342,13 @@ module Vernier
|
|
315
342
|
func_implementations[func_idx]
|
316
343
|
end
|
317
344
|
|
318
|
-
cfunc_category = @categorizer.get_category("cfunc")
|
319
|
-
ruby_category = @categorizer.get_category("Ruby")
|
320
345
|
func_categories, func_subcategories = [], []
|
321
346
|
filenames.each do |filename|
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
else
|
326
|
-
func_categories << ruby_category
|
327
|
-
subcategory = ruby_category.subcategories.detect {|c| c.matches?(filename) }&.idx || 0
|
328
|
-
func_subcategories << subcategory
|
329
|
-
end
|
347
|
+
category, subcategory = categorize_filename(filename)
|
348
|
+
func_categories << category
|
349
|
+
func_subcategories << subcategory
|
330
350
|
end
|
351
|
+
|
331
352
|
@frame_categories = @stack_table_hash[:frame_table].fetch(:func).map do |func_idx|
|
332
353
|
func_categories[func_idx]
|
333
354
|
end
|
@@ -336,6 +357,32 @@ module Vernier
|
|
336
357
|
end
|
337
358
|
end
|
338
359
|
|
360
|
+
def categorize_filename(filename)
|
361
|
+
return cfunc_category_and_subcategory if filename == "<cfunc>"
|
362
|
+
|
363
|
+
category, subcategory = find_category_and_subcategory(filename, Categorizer::ORDERED_CATEGORIES)
|
364
|
+
return category, subcategory if subcategory
|
365
|
+
|
366
|
+
ruby_category_and_subcategory
|
367
|
+
end
|
368
|
+
|
369
|
+
def cfunc_category_and_subcategory
|
370
|
+
[@categorizer.get_category("cfunc"), 0]
|
371
|
+
end
|
372
|
+
|
373
|
+
def ruby_category_and_subcategory
|
374
|
+
[@categorizer.get_category("Ruby"), 0]
|
375
|
+
end
|
376
|
+
|
377
|
+
def find_category_and_subcategory(filename, categories)
|
378
|
+
categories.each do |category_name|
|
379
|
+
category = @categorizer.get_category(category_name)
|
380
|
+
subcategory = category.subcategories.detect {|c| c.matches?(filename) }&.idx
|
381
|
+
return category, subcategory if subcategory
|
382
|
+
end
|
383
|
+
[nil, nil]
|
384
|
+
end
|
385
|
+
|
339
386
|
def filter_filenames(filenames)
|
340
387
|
filter = FilenameFilter.new
|
341
388
|
filenames.map do |filename|
|
data/lib/vernier/output/top.rb
CHANGED
@@ -3,14 +3,16 @@
|
|
3
3
|
module Vernier
|
4
4
|
module Output
|
5
5
|
class Top
|
6
|
-
def initialize(profile)
|
6
|
+
def initialize(profile, row_limit)
|
7
7
|
@profile = profile
|
8
|
+
@row_limit = row_limit
|
8
9
|
end
|
9
10
|
|
10
11
|
class Table
|
11
|
-
def initialize(header)
|
12
|
+
def initialize(header, row_limit)
|
12
13
|
@header = header
|
13
14
|
@rows = []
|
15
|
+
@row_limit = row_limit
|
14
16
|
yield self
|
15
17
|
end
|
16
18
|
|
@@ -24,7 +26,7 @@ module Vernier
|
|
24
26
|
row_separator,
|
25
27
|
format_row(@header),
|
26
28
|
row_separator
|
27
|
-
] + @rows.map do |row|
|
29
|
+
] + @rows.first(@row_limit).map do |row|
|
28
30
|
format_row(row)
|
29
31
|
end + [row_separator]
|
30
32
|
).join("\n")
|
@@ -70,7 +72,7 @@ module Vernier
|
|
70
72
|
top_by_self[name] += weight
|
71
73
|
end
|
72
74
|
|
73
|
-
Table.new %w[Samples % name] do |t|
|
75
|
+
Table.new %w[Samples % name], @row_limit do |t|
|
74
76
|
top_by_self.sort_by(&:last).reverse.each do |frame, samples|
|
75
77
|
pct = 100.0 * samples / total
|
76
78
|
t << [samples.to_s, pct.round(1).to_s, frame]
|
data/lib/vernier/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vernier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.8.
|
4
|
+
version: 1.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Hawthorn
|
@@ -105,7 +105,6 @@ files:
|
|
105
105
|
- lib/vernier/stack_table_helpers.rb
|
106
106
|
- lib/vernier/thread_names.rb
|
107
107
|
- lib/vernier/version.rb
|
108
|
-
- vernier.gemspec
|
109
108
|
homepage: https://github.com/jhawthorn/vernier
|
110
109
|
licenses:
|
111
110
|
- MIT
|
@@ -127,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
127
126
|
- !ruby/object:Gem::Version
|
128
127
|
version: '0'
|
129
128
|
requirements: []
|
130
|
-
rubygems_version: 3.
|
129
|
+
rubygems_version: 3.7.2
|
131
130
|
specification_version: 4
|
132
131
|
summary: A next generation CRuby profiler
|
133
132
|
test_files: []
|
data/vernier.gemspec
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative "lib/vernier/version"
|
4
|
-
|
5
|
-
Gem::Specification.new do |spec|
|
6
|
-
spec.name = "vernier"
|
7
|
-
spec.version = Vernier::VERSION
|
8
|
-
spec.authors = ["John Hawthorn"]
|
9
|
-
spec.email = ["john@hawthorn.email"]
|
10
|
-
|
11
|
-
spec.summary = "A next generation CRuby profiler"
|
12
|
-
spec.description = "Next-generation Ruby 3.2.1+ sampling profiler. Tracks multiple threads, GVL activity, GC pauses, idle time, and more."
|
13
|
-
spec.homepage = "https://github.com/jhawthorn/vernier"
|
14
|
-
spec.license = "MIT"
|
15
|
-
|
16
|
-
unless ENV["IGNORE_REQUIRED_RUBY_VERSION"]
|
17
|
-
spec.required_ruby_version = ">= 3.2.1"
|
18
|
-
end
|
19
|
-
|
20
|
-
spec.metadata["homepage_uri"] = spec.homepage
|
21
|
-
spec.metadata["source_code_uri"] = spec.homepage
|
22
|
-
spec.metadata["changelog_uri"] = spec.homepage
|
23
|
-
|
24
|
-
# Specify which files should be added to the gem when it is released.
|
25
|
-
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
26
|
-
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
27
|
-
`git ls-files -z`.split("\x0").reject do |f|
|
28
|
-
(f == __FILE__) || f.match(%r{\A(?:(?:test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
|
29
|
-
end
|
30
|
-
end
|
31
|
-
spec.bindir = "exe"
|
32
|
-
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
33
|
-
spec.require_paths = ["lib"]
|
34
|
-
spec.extensions = ["ext/vernier/extconf.rb"]
|
35
|
-
|
36
|
-
spec.add_development_dependency "activesupport"
|
37
|
-
spec.add_development_dependency "gvltest"
|
38
|
-
spec.add_development_dependency "rack"
|
39
|
-
end
|