require-profiler 0.2.0 → 0.2.2
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/CHANGELOG.md +10 -0
- data/README.md +5 -0
- data/lib/require_profiler/hyperdrive/skills/rails-boot-profiling/SKILL.md +191 -0
- data/lib/require_profiler/plugins/http_plugin.rb +42 -0
- data/lib/require_profiler/plugins/yaml_plugin.rb +42 -0
- data/lib/require_profiler/plugins.rb +23 -0
- data/lib/require_profiler/printer/call_stack.rb +1 -1
- data/lib/require_profiler/reporter.rb +4 -3
- data/lib/require_profiler/version.rb +1 -1
- data/lib/require_profiler.rb +3 -0
- metadata +63 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d9031019da202ea4bf4ba530de358c6759bb8417de3f96047a138a9d262c0ff0
|
|
4
|
+
data.tar.gz: e51c7eb92cc7419bcdd396103a0565db26e9cf2fd97013577ffcc8b5b127a337
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cc3d71a84a0faac6f801a9836dc0e0b3c3c6c3d694275f709f8a399229c8a1ee5cb8fe3b9ea4f1c311e04f93e0ffb3c28f3462ce6c582888e155da0a64b469d6
|
|
7
|
+
data.tar.gz: d16347ab1249f15e34f325f11f0505f17985c877bf2808b3e1727bff31c4369d95791032546f5f987034f1061ec95a774f1788646afc5f8c8b010374b26da1cc
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
## master
|
|
4
4
|
|
|
5
|
+
## 0.2.2 (2026-06-05)
|
|
6
|
+
|
|
7
|
+
- Fixed YAML tracking when Pathname is used. ([@palkan][])
|
|
8
|
+
|
|
9
|
+
## 0.2.1 (2026-05-26)
|
|
10
|
+
|
|
11
|
+
- Add YAML tracking. ([@palkan][])
|
|
12
|
+
|
|
13
|
+
- Add HTTP tracking via Sniffer. ([@palkan][])
|
|
14
|
+
|
|
5
15
|
## 0.2.0 (2026-05-25) 🔔
|
|
6
16
|
|
|
7
17
|
- Add ability to run Stackprof for a particular file loading. ([@palkan][])
|
data/README.md
CHANGED
|
@@ -108,6 +108,10 @@ Now you can use Speedscope to dig deeper.
|
|
|
108
108
|
|
|
109
109
|
**NOTE:** The `stackprof` gem must be present in your Gemfile for that.
|
|
110
110
|
|
|
111
|
+
### YAML and HTTP support
|
|
112
|
+
|
|
113
|
+
Require Profiler also captures HTTP requests and YAML file loading and add them to the profile, so you can find which Ruby files trigger the corresponding actions on load. NOTE: For HTTP requests tracking, you MUST add [sniffer][] gem to your Gemfile.
|
|
114
|
+
|
|
111
115
|
### Configuration
|
|
112
116
|
|
|
113
117
|
`RequireProfiler.start` accepts the following keyword arguments:
|
|
@@ -189,3 +193,4 @@ The gem is available as open source under the terms of the [MIT License](http://
|
|
|
189
193
|
|
|
190
194
|
[speedscope]: https://www.speedscope.app/
|
|
191
195
|
[require-hooks]: https://github.com/ruby-next/require-hooks
|
|
196
|
+
[sniffer]: https://github.com/aderyabin/sniffer
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: rails-boot-profiling
|
|
3
|
+
description: Profile Rails application boot time to find slow requires. Use when the user asks why the app boots slowly, wants to profile boot time, or needs to optimize require/load performance.
|
|
4
|
+
gem: require-profiler
|
|
5
|
+
versions: ">= 0.2"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Rails Boot Time Profiling
|
|
9
|
+
|
|
10
|
+
Profile Rails application boot time using the require-profiler gem. This skill helps identify which `require`, `load`, YAML, and HTTP calls dominate startup time, and provides tools to drill deeper into slow files.
|
|
11
|
+
|
|
12
|
+
## Prerequisites
|
|
13
|
+
|
|
14
|
+
Before profiling, ensure these conditions are met:
|
|
15
|
+
|
|
16
|
+
1. The `require-profiler` gem is in the Gemfile (at minimum in the development group).
|
|
17
|
+
|
|
18
|
+
2. Eager loading must be enabled for the environment you are profiling. Check the environment config:
|
|
19
|
+
|
|
20
|
+
```ruby
|
|
21
|
+
# config/environments/development.rb (or the target environment)
|
|
22
|
+
config.eager_load = true
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
If `eager_load` is `false`, the profile will miss most application code — only files loaded during boot are captured, and lazy-loaded files will not appear.
|
|
26
|
+
|
|
27
|
+
3. Add `-W0` to the Ruby command to suppress warnings and keep output clean.
|
|
28
|
+
|
|
29
|
+
## Step 1: Run a Full Boot Profile
|
|
30
|
+
|
|
31
|
+
Run the base profiling command:
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
bundle exec ruby -W0 -r./config/boot -require-prof config/environment.rb
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
This loads `config/boot.rb` first (to set up Bundler and Bootsnap) and then profiles everything loaded by `config/environment.rb`.
|
|
38
|
+
|
|
39
|
+
The output is an indented tree showing each required file with its load time (self + children) in milliseconds:
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
config/environment.rb — 4312.071ms
|
|
43
|
+
config/application.rb — 3672.445ms
|
|
44
|
+
railties (>= 0) — 1023.112ms
|
|
45
|
+
actionpack (>= 0) — 412.331ms
|
|
46
|
+
actionview (>= 0) — 198.442ms
|
|
47
|
+
app/models/user.rb — 87.203ms
|
|
48
|
+
app/models/order.rb — 142.891ms
|
|
49
|
+
app/models/concerns/auditable.rb — 12.004ms
|
|
50
|
+
config/initializers/stripe.rb — 523.117ms
|
|
51
|
+
stripe (>= 0) — 498.201ms
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
To get a quick count of how many files were loaded:
|
|
55
|
+
|
|
56
|
+
```sh
|
|
57
|
+
bundle exec ruby -W0 -r./config/boot -require-prof config/environment.rb | wc -l
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Step 2: Narrow the Scope
|
|
61
|
+
|
|
62
|
+
### Filter by Threshold
|
|
63
|
+
|
|
64
|
+
Exclude files that loaded faster than a given number of milliseconds (supports floats):
|
|
65
|
+
|
|
66
|
+
```sh
|
|
67
|
+
REQUIRE_PROFILE_THRESHOLD=100 bundle exec ruby -W0 -r./config/boot -require-prof config/environment.rb
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
This shows only files that took 100ms or more to load — useful for quickly spotting the biggest offenders.
|
|
71
|
+
|
|
72
|
+
### Filter by Focus Pattern
|
|
73
|
+
|
|
74
|
+
Show only files matching a pattern (uses `Regexp.new(...)` under the hood):
|
|
75
|
+
|
|
76
|
+
```sh
|
|
77
|
+
REQUIRE_PROFILE_FOCUS="stripe" bundle exec ruby -W0 -r./config/boot -require-prof config/environment.rb
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
The focus filter also keeps ancestor nodes in the tree, so you can see the full require chain leading to the matched files.
|
|
81
|
+
|
|
82
|
+
Combine both for a precise view:
|
|
83
|
+
|
|
84
|
+
```sh
|
|
85
|
+
REQUIRE_PROFILE_THRESHOLD=50 REQUIRE_PROFILE_FOCUS="initializers" bundle exec ruby -W0 -r./config/boot -require-prof config/environment.rb
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Step 3: Check YAML and HTTP Activity During Boot
|
|
89
|
+
|
|
90
|
+
By default, require-profiler tracks YAML file loads (`YAML.load_file`, etc.) and adds them to the profile tree. This helps find initializers or gems that parse large YAML configs at boot time.
|
|
91
|
+
|
|
92
|
+
HTTP request tracking is also available but requires the [sniffer](https://github.com/aderyabin/sniffer) gem to be in the Gemfile. This surfaces any HTTP calls made during boot (e.g., config fetches from remote services, gem activation pings).
|
|
93
|
+
|
|
94
|
+
To disable either:
|
|
95
|
+
|
|
96
|
+
```sh
|
|
97
|
+
# Disable YAML tracking
|
|
98
|
+
REQUIRE_PROFILER_YAML=false bundle exec ruby -W0 -r./config/boot -require-prof config/environment.rb
|
|
99
|
+
|
|
100
|
+
# Disable HTTP tracking
|
|
101
|
+
REQUIRE_PROFILER_HTTP=false bundle exec ruby -W0 -r./config/boot -require-prof config/environment.rb
|
|
102
|
+
|
|
103
|
+
# Disable all plugins (YAML + HTTP)
|
|
104
|
+
REQUIRE_PROFILER_PLUGINS=false bundle exec ruby -W0 -r./config/boot -require-prof config/environment.rb
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Step 4: Deep-Dive with Stackprof
|
|
108
|
+
|
|
109
|
+
When you identify a file that is unexpectedly slow to load, use Stackprof to profile what happens inside that file during `require`:
|
|
110
|
+
|
|
111
|
+
```sh
|
|
112
|
+
REQUIRE_PROFILE_STACKPROF=config/initializers/stripe.rb bundle exec ruby -W0 -r./config/boot -require-prof config/environment.rb
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
The `stackprof` gem must be in the Gemfile. This generates two files:
|
|
116
|
+
|
|
117
|
+
- `config-initializers-stripe-stackprof.json` — JSON format, viewable in [Speedscope](https://www.speedscope.app/)
|
|
118
|
+
- `config-initializers-stripe-stackprof.dump` — raw Stackprof data, analyzable with the `stackprof` CLI
|
|
119
|
+
|
|
120
|
+
To analyze with the stackprof CLI:
|
|
121
|
+
|
|
122
|
+
```sh
|
|
123
|
+
bundle exec stackprof config-initializers-stripe-stackprof.dump
|
|
124
|
+
bundle exec stackprof config-initializers-stripe-stackprof.dump --method 'ClassName#method_name'
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
To view in Speedscope, open https://www.speedscope.app/ and drag the `.json` file onto the page (nothing is uploaded — parsing is local).
|
|
128
|
+
|
|
129
|
+
## Step 5: Export as JSON for Speedscope
|
|
130
|
+
|
|
131
|
+
Generate a Speedscope-compatible JSON profile of the entire boot:
|
|
132
|
+
|
|
133
|
+
```sh
|
|
134
|
+
REQUIRE_PROFILE_PATH=tmp/require-profile.json bundle exec ruby -W0 -r./config/boot -require-prof config/environment.rb
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
This writes a JSON file conforming to the [Speedscope file format schema](https://www.speedscope.app/file-format-schema.json). Open it in Speedscope and use the **Left Heavy** view to find the most expensive require chains, and the **Sandwich** view to find files that appear repeatedly across different chains.
|
|
138
|
+
|
|
139
|
+
If the Speedscope CLI is installed (`npm install -g speedscope`), open it directly:
|
|
140
|
+
|
|
141
|
+
```sh
|
|
142
|
+
npx speedscope tmp/require-profile.json
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
You can also use the `REQUIRE_PROFILE_FORMAT` env var to select the output format explicitly (`text`, `json`, or `call_stack`). When the output path ends in `.json`, the JSON format is selected automatically.
|
|
146
|
+
|
|
147
|
+
## Collapsed Call Stack Format
|
|
148
|
+
|
|
149
|
+
For flame graph generation with external tools (e.g., `flamegraph.pl`, `inferno`), use the collapsed call stack format:
|
|
150
|
+
|
|
151
|
+
```sh
|
|
152
|
+
REQUIRE_PROFILE_FORMAT=call_stack REQUIRE_PROFILE_PATH=tmp/require-profile.txt bundle exec ruby -W0 -r./config/boot -require-prof config/environment.rb
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
This emits one line per stack in Brendan Gregg's collapsed format with per-frame self time in milliseconds.
|
|
156
|
+
|
|
157
|
+
## Environment Variable Reference
|
|
158
|
+
|
|
159
|
+
| Variable | Purpose | Example |
|
|
160
|
+
|---|---|---|
|
|
161
|
+
| `REQUIRE_PROFILE_THRESHOLD` | Minimum load time in ms to include (float) | `100`, `50.5` |
|
|
162
|
+
| `REQUIRE_PROFILE_FOCUS` | Regexp pattern to filter files | `"stripe"`, `"initializers"` |
|
|
163
|
+
| `REQUIRE_PROFILE_PATH` | Output file path (enables file output) | `tmp/require-profile.json` |
|
|
164
|
+
| `REQUIRE_PROFILE_FORMAT` | Output format: `text`, `json`, `call_stack` | `json` |
|
|
165
|
+
| `REQUIRE_PROFILE_STACKPROF` | File path to deep-profile with Stackprof | `config/initializers/stripe.rb` |
|
|
166
|
+
| `REQUIRE_PROFILER_YAML` | Disable YAML tracking when set to `false` | `false` |
|
|
167
|
+
| `REQUIRE_PROFILER_HTTP` | Disable HTTP tracking when set to `false` | `false` |
|
|
168
|
+
| `REQUIRE_PROFILER_PLUGINS` | Disable all plugins when set to `false` | `false` |
|
|
169
|
+
|
|
170
|
+
## Recommended Agent Workflow
|
|
171
|
+
|
|
172
|
+
Follow this sequence when a user asks about slow boot time:
|
|
173
|
+
|
|
174
|
+
1. **Get a baseline.** Run the full profile command and note the total boot time (the top-level entry's duration) and total file count (`| wc -l`).
|
|
175
|
+
|
|
176
|
+
2. **Find the top offenders.** Re-run with `REQUIRE_PROFILE_THRESHOLD=100` (or adjust based on total time) to surface only slow files. Report the top 5-10 slowest entries to the user.
|
|
177
|
+
|
|
178
|
+
3. **Investigate specific areas.** If the user suspects a particular gem or area, use `REQUIRE_PROFILE_FOCUS` to zoom in. Otherwise, focus on the slowest entries from step 2.
|
|
179
|
+
|
|
180
|
+
4. **Check for boot-time side effects.** Look at YAML and HTTP entries in the profile. HTTP calls during boot are almost always worth investigating — they add latency and can fail. YAML loads of large files can also be significant.
|
|
181
|
+
|
|
182
|
+
5. **Deep-dive when needed.** For files that are unexpectedly slow (the load time seems too high for what the file does), use `REQUIRE_PROFILE_STACKPROF` to generate a Stackprof profile and identify what's happening inside that file.
|
|
183
|
+
|
|
184
|
+
6. **Generate a JSON profile for handoff.** If the user wants to explore the data themselves, or if the profile is too large to analyze in text, export to JSON with `REQUIRE_PROFILE_PATH=tmp/require-profile.json` and point them to Speedscope.
|
|
185
|
+
|
|
186
|
+
7. **Suggest actionable improvements** based on findings:
|
|
187
|
+
- Move heavy gem requires behind lazy loading or autoload
|
|
188
|
+
- Defer initializer work to `after_initialize` or `to_prepare` callbacks
|
|
189
|
+
- Replace boot-time HTTP calls with cached configs or async fetches
|
|
190
|
+
- Split large YAML files or cache parsed results
|
|
191
|
+
- Consider using `bootsnap` if not already present
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module RequireProfiler
|
|
4
|
+
module Plugins
|
|
5
|
+
# Track HTTP calls using Sniffer and add the to the require profile
|
|
6
|
+
class HTTPPlugin < Base
|
|
7
|
+
def activate!
|
|
8
|
+
begin
|
|
9
|
+
require "sniffer"
|
|
10
|
+
rescue LoadError
|
|
11
|
+
return
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
Sniffer.config.logger = Logger.new(IO::NULL)
|
|
15
|
+
|
|
16
|
+
Sniffer.config.middleware do |chain|
|
|
17
|
+
chain.add HTTPPlugin, reporter
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
Sniffer::DataItem::Request.include(Module.new do
|
|
21
|
+
def require_path
|
|
22
|
+
@url ||= "#{method.to_s.upcase}:#{(port == 443) ? "https" : "http"}://#{host}#{query}"
|
|
23
|
+
end
|
|
24
|
+
end)
|
|
25
|
+
|
|
26
|
+
Sniffer.enable!
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# Sniffer hook interface
|
|
30
|
+
def request(data_item)
|
|
31
|
+
reporter.handle_event(Reporter::Event.new(type: :start, kind: :http, path: data_item.request.require_path))
|
|
32
|
+
yield
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def response(data_item)
|
|
36
|
+
yield
|
|
37
|
+
time = data_item.response.timing
|
|
38
|
+
reporter.handle_event(Reporter::Event.new(type: :end, path: data_item.request.require_path, time:))
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module RequireProfiler
|
|
4
|
+
module Plugins
|
|
5
|
+
# Track loading YAML files
|
|
6
|
+
class YAMLPlugin < Base
|
|
7
|
+
module Patch
|
|
8
|
+
def load_file(path, ...)
|
|
9
|
+
YAMLPlugin.track(path.to_s) { super }
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def unsafe_load_file(path, ...)
|
|
13
|
+
YAMLPlugin.track(path.to_s) { super }
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def safe_load_file(path, ...)
|
|
17
|
+
YAMLPlugin.track(path.to_s) { super }
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
class << self
|
|
22
|
+
attr_accessor :reporter
|
|
23
|
+
|
|
24
|
+
def track(path)
|
|
25
|
+
reporter.handle_event(Reporter::Event.new(type: :start, kind: :yml, path:))
|
|
26
|
+
start = Time.now
|
|
27
|
+
yield
|
|
28
|
+
ensure
|
|
29
|
+
time = Time.now - start
|
|
30
|
+
reporter.handle_event(Reporter::Event.new(type: :end, path:, time:))
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def activate!
|
|
35
|
+
require "yaml"
|
|
36
|
+
|
|
37
|
+
YAMLPlugin.reporter = reporter
|
|
38
|
+
::YAML.singleton_class.prepend(Patch)
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module RequireProfiler
|
|
4
|
+
module Plugins
|
|
5
|
+
class << self
|
|
6
|
+
def register_reporter(reporter)
|
|
7
|
+
HTTPPlugin.new(reporter).activate! unless ENV["REQUIRE_PROFILER_HTTP"] == "false"
|
|
8
|
+
YAMLPlugin.new(reporter).activate! unless ENV["REQUIRE_PROFILER_YAML"] == "false"
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
class Base
|
|
13
|
+
attr_reader :reporter
|
|
14
|
+
|
|
15
|
+
def initialize(reporter)
|
|
16
|
+
@reporter = reporter
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
autoload :HTTPPlugin, "require_profiler/plugins/http_plugin"
|
|
21
|
+
autoload :YAMLPlugin, "require_profiler/plugins/yaml_plugin"
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -8,7 +8,7 @@ module RequireProfiler
|
|
|
8
8
|
return unless flush?(node)
|
|
9
9
|
|
|
10
10
|
path = node.path.sub(prefix_stripper, "")
|
|
11
|
-
self_parts = path.split("/")
|
|
11
|
+
self_parts = (node.kind == :path) ? path.split("/") : [path]
|
|
12
12
|
|
|
13
13
|
parts += self_parts.size.times.map { self_parts.take(_1 + 1).join("/") }
|
|
14
14
|
# We only show self-time, so exclude children
|
|
@@ -2,14 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
module RequireProfiler
|
|
4
4
|
class Reporter
|
|
5
|
-
class Event < Struct.new(:type, :path, :time, keyword_init: true)
|
|
5
|
+
class Event < Struct.new(:type, :path, :time, :kind, keyword_init: true)
|
|
6
6
|
end
|
|
7
7
|
|
|
8
|
-
class Node < Struct.new(:path, :time, :parent, :children, :focused, keyword_init: true)
|
|
8
|
+
class Node < Struct.new(:path, :time, :parent, :children, :kind, :focused, keyword_init: true)
|
|
9
9
|
def initialize(...)
|
|
10
10
|
super
|
|
11
11
|
self.children ||= []
|
|
12
12
|
self.focused = false
|
|
13
|
+
self.kind ||= :path
|
|
13
14
|
end
|
|
14
15
|
|
|
15
16
|
def focused!
|
|
@@ -37,7 +38,7 @@ module RequireProfiler
|
|
|
37
38
|
|
|
38
39
|
def handle_event_sync(event)
|
|
39
40
|
if event.type == :start
|
|
40
|
-
node = Node.new(path: event.path, children: [])
|
|
41
|
+
node = Node.new(path: event.path, children: [], kind: event.kind)
|
|
41
42
|
parent = stack.last
|
|
42
43
|
|
|
43
44
|
if parent
|
data/lib/require_profiler.rb
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
module RequireProfiler
|
|
4
4
|
autoload :Reporter, "require_profiler/reporter"
|
|
5
5
|
autoload :Printer, "require_profiler/printer"
|
|
6
|
+
autoload :Plugins, "require_profiler/plugins"
|
|
6
7
|
|
|
7
8
|
# Autoload doesn't work here, because we call it from the hooks for the first time
|
|
8
9
|
require "require_profiler/ruby_profiling"
|
|
@@ -38,6 +39,8 @@ module RequireProfiler
|
|
|
38
39
|
time = Time.now - start
|
|
39
40
|
reporter.handle_event(Reporter::Event.new(type: :end, path:, time:))
|
|
40
41
|
end
|
|
42
|
+
|
|
43
|
+
Plugins.register_reporter(reporter) unless ENV["REQUIRE_PROFILER_PLUGINS"] == "false"
|
|
41
44
|
end
|
|
42
45
|
|
|
43
46
|
def stop
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: require-profiler
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Vladimir Dementyev
|
|
@@ -37,6 +37,34 @@ dependencies:
|
|
|
37
37
|
- - ">="
|
|
38
38
|
- !ruby/object:Gem::Version
|
|
39
39
|
version: '1.15'
|
|
40
|
+
- !ruby/object:Gem::Dependency
|
|
41
|
+
name: benchmark
|
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
|
43
|
+
requirements:
|
|
44
|
+
- - ">="
|
|
45
|
+
- !ruby/object:Gem::Version
|
|
46
|
+
version: '0'
|
|
47
|
+
type: :development
|
|
48
|
+
prerelease: false
|
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
50
|
+
requirements:
|
|
51
|
+
- - ">="
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: '0'
|
|
54
|
+
- !ruby/object:Gem::Dependency
|
|
55
|
+
name: logger
|
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
|
57
|
+
requirements:
|
|
58
|
+
- - ">="
|
|
59
|
+
- !ruby/object:Gem::Version
|
|
60
|
+
version: '0'
|
|
61
|
+
type: :development
|
|
62
|
+
prerelease: false
|
|
63
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
64
|
+
requirements:
|
|
65
|
+
- - ">="
|
|
66
|
+
- !ruby/object:Gem::Version
|
|
67
|
+
version: '0'
|
|
40
68
|
- !ruby/object:Gem::Dependency
|
|
41
69
|
name: rake
|
|
42
70
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -65,6 +93,34 @@ dependencies:
|
|
|
65
93
|
- - ">="
|
|
66
94
|
- !ruby/object:Gem::Version
|
|
67
95
|
version: '3.9'
|
|
96
|
+
- !ruby/object:Gem::Dependency
|
|
97
|
+
name: sniffer
|
|
98
|
+
requirement: !ruby/object:Gem::Requirement
|
|
99
|
+
requirements:
|
|
100
|
+
- - ">="
|
|
101
|
+
- !ruby/object:Gem::Version
|
|
102
|
+
version: '0'
|
|
103
|
+
type: :development
|
|
104
|
+
prerelease: false
|
|
105
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
106
|
+
requirements:
|
|
107
|
+
- - ">="
|
|
108
|
+
- !ruby/object:Gem::Version
|
|
109
|
+
version: '0'
|
|
110
|
+
- !ruby/object:Gem::Dependency
|
|
111
|
+
name: webmock
|
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
|
113
|
+
requirements:
|
|
114
|
+
- - "~>"
|
|
115
|
+
- !ruby/object:Gem::Version
|
|
116
|
+
version: '3.26'
|
|
117
|
+
type: :development
|
|
118
|
+
prerelease: false
|
|
119
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
120
|
+
requirements:
|
|
121
|
+
- - "~>"
|
|
122
|
+
- !ruby/object:Gem::Version
|
|
123
|
+
version: '3.26'
|
|
68
124
|
description: 'Profile Ruby #require/#load/etc calls'
|
|
69
125
|
email:
|
|
70
126
|
- Vladimir Dementyev
|
|
@@ -78,6 +134,10 @@ files:
|
|
|
78
134
|
- lib/equire-prof.rb
|
|
79
135
|
- lib/require-profiler.rb
|
|
80
136
|
- lib/require_profiler.rb
|
|
137
|
+
- lib/require_profiler/hyperdrive/skills/rails-boot-profiling/SKILL.md
|
|
138
|
+
- lib/require_profiler/plugins.rb
|
|
139
|
+
- lib/require_profiler/plugins/http_plugin.rb
|
|
140
|
+
- lib/require_profiler/plugins/yaml_plugin.rb
|
|
81
141
|
- lib/require_profiler/printer.rb
|
|
82
142
|
- lib/require_profiler/printer/call_stack.rb
|
|
83
143
|
- lib/require_profiler/printer/json.rb
|
|
@@ -94,6 +154,8 @@ metadata:
|
|
|
94
154
|
documentation_uri: https://github.com/palkan/require-profiler
|
|
95
155
|
homepage_uri: https://github.com/palkan/require-profiler
|
|
96
156
|
source_code_uri: https://github.com/palkan/require-profiler
|
|
157
|
+
hyperdrive_targets: railties
|
|
158
|
+
hyperdrive_artifacts: skill
|
|
97
159
|
rdoc_options: []
|
|
98
160
|
require_paths:
|
|
99
161
|
- lib
|