aleksi-rack-perftools_profiler 0.0.3 → 0.0.4
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.
- data/README.rdoc +1 -0
- data/VERSION +1 -1
- data/lib/rack/perftools_profiler.rb +1 -0
- data/lib/rack/perftools_profiler/profiler.rb +7 -5
- metadata +3 -3
data/README.rdoc
CHANGED
|
@@ -47,6 +47,7 @@ For Rack::Builder, call 'use' inside the Builder constructor block
|
|
|
47
47
|
== Options
|
|
48
48
|
|
|
49
49
|
* :bundler - run profiler binary from bundle if set to true
|
|
50
|
+
* :gemfile_dir - directory with Gemfile
|
|
50
51
|
* :default_printer - can be set to 'text', 'gif', or 'pdf'. Default is :text
|
|
51
52
|
* :mode - can be set to 'cputime' or 'walltime'. Default is :cputime
|
|
52
53
|
* :frequency - in :cputime mode, the number of times per second the app will be sampled. Default is 100 (times/sec)
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.0.
|
|
1
|
+
0.0.4
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
# OPTIONS
|
|
39
39
|
#
|
|
40
40
|
# :bundler - run profiler binary from bundle if set to true
|
|
41
|
+
# :gemfile_dir - directory with Gemfile
|
|
41
42
|
# :default_printer - can be set to 'text', 'gif', or 'pdf'. Default is :text
|
|
42
43
|
# :mode - can be set to 'cputime' or 'walltime'. Default is :cputime
|
|
43
44
|
# :frequency - in :cputime mode, the number of times per second the app will be sampled.
|
|
@@ -24,13 +24,15 @@ module Rack::PerftoolsProfiler
|
|
|
24
24
|
DEFAULT_PRINTER = :text
|
|
25
25
|
DEFAULT_MODE = :cputime
|
|
26
26
|
UNSET_FREQUENCY = -1
|
|
27
|
+
DEFAULT_GEMFILE_DIR = '.'
|
|
27
28
|
|
|
28
29
|
def initialize(app, options)
|
|
29
|
-
@printer
|
|
30
|
+
@printer = (options.delete(:default_printer) { DEFAULT_PRINTER }).to_sym
|
|
31
|
+
@frequency = (options.delete(:frequency) { UNSET_FREQUENCY }).to_s
|
|
32
|
+
@mode = (options.delete(:mode) { DEFAULT_MODE }).to_sym
|
|
33
|
+
@bundler = (options.delete(:bundler) { false })
|
|
34
|
+
@gemfile_dir = (options.delete(:gemfile_dir) { DEFAULT_GEMFILE_DIR })
|
|
30
35
|
ProfileDataAction.check_printer(@printer)
|
|
31
|
-
@frequency = (options.delete(:frequency) { UNSET_FREQUENCY }).to_s
|
|
32
|
-
@mode = (options.delete(:mode) { DEFAULT_MODE }).to_sym
|
|
33
|
-
@bundler = (options.delete(:bundler) { false })
|
|
34
36
|
raise ProfilerArgumentError, "Invalid option(s): #{options.keys.join(' ')}" unless options.empty?
|
|
35
37
|
end
|
|
36
38
|
|
|
@@ -73,7 +75,7 @@ module Rack::PerftoolsProfiler
|
|
|
73
75
|
args += " --focus=#{focus}" if focus
|
|
74
76
|
cmd = "pprof.rb #{args} #{PROFILING_DATA_FILE}"
|
|
75
77
|
cmd = "bundle exec " + cmd if @bundler
|
|
76
|
-
stdout, stderr, status = run(cmd)
|
|
78
|
+
stdout, stderr, status = Dir.chdir(@gemfile_dir) { run(cmd) }
|
|
77
79
|
if(status == 0)
|
|
78
80
|
[printer, stdout]
|
|
79
81
|
else
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: aleksi-rack-perftools_profiler
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 23
|
|
5
5
|
prerelease: false
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
8
|
- 0
|
|
9
|
-
-
|
|
10
|
-
version: 0.0.
|
|
9
|
+
- 4
|
|
10
|
+
version: 0.0.4
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- Ben Brinckerhoff
|