Giter Club home page Giter Club logo

rack-perftools_profiler's Introduction

DEPRECATED

According to this perftools.rb issue, "perftools isn't working or needed on rubies newer than 2.1. You should use stackprof or rblineprof"

Rack::PerftoolsProfiler

Middleware for profiling Rack-compatible apps using perftools.rb

Quick start

Assuming your application is using Rails 3 (and you have installed the requirements in the next section), add the following code:

Gemfile:

gem 'rack-perftools_profiler', :require => 'rack/perftools_profiler'

config/application.rb:

config.middleware.use ::Rack::PerftoolsProfiler, :default_printer => 'gif', :bundler => true

The visit the page you want to profile:

http://localhost:3000/some_action?profile=true

Requirements

You'll need graphviz to generate call graphs using dot (for the GIF printer):

sudo port install graphviz     # OS X
brew install graphviz          # Homebrew
sudo apt-get install graphviz  # Debian/Ubuntu

You'll need ps2pdf to generate PDFs (On OS X, ps2pdf comes is installed as part of Ghostscript)

sudo port install ghostscript    # OSX
brew install ghostscript         # Homebrew
sudo apt-get install ghostscript # Debian/Ubuntu

Configuration

Install the gem

gem install rack-perftools_profiler

Include the middleware

require 'rack/perftools_profiler'

For Rails 2, add the following to config/environment.rb

config.gem 'rack-perftools_profiler', :lib => 'rack/perftools_profiler'
require 'rack/perftools_profiler'
config.middleware.use ::Rack::PerftoolsProfiler, :default_printer => 'gif'

For Rails 3, add the following to your Gemfile

gem 'rack-perftools_profiler', :require => 'rack/perftools_profiler'

and add the following to config/application.rb

config.middleware.use ::Rack::PerftoolsProfiler, :default_printer => 'gif', :bundler => true

For Sinatra, call use inside a configure block, like so:

configure do
  use ::Rack::PerftoolsProfiler, :default_printer => 'gif'
end

For Rack::Builder, call use inside the Builder constructor block

Rack::Builder.new do
  use ::Rack::PerftoolsProfiler, :default_printer => 'gif'
end

Options

  • :default_printer - can be set to 'text', 'gif', or 'pdf'. Default is 'text'.
  • :mode - can be set to 'cputime', 'methods', 'objects', 'walltime'. Default is :cputime. See the 'Profiling Modes' section below.
  • :frequency - in :cputime mode, the number of times per second the app will be sampled. Default is 100 (times/sec).
  • :bundler - run the profiler binary using 'bundle' if set to true. Default is false.
  • :gemfile_dir - directory with Gemfile. Default is the current directory.
  • :password - password-protect profiling.

Usage

There are two ways to profile your app: with a single request or with multiple requests.

To profile with a single request, visit the URL you want to profile, but add the profile and (optionally) the times GET params (which will rerun the action the specified number of times).

Example:

curl http://localhost:3000/foobar?profile=true&times=3

