Permalink
Browse files

Show off different ways of using the profiler

  • Loading branch information...
1 parent 6d39b78 commit b2069f7bdcca3975fc7805beeb0242eff60c1c8b @tmm1 committed May 30, 2009
Showing with 16 additions and 3 deletions.
  1. +16 −3 README
View
19 README
@@ -3,10 +3,23 @@ google-perftools for ruby code
=== Usage
- require 'perftools'
- PerfTools::CpuProfiler.start("/tmp/add_numbers_profile") do
+ Run the profiler with a block:
+
+ require 'perftools'
+ PerfTools::CpuProfiler.start("/tmp/add_numbers_profile") do
+ 5_000_000.times{ 1+2+3+4+5 }
+ end
+
+ Start and stop the profiler manually:
+
+ require 'perftools'
+ PerfTools::CpuProfiler.start("/tmp/add_numbers_profile")
5_000_000.times{ 1+2+3+4+5 }
- end
+ PerfTools::CpuProfiler.stop
+
+ Profile an existing ruby application without modifying it:
+
+ $ CPUPROFILE=/tmp/my_app_profile ruby -r/path/to/perftools.{bundle,so} my_app.rb
=== Reporting

0 comments on commit b2069f7

Please sign in to comment.