Skip to content
This repository has been archived by the owner on Dec 5, 2023. It is now read-only.

Commit

Permalink
Updated README to include info on 'methods' mode
Browse files Browse the repository at this point in the history
  • Loading branch information
bhb committed Jan 17, 2011
1 parent 92f750a commit afe7b3c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions README.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ For Rack::Builder, call 'use' inside the Builder constructor block
== Options

* :default_printer - can be set to 'text', 'gif', or 'pdf'. Default is :text
* :mode - can be set to 'cputime', 'objects', 'walltime'. Default is :cputime. See the 'Profiling Modes' section below.
* :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.
Expand Down Expand Up @@ -103,8 +103,9 @@ for more details)
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'
* Wall time mode - Reports the amount of time (as in, wall clock time) spent in each section of code. Enable by setting ':mode => :walltime'
* 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:

Expand All @@ -126,9 +127,9 @@ If you change the mode to ':walltime', you'll get profiling data, since the call

== Overriding the Profiling mode

You can also switch the profiling mode on a per-request basis, but ONLY if you are switching to 'object' mode. Due to the implementation of perftools.rb, it is NOT possible to switch to 'walltime' or 'cputime' modes.
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 'object' mode, provide the 'mode' option. When profiling with a single request, add the option to the URL profiled:
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

Expand Down

0 comments on commit afe7b3c

Please sign in to comment.