Note that this will change the status, body, and headers of the response (you'll get back the profiling data, NOT the original response).

You can also profile your application using multiple requests. When you profile using this method, all responses are normal. You must visit __stop__ to complete profiling and then you can view the profiling data by visiting __data__.

Example:

curl http://localhost:3000/__start__
curl http://localhost:3000/foobar
curl http://localhost:3000/foobaz
curl http://localhost:3000/__stop__
curl http://localhost:3000/__data__

Profiling Data Options

Regardless of how you profile your application, you can add additional params to change how the data is displayed. When using a single request, these params are just added to the URL being profiled. When using multiple requests, they are added to the __data__ URL.

  • printer - overrides the default_printer option (see above)
  • ignore - a regular expression of the area of code to ignore
  • focus - a regular expression of the area of code to solely focus on.

(for 'ignore' and 'focus', please see http://google-perftools.googlecode.com/svn/trunk/doc/cpuprofile.html#pprof for more details)

Profiling Modes

perftools.rb (and therefore, the Rack middleware) can be put into three different profiling modes.

  • CPU time mode - Reports how many CPU cycles are spent in each section of code. This is the default and can be enabled by setting :mode => :cputime
  • Method call mode - Report how many method calls are made inside each method. Enable by setting :mode => :methods
  • Object allocation mode - Reports the percentage of object allocations performed in each section of code. Enable by setting :mode => :objects
  • Wall time mode - Reports the amount of time (as in, wall clock time) spent in each section of code. Enable by setting :mode => :walltime

For example, consider the following Sinatra application:

require 'sinatra'
require 'rack/perftools_profiler'

configure do
  use ::Rack::PerftoolsProfiler, :default_printer => 'gif', :mode => :cputime
end

get "/slow" do
  sleep(3)
  "hello"
end

In the default mode, there will be no profiling data for the 'slow' route, because it uses few CPU cycles (You'll see the message 'No nodes to print').

If you change the mode to :walltime, you'll get profiling data, since the call to sleep causes the code to spend several seconds of wall time in the block.

Overriding the Profiling mode

You can also switch the profiling mode on a per-request basis, but ONLY if you are switching to 'methods' or 'objects' mode. Due to the implementation of perftools.rb, it is NOT possible to switch to 'walltime' or 'cputime' modes.

To switch to another mode, provide the 'mode' option. When profiling with a single request, add the option to the URL profiled:

curl http://localhost:3000/foobar?profile=true&mode=objects

When profiling using multiple requests, add the option when visiting __start__ :

curl http://localhost:3000/__start__?mode=objects

If the 'mode' option is omitted, the middleware will default to the mode specified at configuration.

Profiling in production

It is recommended that you always profile your application in the 'production' environment (using rails server -e production or an equivalent), since there can be important differences between 'development' and 'production' that may affect performance.

However, it is recommended that you profile your application on a development or staging machine rather than on a production machine. This is because profiling with multiple requests will not work if your app is running in multiple Ruby server processes.

Profiling a single request will work if there are multiple server processes. If your staging machine is publicly accessible, you can password-protect single-request profiling by using the :password option and then using the profile GET parameter to provide the password:

curl http://localhost:3000/foobar?profile=PASSWORD

Changing behavior with environment variables

The mode and frequency settings are enabled by setting environment variables. Some of these environment variables must be set before 'perftools' is required. If you only require 'rack/perftools_profiler', it will do the right thing (require 'perftools' after setting the environment variables).

If you need to require 'perftools' before 'rack/perftools_profiler' (or you have other problems changing the mode or frequency), try using these environment variables yourself.

Setting the frequency:

CPUPROFILE_FREQUENCY=500 ruby your_app.rb

Setting the mode to 'wall time'

CPUPROFILE_REALTIME=1 ruby your_app.rb

Setting the mode to 'object allocation'

CPUPROFILE_OBJECTS=1 ruby your_app.rb

Acknowledgments

A huge thanks to Aman Gupta for the awesome perftools.rb gem.

The basic idea and initial implementation of the middleware was heavily influenced by Rack::Profiler from rack-contrib.

Notes on bugs

This project depends on the awesome perftools.rb gem. Before submitting a bug, please determine if the bug is with perftools.rb or with this middleware. For instance, if you are having a problem with installation, make sure gem install perftools.rb works. If it does not, please submit a bug report here.

Note on Patches/Pull Requests

  • Fork the project.
  • Make your feature addition or bug fix.
  • Add tests for it. This is important so I don't break it in a future version unintentionally.
  • Commit, do not mess with rakefile, version, or history (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull).
  • Send me a pull request. Bonus points for topic branches.

Copyright

Copyright (c) 2010-2018 Ben Brinckerhoff. See LICENSE for details.

rack-perftools_profiler's People

Contributors

aleksi avatar amatsuda avatar bhb avatar conradirwin avatar jmoses avatar jodell avatar stormbrew avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rack-perftools_profiler's Issues

Broken on Ruby 2: Bump the perftools.rb dependency for fix

This gem does not work with Ruby 2.0 unless the gem's dependency on perftools.rb is bumped to 2.0.1 (which fixes issues with Ruby 2 compatibility). An alternative, which I am currently doing, is to make an explicit dependency on perftools.rb (2.0.1) in my Gemfile, but that is more of a workaround than anything.

Segment fault when trying to stop profiler by visiting /__stop__ on Rails 4.0.5 / Ruby 2.1.1

What I did:
Visit http://localhost:3000/__start__
Do some requests.
Then visit http://localhost:3000/__stop__

The server (started with rails s) crashes.

/me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rack-perftools_profiler-0.6.1/lib/rack/perftools_profiler/profiler.rb:89: [BUG] Segmentation fault at 0x00000000000000
ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-darwin12.0]

-- Crash Report log information --------------------------------------------
   See Crash Report log file under the one of following:
     * ~/Library/Logs/CrashReporter
     * /Library/Logs/CrashReporter
     * ~/Library/Logs/DiagnosticReports
     * /Library/Logs/DiagnosticReports
   for more details.

-- Control frame information -----------------------------------------------
c:0059 p:---- s:0301 e:000300 CFUNC  :stop
c:0058 p:0015 s:0298 e:000297 METHOD /me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rack-perftools_profiler-0.6.1/lib/rack/perftools_profiler/prof
c:0057 p:0009 s:0295 e:000294 METHOD /me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rack-perftools_profiler-0.6.1/lib/rack/perftools_profiler/stop
c:0056 p:0035 s:0292 e:000291 METHOD /me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rack-perftools_profiler-0.6.1/lib/rack/perftools_profiler/prof
c:0055 p:0011 s:0286 e:000285 BLOCK  /me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/warden-1.2.3/lib/warden/manager.rb:35 [FINISH]
c:0054 p:---- s:0284 e:000283 CFUNC  :catch
c:0053 p:0066 s:0280 e:000279 METHOD /me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/warden-1.2.3/lib/warden/manager.rb:34
c:0052 p:0011 s:0275 e:000274 METHOD /me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rack-1.5.2/lib/rack/etag.rb:23
c:0051 p:0050 s:0267 e:000266 METHOD /me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rack-1.5.2/lib/rack/conditionalget.rb:25
c:0050 p:0011 s:0260 e:000259 METHOD /me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rack-1.5.2/lib/rack/head.rb:11
c:0049 p:0034 s:0253 e:000252 METHOD /me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/actionpack-4.0.5/lib/action_dispatch/middleware/params_parser.
c:0048 p:0011 s:0248 e:000247 METHOD /me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/actionpack-4.0.5/lib/action_dispatch/middleware/flash.rb:241
c:0047 p:0023 s:0241 e:000240 METHOD /me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rack-1.5.2/lib/rack/session/abstract/id.rb:225
c:0046 p:0009 s:0233 e:000232 METHOD /me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rack-1.5.2/lib/rack/session/abstract/id.rb:220
c:0045 p:0011 s:0229 e:000228 METHOD /me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/actionpack-4.0.5/lib/action_dispatch/middleware/cookies.rb:486
c:0044 p:0059 s:0221 e:000220 METHOD /me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/activerecord-4.0.5/lib/active_record/query_cache.rb:36
c:0043 p:0021 s:0213 e:000212 METHOD /me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/activerecord-4.0.5/lib/active_record/connection_adapters/abstr
c:0042 p:0013 s:0207 e:000206 BLOCK  /me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/actionpack-4.0.5/lib/action_dispatch/middleware/callbacks.rb:2
c:0041 p:0036 s:0205 e:000204 METHOD /me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/activesupport-4.0.5/lib/active_support/callbacks.rb:373
c:0040 p:0023 s:0200 e:000199 METHOD /me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/activesupport-4.0.5/lib/active_support/callbacks.rb:80
c:0039 p:0014 s:0194 E:0015f0 METHOD /me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/actionpack-4.0.5/lib/action_dispatch/middleware/callbacks.rb:2
c:0038 p:0135 s:0188 e:000187 METHOD /me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rails-dev-tweaks-1.1.0/lib/rails_dev_tweaks/granular_autoload/
c:0037 p:0032 s:0183 e:000182 METHOD /me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/actionpack-4.0.5/lib/action_dispatch/middleware/remote_ip.rb:7
c:0036 p:0011 s:0179 e:000178 METHOD /me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/actionpack-4.0.5/lib/action_dispatch/middleware/debug_exceptio
c:0035 p:0011 s:0170 e:000169 METHOD /me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/actionpack-4.0.5/lib/action_dispatch/middleware/show_exception
c:0034 p:0081 s:0165 e:000164 METHOD /me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/railties-4.0.5/lib/rails/rack/logger.rb:38
c:0033 p:0011 s:0158 e:000157 BLOCK  /me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/railties-4.0.5/lib/rails/rack/logger.rb:20
c:0032 p:0007 s:0156 e:000155 BLOCK  /me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/activesupport-4.0.5/lib/active_support/tagged_logging.rb:68
c:0031 p:0016 s:0154 e:000153 METHOD /me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/activesupport-4.0.5/lib/active_support/tagged_logging.rb:26
c:0030 p:0011 s:0149 e:000148 METHOD /me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/activesupport-4.0.5/lib/active_support/tagged_logging.rb:68
c:0029 p:0042 s:0145 e:000144 METHOD /me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/railties-4.0.5/lib/rails/rack/logger.rb:20
c:0028 p:0032 s:0140 e:000139 METHOD /me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/actionpack-4.0.5/lib/action_dispatch/middleware/request_id.rb:
c:0027 p:0075 s:0136 e:000135 METHOD /me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rack-1.5.2/lib/rack/methodoverride.rb:21
c:0026 p:0024 s:0131 e:000130 METHOD /me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rack-1.5.2/lib/rack/runtime.rb:17
c:0025 p:0035 s:0122 e:000121 METHOD /me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/activesupport-4.0.5/lib/active_support/cache/strategy/local_ca
c:0024 p:0056 s:0118 e:000117 METHOD /me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rack-1.5.2/lib/rack/lock.rb:17
c:0023 p:0094 s:0111 e:000110 METHOD /me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/actionpack-4.0.5/lib/action_dispatch/middleware/static.rb:64
c:0022 p:0011 s:0105 e:000104 METHOD /me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rack-1.5.2/lib/rack/sendfile.rb:112
c:0021 p:0060 s:0095 e:000094 METHOD /me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/railties-4.0.5/lib/rails/engine.rb:511
c:0020 p:0039 s:0091 e:000090 METHOD /me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/railties-4.0.5/lib/rails/application.rb:97
c:0019 p:0011 s:0087 e:000086 METHOD /me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rack-1.5.2/lib/rack/content_length.rb:14
c:0018 p:0014 s:0078 e:000077 BLOCK  /me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/thin-1.6.2/lib/thin/connection.rb:86 [FINISH]
c:0017 p:---- s:0076 e:000075 CFUNC  :catch
c:0016 p:0091 s:0072 e:000071 METHOD /me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/thin-1.6.2/lib/thin/connection.rb:84
c:0015 p:0060 s:0066 e:000064 METHOD /me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/thin-1.6.2/lib/thin/connection.rb:53
c:0014 p:0033 s:0062 e:000061 METHOD /me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/thin-1.6.2/lib/thin/connection.rb:39 [FINISH]
c:0013 p:---- s:0057 e:000056 CFUNC  :run_machine
c:0012 p:0267 s:0054 e:000053 METHOD /me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/eventmachine-1.0.3/lib/eventmachine.rb:187
c:0011 p:0059 s:0047 E:000cf0 METHOD /me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/thin-1.6.2/lib/thin/backends/base.rb:73
c:0010 p:0111 s:0043 E:000aa8 METHOD /me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/thin-1.6.2/lib/thin/server.rb:162
c:0009 p:0136 s:0040 e:000039 METHOD /me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rack-1.5.2/lib/rack/handler/thin.rb:16
c:0008 p:0194 s:0031 E:000080 METHOD /me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rack-1.5.2/lib/rack/server.rb:264
c:0007 p:0257 s:0025 E:0001f8 METHOD /me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/railties-4.0.5/lib/rails/commands/server.rb:84
c:0006 p:0044 s:0020 e:000019 BLOCK  /me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/railties-4.0.5/lib/rails/commands.rb:76 [FINISH]
c:0005 p:---- s:0017 e:000016 CFUNC  :tap
c:0004 p:0562 s:0014 e:000013 TOP    /me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/railties-4.0.5/lib/rails/commands.rb:71 [FINISH]
c:0003 p:---- s:0008 e:000007 CFUNC  :require
c:0002 p:0045 s:0004 E:0005d8 EVAL   script/rails:6 [FINISH]
c:0001 p:0000 s:0002 E:000068 TOP    [FINISH]

script/rails:6:in `<main>'
script/rails:6:in `require'
/me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/railties-4.0.5/lib/rails/commands.rb:71:in `<top (required)>'
/me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/railties-4.0.5/lib/rails/commands.rb:71:in `tap'
/me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/railties-4.0.5/lib/rails/commands.rb:76:in `block in <top (required)>'
/me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/railties-4.0.5/lib/rails/commands/server.rb:84:in `start'
/me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rack-1.5.2/lib/rack/server.rb:264:in `start'
/me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rack-1.5.2/lib/rack/handler/thin.rb:16:in `run'
/me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/thin-1.6.2/lib/thin/server.rb:162:in `start'
/me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/thin-1.6.2/lib/thin/backends/base.rb:73:in `start'
/me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:in `run'
/me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:in `run_machine'
/me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/thin-1.6.2/lib/thin/connection.rb:39:in `receive_data'
/me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/thin-1.6.2/lib/thin/connection.rb:53:in `process'
/me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/thin-1.6.2/lib/thin/connection.rb:84:in `pre_process'
/me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/thin-1.6.2/lib/thin/connection.rb:84:in `catch'
/me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/thin-1.6.2/lib/thin/connection.rb:86:in `block in pre_process'
/me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rack-1.5.2/lib/rack/content_length.rb:14:in `call'
/me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/railties-4.0.5/lib/rails/application.rb:97:in `call'
/me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/railties-4.0.5/lib/rails/engine.rb:511:in `call'
/me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rack-1.5.2/lib/rack/sendfile.rb:112:in `call'
/me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/actionpack-4.0.5/lib/action_dispatch/middleware/static.rb:64:in `call'
/me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rack-1.5.2/lib/rack/lock.rb:17:in `call'
/me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/activesupport-4.0.5/lib/active_support/cache/strategy/local_cache.rb:83:in `call'
/me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rack-1.5.2/lib/rack/runtime.rb:17:in `call'
/me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rack-1.5.2/lib/rack/methodoverride.rb:21:in `call'
/me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/actionpack-4.0.5/lib/action_dispatch/middleware/request_id.rb:21:in `call'
/me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/railties-4.0.5/lib/rails/rack/logger.rb:20:in `call'
/me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/activesupport-4.0.5/lib/active_support/tagged_logging.rb:68:in `tagged'
/me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/activesupport-4.0.5/lib/active_support/tagged_logging.rb:26:in `tagged'
/me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/activesupport-4.0.5/lib/active_support/tagged_logging.rb:68:in `block in tagged'
/me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/railties-4.0.5/lib/rails/rack/logger.rb:20:in `block in call'
/me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/railties-4.0.5/lib/rails/rack/logger.rb:38:in `call_app'
/me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/actionpack-4.0.5/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
/me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/actionpack-4.0.5/lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
/me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/actionpack-4.0.5/lib/action_dispatch/middleware/remote_ip.rb:76:in `call'
/me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rails-dev-tweaks-1.1.0/lib/rails_dev_tweaks/granular_autoload/middleware.rb:34:in `call'
/me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/actionpack-4.0.5/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
/me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/activesupport-4.0.5/lib/active_support/callbacks.rb:80:in `run_callbacks'
/me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/activesupport-4.0.5/lib/active_support/callbacks.rb:373:in `_run__616644286970088589__call__callbacks'
/me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/actionpack-4.0.5/lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
/me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/activerecord-4.0.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:626:in `call'
/me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/activerecord-4.0.5/lib/active_record/query_cache.rb:36:in `call'
/me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/actionpack-4.0.5/lib/action_dispatch/middleware/cookies.rb:486:in `call'
/me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rack-1.5.2/lib/rack/session/abstract/id.rb:220:in `call'
/me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rack-1.5.2/lib/rack/session/abstract/id.rb:225:in `context'
/me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/actionpack-4.0.5/lib/action_dispatch/middleware/flash.rb:241:in `call'
/me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/actionpack-4.0.5/lib/action_dispatch/middleware/params_parser.rb:27:in `call'
/me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rack-1.5.2/lib/rack/head.rb:11:in `call'
/me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rack-1.5.2/lib/rack/conditionalget.rb:25:in `call'
/me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rack-1.5.2/lib/rack/etag.rb:23:in `call'
/me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/warden-1.2.3/lib/warden/manager.rb:34:in `call'
/me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/warden-1.2.3/lib/warden/manager.rb:34:in `catch'
/me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/warden-1.2.3/lib/warden/manager.rb:35:in `block in call'
/me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rack-perftools_profiler-0.6.1/lib/rack/perftools_profiler/profiler_middleware.rb:28:in `call'
/me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rack-perftools_profiler-0.6.1/lib/rack/perftools_profiler/stop_profiling.rb:6:in `act'
/me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rack-perftools_profiler-0.6.1/lib/rack/perftools_profiler/profiler.rb:89:in `stop'
/me/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rack-perftools_profiler-0.6.1/lib/rack/perftools_profiler/profiler.rb:89:in `stop'

-- C level backtrace information -------------------------------------------
0   ruby                                0x000000010e41295d rb_vm_bugreport + 141
1   ruby                                0x000000010e2dd6fd report_bug + 285
2   ruby                                0x000000010e2dd5d3 rb_bug + 179
3   ruby                                0x000000010e39be89 sigsegv + 153
4   libsystem_platform.dylib            0x00007fff941e05aa _sigtramp + 26
5   ruby                                0x000000010e335bc4 rb_class_real + 52
6   ???                                 0x00007fff51952d10 0x0 + 140734562118928

-- Other runtime information -----------------------------------------------

* Loaded script: script/rails

* Loaded features:

    0 enumerator.so
    1 /me/.rbenv/versions/2.1.1/lib/ruby/2.1.0/x86_64-darwin12.0/enc/encdb.bundle
    2 /me/.rbenv/versions/2.1.1/lib/ruby/2.1.0/x86_64-darwin12.0/enc/trans/transdb.bundle
    3 /me/.rbenv/versions/2.1.1/lib/ruby/2.1.0/x86_64-darwin12.0/rbconfig.rb
    4 /me/.rbenv/versions/2.1.1/lib/ruby/2.1.0/rubygems/compatibility.rb
    5 /me/.rbenv/versions/2.1.1/lib/ruby/2.1.0/rubygems/defaults.rb
    6 /me/.rbenv/versions/2.1.1/lib/ruby/2.1.0/rubygems/deprecate.rb
    7 /me/.rbenv/versions/2.1.1/lib/ruby/2.1.0/rubygems/errors.rb
    8 /me/.rbenv/versions/2.1.1/lib/ruby/2.1.0/rubygems/version.rb
    9 /me/.rbenv/versions/2.1.1/lib/ruby/2.1.0/rubygems/requirement.rb

Symbol not found: _ruby_current_thread

Running into an error on running the server.

bundle install seemed to work fine with Rails 3.1.x and Ruby 1.9.3-p0 with rvm 1.9.2. I did run the gem install perftools.rb -v '0.5.6'prior to bundling.

The error is as follows:

dlopen(/Users/username/.rvm/gems/ruby-1.9.3-p0@default/gems/perftools.rb-0.5.6/lib/perftools.bundle, 9): Symbol not found: _ruby_current_thread
Referenced from: /Users/username/.rvm/gems/ruby-1.9.3-p0@default/gems/perftools.rb-0.5.6/lib/perftools.bundle
Expected in: flat namespace
in /Users/username/.rvm/gems/ruby-1.9.3-p0@default/gems/perftools.rb-0.5.6/lib/perftools.bundle - /Users/username/.rvm/gems/ruby-1.9.3-p0@default/gems/perftools.rb-0.5.6/lib/perftools.bundle
/Users/username/.rvm/gems/ruby-1.9.3-p0@default/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in require' /Users/username/.rvm/gems/ruby-1.9.3-p0@default/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:inblock in require'
/Users/username/.rvm/gems/ruby-1.9.3-p0@default/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:in block in load_dependency' /Users/username/.rvm/gems/ruby-1.9.3-p0@default/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:640:innew_constants_in'
/Users/username/.rvm/gems/ruby-1.9.3-p0@default/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:in load_dependency' /Users/username/.rvm/gems/ruby-1.9.3-p0@default/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:inrequire'
/Users/username/.rvm/gems/ruby-1.9.3-p0@default/gems/rack-perftools_profiler-0.5.1/lib/rack/perftools_profiler/profiler.rb:43:in initialize' /Users/username/.rvm/gems/ruby-1.9.3-p0@default/gems/rack-perftools_profiler-0.5.1/lib/rack/perftools_profiler/profiler_middleware.rb:20:innew'
/Users/username/.rvm/gems/ruby-1.9.3-p0@default/gems/rack-perftools_profiler-0.5.1/lib/rack/perftools_profiler/profiler_middleware.rb:20:in initialize' /Users/username/.rvm/gems/ruby-1.9.3-p0@default/gems/rack-perftools_profiler-0.5.1/lib/rack/perftools_profiler.rb:20:innew'
/Users/username/.rvm/gems/ruby-1.9.3-p0@default/gems/rack-perftools_profiler-0.5.1/lib/rack/perftools_profiler.rb:20:in new' /Users/username/.rvm/gems/ruby-1.9.3-p0@default/gems/actionpack-3.1.3/lib/action_dispatch/middleware/stack.rb:43:inbuild'
/Users/username/.rvm/gems/ruby-1.9.3-p0@default/gems/actionpack-3.1.3/lib/action_dispatch/middleware/stack.rb:112:in block in build' /Users/username/.rvm/gems/ruby-1.9.3-p0@default/gems/actionpack-3.1.3/lib/action_dispatch/middleware/stack.rb:112:ineach'
/Users/username/.rvm/gems/ruby-1.9.3-p0@default/gems/actionpack-3.1.3/lib/action_dispatch/middleware/stack.rb:112:in inject' /Users/username/.rvm/gems/ruby-1.9.3-p0@default/gems/actionpack-3.1.3/lib/action_dispatch/middleware/stack.rb:112:inbuild'
/Users/username/.rvm/gems/ruby-1.9.3-p0@default/gems/railties-3.1.3/lib/rails/engine.rb:447:in app' /Users/username/.rvm/gems/ruby-1.9.3-p0@default/gems/railties-3.1.3/lib/rails/application/finisher.rb:37:inblock in module:Finisher'
/Users/username/.rvm/gems/ruby-1.9.3-p0@default/gems/railties-3.1.3/lib/rails/initializable.rb:30:in instance_exec' /Users/username/.rvm/gems/ruby-1.9.3-p0@default/gems/railties-3.1.3/lib/rails/initializable.rb:30:inrun'
/Users/username/.rvm/gems/ruby-1.9.3-p0@default/gems/railties-3.1.3/lib/rails/initializable.rb:55:in block in run_initializers' /Users/username/.rvm/gems/ruby-1.9.3-p0@default/gems/railties-3.1.3/lib/rails/initializable.rb:54:ineach'
/Users/username/.rvm/gems/ruby-1.9.3-p0@default/gems/railties-3.1.3/lib/rails/initializable.rb:54:in run_initializers' /Users/username/.rvm/gems/ruby-1.9.3-p0@default/gems/railties-3.1.3/lib/rails/application.rb:96:ininitialize!'
/Users/username/.rvm/gems/ruby-1.9.3-p0@default/gems/railties-3.1.3/lib/rails/railtie/configurable.rb:30:in method_missing' /Volumes/Users/username/Documents/Development/ruby/rails/AppName/config/environment.rb:5:in<top (required)>'
/Users/username/.rvm/gems/ruby-1.9.3-p0@default/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in require' /Users/username/.rvm/gems/ruby-1.9.3-p0@default/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:inblock in require'
/Users/username/.rvm/gems/ruby-1.9.3-p0@default/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:in block in load_dependency' /Users/username/.rvm/gems/ruby-1.9.3-p0@default/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:640:innew_constants_in'
/Users/username/.rvm/gems/ruby-1.9.3-p0@default/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:in load_dependency' /Users/username/.rvm/gems/ruby-1.9.3-p0@default/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:inrequire'
/Users/username/.rvm/gems/ruby-1.9.3-p0@default/gems/railties-3.1.3/lib/rails/application.rb:83:in require_environment!' /Users/username/.rvm/gems/ruby-1.9.3-p0@default/gems/railties-3.1.3/lib/rails/application.rb:193:inblock (2 levels) in initialize_tasks'
/Users/username/.rvm/gems/ruby-1.9.3-p0@default/gems/rake-0.9.2.2/lib/rake/task.rb:205:in call' /Users/username/.rvm/gems/ruby-1.9.3-p0@default/gems/rake-0.9.2.2/lib/rake/task.rb:205:inblock in execute'
/Users/username/.rvm/gems/ruby-1.9.3-p0@default/gems/rake-0.9.2.2/lib/rake/task.rb:200:in each' /Users/username/.rvm/gems/ruby-1.9.3-p0@default/gems/rake-0.9.2.2/lib/rake/task.rb:200:inexecute'
/Users/username/.rvm/gems/ruby-1.9.3-p0@default/gems/rake-0.9.2.2/lib/rake/task.rb:158:in block in invoke_with_call_chain' /Users/username/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/monitor.rb:211:inmon_synchronize'
/Users/username/.rvm/gems/ruby-1.9.3-p0@default/gems/rake-0.9.2.2/lib/rake/task.rb:151:in invoke_with_call_chain' /Users/username/.rvm/gems/ruby-1.9.3-p0@default/gems/rake-0.9.2.2/lib/rake/task.rb:176:inblock in invoke_prerequisites'
/Users/username/.rvm/gems/ruby-1.9.3-p0@default/gems/rake-0.9.2.2/lib/rake/task.rb:174:in each' /Users/username/.rvm/gems/ruby-1.9.3-p0@default/gems/rake-0.9.2.2/lib/rake/task.rb:174:ininvoke_prerequisites'
/Users/username/.rvm/gems/ruby-1.9.3-p0@default/gems/rake-0.9.2.2/lib/rake/task.rb:157:in block in invoke_with_call_chain' /Users/username/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/monitor.rb:211:inmon_synchronize'
/Users/username/.rvm/gems/ruby-1.9.3-p0@default/gems/rake-0.9.2.2/lib/rake/task.rb:151:in invoke_with_call_chain' /Users/username/.rvm/gems/ruby-1.9.3-p0@default/gems/rake-0.9.2.2/lib/rake/task.rb:144:ininvoke'
/Users/username/.rvm/gems/ruby-1.9.3-p0@default/gems/rake-0.9.2.2/lib/rake/application.rb:116:in invoke_task' /Users/username/.rvm/gems/ruby-1.9.3-p0@default/gems/rake-0.9.2.2/lib/rake/application.rb:94:inblock (2 levels) in top_level'
/Users/username/.rvm/gems/ruby-1.9.3-p0@default/gems/rake-0.9.2.2/lib/rake/application.rb:94:in each' /Users/username/.rvm/gems/ruby-1.9.3-p0@default/gems/rake-0.9.2.2/lib/rake/application.rb:94:inblock in top_level'
/Users/username/.rvm/gems/ruby-1.9.3-p0@default/gems/rake-0.9.2.2/lib/rake/application.rb:133:in standard_exception_handling' /Users/username/.rvm/gems/ruby-1.9.3-p0@default/gems/rake-0.9.2.2/lib/rake/application.rb:88:intop_level'
/Users/username/.rvm/gems/ruby-1.9.3-p0@default/gems/rake-0.9.2.2/lib/rake/application.rb:66:in block in run' /Users/username/.rvm/gems/ruby-1.9.3-p0@default/gems/rake-0.9.2.2/lib/rake/application.rb:133:instandard_exception_handling'
/Users/username/.rvm/gems/ruby-1.9.3-p0@default/gems/rake-0.9.2.2/lib/rake/application.rb:63:in run' /Users/username/.rvm/gems/ruby-1.9.3-p0@default/gems/rake-0.9.2.2/bin/rake:33:in<top (required)>'
/Users/username/.rvm/gems/ruby-1.9.3-p0@default/bin/rake:19:in load' /Users/username/.rvm/gems/ruby-1.9.3-p0@default/bin/rake:19:in

'

Update perftools.rb dependency to allow 2.0.0

Currently, rack-perftools_profiler.gemspec has a dependency of ~> 0.5.6 for perftools.rb. But that version doesn’t work with Ruby 1.9.3. perftools version 2.0.0 does work with 1.9.3 and also seems to work fine with rack-perftools_profiler.

Would you mind updating the dependency to allow using perftools.rb 2.0.0?

Thanks,
Chris

Can't get a minimal Sinatra example working

As a perftools newbie I'm running into problems trying to get it running with my Sinatra application. I've created a minimal 'hello world' app that illustrates my problem:
https://github.com/petewarden/sinatraperftoolsexample

I did my best to follow the directions in the documentation, but I'm betting there's just a step that I'm missing. In more detail, here's what I'm doing:

  1. Installing the perftools gem using this in my Gemfile and running bundle install:
    gem "rack-perftools_profiler"

  2. Including the file in my application:
    require 'rack/perftools_profiler'

  3. Also including a configuration block:
    configure :profiling do
    use ::Rack::PerftoolsProfiler, :default_printer => 'gif'
    end

  4. Launch the application using rackup and visit http://localhost:9292/?profile=true

From my reading of the documentation, I would expect to see a gif displayed in the result showing profile information, but instead I see exactly the same page that appears without the profile argument.

What am I doing wrong? Any help much appreciated, I'm itching to use the framework.


ruby -v
ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin10]

uname -v
Darwin Kernel Version 10.8.0: Tue Jun 7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386

Gemfile.lock
GEM
remote: http://rubygems.org/
specs:
open4 (1.1.0)
perftools.rb (0.5.6)
rack (1.3.2)
rack-perftools_profiler (0.5.0)
open4 (> 1.0)
perftools.rb (
> 0.5.6)
rack (> 1.0)
sinatra (1.2.6)
rack (
> 1.1)
tilt (< 2.0, >= 1.2.2)
tilt (1.3.2)

Segmentation fault when using :mode => :objects

I use Rails 3.1.0 on ruby version:

ruby 1.8.7 (2011-02-18 patchlevel 334) [x86_64-linux], MBARI 0x6770, Ruby Enterprise Edition 2011.03

in application.rb:

config.middleware.use ::Rack::PerftoolsProfiler, :default_printer => 'gif', :bundler => true, :mode => :objects

Traceback:

$ script/rails server -p8888
=> Booting Mongrel
=> Rails 3.1.0 application starting in development on http://0.0.0.0:8888
=> Call with -d to detach
=> Ctrl-C to shutdown server 

Then I make request http://localhost:8888/?profile=true&times=3 and console show:

Segmentation fault

Enabling/disabling GC manually causes rack-perftools_profiler to hang

So I'm profiling a Rails 3.2 app on Ruby 1.9.3 which has the following filter in ApplicationController to reduce the frequency of GC runs:

@@last_gc_run = Time.now
around_filter do |c, &action|
  GC.disable
  rv = action.call()
  if Time.now - @@last_gc_run > 1.0
    GC.enable
    GC.start
    @@last_gc_run = Time.now
  end
  rv
end

Ordinarily, this makes things about 30% faster. If I hit http://mysite/controller/action, it runs as expected, only taking a few seconds... but if I hit http://mysite/controller/action?profile=1, it causes the Ruby process to spin up to 100% CPU usage and run forever. Doesn't respond to signals, needs to be SIGKILLed. Removing this around_filter makes ?profile=1 requests work normally again.

My configuration is { :default_printer => :text, :mode => :walltime }, although the bug seems to occur no matter which printer I use.

Perl errors when trying to use tool, Mac OS Yosemite and Ruby 2.0.0-p247

I can start the profiler via the start URL and then run requests fine, then stop it. But when I try to view the data URL, I get Perl errors:

Running the command 'bundle exec pprof.rb --gif /private/var/folders/xd/k4cggzwd3gg9by03qt2mcl5jnp8jjx/T/rack_perftools_profiler.prof' exited with status 1
Using local file /Users/noah.gibbs/.rvm/rubies/ruby-2.0.0-p247/bin/ruby.
Using local file /private/var/folders/xd/k4cggzwd3gg9by03qt2mcl5jnp8jjx/T/rack_perftools_profiler.prof.
substr outside of string at /Users/noah.gibbs/.rvm/gems/ruby-2.0.0-p247/gems/perftools.rb-2.0.1/bin/pprof line 3543.
Use of uninitialized value in string eq at /Users/noah.gibbs/.rvm/gems/ruby-2.0.0-p247/gems/perftools.rb-2.0.1/bin/pprof line 3543.
substr outside of string at /Users/noah.gibbs/.rvm/gems/ruby-2.0.0-p247/gems/perftools.rb-2.0.1/bin/pprof line 3545.
Use of uninitialized value in string eq at /Users/noah.gibbs/.rvm/gems/ruby-2.0.0-p247/gems/perftools.rb-2.0.1/bin/pprof line 3545.
/private/var/folders/xd/k4cggzwd3gg9by03qt2mcl5jnp8jjx/T/rack_perftools_profiler.prof: header size >= 2**16

Installation fails for ruby 2.1

Installation for ruby 2.1.0-preview1 fails. This is the error message:

killa@ubuntu:~/workspace/one_flexo$ gem install rack-perftools_profiler
Building native extensions. This could take a while...
ERROR: Error installing rack-perftools_profiler:
ERROR: Failed to build gem native extension.

/home/killa/.rvm/rubies/ruby-2.1.0-preview1/bin/ruby extconf.rb

(I'm about to compile google-perftools.. this will definitely take a while)
-- tar zpxvf gperftools-2.0.tar.gz
-- patch -p1 < ../../../patches/perftools.patch
-- patch -p1 < ../../../patches/perftools-notests.patch
-- patch -p1 < ../../../patches/perftools-pprof.patch
-- patch -p1 < ../../../patches/perftools-gc.patch
-- patch -p1 < ../../../patches/perftools-debug.patch
-- patch -p1 < ../../../patches/perftools-objects.patch
-- patch -p1 < ../../../patches/perftools-frames.patch
-- patch -p1 < ../../../patches/perftools-realtime.patch
-- patch -p1 < ../../../patches/perftools-pause.patch
-- sed -i -e 's,SpinLock,ISpinLock,g' src/.cc src/.h src/base/.cc src/base/.h
-- ./configure --disable-heap-profiler --disable-heap-checker --disable-debugalloc --disable-shared
-- make
checking for method.h... no
checking for vm_core.h... no
Makefile creation failed


No source for ruby-2.1.0 (revision 43011) provided with debugger-ruby_core_source gem.


*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.

Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/home/killa/.rvm/rubies/ruby-2.1.0-preview1/bin/ruby

Gem files will remain installed in /home/killa/.rvm/gems/ruby-2.1.0-preview1/gems/perftools.rb-2.0.1 for inspection.
Results logged to /home/killa/.rvm/gems/ruby-2.1.0-preview1/gems/perftools.rb-2.0.1/ext/gem_make.out

I'll be happy to provide any other informations if needed.

Install fails on Windows due to missing tar command

It even fails after installing Cygwin which includes tar.

From mkmf.log: "tar zpxvf gperftools-2.0.tar.gz"

From gem_make.out:

C:/.../Ruby192/bin/ruby.exe extconf.rb 
(I'm about to compile google-perftools.. this will definitely take a while)
  -- tar zpxvf gperftools-2.0.tar.gz
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=C:/.../Ruby192/bin/ruby
extconf.rb:6:in `sys': tar zpxvf gperftools-2.0.tar.gz failed, please report to https://github.com/tmm1/perfools.rb/issues/new with C:/.../Ruby192/lib/ruby/gems/1.9.1/gems/perftools.rb-2.0.0/ext/src/mkmf.log and C:/.../Ruby192/lib/ruby/gems/1.9.1/gems/perftools.rb-2.0.0/ext/src/gperftools-2.0/config.log (RuntimeError)
    from extconf.rb:39:in `block in <main>'
    from extconf.rb:36:in `chdir'
    from extconf.rb:36:in `<main>'

Choose profiling mode based on URL parameter

I'd like the ability to choose profiling mode by providing a parameter to the __start__ URL or to a one-off run using profile=true. This would override what is set where I add the middleware to my chain. What are your thoughts on this feature?

no ps2pdf package for Ubuntu, should use ghostscript

The package "ps2pdf" does not exist in my Ubuntu or Linux Mint repositories (11.10 and 13 respectively). I believe the package you need for Ubuntu is the same as the other systems: ghostscript

If this is the case, the command in the README should be: sudo apt-get install ghostscript

quickstart instructions don't work, need 'gem install perftools.rb'

On latest rails, I needed to run this to make everything work:

gem install perftools.rb

Until doing this I received the below stacktrace. I recommend telling people to add this to their Gemfiles in the quickstart instructions, this isn't self-evident to people unfamiliar with this project, nor is the below error very clear

PROFILE: interrupts/evictions/bytes = 85/0/32528
Running the command 'bundle exec pprof.rb --gif /private/var/folders/1n/m5whr5kx649c6r8zs65s92gr0000gn/T/rack_perftools_profiler.prof' exited with status 1
/Users/evan/.rvm/gems/ruby-1.9.3-p194/gems/perftools.rb-2.0.0/bin/pprof.rb:3:in `exec': No such file or directory - /Users/evan/.rvm/gems/ruby-1.9.3-p194/gems/perftools.rb-2.0.0/bin/pprof (Errno::ENOENT)
    from /Users/evan/.rvm/gems/ruby-1.9.3-p194/gems/perftools.rb-2.0.0/bin/pprof.rb:3:in `<top (required)>'
    from /Users/evan/.rvm/gems/ruby-1.9.3-p194/bin/pprof.rb:19:in `load'
    from /Users/evan/.rvm/gems/ruby-1.9.3-p194/bin/pprof.rb:19:in `<main>'
    from /Users/evan/.rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `eval'
    from /Users/evan/.rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `<main>'

routes problem with devise default setup

Hi, when I have a

config.middleware.use ::Rack::PerftoolsProfiler, :default_printer => 'pdf', :bundler => true

and a

devise_for :users

in the routes.rb file, I get a

Could not find devise mapping for path "/users/sign_in"

error (Rails307, ruby192p180, devise134, rack-perftools_profiler 0.4.1)

I tried to change the middleware order with no luck and would be thankful for any hints.
--Frank

Unable to get useful profiling data

Hi,

Apologies for opening an issue on what may be an implementation question, but I'm unable to get useful profiling data, and the Googling doesn't turn up any useful information. Regardless of how high I set the sampling rate (currently 300) or how many times I rerun the operation using the times parameter (10, 20, higher tends to not send back a response to the browser) the generated PDF always says there's just one sample, and unsurprisingly (given only one sample) usually doesn't have any useful information on what calls were made. It's mostly just the chain of Rack middleware, ending in something like IO#read or Time#new, which takes up 100% of the one sample. Even when it shows a number of code paths being executed, the sample size never increases, which makes it hard to figure out where to optimize.

Have seen anything like this had any experience with this? Is it just that the method is too fast (though in that case, should times=20 still produce data)? Unfortunately the project isn't public so I can't link to the code, but I'd be happy to provide whatever other information I can. The app is running locally in production mode, and the middleware is set up simply as config.middleware.use ::Rack::PerftoolsProfiler, { :default_printer => 'pdf', :bundler => true}, my call parameters are ?profile=true&times=20.

Any help would be most appreciated.

Thanks!

Alex

?profile=true causes error when using mode: objects

Adding ?profile=true to my url following the instructions i get this:

PROFILE: interrupts/evictions/bytes = 0/0/64
Running the command 'bundle exec pprof.rb --gif /private/var/folders/7h/y502phtj2b1g8cjs0c173hrw0000gn/T/rack_perftools_profiler.prof' exited with status 1
Using local file /Users/nico/.rvm/rubies/ruby-2.0.0-p247/bin/ruby.
Using local file /private/var/folders/7h/y502phtj2b1g8cjs0c173hrw0000gn/T/rack_perftools_profiler.prof.
No nodes to print

Objects mode not collecting data?

Howdy, I get a beautiful graph when in cputime mode, but the following error in objects mode:

Running the command 'bundle exec pprof.rb --gif /tmp/rack_perftools_profiler.prof' exited with status 1

Standard error:
Using local file /home/micah/.rvm/rubies/ree-1.8.7-2011.03/bin/ruby.
Using local file /tmp/rack_perftools_profiler.prof.
No nodes to print

Looking at /tmp/rack_perftools_profiler.prof, it does seem light: https://gist.github.com/2374901

For context, I'm running this in a Rails 3.1 app on REE-1.8.7-2011.03, on an action that takes over 15 seconds to complete, where the cputime graph shows ~80% time being spent in GC.

Any ideas?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.