qprof 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/qprof/version.rb +1 -1
- data/lib/qprof.rb +10 -4
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c67f1d968b42697cb0445f69199d6dbc62362802b261b22133c3d27b28fdcd7
|
4
|
+
data.tar.gz: 230ebd116a6c29191d3d88bbb5abe6b310d0fe9225cab19568b712c8aeee8f68
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 994c3256c2f384cf5ac9c5ac13773e25835fd271b427e73a6a8800d55dfeb3a61a60236ce5d43b418e777934de6e8912fd949364776a4458ca3266b97210cb49
|
7
|
+
data.tar.gz: dd473f81ab60d8274d8c0944142e10dd5cea8f9b89a6e87e68fe57c0f9d8a9b08a0e1acaa7a19ab314ecbed872e3e6534843b4bac42a8f17b4426a98a85c0c0a
|
data/lib/qprof/version.rb
CHANGED
data/lib/qprof.rb
CHANGED
@@ -16,21 +16,27 @@ module QProf
|
|
16
16
|
run_svg_path = "/tmp/qprof/#{run}.svg"
|
17
17
|
flamegraph_pl_path = '/tmp/qprof/FlameGraph/flamegraph.pl'
|
18
18
|
|
19
|
+
# pull flamegraph if it's needed
|
19
20
|
`git clone https://github.com/brendangregg/FlameGraph.git #{File.dirname(flamegraph_pl_path)}` unless File.exist?(flamegraph_pl_path)
|
20
21
|
|
22
|
+
# run block
|
21
23
|
@benchmark = Benchmark.measure do
|
22
24
|
@result = RubyProf.profile do
|
23
|
-
yield
|
25
|
+
@value = yield
|
24
26
|
end
|
25
27
|
end
|
26
28
|
|
27
|
-
|
28
|
-
|
29
|
-
.join('; ')
|
29
|
+
# generate graph
|
30
|
+
subtitle = %i[utime stime real].map { |x| "#{x} = #{@benchmark.send(x).round(4)}s" }.join('; ')
|
30
31
|
printer = RubyProf::FlameGraphPrinter.new(@result)
|
31
32
|
File.open(run_txt_path, 'w') { |file| printer.print(file) }
|
32
33
|
`cat #{run_txt_path} | #{flamegraph_pl_path} --title \"#{title}\" --subtitle \"#{subtitle}\" > #{run_svg_path}`
|
34
|
+
|
35
|
+
# open in browser
|
33
36
|
Launchy.open(run_svg_path)
|
37
|
+
|
38
|
+
# return any wrapped value
|
39
|
+
@value
|
34
40
|
end
|
35
41
|
end
|
36
42
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qprof
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- graham otte
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-03-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: securerandom
|
@@ -108,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
108
|
- !ruby/object:Gem::Version
|
109
109
|
version: '0'
|
110
110
|
requirements: []
|
111
|
-
rubygems_version: 3.
|
111
|
+
rubygems_version: 3.4.1
|
112
112
|
signing_key:
|
113
113
|
specification_version: 4
|
114
114
|
summary: quick and dirty ruby flamegraphs
|