[DRE-commits] [ruby-prof] 04/14: Imported Upstream version 0.13.1

Jonas Genannt jonas at brachium-system.net
Thu Dec 19 19:42:23 UTC 2013


This is an automated email from the git hooks/post-receive script.

hggh-guest pushed a commit to branch master
in repository ruby-prof.

commit 5503827ad4827dead153745742292f480ec95c77
Author: Jonas Genannt <jonas at brachium-system.net>
Date:   Thu Dec 19 18:32:33 2013 +0100

    Imported Upstream version 0.13.1
---
 CHANGES                                            |  197 ++-
 LICENSE                                            |    7 +-
 README => README.rdoc                              |  357 +++--
 Rakefile                                           |  147 +-
 bin/ruby-prof                                      |  456 ++++--
 checksums.yaml.gz                                  |  Bin 0 -> 267 bytes
 doc/LICENSE.html                                   |  155 ++
 doc/README_rdoc.html                               |  648 ++++++++
 doc/Rack.html                                      |  167 ++
 doc/Rack/RubyProf.html                             |  319 ++++
 doc/RubyProf.html                                  | 1000 ++++++++++++
 doc/RubyProf/AbstractPrinter.html                  |  580 +++++++
 doc/RubyProf/AggregateCallInfo.html                |  570 +++++++
 doc/RubyProf/CallInfo.html                         |  512 ++++++
 doc/RubyProf/CallInfoPrinter.html                  |  190 +++
 doc/RubyProf/CallInfoVisitor.html                  |  332 ++++
 doc/RubyProf/CallStackPrinter.html                 | 1600 +++++++++++++++++++
 doc/RubyProf/CallTreePrinter.html                  |  413 +++++
 doc/RubyProf/Cmd.html                              |  669 ++++++++
 doc/RubyProf/DotPrinter.html                       |  312 ++++
 doc/RubyProf/FlatPrinter.html                      |  229 +++
 doc/RubyProf/FlatPrinterWithLineNumbers.html       |  267 ++++
 doc/RubyProf/GraphHtmlPrinter.html                 |  630 ++++++++
 doc/RubyProf/GraphPrinter.html                     |  209 +++
 doc/RubyProf/MethodInfo.html                       |  713 +++++++++
 doc/RubyProf/MultiPrinter.html                     |  407 +++++
 doc/RubyProf/Profile.html                          |  821 ++++++++++
 doc/RubyProf/ProfileTask.html                      |  532 +++++++
 doc/RubyProf/Test.html                             |  578 +++++++
 doc/RubyProf/Thread.html                           |  262 +++
 doc/created.rid                                    |   32 +
 doc/examples/flat_txt.html                         |  191 +++
 doc/examples/graph_txt.html                        |  305 ++++
 doc/images/add.png                                 |  Bin 0 -> 733 bytes
 doc/images/brick.png                               |  Bin 0 -> 452 bytes
 doc/images/brick_link.png                          |  Bin 0 -> 764 bytes
 doc/images/bug.png                                 |  Bin 0 -> 774 bytes
 doc/images/bullet_black.png                        |  Bin 0 -> 211 bytes
 doc/images/bullet_toggle_minus.png                 |  Bin 0 -> 207 bytes
 doc/images/bullet_toggle_plus.png                  |  Bin 0 -> 209 bytes
 doc/images/date.png                                |  Bin 0 -> 626 bytes
 doc/images/delete.png                              |  Bin 0 -> 715 bytes
 doc/images/find.png                                |  Bin 0 -> 659 bytes
 doc/images/loadingAnimation.gif                    |  Bin 0 -> 5886 bytes
 doc/images/macFFBgHack.png                         |  Bin 0 -> 207 bytes
 doc/images/package.png                             |  Bin 0 -> 853 bytes
 doc/images/page_green.png                          |  Bin 0 -> 621 bytes
 doc/images/page_white_text.png                     |  Bin 0 -> 342 bytes
 doc/images/page_white_width.png                    |  Bin 0 -> 309 bytes
 doc/images/plugin.png                              |  Bin 0 -> 591 bytes
 doc/images/ruby.png                                |  Bin 0 -> 592 bytes
 doc/images/tag_blue.png                            |  Bin 0 -> 1880 bytes
 doc/images/tag_green.png                           |  Bin 0 -> 613 bytes
 doc/images/transparent.png                         |  Bin 0 -> 97 bytes
 doc/images/wrench.png                              |  Bin 0 -> 610 bytes
 doc/images/wrench_orange.png                       |  Bin 0 -> 584 bytes
 doc/images/zoom.png                                |  Bin 0 -> 692 bytes
 doc/index.html                                     |  647 ++++++++
 doc/js/darkfish.js                                 |  155 ++
 doc/js/jquery.js                                   |   18 +
 doc/js/navigation.js                               |  142 ++
 doc/js/search.js                                   |   94 ++
 doc/js/search_index.js                             |    1 +
 doc/js/searcher.js                                 |  228 +++
 doc/rdoc.css                                       |  543 +++++++
 doc/table_of_contents.html                         |  462 ++++++
 examples/empty.png                                 |  Bin 0 -> 283 bytes
 examples/graph.dot                                 |  106 ++
 examples/graph.png                                 |  Bin 0 -> 142876 bytes
 examples/minus.png                                 |  Bin 0 -> 282 bytes
 examples/multi.flat.txt                            |   23 +
 examples/multi.graph.html                          |  906 +++++++++++
 examples/multi.grind.dat                           |  194 +++
 examples/multi.stack.html                          |  573 +++++++
 examples/plus.png                                  |  Bin 0 -> 300 bytes
 examples/stack.html                                |  573 +++++++
 ext/extconf.rb                                     |   34 -
 ext/measure_allocations.h                          |   58 -
 ext/measure_cpu_time.h                             |  152 --
 ext/measure_gc_runs.h                              |   76 -
 ext/measure_gc_time.h                              |   57 -
 ext/measure_memory.h                               |  101 --
 ext/measure_process_time.h                         |   52 -
 ext/measure_wall_time.h                            |   53 -
 ext/mingw/Rakefile                                 |   23 -
 ext/mingw/build.rake                               |   38 -
 ext/mingw/ruby_prof.so                             |  Bin 38794 -> 0 bytes
 ext/ruby_prof.c                                    | 1680 --------------------
 ext/ruby_prof.h                                    |  188 ---
 ext/ruby_prof/extconf.rb                           |   59 +
 ext/ruby_prof/rp_call_info.c                       |  407 +++++
 ext/ruby_prof/rp_call_info.h                       |   48 +
 ext/ruby_prof/rp_measure.c                         |   48 +
 ext/ruby_prof/rp_measure.h                         |   45 +
 ext/ruby_prof/rp_measure_allocations.c             |   65 +
 ext/ruby_prof/rp_measure_cpu_time.c                |  112 ++
 ext/ruby_prof/rp_measure_gc_runs.c                 |   65 +
 ext/ruby_prof/rp_measure_gc_time.c                 |   57 +
 ext/ruby_prof/rp_measure_memory.c                  |   73 +
 ext/ruby_prof/rp_measure_process_time.c            |   71 +
 ext/ruby_prof/rp_measure_wall_time.c               |   42 +
 ext/ruby_prof/rp_method.c                          |  420 +++++
 ext/ruby_prof/rp_method.h                          |   57 +
 ext/ruby_prof/rp_stack.c                           |  128 ++
 ext/ruby_prof/rp_stack.h                           |   51 +
 ext/ruby_prof/rp_thread.c                          |  268 ++++
 ext/ruby_prof/rp_thread.h                          |   27 +
 ext/ruby_prof/ruby_prof.c                          |  695 ++++++++
 ext/ruby_prof/ruby_prof.h                          |   55 +
 ext/ruby_prof/vc/ruby_prof.sln                     |   32 +
 ext/ruby_prof/vc/ruby_prof_18.vcxproj              |  108 ++
 ext/ruby_prof/vc/ruby_prof_19.vcxproj              |  110 ++
 ext/ruby_prof/vc/ruby_prof_20.vcxproj              |  110 ++
 ext/ruby_prof/version.h                            |    7 +
 ext/vc/ruby_prof.sln                               |   20 -
 ext/vc/ruby_prof.vcproj                            |  241 ---
 ext/version.h                                      |    4 -
 lib/ruby-prof.rb                                   |   41 +-
 lib/ruby-prof/abstract_printer.rb                  |   41 -
 lib/ruby-prof/aggregate_call_info.rb               |   22 +-
 lib/ruby-prof/call_info.rb                         |   66 +-
 lib/ruby-prof/call_info_visitor.rb                 |   44 +
 lib/ruby-prof/compatibility.rb                     |  169 ++
 lib/ruby-prof/flat_printer.rb                      |   79 -
 lib/ruby-prof/graph_html_printer.rb                |  256 ---
 lib/ruby-prof/graph_printer.rb                     |  164 --
 lib/ruby-prof/images/empty.png                     |  Bin 0 -> 283 bytes
 lib/ruby-prof/images/minus.png                     |  Bin 0 -> 282 bytes
 lib/ruby-prof/images/plus.png                      |  Bin 0 -> 300 bytes
 lib/ruby-prof/method_info.rb                       |   38 +-
 lib/ruby-prof/printers/abstract_printer.rb         |   85 +
 lib/ruby-prof/printers/call_info_printer.rb        |   41 +
 lib/ruby-prof/printers/call_stack_printer.rb       |  773 +++++++++
 lib/ruby-prof/{ => printers}/call_tree_printer.rb  |   32 +-
 lib/ruby-prof/printers/dot_printer.rb              |  132 ++
 lib/ruby-prof/printers/flat_printer.rb             |   69 +
 .../printers/flat_printer_with_line_numbers.rb     |   57 +
 lib/ruby-prof/printers/graph_html_printer.rb       |  255 +++
 lib/ruby-prof/printers/graph_printer.rb            |  116 ++
 lib/ruby-prof/printers/multi_printer.rb            |   56 +
 lib/ruby-prof/profile.rb                           |   77 +
 lib/ruby-prof/rack.rb                              |   48 +
 lib/ruby-prof/task.rb                              |   39 +-
 lib/ruby-prof/test.rb                              |   10 +-
 lib/ruby-prof/thread.rb                            |   22 +
 lib/unprof.rb                                      |    2 +
 metadata.yml                                       |  258 +++
 rails/environment/profile.rb                       |   24 -
 rails/example/example_test.rb                      |    9 -
 rails/profile_test_helper.rb                       |   21 -
 ruby-prof.gemspec                                  |   61 +
 test/aggregate_test.rb                             |   61 +-
 test/basic_test.rb                                 |  295 +---
 test/call_info_test.rb                             |   78 +
 test/call_info_visitor_test.rb                     |   31 +
 test/duplicate_names_test.rb                       |   10 +-
 test/dynamic_method_test.rb                        |   74 +
 test/enumerable_test.rb                            |   16 +
 test/exceptions_test.rb                            |   11 +-
 test/exclude_threads_test.rb                       |   94 +-
 test/exec_test.rb                                  |   14 +
 test/fiber_test.rb                                 |   65 +
 test/line_number_test.rb                           |   42 +-
 test/measure_allocations_test.rb                   |   25 +
 test/measure_cpu_time_test.rb                      |  220 +++
 test/measure_gc_runs_test.rb                       |   32 +
 test/measure_gc_time_test.rb                       |   36 +
 test/measure_memory_test.rb                        |   31 +
 test/measure_process_time_test.rb                  |   62 +
 test/measure_wall_time_test.rb                     |  255 +++
 test/measurement_test.rb                           |  121 --
 test/method_elimination_test.rb                    |   84 +
 test/module_test.rb                                |   33 +-
 test/multi_printer_test.rb                         |   82 +
 test/no_method_class_test.rb                       |   10 +-
 test/pause_resume_test.rb                          |  166 ++
 test/prime.rb                                      |   20 +-
 test/prime_test.rb                                 |   13 -
 test/printers_test.rb                              |  260 ++-
 test/recursive_test.rb                             |  259 ++-
 test/singleton_test.rb                             |    9 +-
 test/stack_printer_test.rb                         |   78 +
 test/stack_test.rb                                 |   32 +-
 test/start_stop_test.rb                            |   59 +-
 test/test_helper.rb                                |  115 ++
 test/test_suite.rb                                 |   56 +-
 test/thread_test.rb                                |  119 +-
 test/unique_call_path_test.rb                      |   70 +-
 188 files changed, 25844 insertions(+), 4710 deletions(-)

diff --git a/CHANGES b/CHANGES
index 83bcb9c..0dc528a 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,8 +1,177 @@
+0.12.2 (2013-02-13)
+======================
+* Fixed segfault when using falcon or railsexpress patches for 1.9.3
+
+0.12.1 (2013-01-07)
+======================
+* Add back in pause/resume support since Rails uses it
+
+0.12.0 (2013-01-06)
+======================
+* Ruby 2.0.0 support (Charlie Savage)
+* Fix issue where profiling results could exceed 100% if profile code had multiple top level methods (Charlie Savage)
+* Replaced RubyProf::Thread#top_method with RubyProf::Thread#top_methods (Charlie Savage)
+* Added RubyProf::Thread#total_time (Charlie Savage)
+* Remove the -r and -e command line options.  If you need specific libraries or code profiled then add them
+  to your code (Charlie Savage).
+* Rewrite ruby-prof script to be more self-contained (Gary Weaver)
+* Fix list formatting in readme (Thilo Rusche)
+* Remove pause/resume support since its buggy and complicates the code
+
+0.11.3 (2012-12-27)
+======================
+* Prefix c functions with prof_ to avoid name conflicts (Kenta Murata)
+* Update ruby-prof script to avoid seg faults (Gary Weaver)
+* Rakefile updates (Roger Pack)
+* Fix regexp file reading (Gilbert Roulot)
+* Update documentation (Timo Schilling)
+* Fix up ruby warnings (Mike Gehard)
+* Remove duplicate code (Chas Lemley)
+
+
+0.11.2 (2012-05-06)
+======================
+* Fix compile issue with BOOL.  Should be _Bool for C99.
+
+
+0.11.1 (2012-05-06)
+======================
+* Added option --exclude-common-callbacks, plus exclude #map and #inject in common cycles (Vasily Fedoseyev)
+* Add option --exclude-common-cycles to exclude common iterators (Vasily Fedoseyev)
+* Allow method elimination from command line via '-x' and '-X' keys (Vasily Fedoseyev)
+
+
+0.11.0 (2012-05-05)
+======================
+* Fix pause/resume so it actually works and add tests (David Barri)
+* Resume now returns the result of the block when given (David Barri)
+* Make recursive method explanation more clear (Charlie Savage)
+* Fix ruby warnings (Charlie Savage)
+* Toggle GC.enable_stats when profiling for memory to get the data (Vasily Fedoseyev)
+* Fix patched ruby support and remove some warnings (Vasily Fedoseyev)
+* Fix tests on 1.8.7 (rogerdpack)
+
+
+0.11.0.rc3 (2012-03-26)
+======================
+* Include missing files in gemspec (Charlie Savage).
+
+
+0.11.0.rc2 (2012-03-25)
+======================
+* Lots of improvements to Rack handler - this can be used to profile requests
+  in Rails and other rack-based ruby web frameworks (Charlie Savage).
+* Reimplemented handling of recursive calls using CallInfoVisitor (Charlie Savage).
+* Fix bug where child times were not correctly reported in complicated
+  call graphs with recursion like in frameworks like Rails (Charlie Savage).
+* Add in recursive call information to Flat, Graph and Graph HTML reports (Charlie Savage).
+* Add in new thread class add added RubyProf::Thread#top_method to
+  make report generation easier (Charlie Savage).
+* Add in CallInfoVisitor class to make it easy to iterate over a call graph (Charlie Savage).
+* Add in CallInfoPrinter to make it visualize RubyProf's internal call graphs (Charlie Savage).
+* Significant updates to documentation (Charlie Savage).
+* More c code cleanup (Charlie Savage).
+
+0.11.0.rc1 (2012-03-24)
+======================
+* Big internal refactoring of C code to make RubyProf easier to understand and extend (Charlie Savage).
+* Profile results are now returned as instances of a new class RubyProf::Profile.  The old api
+  is supported via a compatability layer that at some point will be deprecated.  (Charlie Savage).
+* On Windows, use QueryPerformanceCounter and QueryPerformanceFrequency to measure CPU time instead
+  of rdtsc.  This change is based on Microsoft's recommendation (Charlie Savage).
+* On Windows use GetProcessTimes to return real PROCESS_TIME times instead of wall times (Charlie Savage).
+* Split out tests for each time of measurement (cpu_time, process_time, etc.) (Charlie Savage).
+* Dropped support for Ruby 1.8.4 and 1.8.6 and 1.9.0 (Charlie Savage).
+* Added support for sorting results by total, self, wait and child times (Jan Suchal)
+* Added tests for sorting behaviour & removed options from constructor to print method (Jan Suchal)
+* Fix line number tests due to changes at top of file (Charlie Savage).
+* Add encoding statement to top of all files for Ruby 1.9.x compatability (Charlie Savage).
+* Add def file for VC to avoid the whole declspec annoyance (Charlie Savage).
+* Update test suite to ensure current working directory is correct (Charlie Savage).
+* Modernize gem file and remove various custom/home grown solutions that aren't needed anymore (Charlie Savage).
+* Remove custom mingw build scripts, use rake compiler instead  (Charlie Savage).
+* Fixes for compiling with VC 2010 (Charlie Savage).
+
+0.10.8 (2011-07-06)
+======================
+* 1.9.3 super class (Roger Pack)
+
+0.10.7 (2011-05-09)
+======================
+* Fix a bug with REE's GC stats. Issue #53 [thanks graaff]
+
+0.10.6 (2011-04-29)
+======================
+* Slightly more normalized url for linux/windows links to files.
+
+0.10.5 (2011-04-20)
+=======================
+* 1.8.6 compat for -v command (bug fix)
+
+0.10.4 (2011-04-20)
+=======================
+* Faster load time for ruby-prof itself.
+
+0.10.3
+=======================
+* Can cleanly load before rubygems now.
+
+0.10.2
+=======================
+* Fix for 1.9.2, os x for latest commits (thanks skaes!)
+
+0.10.1
+=======================
+* Fix bug in linux wall time, also load with only relative paths so that you can use it to benchmark rubygems startup overhead,
+  itself.
+
+0.10.0
+=======================
+* Some rdoc changes, for linux wall time attempt to use higher granularity (thanks to all the contributors for this round!)
+
+0.9.2
+=======================
+* Make graphviz work on 1.8.6
+* Roll back some 1.9.2 optimizations until I can figure out what caused them.
+
+0.9.1
+=======================
+* Add a graphviz output
+
+0.9.0
+=======================
+* measurements for recursive methods are now correct
+* gave up on splitting up recursive methods according to call depth
+* made it possible to eliminate methods from profiling results
+* new printer for call stack visualization
+* new printer to print several profiles in one run
+* HTML profiles contain Textmate links so you can jump to the source code easily
+* producing an event log is now a runtime option
+
+0.7.10 (2009-01-22)
+=======================
+* fix SEGFAULT in 1.9
+* add new printer flat_printer_with_line_numbers
+
+0.7.7 (2009-01-13)
+======================
+* "fix" multi threading support for 1.9 http://redmine.ruby-lang.org/issues/show/2012
+* speedups
+
+0.7.6 (2009-12-31)
+======================
+* fix some tests for 1.9 (no real code changes)
+
+0.7.5 (2009-12)
+========================
+* fix a GC collection bug (nobu's patch).
+* correctly report recursive call depths (Kevin Scaldeferri).
+* sort methods on output (Kevin Scaldeferri).
+
 0.7.3 (2008-12-09)
 ========================
 * Fixed compile error with new x86_64 code using GCC.
 
-
 0.7.2 (2008-12-08)
 ========================
 * Fixed major bug in printing child methods in graph reports.
@@ -36,29 +205,29 @@
 
 Features
 --------
-* Added two new methods - RubyProf.resume and RubyProf.pause. 
+* Added two new methods - RubyProf.resume and RubyProf.pause.
   RubyProf.resume takes an optional block, which ensures that
   RubyProf.pause is called.  For example:
-  
+
   10.times do |i|
     RubyProf.resume do
       # Some long process
     end
   end
-  
+
   result = RubyProf.stop
 
 * Added support for profiling tests that use Ruby's built-in
-  unit test framework (ie, test derived from 
+  unit test framework (ie, test derived from
   Test::Unit::TestCase).  To enable profiling simply add
   the following line of code to your test class:
-  
+
     include RubyProf::Test
-    
-  By default, profiling results are written to the current 
+
+  By default, profiling results are written to the current
   processes working directory.  To change this, or other
   profiling options, simply modify the PROFILE_OPTIONS hash
-  table as needed.        
+  table as needed.
 
 * Used the new support for profiling test cases to revamp
   the way that Rails profiling works.  For more information
@@ -74,8 +243,8 @@ Features
 
 * Add support for Lloyd Hilaiel's Ruby patch for measuring total heap size.
    See http://lloydforge.org/projects/ruby. (Jeremy Kemper).
-  
-  
+
+
 Fixes
 -------
 * RubyProf.profile no longer crashes if an exception is
@@ -83,7 +252,7 @@ Fixes
 
 * Measure memory in fractional kilobytes rather than rounding down (Jeremy Kemper)
 
-  
+
 0.6.0 (2008-02-03)
 ========================
 
@@ -103,7 +272,7 @@ Fixes
   fixes for min_time support, ability to specify templates using
   strings or filenames, and table layout fixes (Makoto Kuwata)
 * Fixes to scaling factor for calltrees so that precision is not lost
-  due to the conversion to doubles (Sylvain Joyeux) 
+  due to the conversion to doubles (Sylvain Joyeux)
 * Changed constant ALLOCATED_OBJECTS to ALLOCATIONS in the C code to
   match the Ruby code (Sylvain Joyeux)
 * Added support for calltree printer to ruby-prof binary script (Sylvain Joyeux)
@@ -113,7 +282,7 @@ Fixes
 * Fix ruby-prof to work with the latest version of GEMS (Alexander Dymo)
 * Always define MEASURE_CPU_TIME and MEASURE_ALLOCATIONS in Ruby code, but
   set their values to nil if the functionality is not available.
-   
+
 
 0.5.2 (2007-07-19)
 ========================
diff --git a/LICENSE b/LICENSE
index ebc4eef..781ca99 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,15 +1,16 @@
-Copyright (C) 2005  Shugo Maeda <shugo at ruby-lang.org>
+Copyright (C) 2005 - 20011 Shugo Maeda <shugo at ruby-lang.org> and Charlie Savage <cfis at savagexi.com>
 All rights reserved.
- *
+
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions
 are met:
+
 1. Redistributions of source code must retain the above copyright
    notice, this list of conditions and the following disclaimer.
 2. Redistributions in binary form must reproduce the above copyright
    notice, this list of conditions and the following disclaimer in the
    documentation and/or other materials provided with the distribution.
- *
+
 THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
diff --git a/README b/README.rdoc
similarity index 52%
rename from README
rename to README.rdoc
index a5df9ce..9f66dad 100644
--- a/README
+++ b/README.rdoc
@@ -1,95 +1,87 @@
 = ruby-prof
+{<img src="https://travis-ci.org/ruby-prof/ruby-prof.png?branch=master" alt="Build Status" />}[https://travis-ci.org/ruby-prof/ruby-prof]
 
 == Overview
 
 ruby-prof is a fast code profiler for Ruby.  Its features include:
 
 * Speed - it is a C extension and therefore many times faster than the standard Ruby profiler.
-* Modes - Ruby prof can measure a number of different parameters, including
-          call times, memory usage and object allocations. 
+* Modes - Ruby prof can measure a number of different parameters, including call times, memory usage and object allocations.
 * Reports - can generate text and cross-referenced html reports
   - Flat Profiles - similar to the reports generated by the standard Ruby profiler
   - Graph profiles - similar to GProf, these show how long a method runs, which methods call it and which methods it calls.
   - Call tree profiles - outputs results in the calltree format suitable for the KCacheGrind profiling tool.
+  - Many more -- see reports section of this README.
 * Threads - supports profiling multiple threads simultaneously
-* Recursive calls - supports profiling recursive method calls
-
 
 == Requirements
 
-ruby-prof requires Ruby 1.8.4 or higher.
+ruby-prof requires Ruby 1.8.7 or 1.9.2 and higher.
 
 If you are running Linux or Unix you'll need a C compiler so the extension
 can be compiled when it is installed.
 
-If you are running Windows, then install the Windows specific RubyGem which
-includes an already built extension.
-
+If you are running Windows, then you may need to install the
+Windows specific RubyGem which includes an already built extension (see Install section).
 
 == Install
 
 The easiest way to install ruby-prof is by using Ruby Gems.  To install:
 
-<tt>gem install ruby-prof</tt>
+  gem install ruby-prof
 
-If you are running Windows, make sure to install the Win32 RubyGem which 
-includes a pre-built binary. Due to a bug in ruby-gems, you cannot
-install the gem to a path that contains spaces
-(see http://rubyforge.org/tracker/?func=detail&aid=23003&group_id=126&atid=577).
-
-ruby-prof is also available as a tarred gzip archive and zip archive. 
+If you're on windows then a prebuilt binary gem is available.  You may of course
+compile it yourself via use of devkit on MinGW.
 
 == Usage
 
-There are three ways of running ruby-prof.
-
+There are two ways of running ruby-prof, via the command line or via its API.
 
 === ruby-prof executable
 
-The first is to use ruby-prof to run the Ruby program
-you want to profile.  For more information refer to
-the ruby-prof documentation[link:files/bin/ruby-prof.html].
+The first is to use ruby-prof to run the Ruby program you want to
+profile. For more information refer to the documentation of the
+ruby-prof command.
 
 
 === ruby-prof API
 
 The second way is to use the ruby-prof API to profile
-particular segments of code.  
+particular segments of code.
 
   require 'ruby-prof'
-  
+
   # Profile the code
   RubyProf.start
   ...
   [code to profile]
   ...
   result = RubyProf.stop
-  
+
   # Print a flat profile to text
   printer = RubyProf::FlatPrinter.new(result)
-  printer.print(STDOUT, 0)
-  
+  printer.print(STDOUT)
+
 Alternatively, you can use a block to tell ruby-prof what
 to profile:
 
   require 'ruby-prof'
-  
+
   # Profile the code
   result = RubyProf.profile do
     ...
     [code to profile]
     ...
   end
-  
+
   # Print a graph profile to text
   printer = RubyProf::GraphPrinter.new(result)
-  printer.print(STDOUT, 0)
+  printer.print(STDOUT, {})
 
-Starting with the 0.6.1 release, ruby-prof also supports pausing and resuming
-profiling runs.
+ruby-prof also supports pausing and resuming profiling runs.
 
   require 'ruby-prof'
-  
+
   # Profile the code
   RubyProf.start
   [code to profile]
@@ -98,59 +90,94 @@ profiling runs.
   RubyProf.resume
   [code to profile]
   result = RubyProf.stop
-  
+
 Note that resume will automatically call start if a profiling run
 has not yet started.  In addition, resume can also take a block:
 
   require 'ruby-prof'
-  
+
   # Profile the code
   RubyProf.resume do
     [code to profile]
   end
 
   data = RubyProf.stop
-  
-With this usage, resume will automatically call pause at the 
+
+With this usage, resume will automatically call pause at the
 end of the block.
 
 
-=== require unprof
+== Method and Thread Elimination
+
+ruby-prof supports eliminating specific methods and threads from profiling
+results. This is useful for reducing connectivity in the call graph, making it easier to
+identify the source of performance problems when using a graph printer.
+
+For example, consider Integer#times: it's hardly ever useful to know how much time is
+spent in the method itself. We're much more interested in how much the passed in block
+contributes to the time spent in the method which contains the Integer#times call.
 
-The third way of using ruby-prof is by requiring unprof.rb:
+Methods are eliminated from the collected data by calling `eliminate_methods!` on the
+profiling result, before submitting it to a printer.
+
+  result = RubyProf.stop
+  result.eliminate_methods!([/Integer#times/])
+
+The argument given to `eliminate_methods!` is either an array of regular expressions, or
+the name of a file containing a list of regular expressions (line separated text).
+
+After eliminating methods the resulting profile will appear exactly as if those methods
+had been inlined at their call sites.
+
+In a similar manner, threads can be excluded so they are not profiled at all.  To do this,
+pass an array of threads to exclude to ruby-prof:
+
+  RubyProf::exclude_threads = [ thread2 ]
+  RubyProf.start
+
+Note that the excluded threads must be specified *before* profiling.
 
-  require 'unprof'
 
-This will start profiling immediately and will output the results
-using a flat profile report.
+== Benchmarking full load time including rubygems startup cost ==
 
-This method is provided for backwards compatibility.  Using
-{ruby-prof}[link:files/bin/ruby-prof.html] provides more flexibility.
+If you want to get a more accurate measurement of what takes all of a gem's bin/xxx
+command to load, you may want to also measure rubygems' startup penalty.
+You can do this by calling into bin/ruby-prof directly, ex:
 
+$ gem which ruby-prof
+  g:/192/lib/ruby/gems/1.9.1/gems/ruby-prof-0.10.2/lib/ruby-prof.rb
+
+now run it thus (substitute lib/ruby-prof.rb with bin/ruby-prof):
+
+$ ruby g:/192/lib/ruby/gems/1.9.1/gems/ruby-prof-0.10.2/bin/ruby-prof g:\192\bin\some_installed_gem_command
+
+or
+
+$ ruby g:/192/lib/ruby/gems/1.9.1/gems/ruby-prof-0.10.2/bin/ruby-prof ./some_file_that_does_a_require_rubygems_at_the_beginning.rb
 
 == Profiling Tests
 
-Starting with the 0.6.1 release, ruby-prof supports profiling tests cases
-written using Ruby's built-in	unit test framework (ie, test derived from 
-Test::Unit::TestCase).  To enable profiling simply add the following line 
-of code to your test class:
-  
-  	include RubyProf::Test
-  	
+ruby-prof supports profiling tests cases
+written using Ruby's built-in unit test framework (ie, test derived from
+Test::Unit::TestCase).  To enable profiling simply add the following line
+of code to within your test class:
+
+        include RubyProf::Test
+
 Each test method is profiled separately.  ruby-prof will run each test method
 once as a warmup and then ten additional times to gather profile data.
-Note that the profile data will *not* include the class's setup or 
+Note that the profile data will *not* include the class's setup or
 teardown methods.
 
-Separate reports are generated for each method and saved, by default, 
+Separate reports are generated for each method and saved, by default,
 in the test process's working directory.  To change this, or other profiling
-options, modify your test class's PROFILE_OPTIONS hash table. To globally 
-change test profiling options, modify RubyProf::Test::PROFILE_OPTIONS.  
+options, modify your test class's PROFILE_OPTIONS hash table. To globally
+change test profiling options, modify RubyProf::Test::PROFILE_OPTIONS.
 
 
 == Profiling Rails
 
-To profile a Rails application it is vital to run it using production like 
+To profile a Rails application it is vital to run it using production like
 settings (cache classes, cache view lookups, etc.).  Otherwise, Rail's
 dependency loading code will overwhelm any time spent in the application
 itself (our tests show that Rails dependency loading causes a roughly 6x
@@ -159,49 +186,30 @@ profile.rb.
 
 So to profile Rails:
 
-1.  Create a new profile.rb environment - or simply copy the example file
-    in ruby-prof/rails/environment/profile.rb
-    
-2.  Copy the file:
-     
-      ruby-prof/rails/profile_test_helper.rb 
-    
-    To:
-    
-      your_rails_app/test/profile_test_helper.rb
-
-3.  Create a new test directory for profiling:
-
-      your_rails_app/test/profile
-    
-
-4.  Write unit, functional or integration tests specifically designed
-    to profile some part of your Rails application.  At the top
-    of each test, replace this line:
-    
-      require File.dirname(__FILE__) + '/../test_helper'
-
-    With:
-    
-      require File.dirname(__FILE__) + '/../profile_test_helper'
-
-    For example:
-
-    require File.dirname(__FILE__) + '/../profile_test_helper'
-    
-    class ExampleTest < Test::Unit::TestCase
-      include RubyProf::Test
-      fixtures ....
-      
-      def test_stuff
-        puts "Test method"
+1.  Create a new profile.rb environment.  Make sure to turn on cache_classes
+    and cache_template_loading.  Otherwise your profiling results will be
+    overwhelemed by the time Rails spends loading required files.  You should
+    likely turn off caching.
+
+2.  Add the ruby-prof to your gemfile:
+
+      group :profile do
+        gem 'ruby-prof'
+      end
+
+3.  Add the ruby prof rack adapter to your middleware stack.  One way to
+    do this is by adding the following code to config.ru:
+
+      if Rails.env.profile?
+        use Rack::RubyProf, :path => '/temp/profile'
       end
-    end   
 
-5.  Now run your tests.  Results will be written to:
+    The path is where you want profiling results to be stored.  By default the
+    rack adapter will generate a html call graph report and flat text report.
 
-      your_rails_app/tmp/profile
-    
+4.  Now make a request to your running server.  New profiling information will
+    be generated for each request.  Note that each request will overwrite
+    the profiling reports created by the previous request!
 
 == Reports
 
@@ -211,57 +219,81 @@ ruby-prof can generate a number of different reports:
 * Graph Reports
 * HTML Graph Reports
 * Call graphs
+* Call stack reports
+* More!
 
-Flat profiles show the overall time spent in each method.  They
+Flat profiles show the overall time spent in each method. They
 are a good of quickly identifying which methods take the most time.
 An example of a flat profile and an explanation can be found in
-{examples/flat.txt}[link:files/examples/flat_txt.html].
-
-Graph profiles also show the overall time spent in each method.
-In addition, they also show which methods call the current
-method and which methods its calls.  Thus they are good for
-understanding how methods gets called and provide insight into
-the flow of your program.  An example text graph profile
-is located at {examples/graph.txt}[link:files/examples/graph_txt.html].
-
-HTML Graph profiles are the same as graph profiles, except
-output is generated in hyper-linked HTML. Since graph profiles
-can be quite large, the embedded links make it much easier to
-navigate the results.  An example html graph profile
-is located at {examples/graph.html}[link:files/examples/graph_html.html].
-
-HTML Graph profiles are the same as graph profiles, except
-output is generated in hyper-linked HTML. Since graph profiles
-can be quite large, the embedded links make it much easier to
-navigate the results.  An example html graph profile
-is located at {examples/graph.html}[link:files/examples/graph_html.html].
+{examples/flat.txt}[http://github.com/ruby-prof/ruby-prof/tree/master/examples/flat.txt].
+
+There are several varieties of these -- run $ ruby-prof --help
+
+Graph profiles also show the overall time spent in each method. In
+addition, they also show which methods call the current method and which
+methods its calls.  Thus they are good for understanding how methods
+gets called and provide insight into the flow of your program. An
+example text graph profile is located at
+{examples/graph.txt}[http://github.com/ruby-prof/ruby-prof/tree/master/examples/graph.txt].
+
+HTML Graph profiles are the same as graph profiles, except output is
+generated in hyper-linked HTML. Since graph profiles can be quite large,
+the embedded links make it much easier to navigate the results. An
+example html graph profile is located at
+{examples/graph.html}[http://github.com/ruby-prof/ruby-prof/tree/master/examples/graph.html].
 
 Call graphs output results in the calltree profile format which is used
-by KCachegrind.  Call graph support was generously donated by Carl Shimer.
-More information about the format can be found at
-the {KCachegrind}[link:http://kcachegrind.sourceforge.net/cgi-bin/show.cgi/KcacheGrindCalltreeFormat] site.
+by KCachegrind. Call graph support was generously donated by Carl
+Shimer. More information about the format can be found at the
+{KCachegrind}[http://kcachegrind.sourceforge.net/cgi-bin/show.cgi/KcacheGrindCalltreeFormat]
+site.
+
+Call stack reports produce a HTML visualization of the time spent in
+each execution path of the profiled code. An example can be found at
+{examples/stack.html}[http://github.com/ruby-prof/ruby-prof/tree/master/examples/call_stack.html].
 
+Another good example: [http://twitpic.com/28z94a]
+
+Finally, there's a so called MultiPrinter which can generate several
+reports in one profiling run. See
+{examples/multi.stack.html}[http://github.com/ruby-prof/ruby-prof/tree/master/examples/multi.stack.html].
+
+There is also a graphviz .dot visualiser.
 
 == Printers
 
 Reports are created by printers.  Supported printers include:
 
 * RubyProf::FlatPrinter - Creates a flat report in text format
+* RubyProf::FlatPrinterWithLineNumbers - same as above but more verbose
 * RubyProf::GraphPrinter - Creates a call graph report in text format
 * RubyProf::GraphHtmlPrinter - Creates a call graph report in HTML (separate files per thread)
+* RubyProf::DotPrinter - Creates a call graph report in GraphViz's DOT format which can be converted to an image
 * RubyProf::CallTreePrinter - Creates a call tree report compatible with KCachegrind.
+* RubyProf::CallStackPrinter - Creates a HTML visualization of the Ruby stack
+* RubyProf::MultiPrinter - Uses the other printers to create several reports in one profiling run
+* More!
 
 To use a printer:
 
-  result = RubyProf.end
+  ...
+  result = RubyProf.stop
   printer = RubyProf::GraphPrinter.new(result)
-  printer.print(STDOUT, 0)
+  printer.print(STDOUT, :min_percent => 2)
 
 The first parameter is any writable IO object such as STDOUT or a file.
-The second parameter, which has a default value of 0, specifies 
-the minimum percentage a method must take to be printed.  Percentages
-should be specified as integers in the range 0 to 100.  For more
-information please see the documentation for the different printers.
+The second parameter, specifies the minimum percentage a method must take
+to be printed.  Percentages should be specified as integers in the range 0 to 100.
+For more information please see the documentation for the different printers.
+
+The other option is :print_file => true (default false), which adds the filename to the
+output (GraphPrinter only).
+
+The MultiPrinter differs from the other printers in that it requires a directory path
+and a basename for the files it produces.
+
+   printer = RubyProf::MultiPrinter.new(result)
+   printer.print(:path => ".", :profile => "profile")
 
 
 == Measurements
@@ -277,11 +309,10 @@ aspects of a Ruby program.  Supported measurements include:
 * garbage collections runs (RubyProf::GC_RUNS)
 * garbage collection time (RubyProf::GC_TIME)
 
-
 Process time measures the time used by a process between any two moments.
-It is unaffected by other processes concurrently running 
+It is unaffected by other processes concurrently running
 on the system. Note that Windows does not support measuring process
-times - therefore, all measurements on Windows use wall time.
+times - therefore, measurements on Windows defaults to wall time.
 
 Wall time measures the real-world time elapsed between any two moments.
 If there are other processes concurrently running on the system
@@ -290,7 +321,7 @@ then the reported results will be too large.
 
 CPU time uses the CPU clock counter to measure time.  The returned
 values are dependent on the correctly setting the CPU's frequency.
-This mode is only supported on Pentium or PowerPC platforms.
+This mode is only supported on Pentium or PowerPC platforms (linux only).
 
 Object allocation reports show how many objects each method in
 a program allocates.  This support was added by Sylvain Joyeux
@@ -335,17 +366,15 @@ environment variable:
 * export RUBY_PROF_MEASURE_MODE=memory
 * export RUBY_PROF_MEASURE_MODE=gc_runs
 * export RUBY_PROF_MEASURE_MODE=gc_time
-  
-Note that these values have changed since ruby-prof-0.3.0.  
 
-On Linux, process time is measured using the clock method provided 
+On Linux, process time is measured using the clock method provided
 by the C runtime library. Note that the clock method does not
 report time spent in the kernel or child processes and therefore
 does not measure time spent in methods such as Kernel.sleep method.
 If you need to measure these values, then use wall time.  Wall time
 is measured using the gettimeofday kernel method.
 
-On Windows, timings are always wall times.  If you set the clock 
+On Windows, timings default to wall times.  If you set the clock
 mode to PROCESS_TIME, then timing are read using the clock method
 provided by the C runtime library.  Note though, these values are
 wall times on Windows and not process times like on Linux.
@@ -354,64 +383,35 @@ Wall time is measured using the GetLocalTime API.
 If you use wall time, the results will be affected by other
 processes running on your computer, network delays, disk access,
 etc.  As result, for the best results, try to make sure your
-computer is only performing your profiling run and is 
+computer is only performing your profiling run and is
 otherwise quiescent.
 
 On both platforms, cpu time is measured using the RDTSC assembly
 function provided by the Pentium and PowerPC platforms. CPU time
-is dependent on the cpu's frequency.  On Linux, ruby-prof attempts 
+is dependent on the cpu's frequency.  On Linux, ruby-prof attempts
 to read this value from "/proc/cpuinfo."  On Windows, you must
-specify the clock frequency.  This can be done using the
+manually specify the clock frequency.  This can be done using the
 RUBY_PROF_CPU_FREQUENCY environment variable:
 
   export RUBY_PROF_CPU_FREQUENCY=<value>
-  
-You can also directly set the cpu frequency by calling:
-
-  RubyProf.cpu_frequency = <value> 
-
-
-== Recursive Calls
-
-Recursive calls occur when method A calls method A and cycles
-occur when method A calls method B calls method C calls method A.
-ruby-prof detects both direct recursive calls and cycles.  Both
-are indicated in reports by a dash and number following a method
-name.  For example, here is a flat profile from the test method
-RecursiveTest#test_recursive:
-
-
-%self     total     self     wait    child    calls  name
-100.00      2.00     2.00     0.00     0.00        2  Kernel#sleep
-  0.00      2.00     0.00     0.00     2.00        0  RecursiveTest#test_cycle
-  0.00      0.00     0.00     0.00     0.00        2  Fixnum#==
-  0.00      0.00     0.00     0.00     0.00        2  Fixnum#-
-  0.00      1.00     0.00     0.00     1.00        1  Object#sub_cycle-1
-  0.00      2.00     0.00     0.00     2.00        1  Object#sub_cycle
-  0.00      2.00     0.00     0.00     2.00        1  Object#cycle
-  0.00      1.00     0.00     0.00     1.00        1  Object#cycle-1
 
-Notice the presence of Object#cycle and Object#cycle-1.  The -1 means
-the method was either recursively called (directly or indirectly).
+You can also directly set the cpu frequency by calling:
 
-However, the self time values for recursive calls should always 
-be accurate.  It is also believed that the total times are
-accurate, but these should be carefully analyzed to verify their veracity.
+  RubyProf.cpu_frequency = <value>
 
 
 == Multi-threaded Applications
 
 Unfortunately, Ruby does not provide an internal api
-for detecting thread context switches.  As a result, the
+for detecting thread context switches in 1.8.  As a result, the
 timings ruby-prof reports for each thread may be slightly
-inaccurate.  In particular, this will happen for newly 
-spanned threads that immediately go to sleep.  For instance,
-if you use Ruby's timeout library to wait for 2 seconds,
+inaccurate.  In particular, this will happen for newly
+spawned threads that go to sleep immediately (their first call).
+For instance, if you use Ruby's timeout library to wait for 2 seconds,
 the 2 seconds will be assigned to the foreground thread
 and not the newly created background thread.  These errors
-can largely be avoided if the background thread performs an
-operation before going to sleeep. 
-
+can largely be avoided if the background thread performs any
+operation before going to sleep.
 
 == Performance
 
@@ -422,15 +422,12 @@ profiled.  Most programs will run approximately twice as slow
 while highly recursive programs (like the fibonacci series test)
 will run three times slower.
 
+== License
 
-== Windows Binary
-
-The Windows binary is built with the latest version of MinGW.  The source
-repository also includes a Microsoft VC++ 2005 solution.  If you wish to run
-a debug version of ruby-prof on Windows, then it is highly recommended
-you use VC++.
+See LICENSE for license information.
 
+== Development
 
-== License
+Code is located at https://github.com/ruby-prof/ruby-prof
 
-See LICENSE for license information.
+Google group/mailing list: http://groups.google.com/group/ruby-optimization or start a github issue.
diff --git a/Rakefile b/Rakefile
index 2287b61..37220ba 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,118 +1,105 @@
-require 'rubygems'
-require 'rake/gempackagetask'
-require 'rake/rdoctask'
-require 'rake/testtask'
-require 'date'
+# encoding: utf-8
 
-# ------- Version ----
-# Read version from header file
-version_header = File.read('ext/version.h')
-match = version_header.match(/RUBY_PROF_VERSION\s*["](\d.+)["]/)
-raise(RuntimeError, "Could not determine RUBY_PROF_VERSION") if not match
-RUBY_PROF_VERSION = match[1]
-  
-
-# ------- Default Package ----------
-FILES = FileList[
-  'Rakefile',
-  'README',
-  'LICENSE',
-  'CHANGES',
-  'bin/*',
-  'doc/**/*',
-  'examples/*',
-  'ext/*',
-  'ext/mingw/Rakefile',
-  'ext/mingw/build.rake',
-  'ext/vc/*.sln',
-  'ext/vc/*.vcproj',
-  'lib/**/*',
-  'rails/**/*',
-  'test/*'
-]
+require "rubygems/package_task"
+require "rake/extensiontask"
+require "rake/testtask"
+require "rdoc/task"
+require "date"
+require "rake/clean"
+begin
+  require "bundler/setup"
+  Bundler::GemHelper.install_tasks
+  [:build, :install, :release].each {|t| Rake::Task[t].enhance [:rdoc] }
+rescue LoadError
+  $stderr.puts "Install bundler to get support for simplified gem publishing"
+end
 
-# Default GEM Specification
-default_spec = Gem::Specification.new do |spec|
-  spec.name = "ruby-prof"
-  
-  spec.homepage = "http://rubyforge.org/projects/ruby-prof/"
-  spec.summary = "Fast Ruby profiler"
-  spec.description = <<-EOF
-ruby-prof is a fast code profiler for Ruby. It is a C extension and
-therefore is many times faster than the standard Ruby profiler. It
-supports both flat and graph profiles.  For each method, graph profiles
-show how long the method ran, which methods called it and which 
-methods it called. RubyProf generate both text and html and can output
-it to standard out or to a file.
-EOF
+# To release a version of ruby-prof:
+#   * Update version.h
+#   * Update CHANGES
+#   * git commit to commit files
+#   * rake clobber to remove extra files
+#   * rake compile to build windows gems
+#   * rake package to create the gems
+#   * Tag the release (git tag 0.10.1)
+#   * Push to ruybgems.org (gem push pkg/<gem files>)
+# For a ruby only release, just run
+#   * rake release
+# it will push changes to github, tag the release, build the package and upload it to rubygems.org
+# and in case you forgot to increment the version number or have uncommitted changes, it will refuse to work
 
-  spec.version = RUBY_PROF_VERSION
+GEM_NAME = 'ruby-prof'
+SO_NAME = 'ruby_prof'
 
-  spec.author = "Shugo Maeda and Charlie Savage"
-  spec.email = "shugo at ruby-lang.org and cfis at savagexi.com"
-  spec.platform = Gem::Platform::RUBY
-  spec.require_path = "lib" 
-  spec.bindir = "bin"
-  spec.executables = ["ruby-prof"]
-  spec.extensions = ["ext/extconf.rb"]
-  spec.files = FILES.to_a
-  spec.test_files = Dir["test/test_*.rb"]
-  
+default_spec = Gem::Specification.load("#{GEM_NAME}.gemspec")
 
-  spec.required_ruby_version = '>= 1.8.4'
-  spec.date = DateTime.now
-  spec.rubyforge_project = 'ruby-prof'
-  
-  # rdoc
-  spec.has_rdoc = true
+# specify which versions/builds to cross compile
+Rake::ExtensionTask.new do |ext|
+  ext.gem_spec = default_spec
+  ext.name = SO_NAME
+  ext.ext_dir = "ext/#{SO_NAME}"
+  ext.lib_dir = "lib/#{RUBY_VERSION.sub(/\.\d$/, '')}"
+  ext.cross_compile = true
+  ext.cross_platform = ['x86-mswin32-60', 'x86-mingw32-60']
 end
 
 # Rake task to build the default package
-Rake::GemPackageTask.new(default_spec) do |pkg|
+Gem::PackageTask.new(default_spec) do |pkg|
   pkg.need_tar = true
-  #pkg.need_zip = true
 end
 
+# make sure rdoc has been built when packaging
+# why do we ship rdoc as part of the gem?
+Rake::Task[:package].enhance [:rdoc]
 
-# ------- Windows Package ----------
-if RUBY_PLATFORM.match(/win32/)
-  binaries = (FileList['ext/mingw/*.so',
-                       'ext/mingw/*.dll*'])
-
+# Setup Windows Gem
+if RUBY_PLATFORM.match(/win32|mingw32/)
   # Windows specification
   win_spec = default_spec.clone
-  win_spec.extensions = ['ext/mingw/Rakefile']
   win_spec.platform = Gem::Platform::CURRENT
-  win_spec.files += binaries.to_a
+  win_spec.files += Dir.glob('lib/**/*.so')
+  win_spec.instance_variable_set(:@cache_file, nil) # Hack to work around gem issue
+
+  # Unset extensions
+  win_spec.extensions = nil
 
   # Rake task to build the windows package
-  Rake::GemPackageTask.new(win_spec) do |pkg|
+  Gem::PackageTask.new(win_spec) do |pkg|
+    pkg.need_tar = false
   end
 end
 
 # ---------  RDoc Documentation ------
 desc "Generate rdoc documentation"
-Rake::RDocTask.new("rdoc") do |rdoc|
+RDoc::Task.new("rdoc") do |rdoc|
   rdoc.rdoc_dir = 'doc'
   rdoc.title    = "ruby-prof"
   # Show source inline with line numbers
   rdoc.options << "--inline-source" << "--line-numbers"
   # Make the readme file the start page for the generated html
-  rdoc.options << '--main' << 'README'
+  rdoc.options << '--main' << 'README.rdoc'
   rdoc.rdoc_files.include('bin/**/*',
                           'doc/*.rdoc',
                           'examples/flat.txt',
                           'examples/graph.txt',
                           'examples/graph.html',
                           'lib/**/*.rb',
-                          'ext/ruby_prof.c',
-                          'ext/version.h',
-                          'ext/measure_*.h',
-                          'README',
+                          'ext/ruby_prof/ruby_prof.c',
+                          'ext/ruby_prof/version.h',
+                          'ext/ruby_prof/measure_*.h',
+                          'README.rdoc',
                           'LICENSE')
 end
 
-task :default => :package
+task :default => :test
+
+for file in Dir['**/*.{o,so,bundle}']
+  CLEAN.include file
+end
+
+for file in Dir['tmp/*.{txt,dat,png,html}']
+  CLEAN.include file
+end
 
 desc 'Run the ruby-prof test suite'
 Rake::TestTask.new do |t|
@@ -120,4 +107,4 @@ Rake::TestTask.new do |t|
   t.test_files = Dir['test/test_suite.rb']
   t.verbose = true
   t.warning = true
-end
\ No newline at end of file
+end
diff --git a/bin/ruby-prof b/bin/ruby-prof
index b3f72e0..4cd64f2 100755
--- a/bin/ruby-prof
+++ b/bin/ruby-prof
@@ -8,200 +8,322 @@
 #
 # ruby_prof [options] <script.rb> [--] [script-options]"
 #
-# Options:
-#     -p, --printer=printer            Select a printer:
-#                                        flat - Prints a flat profile as text (default).
-#                                        graph - Prints a graph profile as text.
-#                                        graph_html - Prints a graph profile as html.
-#                                        call_tree - format for KCacheGrind
-#     -f, --file=path                  Output results to a file instead of standard out.
-#     -m, --min_percent=min_percent    The minimum percent a method must take before ',
-#                                      being included in output reports.  Should be an
-#                                      integer between 1 and 100.  0 means all methods are printed.
-#         --mode=measure_mode          Select a measurement mode:
-#                                        process - Use process time (default).
-#                                        wall - Use wall time.
-#                                        cpu - Use the CPU clock counter
-#                                              (only supported on Pentium and PowerPCs).
-#                                        allocations - Tracks object allocations
-#                                              (requires a patched Ruby interpreter).
-#                                        memory - Tracks total memory size
-#                                              (requires a patched Ruby interpreter).
-#                                        gc_runs - Tracks number of garbage collection runs
-#                                              (requires a patched Ruby interpreter).
-#                                        gc_time - Tracks time spent doing garbage collection
-#                                              (requires a patched Ruby interpreter).
-#         --replace-progname           Replace $0 when loading the .rb files.
-#         --specialized-instruction    Turn on specialized instruction.
-#     -h, --help                       Show help message
-#         --version                    Show version
-# 
-#
-# See also: {flat profiles}[link:files/examples/flat_txt.html], {graph profiles}[link:files/examples/graph_txt.html], {html graph profiles}[link:files/examples/graph_html.html]
+# Various options:
+#        run "$ ruby-prof --help" to see them
 #
+# See also the readme "reports" section for the various outputs
+
+# First require ruby-prof
+require 'rubygems'
+require 'ruby-prof'
 
+# Now setup option parser
 require 'ostruct'
 require 'optparse'
-require 'ruby-prof'
 
-options = OpenStruct.new
-options.measure_mode = RubyProf::PROCESS_TIME
-options.printer = RubyProf::FlatPrinter
-options.min_percent = 0
-options.file = nil
-options.replace_prog_name = false
-options.specialized_instruction = false
-
-opts = OptionParser.new do |opts|
-  opts.banner = "ruby_prof #{RubyProf::VERSION}\n" +
-                "Usage: ruby_prof [options] <script.rb> [--] [script-options]"
- 
-  opts.separator ""
-  opts.separator "Options:"
-
-    
-  opts.on('-p printer', '--printer=printer', [:flat, :graph, :graph_html, :call_tree],
-          'Select a printer:',
-          '  flat - Prints a flat profile as text (default).',
-          '  graph - Prints a graph profile as text.',
-          '  graph_html - Prints a graph profile as html.',
-          '  call_tree - format for KCacheGrind' ) do |printer|
-
-          
-    case printer
-      when :flat
-        options.printer = RubyProf::FlatPrinter
-      when :graph
-        options.printer = RubyProf::GraphPrinter
-      when :graph_html
-        options.printer = RubyProf::GraphHtmlPrinter
-      when :call_tree
-        options.printer = RubyProf::CallTreePrinter
+module RubyProf
+  class Cmd
+    attr_accessor :options
+
+    def initialize
+      setup_options
+      parse_args
+
+      load_pre_libs
+      load_pre_execs
     end
-  end
-    
-  opts.on('-m min_percent', '--min_percent=min_percent', Float,
-          'The minimum percent a method must take before ',
-          '  being included in output reports.',
-                                        '  this option is not supported for call tree.') do |min_percent|
-    options.min_percent = min_percent
-  end
 
-  opts.on('-f path', '--file=path',
-        'Output results to a file instead of standard out.') do |file|
-    options.file = file
-  end
-    
-  opts.on('--mode=measure_mode',
-      [:process, :wall, :cpu, :allocations, :memory, :gc_runs, :gc_time],
-      'Select what ruby-prof should measure:',
-      '  process - Process time (default).',
-      '  wall - Wall time.',
-      '  cpu - CPU time (Pentium and PowerPCs only).',
-      '  allocations - Object allocations (requires patched Ruby interpreter).',
-      '  memory - Allocated memory in KB (requires patched Ruby interpreter).',
-      '  gc_runs - Number of garbage collections (requires patched Ruby interpreter).',
-      '  gc_time - Time spent in garbage collection (requires patched Ruby interpreter).') do |measure_mode|
-      
-      case measure_mode
-      when :process
-        options.measure_mode = RubyProf::PROCESS_TIME     
-      when :wall
-        options.measure_mode = RubyProf::WALL_TIME      
-      when :cpu
-        options.measure_mode = RubyProf::CPU_TIME
-      when :allocations
-        options.measure_mode = RubyProf::ALLOCATIONS
-      when :memory
-        options.measure_mode = RubyProf::MEMORY
-      when :gc_runs
-        options.measure_mode = RubyProf::GC_RUNS
-      when :gc_time
-        options.measure_mode = RubyProf::GC_TIME
-      end
-  end
-        
-  opts.on("--replace-progname", "Replace $0 when loading the .rb files.") do
+    def setup_options
+      @options = OpenStruct.new
+      options.measure_mode = RubyProf::PROCESS_TIME
+      options.printer = RubyProf::FlatPrinter
+      options.min_percent = 0
+      options.file = nil
+      options.replace_prog_name = false
+      options.specialized_instruction = false
+
+      options.pre_libs = Array.new
+      options.pre_execs = Array.new
+    end
+
+    def option_parser
+      OptionParser.new do |opts|
+        opts.banner = "ruby_prof #{RubyProf::VERSION}\n" +
+            "Usage: ruby-prof [options] <script.rb> [--] [profiled-script-command-line-options]"
+
+        opts.separator ""
+        opts.separator "Options:"
+
+        opts.on('-p printer', '--printer=printer', [:flat, :flat_with_line_numbers, :graph, :graph_html, :call_tree, :call_stack, :dot],
+                'Select a printer:',
+                '  flat - Prints a flat profile as text (default).',
+                '  flat_with_line_numbers - same as flat, with line numbers.',
+                '  graph - Prints a graph profile as text.',
+                '  graph_html - Prints a graph profile as html.',
+                '  call_tree - format for KCacheGrind',
+                '  call_stack - prints a HTML visualization of the call tree',
+                '  dot - Prints a graph profile as a dot file'
+        ) do |printer|
+
+
+          case printer
+          when :flat
+            options.printer = RubyProf::FlatPrinter
+          when :flat_with_line_numbers
+            options.printer = RubyProf::FlatPrinterWithLineNumbers
+          when :graph
+            options.printer = RubyProf::GraphPrinter
+          when :graph_html
+            options.printer = RubyProf::GraphHtmlPrinter
+          when :call_tree
+            options.printer = RubyProf::CallTreePrinter
+          when :call_stack
+            options.printer = RubyProf::CallStackPrinter
+          when :dot
+            options.printer = RubyProf::DotPrinter
+          end
+        end
+
+        opts.on('-m min_percent', '--min_percent=min_percent', Float,
+                'The minimum percent a method must take before ',
+                '  being included in output reports.',
+                '  this option is not supported for call tree.') do |min_percent|
+          options.min_percent = min_percent
+        end
+
+        opts.on('-f path', '--file=path',
+                'Output results to a file instead of standard out.') do |file|
+          options.file = file
+          options.old_wd = Dir.pwd
+        end
+
+        opts.on('--mode=measure_mode',
+                [:process, :wall, :cpu, :allocations, :memory, :gc_runs, :gc_time],
+                'Select what ruby-prof should measure:',
+                '  process - Process time (default).',
+                '  wall - Wall time.',
+                '  cpu - CPU time (Pentium and PowerPCs only).',
+                '  allocations - Object allocations (requires patched Ruby interpreter).',
+                '  memory - Allocated memory in KB (requires patched Ruby interpreter).',
+                '  gc_runs - Number of garbage collections (requires patched Ruby interpreter).',
+                '  gc_time - Time spent in garbage collection (requires patched Ruby interpreter).') do |measure_mode|
+
+          case measure_mode
+          when :process
+            options.measure_mode = RubyProf::PROCESS_TIME
+          when :wall
+            options.measure_mode = RubyProf::WALL_TIME
+          when :cpu
+            options.measure_mode = RubyProf::CPU_TIME
+          when :allocations
+            options.measure_mode = RubyProf::ALLOCATIONS
+          when :memory
+            options.measure_mode = RubyProf::MEMORY
+          when :gc_runs
+            options.measure_mode = RubyProf::GC_RUNS
+          when :gc_time
+            options.measure_mode = RubyProf::GC_TIME
+          end
+        end
+
+        opts.on('-s sort_mode', '--sort=sort_mode', [:total, :self, :wait, :child],
+                'Select how ruby-prof results should be sorted:',
+                '  total - Total time',
+                '  self - Self time',
+                '  wait - Wait time',
+                '  child - Child time') do |sort_mode|
+
+          options.sort_method = case sort_mode
+                                when :total
+                                  :total_time
+                                when :self
+                                  :self_time
+                                when :wait
+                                  :wait_time
+                                when :child
+                                  :children_time
+                                end
+        end
+
+        opts.on("--replace-progname", "Replace $0 when loading the .rb files.") do
           options.replace_prog_name = true
-  end
+        end
 
-  if defined?(VM)
-    opts.on("--specialized-instruction", "Turn on specified instruction.") do
+        if defined?(VM)
+          opts.on("--specialized-instruction", "Turn on specified instruction.") do
             options.specialized_instruction = true
+          end
+        end
+
+        opts.on_tail("-h", "--help", "Show help message") do
+          puts opts
+          exit
+        end
+
+        opts.on_tail("--version", "Show version #{RubyProf::VERSION}") do
+          puts "ruby_prof " + RubyProf::VERSION
+          exit
+        end
+
+        opts.on("-v","Show version, set $VERBOSE to true, profile script if option given") do
+          puts "ruby version: " + [RUBY_PATCHLEVEL, RUBY_PLATFORM, RUBY_VERSION].join(' ')
+          $VERBOSE = true
+        end
+
+        opts.on("-d", "Set $DEBUG to true") do
+          $DEBUG = true
+        end
+
+        opts.on('-R lib', '--require-noprof lib', 'require a specific library (not profiled)') do |lib|
+          options.pre_libs << lib
+        end
+
+        opts.on('-E code', '--eval-noprof code', 'execute the ruby statements (not profiled)') do |code|
+          options.pre_execs << code
+        end
+
+        opts.on('-x regexp', '--exclude regexp', 'exclude methods by regexp (see method elimination)') do|meth|
+          options.eliminate_methods ||= []
+          options.eliminate_methods << Regexp.new(meth)
+        end
+
+        opts.on('-X file', '--exclude-file file', 'exclude methods by regexp listed in file (see method elimination)') do|file|
+          options.eliminate_methods_files ||= []
+          options.eliminate_methods_files << file
+        end
+
+        opts.on('--exclude-common-cycles', 'make common iterators like Integer#times appear inlined') do |meth|
+          options.eliminate_methods ||= []
+          options.eliminate_methods += %w{
+            Integer#times
+            Integer#upto
+            Integer#downto
+            Enumerator#each
+            Enumerator#each_with_index
+            Enumerator#each_with_object
+
+            Array#each
+            Array#each_index
+            Array#reverse_each
+            Array#map
+
+            Hash#each
+            Hash#each_pair
+            Hash#each_key
+            Hash#each_value
+
+            Range#each
+            Enumerable#each_cons
+            Enumerable#each_entry
+            Enumerable#each_slice
+            Enumerable#each_with_index
+            Enumerable#each_with_object
+            Enumerable#reverse_each
+            Enumerable#inject
+            Enumerable#collect
+            Enumerable#reduce
+          }
+          #TODO: may be the whole Enumerable module should be excluded via 'Enumerable#.*', we need feedback on use cases.
+        end
+
+        opts.on('--exclude-common-callbacks', 'make common callbacks invocations like Integer#times appear inlined so you can see call origins in graph') do|meth|
+          options.eliminate_methods ||= []
+          options.eliminate_methods += %w{
+            Method#call
+            Proc#call
+            ActiveSupport::Callbacks::ClassMethods#__run_callback
+          }
+        end
+      end
     end
-  end
-    
-  opts.on_tail("-h", "--help", "Show help message") do
-      puts opts
-      exit
-  end
-  
-  opts.on_tail("-v", "--version", "Show version") do
-      puts "ruby_prof " + RubyProf::VERSION
-      exit
-  end
-end
 
-begin
-  opts.parse! ARGV
-rescue OptionParser::InvalidOption, OptionParser::InvalidArgument,
-       OptionParser::MissingArgument => e
-  puts opts
-  puts
-  puts e.message
-  exit(-1)
-end
+    def parse_args
+      # Make sure the user specified at least one file
+      if ARGV.length < 1 and not options.exec
+        puts self.option_parser
+        puts ""
+        puts "Must specify a script to run"
+        exit(-1)
+      end
+
+      self.option_parser.parse! ARGV
+    rescue OptionParser::InvalidOption, OptionParser::InvalidArgument, OptionParser::MissingArgument => e
+      puts self.option_parser
+      puts e.message
+      exit(-1)
+    end
+
+    def load_pre_libs
+      options.pre_libs.each do |lib|
+        require lib
+      end
+    end
+
+    def load_pre_execs
+      options.pre_execs.each do |exec|
+        eval(exec)
+      end
+    end
 
-# Make sure the user specified at least one file
-if ARGV.length < 1
-  puts opts
-  puts ""
-  puts "Must specify a script to run"
-  exit(-1)
+    def run
+      # Get the script we will execute
+      script = ARGV.shift
+      if options.replace_prog_name
+        $0 = File.expand_path(script)
+      end
+
+      # Set VM compile option
+      if defined?(VM)
+        VM::InstructionSequence.compile_option = {
+            :trace_instruction => true,
+            :specialized_instruction => options.specialized_instruction
+        }
+      end
+
+      # Set the measure mode
+      RubyProf.measure_mode = options.measure_mode
+      RubyProf.start_script(script)
+    end
+  end
 end
 
+# Parse command line options
+cmd = RubyProf::Cmd.new
 
-# Install at_exit handler.  It is important that we do this 
+# Install at_exit handler.  It is important that we do this
 # before loading the scripts so our at_exit handler run
-# *after* any other one that will be installed. 
+# *after* any other one that will be installed.
 
 at_exit {
   # Stop profiling
   result = RubyProf.stop
 
+  # Eliminate unwanted methods from call graph
+  if cmd.options.eliminate_methods
+    result.eliminate_methods!(cmd.options.eliminate_methods)
+  end
+
+  if cmd.options.eliminate_methods_files
+    cmd.options.eliminate_methods_files.each {|f| result.eliminate_methods!(f)}
+  end
+
   # Create a printer
-  printer = options.printer.new(result)
+  printer = cmd.options.printer.new(result)
+  printer_options = {:min_percent => cmd.options.min_percent, :sort_method => cmd.options.sort_method}
 
   # Get output
-  if options.file
-    File.open(options.file, 'w') do |file|
-      printer.print(file, {:min_percent => options.min_percent})
+  if cmd.options.file
+    # write it relative to the dir they *started* in, as it's a bit surprising to write it in the dir they end up in.
+    Dir.chdir(cmd.options.old_wd) do
+      File.open(cmd.options.file, 'w') do |file|
+        printer.print(file, printer_options)
+      end
     end
   else
-    # Print out results 
-    printer.print(STDOUT, {:min_percent => options.min_percent})
+    # Print out results
+    printer.print(STDOUT, printer_options)
   end
 }
 
-# Now set measure mode
-RubyProf.measure_mode = options.measure_mode
-
-# Set VM compile option
-if defined?(VM)
-  VM::InstructionSequence.compile_option = {
-    :trace_instruction => true,
-    :specialized_instruction => options.specialized_instruction
-  }
-end
-
-# Get the script we will execute
-script = ARGV.shift
-if options.replace_prog_name
-  $0 = File.expand_path(script)
-end
-
-# Start profiling
-RubyProf.start 
-
-# Load the script
-load script
\ No newline at end of file
+# Now profile some code
+cmd.run
\ No newline at end of file
diff --git a/checksums.yaml.gz b/checksums.yaml.gz
new file mode 100644
index 0000000..e8572ea
Binary files /dev/null and b/checksums.yaml.gz differ
diff --git a/doc/LICENSE.html b/doc/LICENSE.html
new file mode 100644
index 0000000..2ac504f
--- /dev/null
+++ b/doc/LICENSE.html
@@ -0,0 +1,155 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+
+<title>LICENSE - ruby-prof</title>
+
+<link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">
+
+<script type="text/javascript">
+  var rdoc_rel_prefix = "./";
+</script>
+
+<script type="text/javascript" charset="utf-8" src="./js/jquery.js"></script>
+<script type="text/javascript" charset="utf-8" src="./js/navigation.js"></script>
+<script type="text/javascript" charset="utf-8" src="./js/search_index.js"></script>
+<script type="text/javascript" charset="utf-8" src="./js/search.js"></script>
+<script type="text/javascript" charset="utf-8" src="./js/searcher.js"></script>
+<script type="text/javascript" charset="utf-8" src="./js/darkfish.js"></script>
+
+
+<body class="file">
+<nav id="metadata">
+  <nav id="home-section" class="section">
+  <h3 class="section-header">
+    <a href="./index.html">Home</a>
+    <a href="./table_of_contents.html#classes">Classes</a>
+    <a href="./table_of_contents.html#methods">Methods</a>
+  </h3>
+</nav>
+
+
+  <nav id="search-section" class="section project-section" class="initially-hidden">
+  <form action="#" method="get" accept-charset="utf-8">
+    <h3 class="section-header">
+      <input type="text" name="search" placeholder="Search" id="search-field"
+             title="Type to search, Up and Down to navigate, Enter to load">
+    </h3>
+  </form>
+
+  <ul id="search-results" class="initially-hidden"></ul>
+</nav>
+
+
+  <div id="project-metadata">
+    <nav id="fileindex-section" class="section project-section">
+  <h3 class="section-header">Pages</h3>
+
+  <ul>
+  
+    <li class="file"><a href="./LICENSE.html">LICENSE</a>
+  
+    <li class="file"><a href="./README_rdoc.html">README</a>
+  
+    <li class="file"><a href="./examples/flat_txt.html">flat</a>
+  
+    <li class="file"><a href="./examples/graph_txt.html">graph</a>
+  
+  </ul>
+</nav>
+
+    <nav id="classindex-section" class="section project-section">
+  <h3 class="section-header">Class and Module Index</h3>
+
+  <ul class="link-list">
+  
+    <li><a href="./RubyProf.html">RubyProf</a>
+  
+    <li><a href="./RubyProf/AbstractPrinter.html">RubyProf::AbstractPrinter</a>
+  
+    <li><a href="./RubyProf/AggregateCallInfo.html">RubyProf::AggregateCallInfo</a>
+  
+    <li><a href="./RubyProf/CallInfo.html">RubyProf::CallInfo</a>
+  
+    <li><a href="./RubyProf/CallInfoPrinter.html">RubyProf::CallInfoPrinter</a>
+  
+    <li><a href="./RubyProf/CallInfoVisitor.html">RubyProf::CallInfoVisitor</a>
+  
+    <li><a href="./RubyProf/CallStackPrinter.html">RubyProf::CallStackPrinter</a>
+  
+    <li><a href="./RubyProf/CallTreePrinter.html">RubyProf::CallTreePrinter</a>
+  
+    <li><a href="./RubyProf/Cmd.html">RubyProf::Cmd</a>
+  
+    <li><a href="./RubyProf/DotPrinter.html">RubyProf::DotPrinter</a>
+  
+    <li><a href="./RubyProf/FlatPrinter.html">RubyProf::FlatPrinter</a>
+  
+    <li><a href="./RubyProf/FlatPrinterWithLineNumbers.html">RubyProf::FlatPrinterWithLineNumbers</a>
+  
+    <li><a href="./RubyProf/GraphHtmlPrinter.html">RubyProf::GraphHtmlPrinter</a>
+  
+    <li><a href="./RubyProf/GraphPrinter.html">RubyProf::GraphPrinter</a>
+  
+    <li><a href="./RubyProf/MethodInfo.html">RubyProf::MethodInfo</a>
+  
+    <li><a href="./RubyProf/MultiPrinter.html">RubyProf::MultiPrinter</a>
+  
+    <li><a href="./RubyProf/Profile.html">RubyProf::Profile</a>
+  
+    <li><a href="./RubyProf/ProfileTask.html">RubyProf::ProfileTask</a>
+  
+    <li><a href="./RubyProf/Test.html">RubyProf::Test</a>
+  
+    <li><a href="./RubyProf/Thread.html">RubyProf::Thread</a>
+  
+    <li><a href="./Rack.html">Rack</a>
+  
+    <li><a href="./Rack/RubyProf.html">Rack::RubyProf</a>
+  
+  </ul>
+</nav>
+
+  </div>
+</nav>
+
+<div id="documentation" class="description">
+  
+<p>Copyright (C) 2005 - 20011 Shugo Maeda <shugo at ruby-lang.org> and
+Charlie Savage <cfis at savagexi.com> All rights reserved.</p>
+
+<p>Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:</p>
+<ol><li>
+<p>Redistributions of source code must retain the above copyright notice, this
+list of conditions and the following disclaimer.</p>
+</li><li>
+<p>Redistributions in binary form must reproduce the above copyright notice,
+this list of conditions and the following disclaimer in the documentation
+and/or other materials provided with the distribution.</p>
+</li></ol>
+
+<p>THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS “AS IS''
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGE.</p>
+
+</div>
+
+
+
+<footer id="validator-badges">
+  <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
+  <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.1.
+  <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
+</footer>
+
diff --git a/doc/README_rdoc.html b/doc/README_rdoc.html
new file mode 100644
index 0000000..c170b68
--- /dev/null
+++ b/doc/README_rdoc.html
@@ -0,0 +1,648 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+
+<title>README - ruby-prof</title>
+
+<link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">
+
+<script type="text/javascript">
+  var rdoc_rel_prefix = "./";
+</script>
+
+<script type="text/javascript" charset="utf-8" src="./js/jquery.js"></script>
+<script type="text/javascript" charset="utf-8" src="./js/navigation.js"></script>
+<script type="text/javascript" charset="utf-8" src="./js/search_index.js"></script>
+<script type="text/javascript" charset="utf-8" src="./js/search.js"></script>
+<script type="text/javascript" charset="utf-8" src="./js/searcher.js"></script>
+<script type="text/javascript" charset="utf-8" src="./js/darkfish.js"></script>
+
+
+<body class="file">
+<nav id="metadata">
+  <nav id="home-section" class="section">
+  <h3 class="section-header">
+    <a href="./index.html">Home</a>
+    <a href="./table_of_contents.html#classes">Classes</a>
+    <a href="./table_of_contents.html#methods">Methods</a>
+  </h3>
+</nav>
+
+
+  <nav id="search-section" class="section project-section" class="initially-hidden">
+  <form action="#" method="get" accept-charset="utf-8">
+    <h3 class="section-header">
+      <input type="text" name="search" placeholder="Search" id="search-field"
+             title="Type to search, Up and Down to navigate, Enter to load">
+    </h3>
+  </form>
+
+  <ul id="search-results" class="initially-hidden"></ul>
+</nav>
+
+
+  <div id="project-metadata">
+    <nav id="fileindex-section" class="section project-section">
+  <h3 class="section-header">Pages</h3>
+
+  <ul>
+  
+    <li class="file"><a href="./LICENSE.html">LICENSE</a>
+  
+    <li class="file"><a href="./README_rdoc.html">README</a>
+  
+    <li class="file"><a href="./examples/flat_txt.html">flat</a>
+  
+    <li class="file"><a href="./examples/graph_txt.html">graph</a>
+  
+  </ul>
+</nav>
+
+    <nav id="classindex-section" class="section project-section">
+  <h3 class="section-header">Class and Module Index</h3>
+
+  <ul class="link-list">
+  
+    <li><a href="./RubyProf.html">RubyProf</a>
+  
+    <li><a href="./RubyProf/AbstractPrinter.html">RubyProf::AbstractPrinter</a>
+  
+    <li><a href="./RubyProf/AggregateCallInfo.html">RubyProf::AggregateCallInfo</a>
+  
+    <li><a href="./RubyProf/CallInfo.html">RubyProf::CallInfo</a>
+  
+    <li><a href="./RubyProf/CallInfoPrinter.html">RubyProf::CallInfoPrinter</a>
+  
+    <li><a href="./RubyProf/CallInfoVisitor.html">RubyProf::CallInfoVisitor</a>
+  
+    <li><a href="./RubyProf/CallStackPrinter.html">RubyProf::CallStackPrinter</a>
+  
+    <li><a href="./RubyProf/CallTreePrinter.html">RubyProf::CallTreePrinter</a>
+  
+    <li><a href="./RubyProf/Cmd.html">RubyProf::Cmd</a>
+  
+    <li><a href="./RubyProf/DotPrinter.html">RubyProf::DotPrinter</a>
+  
+    <li><a href="./RubyProf/FlatPrinter.html">RubyProf::FlatPrinter</a>
+  
+    <li><a href="./RubyProf/FlatPrinterWithLineNumbers.html">RubyProf::FlatPrinterWithLineNumbers</a>
+  
+    <li><a href="./RubyProf/GraphHtmlPrinter.html">RubyProf::GraphHtmlPrinter</a>
+  
+    <li><a href="./RubyProf/GraphPrinter.html">RubyProf::GraphPrinter</a>
+  
+    <li><a href="./RubyProf/MethodInfo.html">RubyProf::MethodInfo</a>
+  
+    <li><a href="./RubyProf/MultiPrinter.html">RubyProf::MultiPrinter</a>
+  
+    <li><a href="./RubyProf/Profile.html">RubyProf::Profile</a>
+  
+    <li><a href="./RubyProf/ProfileTask.html">RubyProf::ProfileTask</a>
+  
+    <li><a href="./RubyProf/Test.html">RubyProf::Test</a>
+  
+    <li><a href="./RubyProf/Thread.html">RubyProf::Thread</a>
+  
+    <li><a href="./Rack.html">Rack</a>
+  
+    <li><a href="./Rack/RubyProf.html">Rack::RubyProf</a>
+  
+  </ul>
+</nav>
+
+  </div>
+</nav>
+
+<div id="documentation" class="description">
+  
+<h1 id="label-ruby-prof">ruby-prof</h1>
+
+<p><a href="https://travis-ci.org/ruby-prof/ruby-prof"><img
+src="https://travis-ci.org/ruby-prof/ruby-prof.png?branch=master"
+alt="Build Status" /></a></p>
+
+<h2 id="label-Overview">Overview</h2>
+
+<p>ruby-prof is a fast code profiler for Ruby.  Its features include:</p>
+<ul><li>
+<p>Speed - it is a C extension and therefore many times faster than the
+standard Ruby profiler.</p>
+</li><li>
+<p>Modes - Ruby prof can measure a number of different parameters, including
+call times, memory usage and object allocations.</p>
+</li><li>
+<p>Reports - can generate text and cross-referenced html reports</p>
+<ul><li>
+<p>Flat Profiles - similar to the reports generated by the standard Ruby
+profiler</p>
+</li><li>
+<p>Graph profiles - similar to GProf, these show how long a method runs, which
+methods call it and which methods it calls.</p>
+</li><li>
+<p>Call tree profiles - outputs results in the calltree format suitable for
+the KCacheGrind profiling tool.</p>
+</li><li>
+<p>Many more – see reports section of this <a
+href="README_rdoc.html">README</a>.</p>
+</li></ul>
+</li><li>
+<p>Threads - supports profiling multiple threads simultaneously</p>
+</li></ul>
+
+<h2 id="label-Requirements">Requirements</h2>
+
+<p>ruby-prof requires Ruby 1.8.7 or 1.9.2 and higher.</p>
+
+<p>If you are running Linux or Unix you'll need a C compiler so the
+extension can be compiled when it is installed.</p>
+
+<p>If you are running Windows, then you may need to install the Windows
+specific RubyGem which includes an already built extension (see Install
+section).</p>
+
+<h2 id="label-Install">Install</h2>
+
+<p>The easiest way to install ruby-prof is by using Ruby Gems.  To install:</p>
+
+<pre>gem install ruby-prof</pre>
+
+<p>If you're on windows then a prebuilt binary gem is available.  You may
+of course compile it yourself via use of devkit on MinGW.</p>
+
+<h2 id="label-Usage">Usage</h2>
+
+<p>There are two ways of running ruby-prof, via the command line or via its
+API.</p>
+
+<h3 id="label-ruby-prof+executable">ruby-prof executable</h3>
+
+<p>The first is to use ruby-prof to run the Ruby program you want to profile.
+For more information refer to the documentation of the ruby-prof command.</p>
+
+<h3 id="label-ruby-prof+API">ruby-prof API</h3>
+
+<p>The second way is to use the ruby-prof API to profile particular segments
+of code.</p>
+
+<pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">'ruby-prof'</span>
+
+<span class="ruby-comment"># Profile the code</span>
+<span class="ruby-constant">RubyProf</span>.<span class="ruby-identifier">start</span>
+<span class="ruby-operator">...</span>
+[<span class="ruby-identifier">code</span> <span class="ruby-identifier">to</span> <span class="ruby-identifier">profile</span>]
+<span class="ruby-operator">...</span>
+<span class="ruby-identifier">result</span> = <span class="ruby-constant">RubyProf</span>.<span class="ruby-identifier">stop</span>
+
+<span class="ruby-comment"># Print a flat profile to text</span>
+<span class="ruby-identifier">printer</span> = <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">FlatPrinter</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">result</span>)
+<span class="ruby-identifier">printer</span>.<span class="ruby-identifier">print</span>(<span class="ruby-constant">STDOUT</span>)
+</pre>
+
+<p>Alternatively, you can use a block to tell ruby-prof what to profile:</p>
+
+<pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">'ruby-prof'</span>
+
+<span class="ruby-comment"># Profile the code</span>
+<span class="ruby-identifier">result</span> = <span class="ruby-constant">RubyProf</span>.<span class="ruby-identifier">profile</span> <span class="ruby-keyword">do</span>
+  <span class="ruby-operator">...</span>
+  [<span class="ruby-identifier">code</span> <span class="ruby-identifier">to</span> <span class="ruby-identifier">profile</span>]
+  <span class="ruby-operator">...</span>
+<span class="ruby-keyword">end</span>
+
+<span class="ruby-comment"># Print a graph profile to text</span>
+<span class="ruby-identifier">printer</span> = <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">GraphPrinter</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">result</span>)
+<span class="ruby-identifier">printer</span>.<span class="ruby-identifier">print</span>(<span class="ruby-constant">STDOUT</span>, {})
+</pre>
+
+<p>ruby-prof also supports pausing and resuming profiling runs.</p>
+
+<pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">'ruby-prof'</span>
+
+<span class="ruby-comment"># Profile the code</span>
+<span class="ruby-constant">RubyProf</span>.<span class="ruby-identifier">start</span>
+[<span class="ruby-identifier">code</span> <span class="ruby-identifier">to</span> <span class="ruby-identifier">profile</span>]
+<span class="ruby-constant">RubyProf</span>.<span class="ruby-identifier">pause</span>
+[<span class="ruby-identifier">other</span> <span class="ruby-identifier">code</span>]
+<span class="ruby-constant">RubyProf</span>.<span class="ruby-identifier">resume</span>
+[<span class="ruby-identifier">code</span> <span class="ruby-identifier">to</span> <span class="ruby-identifier">profile</span>]
+<span class="ruby-identifier">result</span> = <span class="ruby-constant">RubyProf</span>.<span class="ruby-identifier">stop</span>
+</pre>
+
+<p>Note that resume will automatically call start if a profiling run has not
+yet started.  In addition, resume can also take a block:</p>
+
+<pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">'ruby-prof'</span>
+
+<span class="ruby-comment"># Profile the code</span>
+<span class="ruby-constant">RubyProf</span>.<span class="ruby-identifier">resume</span> <span class="ruby-keyword">do</span>
+  [<span class="ruby-identifier">code</span> <span class="ruby-identifier">to</span> <span class="ruby-identifier">profile</span>]
+<span class="ruby-keyword">end</span>
+
+<span class="ruby-identifier">data</span> = <span class="ruby-constant">RubyProf</span>.<span class="ruby-identifier">stop</span>
+</pre>
+
+<p>With this usage, resume will automatically call pause at the end of the
+block.</p>
+
+<h2 id="label-Method+and+Thread+Elimination">Method and Thread Elimination</h2>
+
+<p>ruby-prof supports eliminating specific methods and threads from profiling
+results. This is useful for reducing connectivity in the call graph, making
+it easier to identify the source of performance problems when using a graph
+printer.</p>
+
+<p>For example, consider Integer#times: it's hardly ever useful to know
+how much time is spent in the method itself. We're much more interested
+in how much the passed in block contributes to the time spent in the method
+which contains the Integer#times call.</p>
+
+<p>Methods are eliminated from the collected data by calling
+`eliminate_methods!` on the profiling result, before submitting it to a
+printer.</p>
+
+<pre>result = RubyProf.stop
+result.eliminate_methods!([/Integer#times/])</pre>
+
+<p>The argument given to `eliminate_methods!` is either an array of regular
+expressions, or the name of a file containing a list of regular expressions
+(line separated text).</p>
+
+<p>After eliminating methods the resulting profile will appear exactly as if
+those methods had been inlined at their call sites.</p>
+
+<p>In a similar manner, threads can be excluded so they are not profiled at
+all.  To do this, pass an array of threads to exclude to ruby-prof:</p>
+
+<pre>RubyProf::exclude_threads = [ thread2 ]
+RubyProf.start</pre>
+
+<p>Note that the excluded threads must be specified <strong>before</strong>
+profiling.</p>
+
+<h2 id="label-Benchmarking+full+load+time+including+rubygems+startup+cost+%3D%3D">Benchmarking full load time including rubygems startup cost ==</h2>
+
+<p>If you want to get a more accurate measurement of what takes all of a
+gem's bin/xxx command to load, you may want to also measure
+rubygems' startup penalty. You can do this by calling into
+bin/ruby-prof directly, ex:</p>
+
+<p>$ gem which ruby-prof</p>
+
+<pre>g:/192/lib/ruby/gems/1.9.1/gems/ruby-prof-0.10.2/lib/ruby-prof.rb</pre>
+
+<p>now run it thus (substitute lib/ruby-prof.rb with bin/ruby-prof):</p>
+
+<p>$ ruby g:/192/lib/ruby/gems/1.9.1/gems/ruby-prof-0.10.2/bin/ruby-prof
+g:192binsome_installed_gem_command</p>
+
+<p>or</p>
+
+<p>$ ruby g:/192/lib/ruby/gems/1.9.1/gems/ruby-prof-0.10.2/bin/ruby-prof
+./some_file_that_does_a_require_rubygems_at_the_beginning.rb</p>
+
+<h2 id="label-Profiling+Tests">Profiling Tests</h2>
+
+<p>ruby-prof supports profiling tests cases written using Ruby's built-in
+unit test framework (ie, test derived from Test::Unit::TestCase).  To
+enable profiling simply add the following line of code to within your test
+class:</p>
+
+<pre>include RubyProf::Test</pre>
+
+<p>Each test method is profiled separately.  ruby-prof will run each test
+method once as a warmup and then ten additional times to gather profile
+data. Note that the profile data will <strong>not</strong> include the
+class's setup or teardown methods.</p>
+
+<p>Separate reports are generated for each method and saved, by default, in
+the test process's working directory.  To change this, or other
+profiling options, modify your test class's PROFILE_OPTIONS hash table.
+To globally change test profiling options, modify
+RubyProf::Test::PROFILE_OPTIONS.</p>
+
+<h2 id="label-Profiling+Rails">Profiling Rails</h2>
+
+<p>To profile a Rails application it is vital to run it using production like
+settings (cache classes, cache view lookups, etc.).  Otherwise, Rail's
+dependency loading code will overwhelm any time spent in the application
+itself (our tests show that Rails dependency loading causes a roughly 6x
+slowdown).  The best way to do this is create a new Rails environment,
+profile.rb.</p>
+
+<p>So to profile Rails:</p>
+<ol><li>
+<p>Create a new profile.rb environment.  Make sure to turn on cache_classes
+and cache_template_loading.  Otherwise your profiling results will be
+overwhelemed by the time Rails spends loading required files.  You should
+likely turn off caching.</p>
+</li><li>
+<p>Add the ruby-prof to your gemfile:</p>
+
+<pre>group :profile do
+  gem 'ruby-prof'
+end</pre>
+</li><li>
+<p>Add the ruby prof rack adapter to your middleware stack.  One way to do
+this is by adding the following code to config.ru:</p>
+
+<pre class="ruby"><span class="ruby-keyword">if</span> <span class="ruby-constant">Rails</span>.<span class="ruby-identifier">env</span>.<span class="ruby-identifier">profile?</span>
+  <span class="ruby-identifier">use</span> <span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">RubyProf</span>, :<span class="ruby-identifier">path</span> =<span class="ruby-operator">></span> <span class="ruby-string">'/temp/profile'</span>
+<span class="ruby-keyword">end</span>
+</pre>
+
+<p>The path is where you want profiling results to be stored.  By default the
+rack adapter will generate a html call graph report and flat text report.</p>
+</li><li>
+<p>Now make a request to your running server.  New profiling information will
+be generated for each request.  Note that each request will overwrite the
+profiling reports created by the previous request!</p>
+</li></ol>
+
+<h2 id="label-Reports">Reports</h2>
+
+<p>ruby-prof can generate a number of different reports:</p>
+<ul><li>
+<p>Flat Reports</p>
+</li><li>
+<p>Graph Reports</p>
+</li><li>
+<p>HTML Graph Reports</p>
+</li><li>
+<p>Call graphs</p>
+</li><li>
+<p>Call stack reports</p>
+</li><li>
+<p>More!</p>
+</li></ul>
+
+<p>Flat profiles show the overall time spent in each method. They are a good
+of quickly identifying which methods take the most time. An example of a
+flat profile and an explanation can be found in <a
+href="http://github.com/ruby-prof/ruby-prof/tree/master/examples/flat.txt">examples/flat.txt</a>.</p>
+
+<p>There are several varieties of these – run $ ruby-prof –help</p>
+
+<p>Graph profiles also show the overall time spent in each method. In
+addition, they also show which methods call the current method and which
+methods its calls.  Thus they are good for understanding how methods gets
+called and provide insight into the flow of your program. An example text
+graph profile is located at <a
+href="http://github.com/ruby-prof/ruby-prof/tree/master/examples/graph.txt">examples/graph.txt</a>.</p>
+
+<p>HTML Graph profiles are the same as graph profiles, except output is
+generated in hyper-linked HTML. Since graph profiles can be quite large,
+the embedded links make it much easier to navigate the results. An example
+html graph profile is located at <a
+href="http://github.com/ruby-prof/ruby-prof/tree/master/examples/graph.html">examples/graph.html</a>.</p>
+
+<p>Call graphs output results in the calltree profile format which is used by
+KCachegrind. Call graph support was generously donated by Carl Shimer. More
+information about the format can be found at the <a
+href="http://kcachegrind.sourceforge.net/cgi-bin/show.cgi/KcacheGrindCalltreeFormat">KCachegrind</a>
+site.</p>
+
+<p>Call stack reports produce a HTML visualization of the time spent in each
+execution path of the profiled code. An example can be found at <a
+href="http://github.com/ruby-prof/ruby-prof/tree/master/examples/call_stack.html">examples/stack.html</a>.</p>
+
+<p>Another good example: [<a
+href="http://twitpic.com/28z94a">twitpic.com/28z94a</a>]</p>
+
+<p>Finally, there's a so called MultiPrinter which can generate several
+reports in one profiling run. See <a
+href="http://github.com/ruby-prof/ruby-prof/tree/master/examples/multi.stack.html">examples/multi.stack.html</a>.</p>
+
+<p>There is also a graphviz .dot visualiser.</p>
+
+<h2 id="label-Printers">Printers</h2>
+
+<p>Reports are created by printers.  Supported printers include:</p>
+<ul><li>
+<p><a href="RubyProf/FlatPrinter.html">RubyProf::FlatPrinter</a> - Creates a
+flat report in text format</p>
+</li><li>
+<p><a
+href="RubyProf/FlatPrinterWithLineNumbers.html">RubyProf::FlatPrinterWithLineNumbers</a>
+- same as above but more verbose</p>
+</li><li>
+<p><a href="RubyProf/GraphPrinter.html">RubyProf::GraphPrinter</a> - Creates a
+call graph report in text format</p>
+</li><li>
+<p><a href="RubyProf/GraphHtmlPrinter.html">RubyProf::GraphHtmlPrinter</a> -
+Creates a call graph report in HTML (separate files per thread)</p>
+</li><li>
+<p><a href="RubyProf/DotPrinter.html">RubyProf::DotPrinter</a> - Creates a
+call graph report in GraphViz's DOT format which can be converted to an
+image</p>
+</li><li>
+<p><a href="RubyProf/CallTreePrinter.html">RubyProf::CallTreePrinter</a> -
+Creates a call tree report compatible with KCachegrind.</p>
+</li><li>
+<p><a href="RubyProf/CallStackPrinter.html">RubyProf::CallStackPrinter</a> -
+Creates a HTML visualization of the Ruby stack</p>
+</li><li>
+<p><a href="RubyProf/MultiPrinter.html">RubyProf::MultiPrinter</a> - Uses the
+other printers to create several reports in one profiling run</p>
+</li><li>
+<p>More!</p>
+</li></ul>
+
+<p>To use a printer:</p>
+
+<pre class="ruby"><span class="ruby-operator">...</span>
+<span class="ruby-identifier">result</span> = <span class="ruby-constant">RubyProf</span>.<span class="ruby-identifier">stop</span>
+<span class="ruby-identifier">printer</span> = <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">GraphPrinter</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">result</span>)
+<span class="ruby-identifier">printer</span>.<span class="ruby-identifier">print</span>(<span class="ruby-constant">STDOUT</span>, :<span class="ruby-identifier">min_percent</span> =<span class="ruby-operator">></span> <span class="ruby-value">2</span>)
+</pre>
+
+<p>The first parameter is any writable IO object such as STDOUT or a file. The
+second parameter, specifies the minimum percentage a method must take to be
+printed.  Percentages should be specified as integers in the range 0 to
+100. For more information please see the documentation for the different
+printers.</p>
+
+<p>The other option is :print_file => true (default false), which adds the
+filename to the output (GraphPrinter only).</p>
+
+<p>The MultiPrinter differs from the other printers in that it requires a
+directory path and a basename for the files it produces.</p>
+
+<pre class="ruby"><span class="ruby-identifier">printer</span> = <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">MultiPrinter</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">result</span>)
+<span class="ruby-identifier">printer</span>.<span class="ruby-identifier">print</span>(:<span class="ruby-identifier">path</span> =<span class="ruby-operator">></span> <span class="ruby-string">"."</span>, :<span class="ruby-identifier">profile</span> =<span class="ruby-operator">></span> <span class="ruby-string">"profile"</span>)
+</pre>
+
+<h2 id="label-Measurements">Measurements</h2>
+
+<p>Depending on the mode and platform, ruby-prof can measure various aspects
+of a Ruby program.  Supported measurements include:</p>
+<ul><li>
+<p>process time (RubyProf::PROCESS_TIME)</p>
+</li><li>
+<p>wall time (RubyProf::WALL_TIME)</p>
+</li><li>
+<p>cpu time (RubyProf::CPU_TIME)</p>
+</li><li>
+<p>object allocations (RubyProf::ALLOCATIONS)</p>
+</li><li>
+<p>memory usage (RubyProf::MEMORY)</p>
+</li><li>
+<p>garbage collections runs (RubyProf::GC_RUNS)</p>
+</li><li>
+<p>garbage collection time (RubyProf::GC_TIME)</p>
+</li></ul>
+
+<p>Process time measures the time used by a process between any two moments.
+It is unaffected by other processes concurrently running on the system.
+Note that Windows does not support measuring process times - therefore,
+measurements on Windows defaults to wall time.</p>
+
+<p>Wall time measures the real-world time elapsed between any two moments. If
+there are other processes concurrently running on the system that use
+significant CPU or disk time during a profiling run then the reported
+results will be too large.</p>
+
+<p>CPU time uses the CPU clock counter to measure time.  The returned values
+are dependent on the correctly setting the CPU's frequency. This mode
+is only supported on Pentium or PowerPC platforms (linux only).</p>
+
+<p>Object allocation reports show how many objects each method in a program
+allocates.  This support was added by Sylvain Joyeux and requires a patched
+Ruby interpreter.  For more information and the patch, please see: <a
+href="http://rubyforge.org/tracker/index.php?func=detail&aid=11497&group_id=426&atid=1700">rubyforge.org/tracker/index.php?func=detail&aid=11497&group_id=426&atid=1700</a></p>
+
+<p>Memory usage reports show how much memory each method in a program uses. 
+This support was added by Alexander Dymo and requires a patched Ruby
+interpreter.  For more information, see: <a
+href="http://rubyforge.org/tracker/index.php?func=detail&aid=17676&group_id=1814&atid=7062">rubyforge.org/tracker/index.php?func=detail&aid=17676&group_id=1814&atid=7062</a></p>
+
+<p>Garbage collection runs report how many times Ruby's garbage collector
+is invoked during a profiling session.  This support was added by Jeremy
+Kemper and requires a patched Ruby interpreter.  For more information, see:
+<a
+href="http://rubyforge.org/tracker/index.php?func=detail&aid=17676&group_id=1814&atid=7062">rubyforge.org/tracker/index.php?func=detail&aid=17676&group_id=1814&atid=7062</a></p>
+
+<p>Garbage collection time reports how much time is spent in Ruby's
+garbage collector during a profiling session.  This support was added by
+Jeremy Kemper and requires a patched Ruby interpreter.  For more
+information, see: <a
+href="http://rubyforge.org/tracker/index.php?func=detail&aid=17676&group_id=1814&atid=7062">rubyforge.org/tracker/index.php?func=detail&aid=17676&group_id=1814&atid=7062</a></p>
+
+<p>To set the measurement:</p>
+<ul><li>
+<p><a href="RubyProf.html#method-c-measure_mode">RubyProf.measure_mode</a> =
+RubyProf::PROCESS_TIME</p>
+</li><li>
+<p><a href="RubyProf.html#method-c-measure_mode">RubyProf.measure_mode</a> =
+RubyProf::WALL_TIME</p>
+</li><li>
+<p><a href="RubyProf.html#method-c-measure_mode">RubyProf.measure_mode</a> =
+RubyProf::CPU_TIME</p>
+</li><li>
+<p><a href="RubyProf.html#method-c-measure_mode">RubyProf.measure_mode</a> =
+RubyProf::ALLOCATIONS</p>
+</li><li>
+<p><a href="RubyProf.html#method-c-measure_mode">RubyProf.measure_mode</a> =
+RubyProf::MEMORY</p>
+</li><li>
+<p><a href="RubyProf.html#method-c-measure_mode">RubyProf.measure_mode</a> =
+RubyProf::GC_RUNS</p>
+</li><li>
+<p><a href="RubyProf.html#method-c-measure_mode">RubyProf.measure_mode</a> =
+RubyProf::GC_TIME</p>
+</li></ul>
+
+<p>The default value is RubyProf::PROCESS_TIME.</p>
+
+<p>You may also specify the measure_mode by using the RUBY_PROF_MEASURE_MODE
+environment variable:</p>
+<ul><li>
+<p>export RUBY_PROF_MEASURE_MODE=process</p>
+</li><li>
+<p>export RUBY_PROF_MEASURE_MODE=wall</p>
+</li><li>
+<p>export RUBY_PROF_MEASURE_MODE=cpu</p>
+</li><li>
+<p>export RUBY_PROF_MEASURE_MODE=allocations</p>
+</li><li>
+<p>export RUBY_PROF_MEASURE_MODE=memory</p>
+</li><li>
+<p>export RUBY_PROF_MEASURE_MODE=gc_runs</p>
+</li><li>
+<p>export RUBY_PROF_MEASURE_MODE=gc_time</p>
+</li></ul>
+
+<p>On Linux, process time is measured using the clock method provided by the C
+runtime library. Note that the clock method does not report time spent in
+the kernel or child processes and therefore does not measure time spent in
+methods such as Kernel.sleep method. If you need to measure these values,
+then use wall time.  Wall time is measured using the gettimeofday kernel
+method.</p>
+
+<p>On Windows, timings default to wall times.  If you set the clock mode to
+PROCESS_TIME, then timing are read using the clock method provided by the C
+runtime library.  Note though, these values are wall times on Windows and
+not process times like on Linux. Wall time is measured using the
+GetLocalTime API.</p>
+
+<p>If you use wall time, the results will be affected by other processes
+running on your computer, network delays, disk access, etc.  As result, for
+the best results, try to make sure your computer is only performing your
+profiling run and is otherwise quiescent.</p>
+
+<p>On both platforms, cpu time is measured using the RDTSC assembly function
+provided by the Pentium and PowerPC platforms. CPU time is dependent on the
+cpu's frequency.  On Linux, ruby-prof attempts to read this value from
+“/proc/cpuinfo.”  On Windows, you must manually specify the clock
+frequency.  This can be done using the RUBY_PROF_CPU_FREQUENCY environment
+variable:</p>
+
+<pre>export RUBY_PROF_CPU_FREQUENCY=<value></pre>
+
+<p>You can also directly set the cpu frequency by calling:</p>
+
+<pre>RubyProf.cpu_frequency = <value></pre>
+
+<h2 id="label-Multi-threaded+Applications">Multi-threaded Applications</h2>
+
+<p>Unfortunately, Ruby does not provide an internal api for detecting thread
+context switches in 1.8.  As a result, the timings ruby-prof reports for
+each thread may be slightly inaccurate.  In particular, this will happen
+for newly spawned threads that go to sleep immediately (their first call).
+For instance, if you use Ruby's timeout library to wait for 2 seconds,
+the 2 seconds will be assigned to the foreground thread and not the newly
+created background thread.  These errors can largely be avoided if the
+background thread performs any operation before going to sleep.</p>
+
+<h2 id="label-Performance">Performance</h2>
+
+<p>Significant effort has been put into reducing ruby-prof's overhead as
+much as possible.  Our tests show that the overhead associated with
+profiling code varies considerably with the code being profiled.  Most
+programs will run approximately twice as slow while highly recursive
+programs (like the fibonacci series test) will run three times slower.</p>
+
+<h2 id="label-License">License</h2>
+
+<p>See <a href="LICENSE.html">LICENSE</a> for license information.</p>
+
+<h2 id="label-Development">Development</h2>
+
+<p>Code is located at <a
+href="https://github.com/ruby-prof/ruby-prof">github.com/ruby-prof/ruby-prof</a></p>
+
+<p>Google group/mailing list: <a
+href="http://groups.google.com/group/ruby-optimization">groups.google.com/group/ruby-optimization</a>
+or start a github issue.</p>
+
+</div>
+
+
+
+<footer id="validator-badges">
+  <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
+  <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.1.
+  <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
+</footer>
+
diff --git a/doc/Rack.html b/doc/Rack.html
new file mode 100644
index 0000000..f7c4d5e
--- /dev/null
+++ b/doc/Rack.html
@@ -0,0 +1,167 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+
+<title>module Rack - ruby-prof</title>
+
+<link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">
+
+<script type="text/javascript">
+  var rdoc_rel_prefix = "./";
+</script>
+
+<script type="text/javascript" charset="utf-8" src="./js/jquery.js"></script>
+<script type="text/javascript" charset="utf-8" src="./js/navigation.js"></script>
+<script type="text/javascript" charset="utf-8" src="./js/search_index.js"></script>
+<script type="text/javascript" charset="utf-8" src="./js/search.js"></script>
+<script type="text/javascript" charset="utf-8" src="./js/searcher.js"></script>
+<script type="text/javascript" charset="utf-8" src="./js/darkfish.js"></script>
+
+
+<body id="top" class="module">
+<nav id="metadata">
+  <nav id="home-section" class="section">
+  <h3 class="section-header">
+    <a href="./index.html">Home</a>
+    <a href="./table_of_contents.html#classes">Classes</a>
+    <a href="./table_of_contents.html#methods">Methods</a>
+  </h3>
+</nav>
+
+
+  <nav id="search-section" class="section project-section" class="initially-hidden">
+  <form action="#" method="get" accept-charset="utf-8">
+    <h3 class="section-header">
+      <input type="text" name="search" placeholder="Search" id="search-field"
+             title="Type to search, Up and Down to navigate, Enter to load">
+    </h3>
+  </form>
+
+  <ul id="search-results" class="initially-hidden"></ul>
+</nav>
+
+
+  <div id="file-metadata">
+    <nav id="file-list-section" class="section">
+  <h3 class="section-header">Defined In</h3>
+  <ul>
+    <li>lib/ruby-prof/rack.rb
+  </ul>
+</nav>
+
+    
+  </div>
+
+  <div id="class-metadata">
+    
+    
+    
+    
+  </div>
+
+  <div id="project-metadata">
+    <nav id="fileindex-section" class="section project-section">
+  <h3 class="section-header">Pages</h3>
+
+  <ul>
+  
+    <li class="file"><a href="./LICENSE.html">LICENSE</a>
+  
+    <li class="file"><a href="./README_rdoc.html">README</a>
+  
+    <li class="file"><a href="./examples/flat_txt.html">flat</a>
+  
+    <li class="file"><a href="./examples/graph_txt.html">graph</a>
+  
+  </ul>
+</nav>
+
+    <nav id="classindex-section" class="section project-section">
+  <h3 class="section-header">Class and Module Index</h3>
+
+  <ul class="link-list">
+  
+    <li><a href="./RubyProf.html">RubyProf</a>
+  
+    <li><a href="./RubyProf/AbstractPrinter.html">RubyProf::AbstractPrinter</a>
+  
+    <li><a href="./RubyProf/AggregateCallInfo.html">RubyProf::AggregateCallInfo</a>
+  
+    <li><a href="./RubyProf/CallInfo.html">RubyProf::CallInfo</a>
+  
+    <li><a href="./RubyProf/CallInfoPrinter.html">RubyProf::CallInfoPrinter</a>
+  
+    <li><a href="./RubyProf/CallInfoVisitor.html">RubyProf::CallInfoVisitor</a>
+  
+    <li><a href="./RubyProf/CallStackPrinter.html">RubyProf::CallStackPrinter</a>
+  
+    <li><a href="./RubyProf/CallTreePrinter.html">RubyProf::CallTreePrinter</a>
+  
+    <li><a href="./RubyProf/Cmd.html">RubyProf::Cmd</a>
+  
+    <li><a href="./RubyProf/DotPrinter.html">RubyProf::DotPrinter</a>
+  
+    <li><a href="./RubyProf/FlatPrinter.html">RubyProf::FlatPrinter</a>
+  
+    <li><a href="./RubyProf/FlatPrinterWithLineNumbers.html">RubyProf::FlatPrinterWithLineNumbers</a>
+  
+    <li><a href="./RubyProf/GraphHtmlPrinter.html">RubyProf::GraphHtmlPrinter</a>
+  
+    <li><a href="./RubyProf/GraphPrinter.html">RubyProf::GraphPrinter</a>
+  
+    <li><a href="./RubyProf/MethodInfo.html">RubyProf::MethodInfo</a>
+  
+    <li><a href="./RubyProf/MultiPrinter.html">RubyProf::MultiPrinter</a>
+  
+    <li><a href="./RubyProf/Profile.html">RubyProf::Profile</a>
+  
+    <li><a href="./RubyProf/ProfileTask.html">RubyProf::ProfileTask</a>
+  
+    <li><a href="./RubyProf/Test.html">RubyProf::Test</a>
+  
+    <li><a href="./RubyProf/Thread.html">RubyProf::Thread</a>
+  
+    <li><a href="./Rack.html">Rack</a>
+  
+    <li><a href="./Rack/RubyProf.html">Rack::RubyProf</a>
+  
+  </ul>
+</nav>
+
+  </div>
+</nav>
+
+<div id="documentation">
+  <h1 class="module">module Rack</h1>
+
+  <div id="description" class="description">
+    
+  </div><!-- description -->
+
+  
+  
+  
+  <section id="5Buntitled-5D" class="documentation-section">
+    
+
+    
+
+    
+
+    
+
+    <!-- Methods -->
+    
+  </section><!-- 5Buntitled-5D -->
+
+</div><!-- documentation -->
+
+
+<footer id="validator-badges">
+  <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
+  <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.1.
+  <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
+</footer>
+
diff --git a/doc/Rack/RubyProf.html b/doc/Rack/RubyProf.html
new file mode 100644
index 0000000..4f7f1e2
--- /dev/null
+++ b/doc/Rack/RubyProf.html
@@ -0,0 +1,319 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+
+<title>class Rack::RubyProf - ruby-prof</title>
+
+<link type="text/css" media="screen" href="../rdoc.css" rel="stylesheet">
+
+<script type="text/javascript">
+  var rdoc_rel_prefix = "../";
+</script>
+
+<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/navigation.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/search_index.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/search.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/searcher.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/darkfish.js"></script>
+
+
+<body id="top" class="class">
+<nav id="metadata">
+  <nav id="home-section" class="section">
+  <h3 class="section-header">
+    <a href="../index.html">Home</a>
+    <a href="../table_of_contents.html#classes">Classes</a>
+    <a href="../table_of_contents.html#methods">Methods</a>
+  </h3>
+</nav>
+
+
+  <nav id="search-section" class="section project-section" class="initially-hidden">
+  <form action="#" method="get" accept-charset="utf-8">
+    <h3 class="section-header">
+      <input type="text" name="search" placeholder="Search" id="search-field"
+             title="Type to search, Up and Down to navigate, Enter to load">
+    </h3>
+  </form>
+
+  <ul id="search-results" class="initially-hidden"></ul>
+</nav>
+
+
+  <div id="file-metadata">
+    <nav id="file-list-section" class="section">
+  <h3 class="section-header">Defined In</h3>
+  <ul>
+    <li>lib/ruby-prof/rack.rb
+  </ul>
+</nav>
+
+    
+  </div>
+
+  <div id="class-metadata">
+    
+    <nav id="parent-class-section" class="section">
+  <h3 class="section-header">Parent</h3>
+  
+  <p class="link">Object
+  
+</nav>
+
+    
+    <!-- Method Quickref -->
+<nav id="method-list-section" class="section">
+  <h3 class="section-header">Methods</h3>
+
+  <ul class="link-list">
+    
+    <li><a href="#method-c-new">::new</a>
+    
+    <li><a href="#method-i-call">#call</a>
+    
+    <li><a href="#method-i-print">#print</a>
+    
+  </ul>
+</nav>
+
+  </div>
+
+  <div id="project-metadata">
+    <nav id="fileindex-section" class="section project-section">
+  <h3 class="section-header">Pages</h3>
+
+  <ul>
+  
+    <li class="file"><a href="../LICENSE.html">LICENSE</a>
+  
+    <li class="file"><a href="../README_rdoc.html">README</a>
+  
+    <li class="file"><a href="../examples/flat_txt.html">flat</a>
+  
+    <li class="file"><a href="../examples/graph_txt.html">graph</a>
+  
+  </ul>
+</nav>
+
+    <nav id="classindex-section" class="section project-section">
+  <h3 class="section-header">Class and Module Index</h3>
+
+  <ul class="link-list">
+  
+    <li><a href="../RubyProf.html">RubyProf</a>
+  
+    <li><a href="../RubyProf/AbstractPrinter.html">RubyProf::AbstractPrinter</a>
+  
+    <li><a href="../RubyProf/AggregateCallInfo.html">RubyProf::AggregateCallInfo</a>
+  
+    <li><a href="../RubyProf/CallInfo.html">RubyProf::CallInfo</a>
+  
+    <li><a href="../RubyProf/CallInfoPrinter.html">RubyProf::CallInfoPrinter</a>
+  
+    <li><a href="../RubyProf/CallInfoVisitor.html">RubyProf::CallInfoVisitor</a>
+  
+    <li><a href="../RubyProf/CallStackPrinter.html">RubyProf::CallStackPrinter</a>
+  
+    <li><a href="../RubyProf/CallTreePrinter.html">RubyProf::CallTreePrinter</a>
+  
+    <li><a href="../RubyProf/Cmd.html">RubyProf::Cmd</a>
+  
+    <li><a href="../RubyProf/DotPrinter.html">RubyProf::DotPrinter</a>
+  
+    <li><a href="../RubyProf/FlatPrinter.html">RubyProf::FlatPrinter</a>
+  
+    <li><a href="../RubyProf/FlatPrinterWithLineNumbers.html">RubyProf::FlatPrinterWithLineNumbers</a>
+  
+    <li><a href="../RubyProf/GraphHtmlPrinter.html">RubyProf::GraphHtmlPrinter</a>
+  
+    <li><a href="../RubyProf/GraphPrinter.html">RubyProf::GraphPrinter</a>
+  
+    <li><a href="../RubyProf/MethodInfo.html">RubyProf::MethodInfo</a>
+  
+    <li><a href="../RubyProf/MultiPrinter.html">RubyProf::MultiPrinter</a>
+  
+    <li><a href="../RubyProf/Profile.html">RubyProf::Profile</a>
+  
+    <li><a href="../RubyProf/ProfileTask.html">RubyProf::ProfileTask</a>
+  
+    <li><a href="../RubyProf/Test.html">RubyProf::Test</a>
+  
+    <li><a href="../RubyProf/Thread.html">RubyProf::Thread</a>
+  
+    <li><a href="../Rack.html">Rack</a>
+  
+    <li><a href="../Rack/RubyProf.html">Rack::RubyProf</a>
+  
+  </ul>
+</nav>
+
+  </div>
+</nav>
+
+<div id="documentation">
+  <h1 class="class">class Rack::RubyProf</h1>
+
+  <div id="description" class="description">
+    
+  </div><!-- description -->
+
+  
+  
+  
+  <section id="5Buntitled-5D" class="documentation-section">
+    
+
+    
+
+    
+
+    
+
+    <!-- Methods -->
+    
+     <section id="public-class-5Buntitled-5D-method-details" class="method-section section">
+      <h3 class="section-header">Public Class Methods</h3>
+
+    
+      <div id="method-c-new" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">new</span><span
+            class="method-args">(app, options = {})</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="new-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/rack.rb, line 5</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">app</span>, <span class="ruby-identifier">options</span> = {})
+  <span class="ruby-ivar">@app</span> = <span class="ruby-identifier">app</span>
+  <span class="ruby-ivar">@options</span> = <span class="ruby-identifier">options</span>
+  <span class="ruby-ivar">@options</span>[<span class="ruby-value">:min_percent</span>] <span class="ruby-operator">||=</span> <span class="ruby-value">1</span>
+  <span class="ruby-ivar">@tmpdir</span> = <span class="ruby-identifier">options</span>[<span class="ruby-value">:path</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">tmpdir</span>
+  <span class="ruby-ivar">@printer_klasses</span> = <span class="ruby-ivar">@options</span>[<span class="ruby-value">:printers</span>]  <span class="ruby-operator">||</span> {<span class="ruby-operator">::</span><span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">FlatPrinter</span> =<span class="ruby-operator">></span> <span class="ruby-string">'flat.txt'</span>,
+                                              <span class="ruby-operator">::</span><span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">GraphPrinter</span> =<span class="ruby-operator">></span> <span class="ruby-string">'graph.txt'</span>,
+                                              <span class="ruby-operator">::</span><span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">GraphHtmlPrinter</span> =<span class="ruby-operator">></span> <span class="ruby-string">'graph.html'</span>,
+                                              <span class="ruby-operator">::</span><span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">CallStackPrinter</span> =<span class="ruby-operator">></span> <span class="ruby-string">'call_stack.html'</span>}
+
+  <span class="ruby-ivar">@skip_paths</span> = <span class="ruby-identifier">options</span>[<span class="ruby-value">:skip_paths</span>] <span class="ruby-operator">||</span> [<span class="ruby-regexp">%r{^/assets}</span>, <span class="ruby-regexp">%r{\.css$}</span>, <span class="ruby-regexp">%r{\.js$}</span>, <span class="ruby-regexp">%r{\.png$}</span>, <span class="ruby-regexp">%r{\.jpeg$}</span>, <span class="ruby-regexp">%r{\.jpg$}</span>, <span class="ruby-regexp">%r{\.gif$}</span>]
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- new-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- new-method -->
+
+    
+    </section><!-- public-class-method-details -->
+  
+     <section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
+      <h3 class="section-header">Public Instance Methods</h3>
+
+    
+      <div id="method-i-call" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">call</span><span
+            class="method-args">(env)</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="call-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/rack.rb, line 18</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>)
+  <span class="ruby-identifier">request</span> = <span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">Request</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">env</span>)
+
+  <span class="ruby-keyword">if</span> <span class="ruby-ivar">@skip_paths</span>.<span class="ruby-identifier">any?</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">skip_path</span><span class="ruby-operator">|</span> <span class="ruby-identifier">skip_path</span> <span class="ruby-operator">=~</span> <span class="ruby-identifier">request</span>.<span class="ruby-identifier">path</span>}
+    <span class="ruby-ivar">@app</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>)
+  <span class="ruby-keyword">else</span>
+    <span class="ruby-identifier">result</span> = <span class="ruby-keyword">nil</span>
+    <span class="ruby-identifier">data</span> = <span class="ruby-operator">::</span><span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">Profile</span>.<span class="ruby-identifier">profile</span> <span class="ruby-keyword">do</span>
+      <span class="ruby-identifier">result</span> = <span class="ruby-ivar">@app</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>)
+    <span class="ruby-keyword">end</span>
+
+    <span class="ruby-identifier">path</span> = <span class="ruby-identifier">request</span>.<span class="ruby-identifier">path</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-string">'/'</span>, <span class="ruby-string">'-'</span>)
+    <span class="ruby-identifier">path</span>.<span class="ruby-identifier">slice!</span>(<span class="ruby-value">0</span>)
+
+    <span class="ruby-identifier">print</span>(<span class="ruby-identifier">data</span>, <span class="ruby-identifier">path</span>)
+    <span class="ruby-identifier">result</span>
+  <span class="ruby-keyword">end</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- call-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- call-method -->
+
+    
+      <div id="method-i-print" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">print</span><span
+            class="method-args">(data, path)</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="print-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/rack.rb, line 37</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">print</span>(<span class="ruby-identifier">data</span>, <span class="ruby-identifier">path</span>)
+  <span class="ruby-ivar">@printer_klasses</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">printer_klass</span>, <span class="ruby-identifier">base_name</span><span class="ruby-operator">|</span>
+    <span class="ruby-identifier">printer</span> = <span class="ruby-identifier">printer_klass</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">data</span>)
+    <span class="ruby-identifier">file_name</span> = <span class="ruby-operator">::</span><span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-ivar">@tmpdir</span>, <span class="ruby-node">"#{path}-#{base_name}"</span>)
+    <span class="ruby-operator">::</span><span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">file_name</span>, <span class="ruby-string">'wb'</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">file</span><span class="ruby-operator">|</span>
+      <span class="ruby-identifier">printer</span>.<span class="ruby-identifier">print</span>(<span class="ruby-identifier">file</span>, <span class="ruby-ivar">@options</span>)
+    <span class="ruby-keyword">end</span>
+  <span class="ruby-keyword">end</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- print-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- print-method -->
+
+    
+    </section><!-- public-instance-method-details -->
+  
+  </section><!-- 5Buntitled-5D -->
+
+</div><!-- documentation -->
+
+
+<footer id="validator-badges">
+  <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
+  <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.1.
+  <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
+</footer>
+
diff --git a/doc/RubyProf.html b/doc/RubyProf.html
new file mode 100644
index 0000000..37baa43
--- /dev/null
+++ b/doc/RubyProf.html
@@ -0,0 +1,1000 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+
+<title>module RubyProf - ruby-prof</title>
+
+<link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">
+
+<script type="text/javascript">
+  var rdoc_rel_prefix = "./";
+</script>
+
+<script type="text/javascript" charset="utf-8" src="./js/jquery.js"></script>
+<script type="text/javascript" charset="utf-8" src="./js/navigation.js"></script>
+<script type="text/javascript" charset="utf-8" src="./js/search_index.js"></script>
+<script type="text/javascript" charset="utf-8" src="./js/search.js"></script>
+<script type="text/javascript" charset="utf-8" src="./js/searcher.js"></script>
+<script type="text/javascript" charset="utf-8" src="./js/darkfish.js"></script>
+
+
+<body id="top" class="module">
+<nav id="metadata">
+  <nav id="home-section" class="section">
+  <h3 class="section-header">
+    <a href="./index.html">Home</a>
+    <a href="./table_of_contents.html#classes">Classes</a>
+    <a href="./table_of_contents.html#methods">Methods</a>
+  </h3>
+</nav>
+
+
+  <nav id="search-section" class="section project-section" class="initially-hidden">
+  <form action="#" method="get" accept-charset="utf-8">
+    <h3 class="section-header">
+      <input type="text" name="search" placeholder="Search" id="search-field"
+             title="Type to search, Up and Down to navigate, Enter to load">
+    </h3>
+  </form>
+
+  <ul id="search-results" class="initially-hidden"></ul>
+</nav>
+
+
+  <div id="file-metadata">
+    <nav id="file-list-section" class="section">
+  <h3 class="section-header">Defined In</h3>
+  <ul>
+    <li>bin/ruby-prof
+    <li>lib/ruby-prof.rb
+    <li>lib/ruby-prof/aggregate_call_info.rb
+    <li>lib/ruby-prof/call_info.rb
+    <li>lib/ruby-prof/call_info_visitor.rb
+    <li>lib/ruby-prof/compatibility.rb
+    <li>lib/ruby-prof/method_info.rb
+    <li>lib/ruby-prof/printers/abstract_printer.rb
+    <li>lib/ruby-prof/printers/call_info_printer.rb
+    <li>lib/ruby-prof/printers/call_stack_printer.rb
+    <li>lib/ruby-prof/printers/call_tree_printer.rb
+    <li>lib/ruby-prof/printers/dot_printer.rb
+    <li>lib/ruby-prof/printers/flat_printer.rb
+    <li>lib/ruby-prof/printers/flat_printer_with_line_numbers.rb
+    <li>lib/ruby-prof/printers/graph_html_printer.rb
+    <li>lib/ruby-prof/printers/graph_printer.rb
+    <li>lib/ruby-prof/printers/multi_printer.rb
+    <li>lib/ruby-prof/profile.rb
+    <li>lib/ruby-prof/task.rb
+    <li>lib/ruby-prof/test.rb
+    <li>lib/ruby-prof/thread.rb
+    <li>ext/ruby_prof/ruby_prof.c
+  </ul>
+</nav>
+
+    
+  </div>
+
+  <div id="class-metadata">
+    
+    
+    
+    <!-- Method Quickref -->
+<nav id="method-list-section" class="section">
+  <h3 class="section-header">Methods</h3>
+
+  <ul class="link-list">
+    
+    <li><a href="#method-c-cpu_frequency">::cpu_frequency</a>
+    
+    <li><a href="#method-c-cpu_frequency-3D">::cpu_frequency=</a>
+    
+    <li><a href="#method-c-exclude_threads">::exclude_threads</a>
+    
+    <li><a href="#method-c-exclude_threads-3D">::exclude_threads=</a>
+    
+    <li><a href="#method-c-figure_measure_mode">::figure_measure_mode</a>
+    
+    <li><a href="#method-c-measure_allocations">::measure_allocations</a>
+    
+    <li><a href="#method-c-measure_cpu_time">::measure_cpu_time</a>
+    
+    <li><a href="#method-c-measure_gc_runs">::measure_gc_runs</a>
+    
+    <li><a href="#method-c-measure_gc_time">::measure_gc_time</a>
+    
+    <li><a href="#method-c-measure_memory">::measure_memory</a>
+    
+    <li><a href="#method-c-measure_mode">::measure_mode</a>
+    
+    <li><a href="#method-c-measure_mode-3D">::measure_mode=</a>
+    
+    <li><a href="#method-c-measure_process_time">::measure_process_time</a>
+    
+    <li><a href="#method-c-measure_wall_time">::measure_wall_time</a>
+    
+    <li><a href="#method-c-pause">::pause</a>
+    
+    <li><a href="#method-c-profile">::profile</a>
+    
+    <li><a href="#method-c-resume">::resume</a>
+    
+    <li><a href="#method-c-running-3F">::running?</a>
+    
+    <li><a href="#method-c-start">::start</a>
+    
+    <li><a href="#method-c-start_script">::start_script</a>
+    
+    <li><a href="#method-c-stop">::stop</a>
+    
+  </ul>
+</nav>
+
+  </div>
+
+  <div id="project-metadata">
+    <nav id="fileindex-section" class="section project-section">
+  <h3 class="section-header">Pages</h3>
+
+  <ul>
+  
+    <li class="file"><a href="./LICENSE.html">LICENSE</a>
+  
+    <li class="file"><a href="./README_rdoc.html">README</a>
+  
+    <li class="file"><a href="./examples/flat_txt.html">flat</a>
+  
+    <li class="file"><a href="./examples/graph_txt.html">graph</a>
+  
+  </ul>
+</nav>
+
+    <nav id="classindex-section" class="section project-section">
+  <h3 class="section-header">Class and Module Index</h3>
+
+  <ul class="link-list">
+  
+    <li><a href="./RubyProf.html">RubyProf</a>
+  
+    <li><a href="./RubyProf/AbstractPrinter.html">RubyProf::AbstractPrinter</a>
+  
+    <li><a href="./RubyProf/AggregateCallInfo.html">RubyProf::AggregateCallInfo</a>
+  
+    <li><a href="./RubyProf/CallInfo.html">RubyProf::CallInfo</a>
+  
+    <li><a href="./RubyProf/CallInfoPrinter.html">RubyProf::CallInfoPrinter</a>
+  
+    <li><a href="./RubyProf/CallInfoVisitor.html">RubyProf::CallInfoVisitor</a>
+  
+    <li><a href="./RubyProf/CallStackPrinter.html">RubyProf::CallStackPrinter</a>
+  
+    <li><a href="./RubyProf/CallTreePrinter.html">RubyProf::CallTreePrinter</a>
+  
+    <li><a href="./RubyProf/Cmd.html">RubyProf::Cmd</a>
+  
+    <li><a href="./RubyProf/DotPrinter.html">RubyProf::DotPrinter</a>
+  
+    <li><a href="./RubyProf/FlatPrinter.html">RubyProf::FlatPrinter</a>
+  
+    <li><a href="./RubyProf/FlatPrinterWithLineNumbers.html">RubyProf::FlatPrinterWithLineNumbers</a>
+  
+    <li><a href="./RubyProf/GraphHtmlPrinter.html">RubyProf::GraphHtmlPrinter</a>
+  
+    <li><a href="./RubyProf/GraphPrinter.html">RubyProf::GraphPrinter</a>
+  
+    <li><a href="./RubyProf/MethodInfo.html">RubyProf::MethodInfo</a>
+  
+    <li><a href="./RubyProf/MultiPrinter.html">RubyProf::MultiPrinter</a>
+  
+    <li><a href="./RubyProf/Profile.html">RubyProf::Profile</a>
+  
+    <li><a href="./RubyProf/ProfileTask.html">RubyProf::ProfileTask</a>
+  
+    <li><a href="./RubyProf/Test.html">RubyProf::Test</a>
+  
+    <li><a href="./RubyProf/Thread.html">RubyProf::Thread</a>
+  
+    <li><a href="./Rack.html">Rack</a>
+  
+    <li><a href="./Rack/RubyProf.html">Rack::RubyProf</a>
+  
+  </ul>
+</nav>
+
+  </div>
+</nav>
+
+<div id="documentation">
+  <h1 class="module">module RubyProf</h1>
+
+  <div id="description" class="description">
+    
+<p>The call info visitor class does a depth-first traversal across a
+thread's call stack.  At each call_info node, the visitor executes the
+block provided in the visit method.  The block is passed two parameters,
+the event and the call_info instance.  Event will be either :enter or
+:exit.</p>
+
+<pre class="ruby"><span class="ruby-identifier">visitor</span> = <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">CallInfoVisitor</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">result</span>.<span class="ruby-identifier">threads</span>.<span class="ruby-identifier">first</span>)
+
+<span class="ruby-identifier">method_names</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
+
+<span class="ruby-identifier">visitor</span>.<span class="ruby-identifier">visit</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">call_info</span>, <span class="ruby-identifier">event</span><span class="ruby-operator">|</span>
+  <span class="ruby-identifier">method_names</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">call_info</span>.<span class="ruby-identifier">target</span>.<span class="ruby-identifier">full_name</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">event</span> <span class="ruby-operator">==</span> :<span class="ruby-identifier">enter</span>
+<span class="ruby-keyword">end</span>
+
+<span class="ruby-identifier">puts</span> <span class="ruby-identifier">method_names</span>
+</pre>
+
+<p>These methods are here for backwards compatability with previous <a
+href="RubyProf.html">RubyProf</a> releases</p>
+
+  </div><!-- description -->
+
+  
+  
+  
+  <section id="5Buntitled-5D" class="documentation-section">
+    
+
+    
+
+    
+    <!-- Constants -->
+    <section id="constants-list" class="section">
+      <h3 class="section-header">Constants</h3>
+      <dl>
+      
+        <dt id="VERSION">VERSION
+        
+        <dd class="description">
+        
+      
+      </dl>
+    </section>
+    
+
+    
+
+    <!-- Methods -->
+    
+     <section id="public-class-5Buntitled-5D-method-details" class="method-section section">
+      <h3 class="section-header">Public Class Methods</h3>
+
+    
+      <div id="method-c-cpu_frequency" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">cpu_frequency</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          <p>Measurements</p>
+          
+
+          
+          <div class="method-source-code" id="cpu_frequency-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/compatibility.rb, line 5</span>
+<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">cpu_frequency</span>
+  <span class="ruby-constant">Measure</span><span class="ruby-operator">::</span><span class="ruby-constant">CpuTime</span>.<span class="ruby-identifier">frequency</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- cpu_frequency-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- cpu_frequency-method -->
+
+    
+      <div id="method-c-cpu_frequency-3D" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">cpu_frequency=</span><span
+            class="method-args">(value)</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="cpu_frequency-3D-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/compatibility.rb, line 9</span>
+<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">cpu_frequency=</span>(<span class="ruby-identifier">value</span>)
+  <span class="ruby-constant">Measure</span><span class="ruby-operator">::</span><span class="ruby-constant">CpuTime</span>.<span class="ruby-identifier">frequency</span> = <span class="ruby-identifier">value</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- cpu_frequency-3D-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- cpu_frequency-3D-method -->
+
+    
+      <div id="method-c-exclude_threads" class="method-detail ">
+        
+        
+        <div class="method-heading">
+          <span class="method-callseq">
+            exclude_threads → exclude_threads
+          </span>
+          
+          <span class="method-click-advice">click to toggle source</span>
+          
+        </div>
+        
+        
+
+        <div class="method-description">
+          
+          <p>Returns threads ruby-prof should exclude from profiling</p>
+          
+
+          
+          <div class="method-source-code" id="exclude_threads-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/compatibility.rb, line 79</span>
+<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">exclude_threads</span>
+  <span class="ruby-ivar">@exclude_threads</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- exclude_threads-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- exclude_threads-method -->
+
+    
+      <div id="method-c-exclude_threads-3D" class="method-detail ">
+        
+        
+        <div class="method-heading">
+          <span class="method-callseq">
+            exclude_threads= → void
+          </span>
+          
+          <span class="method-click-advice">click to toggle source</span>
+          
+        </div>
+        
+        
+
+        <div class="method-description">
+          
+          <p>Specifies what threads ruby-prof should exclude from profiling</p>
+          
+
+          
+          <div class="method-source-code" id="exclude_threads-3D-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/compatibility.rb, line 88</span>
+<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">exclude_threads=</span>(<span class="ruby-identifier">value</span>)
+  <span class="ruby-ivar">@exclude_threads</span> = <span class="ruby-identifier">value</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- exclude_threads-3D-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- exclude_threads-3D-method -->
+
+    
+      <div id="method-c-figure_measure_mode" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">figure_measure_mode</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          <p>Checks if the user specified the clock mode via the RUBY_PROF_MEASURE_MODE
+environment variable</p>
+          
+
+          
+          <div class="method-source-code" id="figure_measure_mode-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof.rb, line 33</span>
+<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">figure_measure_mode</span>
+  <span class="ruby-keyword">case</span> <span class="ruby-constant">ENV</span>[<span class="ruby-string">"RUBY_PROF_MEASURE_MODE"</span>]
+  <span class="ruby-keyword">when</span> <span class="ruby-string">"wall"</span> <span class="ruby-operator">||</span> <span class="ruby-string">"wall_time"</span>
+    <span class="ruby-constant">RubyProf</span>.<span class="ruby-identifier">measure_mode</span> = <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">WALL_TIME</span>
+  <span class="ruby-keyword">when</span> <span class="ruby-string">"cpu"</span> <span class="ruby-operator">||</span> <span class="ruby-string">"cpu_time"</span>
+    <span class="ruby-keyword">if</span> <span class="ruby-constant">ENV</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-string">"RUBY_PROF_CPU_FREQUENCY"</span>)
+      <span class="ruby-constant">RubyProf</span>.<span class="ruby-identifier">cpu_frequency</span> = <span class="ruby-constant">ENV</span>[<span class="ruby-string">"RUBY_PROF_CPU_FREQUENCY"</span>].<span class="ruby-identifier">to_f</span>
+    <span class="ruby-keyword">else</span>
+      <span class="ruby-keyword">begin</span>
+        <span class="ruby-identifier">open</span>(<span class="ruby-string">"/proc/cpuinfo"</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span>
+          <span class="ruby-identifier">f</span>.<span class="ruby-identifier">each_line</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">line</span><span class="ruby-operator">|</span>
+            <span class="ruby-identifier">s</span> = <span class="ruby-identifier">line</span>.<span class="ruby-identifier">slice</span>(<span class="ruby-regexp">%rcpu MHz\s*:\s*(.*)/</span>, <span class="ruby-value">1</span>)
+            <span class="ruby-keyword">if</span> <span class="ruby-identifier">s</span>
+              <span class="ruby-constant">RubyProf</span>.<span class="ruby-identifier">cpu_frequency</span> = <span class="ruby-identifier">s</span>.<span class="ruby-identifier">to_f</span> * <span class="ruby-value">1000000</span>
+              <span class="ruby-keyword">break</span>
+            <span class="ruby-keyword">end</span>
+          <span class="ruby-keyword">end</span>
+        <span class="ruby-keyword">end</span>
+      <span class="ruby-keyword">rescue</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">ENOENT</span>
+      <span class="ruby-keyword">end</span>
+    <span class="ruby-keyword">end</span>
+    <span class="ruby-constant">RubyProf</span>.<span class="ruby-identifier">measure_mode</span> = <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">CPU_TIME</span>
+  <span class="ruby-keyword">when</span> <span class="ruby-string">"allocations"</span>
+    <span class="ruby-constant">RubyProf</span>.<span class="ruby-identifier">measure_mode</span> = <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">ALLOCATIONS</span>
+  <span class="ruby-keyword">when</span> <span class="ruby-string">"memory"</span>
+    <span class="ruby-constant">RubyProf</span>.<span class="ruby-identifier">measure_mode</span> = <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">MEMORY</span>
+  <span class="ruby-keyword">else</span>
+    <span class="ruby-comment"># the default...</span>
+    <span class="ruby-constant">RubyProf</span>.<span class="ruby-identifier">measure_mode</span> = <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">PROCESS_TIME</span>
+  <span class="ruby-keyword">end</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- figure_measure_mode-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- figure_measure_mode-method -->
+
+    
+      <div id="method-c-measure_allocations" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">measure_allocations</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="measure_allocations-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/compatibility.rb, line 13</span>
+<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">measure_allocations</span>
+  <span class="ruby-constant">Measure</span><span class="ruby-operator">::</span><span class="ruby-constant">Allocations</span>.<span class="ruby-identifier">measure</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- measure_allocations-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- measure_allocations-method -->
+
+    
+      <div id="method-c-measure_cpu_time" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">measure_cpu_time</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="measure_cpu_time-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/compatibility.rb, line 17</span>
+<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">measure_cpu_time</span>
+  <span class="ruby-constant">Measure</span><span class="ruby-operator">::</span><span class="ruby-constant">CpuTime</span>.<span class="ruby-identifier">measure</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- measure_cpu_time-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- measure_cpu_time-method -->
+
+    
+      <div id="method-c-measure_gc_runs" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">measure_gc_runs</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="measure_gc_runs-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/compatibility.rb, line 21</span>
+<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">measure_gc_runs</span>
+  <span class="ruby-constant">Measure</span><span class="ruby-operator">::</span><span class="ruby-constant">GcRuns</span>.<span class="ruby-identifier">measure</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- measure_gc_runs-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- measure_gc_runs-method -->
+
+    
+      <div id="method-c-measure_gc_time" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">measure_gc_time</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="measure_gc_time-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/compatibility.rb, line 25</span>
+<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">measure_gc_time</span>
+  <span class="ruby-constant">Measure</span><span class="ruby-operator">::</span><span class="ruby-constant">GcTime</span>.<span class="ruby-identifier">measure</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- measure_gc_time-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- measure_gc_time-method -->
+
+    
+      <div id="method-c-measure_memory" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">measure_memory</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="measure_memory-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/compatibility.rb, line 29</span>
+<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">measure_memory</span>
+  <span class="ruby-constant">Measure</span><span class="ruby-operator">::</span><span class="ruby-constant">Memory</span>.<span class="ruby-identifier">measure</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- measure_memory-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- measure_memory-method -->
+
+    
+      <div id="method-c-measure_mode" class="method-detail ">
+        
+        
+        <div class="method-heading">
+          <span class="method-callseq">
+            measure_mode → measure_mode
+          </span>
+          
+          <span class="method-click-advice">click to toggle source</span>
+          
+        </div>
+        
+        
+
+        <div class="method-description">
+          
+          <p>Returns what ruby-prof is measuring.  Valid values include:</p>
+
+<p>*RubyProf::PROCESS_TIME - Measure process time.  This is default.  It is
+implemented using the clock functions in the C Runtime library.
+*RubyProf::WALL_TIME - Measure wall time using gettimeofday on Linx and
+GetLocalTime on Windows *RubyProf::CPU_TIME - Measure time using the CPU
+clock counter.  This mode is only supported on Pentium or PowerPC
+platforms. *RubyProf::ALLOCATIONS - Measure object allocations.  This
+requires a patched Ruby interpreter. *RubyProf::MEMORY - Measure memory
+size.  This requires a patched Ruby interpreter. *RubyProf::GC_RUNS -
+Measure number of garbage collections.  This requires a patched Ruby
+interpreter. *RubyProf::GC_TIME - Measure time spent doing garbage
+collection.  This requires a patched Ruby interpreter.*/</p>
+          
+
+          
+          <div class="method-source-code" id="measure_mode-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/compatibility.rb, line 54</span>
+<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">measure_mode</span>
+  <span class="ruby-ivar">@measure_mode</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">WALL_TIME</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- measure_mode-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- measure_mode-method -->
+
+    
+      <div id="method-c-measure_mode-3D" class="method-detail ">
+        
+        
+        <div class="method-heading">
+          <span class="method-callseq">
+            measure_mode=value → void
+          </span>
+          
+          <span class="method-click-advice">click to toggle source</span>
+          
+        </div>
+        
+        
+
+        <div class="method-description">
+          
+          <p>Specifies what ruby-prof should measure.  Valid values include:</p>
+
+<p>*RubyProf::PROCESS_TIME - Measure process time.  This is default.  It is
+implemented using the clock functions in the C Runtime library.
+*RubyProf::WALL_TIME - Measure wall time using gettimeofday on Linx and
+GetLocalTime on Windows *RubyProf::CPU_TIME - Measure time using the CPU
+clock counter.  This mode is only supported on Pentium or PowerPC
+platforms. *RubyProf::ALLOCATIONS - Measure object allocations.  This
+requires a patched Ruby interpreter. *RubyProf::MEMORY - Measure memory
+size.  This requires a patched Ruby interpreter. *RubyProf::GC_RUNS -
+Measure number of garbage collections.  This requires a patched Ruby
+interpreter. *RubyProf::GC_TIME - Measure time spent doing garbage
+collection.  This requires a patched Ruby interpreter.*/</p>
+          
+
+          
+          <div class="method-source-code" id="measure_mode-3D-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/compatibility.rb, line 70</span>
+<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">measure_mode=</span>(<span class="ruby-identifier">value</span>)
+  <span class="ruby-ivar">@measure_mode</span> = <span class="ruby-identifier">value</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- measure_mode-3D-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- measure_mode-3D-method -->
+
+    
+      <div id="method-c-measure_process_time" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">measure_process_time</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="measure_process_time-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/compatibility.rb, line 33</span>
+<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">measure_process_time</span>
+  <span class="ruby-constant">Measure</span><span class="ruby-operator">::</span><span class="ruby-constant">ProcessTime</span>.<span class="ruby-identifier">measure</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- measure_process_time-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- measure_process_time-method -->
+
+    
+      <div id="method-c-measure_wall_time" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">measure_wall_time</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="measure_wall_time-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/compatibility.rb, line 37</span>
+<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">measure_wall_time</span>
+  <span class="ruby-constant">Measure</span><span class="ruby-operator">::</span><span class="ruby-constant">WallTime</span>.<span class="ruby-identifier">measure</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- measure_wall_time-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- measure_wall_time-method -->
+
+    
+      <div id="method-c-pause" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">pause</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="pause-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/compatibility.rb, line 105</span>
+<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">pause</span>
+  <span class="ruby-identifier">ensure_running!</span>
+  <span class="ruby-identifier">disable_gc_stats_if_needed</span>
+  <span class="ruby-ivar">@profile</span>.<span class="ruby-identifier">pause</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- pause-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- pause-method -->
+
+    
+      <div id="method-c-profile" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">profile</span><span
+            class="method-args">(&block)</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          <p><a href="RubyProf/Profile.html">Profile</a> a block</p>
+          
+
+          
+          <div class="method-source-code" id="profile-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/compatibility.rb, line 134</span>
+<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">profile</span>(&<span class="ruby-identifier">block</span>)
+  <span class="ruby-identifier">ensure_not_running!</span>
+  <span class="ruby-identifier">gc_stat_was_enabled</span> = <span class="ruby-identifier">enable_gc_stats_if_needed</span>
+  <span class="ruby-identifier">res</span> = <span class="ruby-constant">Profile</span>.<span class="ruby-identifier">profile</span>(<span class="ruby-keyword">self</span>.<span class="ruby-identifier">measure_mode</span>, <span class="ruby-keyword">self</span>.<span class="ruby-identifier">exclude_threads</span>, &<span class="ruby-identifier">block</span>)
+  <span class="ruby-identifier">disable_gc_stats_if_needed</span>(<span class="ruby-identifier">gc_stat_was_enabled</span>)
+  <span class="ruby-identifier">res</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- profile-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- profile-method -->
+
+    
+      <div id="method-c-resume" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">resume</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="resume-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/compatibility.rb, line 119</span>
+<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">resume</span>
+  <span class="ruby-identifier">ensure_running!</span>
+  <span class="ruby-identifier">enable_gc_stats_if_needed</span>
+  <span class="ruby-ivar">@profile</span>.<span class="ruby-identifier">resume</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- resume-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- resume-method -->
+
+    
+      <div id="method-c-running-3F" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">running?</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="running-3F-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/compatibility.rb, line 111</span>
+<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">running?</span>
+  <span class="ruby-keyword">if</span> <span class="ruby-keyword">defined?</span>(<span class="ruby-ivar">@profile</span>) <span class="ruby-keyword">and</span> <span class="ruby-ivar">@profile</span>
+    <span class="ruby-ivar">@profile</span>.<span class="ruby-identifier">running?</span>
+  <span class="ruby-keyword">else</span>
+    <span class="ruby-keyword">false</span>
+  <span class="ruby-keyword">end</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- running-3F-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- running-3F-method -->
+
+    
+      <div id="method-c-start" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">start</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="start-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/compatibility.rb, line 98</span>
+<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">start</span>
+  <span class="ruby-identifier">ensure_not_running!</span>
+  <span class="ruby-ivar">@profile</span> = <span class="ruby-constant">Profile</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword">self</span>.<span class="ruby-identifier">measure_mode</span>, <span class="ruby-keyword">self</span>.<span class="ruby-identifier">exclude_threads</span>)
+  <span class="ruby-identifier">enable_gc_stats_if_needed</span>
+  <span class="ruby-ivar">@profile</span>.<span class="ruby-identifier">start</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- start-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- start-method -->
+
+    
+      <div id="method-c-start_script" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">start_script</span><span
+            class="method-args">(script)</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          <p>Profiling</p>
+          
+
+          
+          <div class="method-source-code" id="start_script-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/compatibility.rb, line 93</span>
+<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">start_script</span>(<span class="ruby-identifier">script</span>)
+  <span class="ruby-identifier">start</span>
+  <span class="ruby-identifier">load</span> <span class="ruby-identifier">script</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- start_script-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- start_script-method -->
+
+    
+      <div id="method-c-stop" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">stop</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="stop-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/compatibility.rb, line 125</span>
+<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">stop</span>
+  <span class="ruby-identifier">ensure_running!</span>
+  <span class="ruby-identifier">result</span> = <span class="ruby-ivar">@profile</span>.<span class="ruby-identifier">stop</span>
+  <span class="ruby-identifier">disable_gc_stats_if_needed</span>
+  <span class="ruby-ivar">@profile</span> = <span class="ruby-keyword">nil</span>
+  <span class="ruby-identifier">result</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- stop-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- stop-method -->
+
+    
+    </section><!-- public-class-method-details -->
+  
+  </section><!-- 5Buntitled-5D -->
+
+</div><!-- documentation -->
+
+
+<footer id="validator-badges">
+  <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
+  <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.1.
+  <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
+</footer>
+
diff --git a/doc/RubyProf/AbstractPrinter.html b/doc/RubyProf/AbstractPrinter.html
new file mode 100644
index 0000000..4f526f1
--- /dev/null
+++ b/doc/RubyProf/AbstractPrinter.html
@@ -0,0 +1,580 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+
+<title>class RubyProf::AbstractPrinter - ruby-prof</title>
+
+<link type="text/css" media="screen" href="../rdoc.css" rel="stylesheet">
+
+<script type="text/javascript">
+  var rdoc_rel_prefix = "../";
+</script>
+
+<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/navigation.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/search_index.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/search.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/searcher.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/darkfish.js"></script>
+
+
+<body id="top" class="class">
+<nav id="metadata">
+  <nav id="home-section" class="section">
+  <h3 class="section-header">
+    <a href="../index.html">Home</a>
+    <a href="../table_of_contents.html#classes">Classes</a>
+    <a href="../table_of_contents.html#methods">Methods</a>
+  </h3>
+</nav>
+
+
+  <nav id="search-section" class="section project-section" class="initially-hidden">
+  <form action="#" method="get" accept-charset="utf-8">
+    <h3 class="section-header">
+      <input type="text" name="search" placeholder="Search" id="search-field"
+             title="Type to search, Up and Down to navigate, Enter to load">
+    </h3>
+  </form>
+
+  <ul id="search-results" class="initially-hidden"></ul>
+</nav>
+
+
+  <div id="file-metadata">
+    <nav id="file-list-section" class="section">
+  <h3 class="section-header">Defined In</h3>
+  <ul>
+    <li>lib/ruby-prof/printers/abstract_printer.rb
+  </ul>
+</nav>
+
+    
+  </div>
+
+  <div id="class-metadata">
+    
+    <nav id="parent-class-section" class="section">
+  <h3 class="section-header">Parent</h3>
+  
+  <p class="link">Object
+  
+</nav>
+
+    
+    <!-- Method Quickref -->
+<nav id="method-list-section" class="section">
+  <h3 class="section-header">Methods</h3>
+
+  <ul class="link-list">
+    
+    <li><a href="#method-c-new">::new</a>
+    
+    <li><a href="#method-i-method_name">#method_name</a>
+    
+    <li><a href="#method-i-min_percent">#min_percent</a>
+    
+    <li><a href="#method-i-print">#print</a>
+    
+    <li><a href="#method-i-print_file">#print_file</a>
+    
+    <li><a href="#method-i-print_footer">#print_footer</a>
+    
+    <li><a href="#method-i-print_header">#print_header</a>
+    
+    <li><a href="#method-i-print_thread">#print_thread</a>
+    
+    <li><a href="#method-i-print_threads">#print_threads</a>
+    
+    <li><a href="#method-i-setup_options">#setup_options</a>
+    
+    <li><a href="#method-i-sort_method">#sort_method</a>
+    
+  </ul>
+</nav>
+
+  </div>
+
+  <div id="project-metadata">
+    <nav id="fileindex-section" class="section project-section">
+  <h3 class="section-header">Pages</h3>
+
+  <ul>
+  
+    <li class="file"><a href="../LICENSE.html">LICENSE</a>
+  
+    <li class="file"><a href="../README_rdoc.html">README</a>
+  
+    <li class="file"><a href="../examples/flat_txt.html">flat</a>
+  
+    <li class="file"><a href="../examples/graph_txt.html">graph</a>
+  
+  </ul>
+</nav>
+
+    <nav id="classindex-section" class="section project-section">
+  <h3 class="section-header">Class and Module Index</h3>
+
+  <ul class="link-list">
+  
+    <li><a href="../RubyProf.html">RubyProf</a>
+  
+    <li><a href="../RubyProf/AbstractPrinter.html">RubyProf::AbstractPrinter</a>
+  
+    <li><a href="../RubyProf/AggregateCallInfo.html">RubyProf::AggregateCallInfo</a>
+  
+    <li><a href="../RubyProf/CallInfo.html">RubyProf::CallInfo</a>
+  
+    <li><a href="../RubyProf/CallInfoPrinter.html">RubyProf::CallInfoPrinter</a>
+  
+    <li><a href="../RubyProf/CallInfoVisitor.html">RubyProf::CallInfoVisitor</a>
+  
+    <li><a href="../RubyProf/CallStackPrinter.html">RubyProf::CallStackPrinter</a>
+  
+    <li><a href="../RubyProf/CallTreePrinter.html">RubyProf::CallTreePrinter</a>
+  
+    <li><a href="../RubyProf/Cmd.html">RubyProf::Cmd</a>
+  
+    <li><a href="../RubyProf/DotPrinter.html">RubyProf::DotPrinter</a>
+  
+    <li><a href="../RubyProf/FlatPrinter.html">RubyProf::FlatPrinter</a>
+  
+    <li><a href="../RubyProf/FlatPrinterWithLineNumbers.html">RubyProf::FlatPrinterWithLineNumbers</a>
+  
+    <li><a href="../RubyProf/GraphHtmlPrinter.html">RubyProf::GraphHtmlPrinter</a>
+  
+    <li><a href="../RubyProf/GraphPrinter.html">RubyProf::GraphPrinter</a>
+  
+    <li><a href="../RubyProf/MethodInfo.html">RubyProf::MethodInfo</a>
+  
+    <li><a href="../RubyProf/MultiPrinter.html">RubyProf::MultiPrinter</a>
+  
+    <li><a href="../RubyProf/Profile.html">RubyProf::Profile</a>
+  
+    <li><a href="../RubyProf/ProfileTask.html">RubyProf::ProfileTask</a>
+  
+    <li><a href="../RubyProf/Test.html">RubyProf::Test</a>
+  
+    <li><a href="../RubyProf/Thread.html">RubyProf::Thread</a>
+  
+    <li><a href="../Rack.html">Rack</a>
+  
+    <li><a href="../Rack/RubyProf.html">Rack::RubyProf</a>
+  
+  </ul>
+</nav>
+
+  </div>
+</nav>
+
+<div id="documentation">
+  <h1 class="class">class RubyProf::AbstractPrinter</h1>
+
+  <div id="description" class="description">
+    
+  </div><!-- description -->
+
+  
+  
+  
+  <section id="5Buntitled-5D" class="documentation-section">
+    
+
+    
+
+    
+
+    
+
+    <!-- Methods -->
+    
+     <section id="public-class-5Buntitled-5D-method-details" class="method-section section">
+      <h3 class="section-header">Public Class Methods</h3>
+
+    
+      <div id="method-c-new" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">new</span><span
+            class="method-args">(result)</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          <p>Create a new printer.</p>
+
+<p>result should be the output generated from a profiling run</p>
+          
+
+          
+          <div class="method-source-code" id="new-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/printers/abstract_printer.rb, line 7</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">result</span>)
+  <span class="ruby-ivar">@result</span> = <span class="ruby-identifier">result</span>
+  <span class="ruby-ivar">@output</span> = <span class="ruby-keyword">nil</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- new-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- new-method -->
+
+    
+    </section><!-- public-class-method-details -->
+  
+     <section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
+      <h3 class="section-header">Public Instance Methods</h3>
+
+    
+      <div id="method-i-method_name" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">method_name</span><span
+            class="method-args">(method)</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="method_name-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/printers/abstract_printer.rb, line 44</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">method_name</span>(<span class="ruby-identifier">method</span>)
+  <span class="ruby-identifier">name</span> = <span class="ruby-identifier">method</span>.<span class="ruby-identifier">full_name</span>
+  <span class="ruby-keyword">if</span> <span class="ruby-identifier">print_file</span>
+    <span class="ruby-identifier">name</span> <span class="ruby-operator">+=</span> <span class="ruby-node">" (#{method.source_file}:#{method.line}}"</span>
+  <span class="ruby-keyword">end</span>
+  <span class="ruby-identifier">name</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- method_name-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- method_name-method -->
+
+    
+      <div id="method-i-min_percent" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">min_percent</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="min_percent-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/printers/abstract_printer.rb, line 32</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">min_percent</span>
+  <span class="ruby-ivar">@options</span>[<span class="ruby-value">:min_percent</span>] <span class="ruby-operator">||</span> <span class="ruby-value">0</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- min_percent-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- min_percent-method -->
+
+    
+      <div id="method-i-print" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">print</span><span
+            class="method-args">(output = STDOUT, options = {})</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          <p>Print a profiling report to the provided output.</p>
+
+<p>output - Any IO object, including STDOUT or a file. The default value is
+STDOUT.</p>
+
+<p>options - Hash of print options.  See <a
+href="AbstractPrinter.html#method-i-setup_options">setup_options</a> for
+more information.  Note that each printer can define its own set of
+options.</p>
+          
+
+          
+          <div class="method-source-code" id="print-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/printers/abstract_printer.rb, line 60</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">print</span>(<span class="ruby-identifier">output</span> = <span class="ruby-constant">STDOUT</span>, <span class="ruby-identifier">options</span> = {})
+  <span class="ruby-ivar">@output</span> = <span class="ruby-identifier">output</span>
+  <span class="ruby-identifier">setup_options</span>(<span class="ruby-identifier">options</span>)
+  <span class="ruby-identifier">print_threads</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- print-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- print-method -->
+
+    
+      <div id="method-i-print_file" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">print_file</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="print_file-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/printers/abstract_printer.rb, line 36</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">print_file</span>
+  <span class="ruby-ivar">@options</span>[<span class="ruby-value">:print_file</span>] <span class="ruby-operator">||</span> <span class="ruby-keyword">false</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- print_file-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- print_file-method -->
+
+    
+      <div id="method-i-print_footer" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">print_footer</span><span
+            class="method-args">(thread)</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="print_footer-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/printers/abstract_printer.rb, line 81</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">print_footer</span>(<span class="ruby-identifier">thread</span>)
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- print_footer-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- print_footer-method -->
+
+    
+      <div id="method-i-print_header" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">print_header</span><span
+            class="method-args">(thread)</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="print_header-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/printers/abstract_printer.rb, line 78</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">print_header</span>(<span class="ruby-identifier">thread</span>)
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- print_header-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- print_header-method -->
+
+    
+      <div id="method-i-print_thread" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">print_thread</span><span
+            class="method-args">(thread)</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="print_thread-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/printers/abstract_printer.rb, line 72</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">print_thread</span>(<span class="ruby-identifier">thread</span>)
+  <span class="ruby-identifier">print_header</span>(<span class="ruby-identifier">thread</span>)
+  <span class="ruby-identifier">print_methods</span>(<span class="ruby-identifier">thread</span>)
+  <span class="ruby-identifier">print_footer</span>(<span class="ruby-identifier">thread</span>)
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- print_thread-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- print_thread-method -->
+
+    
+      <div id="method-i-print_threads" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">print_threads</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="print_threads-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/printers/abstract_printer.rb, line 66</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">print_threads</span>
+  <span class="ruby-ivar">@result</span>.<span class="ruby-identifier">threads</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">thread</span><span class="ruby-operator">|</span>
+    <span class="ruby-identifier">print_thread</span>(<span class="ruby-identifier">thread</span>)
+  <span class="ruby-keyword">end</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- print_threads-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- print_threads-method -->
+
+    
+      <div id="method-i-setup_options" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">setup_options</span><span
+            class="method-args">(options = {})</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          <p>Specify print options.</p>
+
+<p>options - Hash table</p>
+
+<pre>:min_percent - Number 0 to 100 that specifes the minimum
+               %self (the methods self time divided by the
+               overall total time) that a method must take
+               for it to be printed out in the report.
+               Default value is 0.
+
+:print_file  - True or false. Specifies if a method's source
+               file should be printed.  Default value if false.
+
+:sort_method - Specifies method used for sorting method infos.
+               Available values are :total_time, :self_time,
+               :wait_time, :children_time
+               Default value is :total_time</pre>
+          
+
+          
+          <div class="method-source-code" id="setup_options-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/printers/abstract_printer.rb, line 28</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">setup_options</span>(<span class="ruby-identifier">options</span> = {})
+  <span class="ruby-ivar">@options</span> = <span class="ruby-identifier">options</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- setup_options-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- setup_options-method -->
+
+    
+      <div id="method-i-sort_method" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">sort_method</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="sort_method-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/printers/abstract_printer.rb, line 40</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">sort_method</span>
+  <span class="ruby-ivar">@options</span>[<span class="ruby-value">:sort_method</span>] <span class="ruby-operator">||</span> <span class="ruby-value">:total_time</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- sort_method-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- sort_method-method -->
+
+    
+    </section><!-- public-instance-method-details -->
+  
+  </section><!-- 5Buntitled-5D -->
+
+</div><!-- documentation -->
+
+
+<footer id="validator-badges">
+  <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
+  <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.1.
+  <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
+</footer>
+
diff --git a/doc/RubyProf/AggregateCallInfo.html b/doc/RubyProf/AggregateCallInfo.html
new file mode 100644
index 0000000..e771dea
--- /dev/null
+++ b/doc/RubyProf/AggregateCallInfo.html
@@ -0,0 +1,570 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+
+<title>class RubyProf::AggregateCallInfo - ruby-prof</title>
+
+<link type="text/css" media="screen" href="../rdoc.css" rel="stylesheet">
+
+<script type="text/javascript">
+  var rdoc_rel_prefix = "../";
+</script>
+
+<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/navigation.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/search_index.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/search.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/searcher.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/darkfish.js"></script>
+
+
+<body id="top" class="class">
+<nav id="metadata">
+  <nav id="home-section" class="section">
+  <h3 class="section-header">
+    <a href="../index.html">Home</a>
+    <a href="../table_of_contents.html#classes">Classes</a>
+    <a href="../table_of_contents.html#methods">Methods</a>
+  </h3>
+</nav>
+
+
+  <nav id="search-section" class="section project-section" class="initially-hidden">
+  <form action="#" method="get" accept-charset="utf-8">
+    <h3 class="section-header">
+      <input type="text" name="search" placeholder="Search" id="search-field"
+             title="Type to search, Up and Down to navigate, Enter to load">
+    </h3>
+  </form>
+
+  <ul id="search-results" class="initially-hidden"></ul>
+</nav>
+
+
+  <div id="file-metadata">
+    <nav id="file-list-section" class="section">
+  <h3 class="section-header">Defined In</h3>
+  <ul>
+    <li>lib/ruby-prof/aggregate_call_info.rb
+  </ul>
+</nav>
+
+    
+  </div>
+
+  <div id="class-metadata">
+    
+    <nav id="parent-class-section" class="section">
+  <h3 class="section-header">Parent</h3>
+  
+  <p class="link">Object
+  
+</nav>
+
+    
+    <!-- Method Quickref -->
+<nav id="method-list-section" class="section">
+  <h3 class="section-header">Methods</h3>
+
+  <ul class="link-list">
+    
+    <li><a href="#method-c-new">::new</a>
+    
+    <li><a href="#method-i-called">#called</a>
+    
+    <li><a href="#method-i-children">#children</a>
+    
+    <li><a href="#method-i-children_time">#children_time</a>
+    
+    <li><a href="#method-i-line">#line</a>
+    
+    <li><a href="#method-i-parent">#parent</a>
+    
+    <li><a href="#method-i-self_time">#self_time</a>
+    
+    <li><a href="#method-i-target">#target</a>
+    
+    <li><a href="#method-i-to_s">#to_s</a>
+    
+    <li><a href="#method-i-total_time">#total_time</a>
+    
+    <li><a href="#method-i-wait_time">#wait_time</a>
+    
+  </ul>
+</nav>
+
+  </div>
+
+  <div id="project-metadata">
+    <nav id="fileindex-section" class="section project-section">
+  <h3 class="section-header">Pages</h3>
+
+  <ul>
+  
+    <li class="file"><a href="../LICENSE.html">LICENSE</a>
+  
+    <li class="file"><a href="../README_rdoc.html">README</a>
+  
+    <li class="file"><a href="../examples/flat_txt.html">flat</a>
+  
+    <li class="file"><a href="../examples/graph_txt.html">graph</a>
+  
+  </ul>
+</nav>
+
+    <nav id="classindex-section" class="section project-section">
+  <h3 class="section-header">Class and Module Index</h3>
+
+  <ul class="link-list">
+  
+    <li><a href="../RubyProf.html">RubyProf</a>
+  
+    <li><a href="../RubyProf/AbstractPrinter.html">RubyProf::AbstractPrinter</a>
+  
+    <li><a href="../RubyProf/AggregateCallInfo.html">RubyProf::AggregateCallInfo</a>
+  
+    <li><a href="../RubyProf/CallInfo.html">RubyProf::CallInfo</a>
+  
+    <li><a href="../RubyProf/CallInfoPrinter.html">RubyProf::CallInfoPrinter</a>
+  
+    <li><a href="../RubyProf/CallInfoVisitor.html">RubyProf::CallInfoVisitor</a>
+  
+    <li><a href="../RubyProf/CallStackPrinter.html">RubyProf::CallStackPrinter</a>
+  
+    <li><a href="../RubyProf/CallTreePrinter.html">RubyProf::CallTreePrinter</a>
+  
+    <li><a href="../RubyProf/Cmd.html">RubyProf::Cmd</a>
+  
+    <li><a href="../RubyProf/DotPrinter.html">RubyProf::DotPrinter</a>
+  
+    <li><a href="../RubyProf/FlatPrinter.html">RubyProf::FlatPrinter</a>
+  
+    <li><a href="../RubyProf/FlatPrinterWithLineNumbers.html">RubyProf::FlatPrinterWithLineNumbers</a>
+  
+    <li><a href="../RubyProf/GraphHtmlPrinter.html">RubyProf::GraphHtmlPrinter</a>
+  
+    <li><a href="../RubyProf/GraphPrinter.html">RubyProf::GraphPrinter</a>
+  
+    <li><a href="../RubyProf/MethodInfo.html">RubyProf::MethodInfo</a>
+  
+    <li><a href="../RubyProf/MultiPrinter.html">RubyProf::MultiPrinter</a>
+  
+    <li><a href="../RubyProf/Profile.html">RubyProf::Profile</a>
+  
+    <li><a href="../RubyProf/ProfileTask.html">RubyProf::ProfileTask</a>
+  
+    <li><a href="../RubyProf/Test.html">RubyProf::Test</a>
+  
+    <li><a href="../RubyProf/Thread.html">RubyProf::Thread</a>
+  
+    <li><a href="../Rack.html">Rack</a>
+  
+    <li><a href="../Rack/RubyProf.html">Rack::RubyProf</a>
+  
+  </ul>
+</nav>
+
+  </div>
+</nav>
+
+<div id="documentation">
+  <h1 class="class">class RubyProf::AggregateCallInfo</h1>
+
+  <div id="description" class="description">
+    
+  </div><!-- description -->
+
+  
+  
+  
+  <section id="5Buntitled-5D" class="documentation-section">
+    
+
+    
+
+    
+
+    
+    <!-- Attributes -->
+    <section id="attribute-method-details" class="method-section section">
+      <h3 class="section-header">Attributes</h3>
+
+      
+      <div id="attribute-i-call_infos" class="method-detail">
+        <div class="method-heading attribute-method-heading">
+          <span class="method-name">call_infos</span><span
+            class="attribute-access-type">[R]</span>
+        </div>
+
+        <div class="method-description">
+        
+        
+        
+        </div>
+      </div>
+      
+    </section><!-- attribute-method-details -->
+    
+
+    <!-- Methods -->
+    
+     <section id="public-class-5Buntitled-5D-method-details" class="method-section section">
+      <h3 class="section-header">Public Class Methods</h3>
+
+    
+      <div id="method-c-new" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">new</span><span
+            class="method-args">(call_infos)</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="new-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/aggregate_call_info.rb, line 6</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">call_infos</span>)
+  <span class="ruby-keyword">if</span> <span class="ruby-identifier">call_infos</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
+    <span class="ruby-identifier">raise</span>(<span class="ruby-constant">ArgumentError</span>, <span class="ruby-string">"Must specify at least one call info."</span>)
+  <span class="ruby-keyword">end</span>
+  <span class="ruby-ivar">@call_infos</span> = <span class="ruby-identifier">call_infos</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- new-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- new-method -->
+
+    
+    </section><!-- public-class-method-details -->
+  
+     <section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
+      <h3 class="section-header">Public Instance Methods</h3>
+
+    
+      <div id="method-i-called" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">called</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="called-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/aggregate_call_info.rb, line 47</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">called</span>
+  <span class="ruby-identifier">aggregate</span>(<span class="ruby-value">:called</span>)
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- called-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- called-method -->
+
+    
+      <div id="method-i-children" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">children</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="children-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/aggregate_call_info.rb, line 25</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">children</span>
+  <span class="ruby-identifier">call_infos</span>.<span class="ruby-identifier">inject</span>(<span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">result</span>, <span class="ruby-identifier">call_info</span><span class="ruby-operator">|</span>
+    <span class="ruby-identifier">result</span>.<span class="ruby-identifier">concat</span>(<span class="ruby-identifier">call_info</span>.<span class="ruby-identifier">children</span>)
+  <span class="ruby-keyword">end</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- children-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- children-method -->
+
+    
+      <div id="method-i-children_time" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">children_time</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="children_time-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/aggregate_call_info.rb, line 43</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">children_time</span>
+  <span class="ruby-identifier">aggregate_without_recursion</span>(<span class="ruby-value">:children_time</span>)
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- children_time-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- children_time-method -->
+
+    
+      <div id="method-i-line" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">line</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="line-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/aggregate_call_info.rb, line 21</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">line</span>
+  <span class="ruby-identifier">call_infos</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">line</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- line-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- line-method -->
+
+    
+      <div id="method-i-parent" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">parent</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="parent-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/aggregate_call_info.rb, line 17</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">parent</span>
+  <span class="ruby-identifier">call_infos</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">parent</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- parent-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- parent-method -->
+
+    
+      <div id="method-i-self_time" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">self_time</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="self_time-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/aggregate_call_info.rb, line 35</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">self_time</span>
+  <span class="ruby-identifier">aggregate_without_recursion</span>(<span class="ruby-value">:self_time</span>)
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- self_time-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- self_time-method -->
+
+    
+      <div id="method-i-target" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">target</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="target-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/aggregate_call_info.rb, line 13</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">target</span>
+  <span class="ruby-identifier">call_infos</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">target</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- target-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- target-method -->
+
+    
+      <div id="method-i-to_s" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">to_s</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="to_s-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/aggregate_call_info.rb, line 51</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">to_s</span>
+  <span class="ruby-node">"#{call_infos.first.target.full_name}"</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- to_s-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- to_s-method -->
+
+    
+      <div id="method-i-total_time" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">total_time</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="total_time-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/aggregate_call_info.rb, line 31</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">total_time</span>
+  <span class="ruby-identifier">aggregate_without_recursion</span>(<span class="ruby-value">:total_time</span>)
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- total_time-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- total_time-method -->
+
+    
+      <div id="method-i-wait_time" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">wait_time</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="wait_time-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/aggregate_call_info.rb, line 39</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">wait_time</span>
+  <span class="ruby-identifier">aggregate_without_recursion</span>(<span class="ruby-value">:wait_time</span>)
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- wait_time-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- wait_time-method -->
+
+    
+    </section><!-- public-instance-method-details -->
+  
+  </section><!-- 5Buntitled-5D -->
+
+</div><!-- documentation -->
+
+
+<footer id="validator-badges">
+  <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
+  <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.1.
+  <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
+</footer>
+
diff --git a/doc/RubyProf/CallInfo.html b/doc/RubyProf/CallInfo.html
new file mode 100644
index 0000000..1f7c2e1
--- /dev/null
+++ b/doc/RubyProf/CallInfo.html
@@ -0,0 +1,512 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+
+<title>class RubyProf::CallInfo - ruby-prof</title>
+
+<link type="text/css" media="screen" href="../rdoc.css" rel="stylesheet">
+
+<script type="text/javascript">
+  var rdoc_rel_prefix = "../";
+</script>
+
+<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/navigation.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/search_index.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/search.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/searcher.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/darkfish.js"></script>
+
+
+<body id="top" class="class">
+<nav id="metadata">
+  <nav id="home-section" class="section">
+  <h3 class="section-header">
+    <a href="../index.html">Home</a>
+    <a href="../table_of_contents.html#classes">Classes</a>
+    <a href="../table_of_contents.html#methods">Methods</a>
+  </h3>
+</nav>
+
+
+  <nav id="search-section" class="section project-section" class="initially-hidden">
+  <form action="#" method="get" accept-charset="utf-8">
+    <h3 class="section-header">
+      <input type="text" name="search" placeholder="Search" id="search-field"
+             title="Type to search, Up and Down to navigate, Enter to load">
+    </h3>
+  </form>
+
+  <ul id="search-results" class="initially-hidden"></ul>
+</nav>
+
+
+  <div id="file-metadata">
+    <nav id="file-list-section" class="section">
+  <h3 class="section-header">Defined In</h3>
+  <ul>
+    <li>lib/ruby-prof/call_info.rb
+  </ul>
+</nav>
+
+    
+  </div>
+
+  <div id="class-metadata">
+    
+    <nav id="parent-class-section" class="section">
+  <h3 class="section-header">Parent</h3>
+  
+  <p class="link">Object
+  
+</nav>
+
+    
+    <!-- Method Quickref -->
+<nav id="method-list-section" class="section">
+  <h3 class="section-header">Methods</h3>
+
+  <ul class="link-list">
+    
+    <li><a href="#method-i-call_sequence">#call_sequence</a>
+    
+    <li><a href="#method-i-children_time">#children_time</a>
+    
+    <li><a href="#method-i-eliminate-21">#eliminate!</a>
+    
+    <li><a href="#method-i-find_call">#find_call</a>
+    
+    <li><a href="#method-i-merge_call_tree">#merge_call_tree</a>
+    
+    <li><a href="#method-i-root-3F">#root?</a>
+    
+    <li><a href="#method-i-stack">#stack</a>
+    
+    <li><a href="#method-i-to_s">#to_s</a>
+    
+  </ul>
+</nav>
+
+  </div>
+
+  <div id="project-metadata">
+    <nav id="fileindex-section" class="section project-section">
+  <h3 class="section-header">Pages</h3>
+
+  <ul>
+  
+    <li class="file"><a href="../LICENSE.html">LICENSE</a>
+  
+    <li class="file"><a href="../README_rdoc.html">README</a>
+  
+    <li class="file"><a href="../examples/flat_txt.html">flat</a>
+  
+    <li class="file"><a href="../examples/graph_txt.html">graph</a>
+  
+  </ul>
+</nav>
+
+    <nav id="classindex-section" class="section project-section">
+  <h3 class="section-header">Class and Module Index</h3>
+
+  <ul class="link-list">
+  
+    <li><a href="../RubyProf.html">RubyProf</a>
+  
+    <li><a href="../RubyProf/AbstractPrinter.html">RubyProf::AbstractPrinter</a>
+  
+    <li><a href="../RubyProf/AggregateCallInfo.html">RubyProf::AggregateCallInfo</a>
+  
+    <li><a href="../RubyProf/CallInfo.html">RubyProf::CallInfo</a>
+  
+    <li><a href="../RubyProf/CallInfoPrinter.html">RubyProf::CallInfoPrinter</a>
+  
+    <li><a href="../RubyProf/CallInfoVisitor.html">RubyProf::CallInfoVisitor</a>
+  
+    <li><a href="../RubyProf/CallStackPrinter.html">RubyProf::CallStackPrinter</a>
+  
+    <li><a href="../RubyProf/CallTreePrinter.html">RubyProf::CallTreePrinter</a>
+  
+    <li><a href="../RubyProf/Cmd.html">RubyProf::Cmd</a>
+  
+    <li><a href="../RubyProf/DotPrinter.html">RubyProf::DotPrinter</a>
+  
+    <li><a href="../RubyProf/FlatPrinter.html">RubyProf::FlatPrinter</a>
+  
+    <li><a href="../RubyProf/FlatPrinterWithLineNumbers.html">RubyProf::FlatPrinterWithLineNumbers</a>
+  
+    <li><a href="../RubyProf/GraphHtmlPrinter.html">RubyProf::GraphHtmlPrinter</a>
+  
+    <li><a href="../RubyProf/GraphPrinter.html">RubyProf::GraphPrinter</a>
+  
+    <li><a href="../RubyProf/MethodInfo.html">RubyProf::MethodInfo</a>
+  
+    <li><a href="../RubyProf/MultiPrinter.html">RubyProf::MultiPrinter</a>
+  
+    <li><a href="../RubyProf/Profile.html">RubyProf::Profile</a>
+  
+    <li><a href="../RubyProf/ProfileTask.html">RubyProf::ProfileTask</a>
+  
+    <li><a href="../RubyProf/Test.html">RubyProf::Test</a>
+  
+    <li><a href="../RubyProf/Thread.html">RubyProf::Thread</a>
+  
+    <li><a href="../Rack.html">Rack</a>
+  
+    <li><a href="../Rack/RubyProf.html">Rack::RubyProf</a>
+  
+  </ul>
+</nav>
+
+  </div>
+</nav>
+
+<div id="documentation">
+  <h1 class="class">class RubyProf::CallInfo</h1>
+
+  <div id="description" class="description">
+    
+  </div><!-- description -->
+
+  
+  
+  
+  <section id="5Buntitled-5D" class="documentation-section">
+    
+
+    
+
+    
+
+    
+    <!-- Attributes -->
+    <section id="attribute-method-details" class="method-section section">
+      <h3 class="section-header">Attributes</h3>
+
+      
+      <div id="attribute-i-recursive" class="method-detail">
+        <div class="method-heading attribute-method-heading">
+          <span class="method-name">recursive</span><span
+            class="attribute-access-type">[RW]</span>
+        </div>
+
+        <div class="method-description">
+        
+        
+        
+        </div>
+      </div>
+      
+    </section><!-- attribute-method-details -->
+    
+
+    <!-- Methods -->
+    
+     <section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
+      <h3 class="section-header">Public Instance Methods</h3>
+
+    
+      <div id="method-i-call_sequence" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">call_sequence</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="call_sequence-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line 25</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">call_sequence</span>
+  <span class="ruby-ivar">@call_sequence</span> <span class="ruby-operator">||=</span> <span class="ruby-keyword">begin</span>
+    <span class="ruby-identifier">stack</span>.<span class="ruby-identifier">map</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">method</span><span class="ruby-operator">|</span> <span class="ruby-identifier">method</span>.<span class="ruby-identifier">full_name</span>}.<span class="ruby-identifier">join</span>(<span class="ruby-string">'->'</span>)
+  <span class="ruby-keyword">end</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- call_sequence-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- call_sequence-method -->
+
+    
+      <div id="method-i-children_time" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">children_time</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="children_time-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line 6</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">children_time</span>
+  <span class="ruby-identifier">children</span>.<span class="ruby-identifier">inject</span>(<span class="ruby-value">0</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">sum</span>, <span class="ruby-identifier">call_info</span><span class="ruby-operator">|</span>
+    <span class="ruby-identifier">sum</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">call_info</span>.<span class="ruby-identifier">total_time</span>
+  <span class="ruby-keyword">end</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- children_time-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- children_time-method -->
+
+    
+      <div id="method-i-eliminate-21" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">eliminate!</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          <p>eliminate call info from the call tree. adds self and wait time to parent
+and attaches called methods to parent. merges call trees for methods called
+from both praent end self.</p>
+          
+
+          
+          <div class="method-source-code" id="eliminate-21-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line 42</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">eliminate!</span>
+  <span class="ruby-comment"># puts "eliminating #{self}"</span>
+  <span class="ruby-keyword">return</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">parent</span>
+  <span class="ruby-identifier">parent</span>.<span class="ruby-identifier">add_self_time</span>(<span class="ruby-keyword">self</span>)
+  <span class="ruby-identifier">parent</span>.<span class="ruby-identifier">add_wait_time</span>(<span class="ruby-keyword">self</span>)
+  <span class="ruby-identifier">children</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">kid</span><span class="ruby-operator">|</span>
+    <span class="ruby-keyword">if</span> <span class="ruby-identifier">call</span> = <span class="ruby-identifier">parent</span>.<span class="ruby-identifier">find_call</span>(<span class="ruby-identifier">kid</span>)
+      <span class="ruby-identifier">call</span>.<span class="ruby-identifier">merge_call_tree</span>(<span class="ruby-identifier">kid</span>)
+    <span class="ruby-keyword">else</span>
+      <span class="ruby-identifier">parent</span>.<span class="ruby-identifier">children</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">kid</span>
+      <span class="ruby-comment"># $stderr.puts "setting parent of #{kid}\nto #{parent}"</span>
+      <span class="ruby-identifier">kid</span>.<span class="ruby-identifier">parent</span> = <span class="ruby-identifier">parent</span>
+    <span class="ruby-keyword">end</span>
+  <span class="ruby-keyword">end</span>
+  <span class="ruby-identifier">parent</span>.<span class="ruby-identifier">children</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-keyword">self</span>)
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- eliminate-21-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- eliminate-21-method -->
+
+    
+      <div id="method-i-find_call" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">find_call</span><span
+            class="method-args">(other)</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          <p>find a specific call in list of children. returns nil if not found. note:
+there can't be more than one child with a given target method. in other
+words: x.children.grep{|y|y.target==m}.size <= 1 for all method infos m
+and call infos x</p>
+          
+
+          
+          <div class="method-source-code" id="find_call-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line 62</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">find_call</span>(<span class="ruby-identifier">other</span>)
+  <span class="ruby-identifier">matching</span> = <span class="ruby-identifier">children</span>.<span class="ruby-identifier">select</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">kid</span><span class="ruby-operator">|</span> <span class="ruby-identifier">kid</span>.<span class="ruby-identifier">target</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">target</span> }
+  <span class="ruby-identifier">raise</span> <span class="ruby-string">"inconsistent call tree"</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">matching</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator"><=</span> <span class="ruby-value">1</span>
+  <span class="ruby-identifier">matching</span>.<span class="ruby-identifier">first</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- find_call-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- find_call-method -->
+
+    
+      <div id="method-i-merge_call_tree" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">merge_call_tree</span><span
+            class="method-args">(other)</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          <p>merge two call trees. adds self, wait, and total time of other to self and
+merges children of other into children of self.</p>
+          
+
+          
+          <div class="method-source-code" id="merge_call_tree-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line 69</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">merge_call_tree</span>(<span class="ruby-identifier">other</span>)
+  <span class="ruby-comment"># $stderr.puts "merging #{self}\nand #{other}"</span>
+  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">called</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">called</span>
+  <span class="ruby-identifier">add_self_time</span>(<span class="ruby-identifier">other</span>)
+  <span class="ruby-identifier">add_wait_time</span>(<span class="ruby-identifier">other</span>)
+  <span class="ruby-identifier">add_total_time</span>(<span class="ruby-identifier">other</span>)
+  <span class="ruby-identifier">other</span>.<span class="ruby-identifier">children</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">other_kid</span><span class="ruby-operator">|</span>
+    <span class="ruby-keyword">if</span> <span class="ruby-identifier">kid</span> = <span class="ruby-identifier">find_call</span>(<span class="ruby-identifier">other_kid</span>)
+      <span class="ruby-comment"># $stderr.puts "merging kids"</span>
+      <span class="ruby-identifier">kid</span>.<span class="ruby-identifier">merge_call_tree</span>(<span class="ruby-identifier">other_kid</span>)
+    <span class="ruby-keyword">else</span>
+      <span class="ruby-identifier">other_kid</span>.<span class="ruby-identifier">parent</span> = <span class="ruby-keyword">self</span>
+      <span class="ruby-identifier">children</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">other_kid</span>
+    <span class="ruby-keyword">end</span>
+  <span class="ruby-keyword">end</span>
+  <span class="ruby-identifier">other</span>.<span class="ruby-identifier">children</span>.<span class="ruby-identifier">clear</span>
+  <span class="ruby-identifier">other</span>.<span class="ruby-identifier">target</span>.<span class="ruby-identifier">call_infos</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">other</span>)
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- merge_call_tree-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- merge_call_tree-method -->
+
+    
+      <div id="method-i-root-3F" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">root?</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="root-3F-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line 31</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">root?</span>
+  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">parent</span>.<span class="ruby-identifier">nil?</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- root-3F-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- root-3F-method -->
+
+    
+      <div id="method-i-stack" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">stack</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="stack-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line 12</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">stack</span>
+  <span class="ruby-ivar">@stack</span> <span class="ruby-operator">||=</span> <span class="ruby-keyword">begin</span>
+    <span class="ruby-identifier">methods</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
+    <span class="ruby-identifier">call_info</span> = <span class="ruby-keyword">self</span>
+
+    <span class="ruby-keyword">while</span> <span class="ruby-identifier">call_info</span>
+      <span class="ruby-identifier">methods</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">call_info</span>.<span class="ruby-identifier">target</span>
+      <span class="ruby-identifier">call_info</span> = <span class="ruby-identifier">call_info</span>.<span class="ruby-identifier">parent</span>
+    <span class="ruby-keyword">end</span>
+    <span class="ruby-identifier">methods</span>.<span class="ruby-identifier">reverse</span>
+  <span class="ruby-keyword">end</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- stack-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- stack-method -->
+
+    
+      <div id="method-i-to_s" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">to_s</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="to_s-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/call_info.rb, line 35</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">to_s</span>
+  <span class="ruby-node">"#{self.target.full_name} (c: #{self.called}, tt: #{self.total_time}, st: #{self.self_time}, ct: #{self.children_time})"</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- to_s-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- to_s-method -->
+
+    
+    </section><!-- public-instance-method-details -->
+  
+  </section><!-- 5Buntitled-5D -->
+
+</div><!-- documentation -->
+
+
+<footer id="validator-badges">
+  <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
+  <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.1.
+  <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
+</footer>
+
diff --git a/doc/RubyProf/CallInfoPrinter.html b/doc/RubyProf/CallInfoPrinter.html
new file mode 100644
index 0000000..9e850ac
--- /dev/null
+++ b/doc/RubyProf/CallInfoPrinter.html
@@ -0,0 +1,190 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+
+<title>class RubyProf::CallInfoPrinter - ruby-prof</title>
+
+<link type="text/css" media="screen" href="../rdoc.css" rel="stylesheet">
+
+<script type="text/javascript">
+  var rdoc_rel_prefix = "../";
+</script>
+
+<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/navigation.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/search_index.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/search.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/searcher.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/darkfish.js"></script>
+
+
+<body id="top" class="class">
+<nav id="metadata">
+  <nav id="home-section" class="section">
+  <h3 class="section-header">
+    <a href="../index.html">Home</a>
+    <a href="../table_of_contents.html#classes">Classes</a>
+    <a href="../table_of_contents.html#methods">Methods</a>
+  </h3>
+</nav>
+
+
+  <nav id="search-section" class="section project-section" class="initially-hidden">
+  <form action="#" method="get" accept-charset="utf-8">
+    <h3 class="section-header">
+      <input type="text" name="search" placeholder="Search" id="search-field"
+             title="Type to search, Up and Down to navigate, Enter to load">
+    </h3>
+  </form>
+
+  <ul id="search-results" class="initially-hidden"></ul>
+</nav>
+
+
+  <div id="file-metadata">
+    <nav id="file-list-section" class="section">
+  <h3 class="section-header">Defined In</h3>
+  <ul>
+    <li>lib/ruby-prof/printers/call_info_printer.rb
+  </ul>
+</nav>
+
+    
+  </div>
+
+  <div id="class-metadata">
+    
+    <nav id="parent-class-section" class="section">
+  <h3 class="section-header">Parent</h3>
+  
+  <p class="link"><a href="AbstractPrinter.html">RubyProf::AbstractPrinter</a>
+  
+</nav>
+
+    
+    
+  </div>
+
+  <div id="project-metadata">
+    <nav id="fileindex-section" class="section project-section">
+  <h3 class="section-header">Pages</h3>
+
+  <ul>
+  
+    <li class="file"><a href="../LICENSE.html">LICENSE</a>
+  
+    <li class="file"><a href="../README_rdoc.html">README</a>
+  
+    <li class="file"><a href="../examples/flat_txt.html">flat</a>
+  
+    <li class="file"><a href="../examples/graph_txt.html">graph</a>
+  
+  </ul>
+</nav>
+
+    <nav id="classindex-section" class="section project-section">
+  <h3 class="section-header">Class and Module Index</h3>
+
+  <ul class="link-list">
+  
+    <li><a href="../RubyProf.html">RubyProf</a>
+  
+    <li><a href="../RubyProf/AbstractPrinter.html">RubyProf::AbstractPrinter</a>
+  
+    <li><a href="../RubyProf/AggregateCallInfo.html">RubyProf::AggregateCallInfo</a>
+  
+    <li><a href="../RubyProf/CallInfo.html">RubyProf::CallInfo</a>
+  
+    <li><a href="../RubyProf/CallInfoPrinter.html">RubyProf::CallInfoPrinter</a>
+  
+    <li><a href="../RubyProf/CallInfoVisitor.html">RubyProf::CallInfoVisitor</a>
+  
+    <li><a href="../RubyProf/CallStackPrinter.html">RubyProf::CallStackPrinter</a>
+  
+    <li><a href="../RubyProf/CallTreePrinter.html">RubyProf::CallTreePrinter</a>
+  
+    <li><a href="../RubyProf/Cmd.html">RubyProf::Cmd</a>
+  
+    <li><a href="../RubyProf/DotPrinter.html">RubyProf::DotPrinter</a>
+  
+    <li><a href="../RubyProf/FlatPrinter.html">RubyProf::FlatPrinter</a>
+  
+    <li><a href="../RubyProf/FlatPrinterWithLineNumbers.html">RubyProf::FlatPrinterWithLineNumbers</a>
+  
+    <li><a href="../RubyProf/GraphHtmlPrinter.html">RubyProf::GraphHtmlPrinter</a>
+  
+    <li><a href="../RubyProf/GraphPrinter.html">RubyProf::GraphPrinter</a>
+  
+    <li><a href="../RubyProf/MethodInfo.html">RubyProf::MethodInfo</a>
+  
+    <li><a href="../RubyProf/MultiPrinter.html">RubyProf::MultiPrinter</a>
+  
+    <li><a href="../RubyProf/Profile.html">RubyProf::Profile</a>
+  
+    <li><a href="../RubyProf/ProfileTask.html">RubyProf::ProfileTask</a>
+  
+    <li><a href="../RubyProf/Test.html">RubyProf::Test</a>
+  
+    <li><a href="../RubyProf/Thread.html">RubyProf::Thread</a>
+  
+    <li><a href="../Rack.html">Rack</a>
+  
+    <li><a href="../Rack/RubyProf.html">Rack::RubyProf</a>
+  
+  </ul>
+</nav>
+
+  </div>
+</nav>
+
+<div id="documentation">
+  <h1 class="class">class RubyProf::CallInfoPrinter</h1>
+
+  <div id="description" class="description">
+    
+<p>Prints out the call graph based on <a href="CallInfo.html">CallInfo</a>
+instances.  This is mainly for debugging purposes as it provides access
+into into RubyProf's internals.</p>
+
+  </div><!-- description -->
+
+  
+  
+  
+  <section id="5Buntitled-5D" class="documentation-section">
+    
+
+    
+
+    
+    <!-- Constants -->
+    <section id="constants-list" class="section">
+      <h3 class="section-header">Constants</h3>
+      <dl>
+      
+        <dt id="TIME_WIDTH">TIME_WIDTH
+        
+        <dd class="description">
+        
+      
+      </dl>
+    </section>
+    
+
+    
+
+    <!-- Methods -->
+    
+  </section><!-- 5Buntitled-5D -->
+
+</div><!-- documentation -->
+
+
+<footer id="validator-badges">
+  <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
+  <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.1.
+  <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
+</footer>
+
diff --git a/doc/RubyProf/CallInfoVisitor.html b/doc/RubyProf/CallInfoVisitor.html
new file mode 100644
index 0000000..0d0cd43
--- /dev/null
+++ b/doc/RubyProf/CallInfoVisitor.html
@@ -0,0 +1,332 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+
+<title>class RubyProf::CallInfoVisitor - ruby-prof</title>
+
+<link type="text/css" media="screen" href="../rdoc.css" rel="stylesheet">
+
+<script type="text/javascript">
+  var rdoc_rel_prefix = "../";
+</script>
+
+<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/navigation.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/search_index.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/search.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/searcher.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/darkfish.js"></script>
+
+
+<body id="top" class="class">
+<nav id="metadata">
+  <nav id="home-section" class="section">
+  <h3 class="section-header">
+    <a href="../index.html">Home</a>
+    <a href="../table_of_contents.html#classes">Classes</a>
+    <a href="../table_of_contents.html#methods">Methods</a>
+  </h3>
+</nav>
+
+
+  <nav id="search-section" class="section project-section" class="initially-hidden">
+  <form action="#" method="get" accept-charset="utf-8">
+    <h3 class="section-header">
+      <input type="text" name="search" placeholder="Search" id="search-field"
+             title="Type to search, Up and Down to navigate, Enter to load">
+    </h3>
+  </form>
+
+  <ul id="search-results" class="initially-hidden"></ul>
+</nav>
+
+
+  <div id="file-metadata">
+    <nav id="file-list-section" class="section">
+  <h3 class="section-header">Defined In</h3>
+  <ul>
+    <li>lib/ruby-prof/call_info_visitor.rb
+  </ul>
+</nav>
+
+    
+  </div>
+
+  <div id="class-metadata">
+    
+    <nav id="parent-class-section" class="section">
+  <h3 class="section-header">Parent</h3>
+  
+  <p class="link">Object
+  
+</nav>
+
+    
+    <!-- Method Quickref -->
+<nav id="method-list-section" class="section">
+  <h3 class="section-header">Methods</h3>
+
+  <ul class="link-list">
+    
+    <li><a href="#method-c-new">::new</a>
+    
+    <li><a href="#method-i-visit">#visit</a>
+    
+    <li><a href="#method-i-visit_call_info">#visit_call_info</a>
+    
+  </ul>
+</nav>
+
+  </div>
+
+  <div id="project-metadata">
+    <nav id="fileindex-section" class="section project-section">
+  <h3 class="section-header">Pages</h3>
+
+  <ul>
+  
+    <li class="file"><a href="../LICENSE.html">LICENSE</a>
+  
+    <li class="file"><a href="../README_rdoc.html">README</a>
+  
+    <li class="file"><a href="../examples/flat_txt.html">flat</a>
+  
+    <li class="file"><a href="../examples/graph_txt.html">graph</a>
+  
+  </ul>
+</nav>
+
+    <nav id="classindex-section" class="section project-section">
+  <h3 class="section-header">Class and Module Index</h3>
+
+  <ul class="link-list">
+  
+    <li><a href="../RubyProf.html">RubyProf</a>
+  
+    <li><a href="../RubyProf/AbstractPrinter.html">RubyProf::AbstractPrinter</a>
+  
+    <li><a href="../RubyProf/AggregateCallInfo.html">RubyProf::AggregateCallInfo</a>
+  
+    <li><a href="../RubyProf/CallInfo.html">RubyProf::CallInfo</a>
+  
+    <li><a href="../RubyProf/CallInfoPrinter.html">RubyProf::CallInfoPrinter</a>
+  
+    <li><a href="../RubyProf/CallInfoVisitor.html">RubyProf::CallInfoVisitor</a>
+  
+    <li><a href="../RubyProf/CallStackPrinter.html">RubyProf::CallStackPrinter</a>
+  
+    <li><a href="../RubyProf/CallTreePrinter.html">RubyProf::CallTreePrinter</a>
+  
+    <li><a href="../RubyProf/Cmd.html">RubyProf::Cmd</a>
+  
+    <li><a href="../RubyProf/DotPrinter.html">RubyProf::DotPrinter</a>
+  
+    <li><a href="../RubyProf/FlatPrinter.html">RubyProf::FlatPrinter</a>
+  
+    <li><a href="../RubyProf/FlatPrinterWithLineNumbers.html">RubyProf::FlatPrinterWithLineNumbers</a>
+  
+    <li><a href="../RubyProf/GraphHtmlPrinter.html">RubyProf::GraphHtmlPrinter</a>
+  
+    <li><a href="../RubyProf/GraphPrinter.html">RubyProf::GraphPrinter</a>
+  
+    <li><a href="../RubyProf/MethodInfo.html">RubyProf::MethodInfo</a>
+  
+    <li><a href="../RubyProf/MultiPrinter.html">RubyProf::MultiPrinter</a>
+  
+    <li><a href="../RubyProf/Profile.html">RubyProf::Profile</a>
+  
+    <li><a href="../RubyProf/ProfileTask.html">RubyProf::ProfileTask</a>
+  
+    <li><a href="../RubyProf/Test.html">RubyProf::Test</a>
+  
+    <li><a href="../RubyProf/Thread.html">RubyProf::Thread</a>
+  
+    <li><a href="../Rack.html">Rack</a>
+  
+    <li><a href="../Rack/RubyProf.html">Rack::RubyProf</a>
+  
+  </ul>
+</nav>
+
+  </div>
+</nav>
+
+<div id="documentation">
+  <h1 class="class">class RubyProf::CallInfoVisitor</h1>
+
+  <div id="description" class="description">
+    
+  </div><!-- description -->
+
+  
+  
+  
+  <section id="5Buntitled-5D" class="documentation-section">
+    
+
+    
+
+    
+
+    
+    <!-- Attributes -->
+    <section id="attribute-method-details" class="method-section section">
+      <h3 class="section-header">Attributes</h3>
+
+      
+      <div id="attribute-i-block" class="method-detail">
+        <div class="method-heading attribute-method-heading">
+          <span class="method-name">block</span><span
+            class="attribute-access-type">[R]</span>
+        </div>
+
+        <div class="method-description">
+        
+        
+        
+        </div>
+      </div>
+      
+      <div id="attribute-i-thread" class="method-detail">
+        <div class="method-heading attribute-method-heading">
+          <span class="method-name">thread</span><span
+            class="attribute-access-type">[R]</span>
+        </div>
+
+        <div class="method-description">
+        
+        
+        
+        </div>
+      </div>
+      
+    </section><!-- attribute-method-details -->
+    
+
+    <!-- Methods -->
+    
+     <section id="public-class-5Buntitled-5D-method-details" class="method-section section">
+      <h3 class="section-header">Public Class Methods</h3>
+
+    
+      <div id="method-c-new" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">new</span><span
+            class="method-args">(thread)</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="new-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/call_info_visitor.rb, line 22</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">thread</span>)
+  <span class="ruby-ivar">@thread</span> = <span class="ruby-identifier">thread</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- new-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- new-method -->
+
+    
+    </section><!-- public-class-method-details -->
+  
+     <section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
+      <h3 class="section-header">Public Instance Methods</h3>
+
+    
+      <div id="method-i-visit" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">visit</span><span
+            class="method-args">(&block)</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="visit-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/call_info_visitor.rb, line 26</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">visit</span>(&<span class="ruby-identifier">block</span>)
+  <span class="ruby-ivar">@block</span> = <span class="ruby-identifier">block</span>
+
+  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">thread</span>.<span class="ruby-identifier">top_methods</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">method_info</span><span class="ruby-operator">|</span>
+    <span class="ruby-identifier">method_info</span>.<span class="ruby-identifier">call_infos</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">call_info</span><span class="ruby-operator">|</span>
+      <span class="ruby-keyword">self</span>.<span class="ruby-identifier">visit_call_info</span>(<span class="ruby-identifier">call_info</span>)
+    <span class="ruby-keyword">end</span>
+  <span class="ruby-keyword">end</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- visit-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- visit-method -->
+
+    
+      <div id="method-i-visit_call_info" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">visit_call_info</span><span
+            class="method-args">(call_info)</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="visit_call_info-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/call_info_visitor.rb, line 36</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">visit_call_info</span>(<span class="ruby-identifier">call_info</span>)
+  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">block</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">call_info</span>, <span class="ruby-value">:enter</span>)
+  <span class="ruby-identifier">call_info</span>.<span class="ruby-identifier">children</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">child</span><span class="ruby-operator">|</span>
+    <span class="ruby-identifier">visit_call_info</span>(<span class="ruby-identifier">child</span>)
+  <span class="ruby-keyword">end</span>
+  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">block</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">call_info</span>, <span class="ruby-value">:exit</span>)
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- visit_call_info-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- visit_call_info-method -->
+
+    
+    </section><!-- public-instance-method-details -->
+  
+  </section><!-- 5Buntitled-5D -->
+
+</div><!-- documentation -->
+
+
+<footer id="validator-badges">
+  <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
+  <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.1.
+  <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
+</footer>
+
diff --git a/doc/RubyProf/CallStackPrinter.html b/doc/RubyProf/CallStackPrinter.html
new file mode 100644
index 0000000..51d9dc9
--- /dev/null
+++ b/doc/RubyProf/CallStackPrinter.html
@@ -0,0 +1,1600 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+
+<title>class RubyProf::CallStackPrinter - ruby-prof</title>
+
+<link type="text/css" media="screen" href="../rdoc.css" rel="stylesheet">
+
+<script type="text/javascript">
+  var rdoc_rel_prefix = "../";
+</script>
+
+<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/navigation.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/search_index.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/search.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/searcher.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/darkfish.js"></script>
+
+
+<body id="top" class="class">
+<nav id="metadata">
+  <nav id="home-section" class="section">
+  <h3 class="section-header">
+    <a href="../index.html">Home</a>
+    <a href="../table_of_contents.html#classes">Classes</a>
+    <a href="../table_of_contents.html#methods">Methods</a>
+  </h3>
+</nav>
+
+
+  <nav id="search-section" class="section project-section" class="initially-hidden">
+  <form action="#" method="get" accept-charset="utf-8">
+    <h3 class="section-header">
+      <input type="text" name="search" placeholder="Search" id="search-field"
+             title="Type to search, Up and Down to navigate, Enter to load">
+    </h3>
+  </form>
+
+  <ul id="search-results" class="initially-hidden"></ul>
+</nav>
+
+
+  <div id="file-metadata">
+    <nav id="file-list-section" class="section">
+  <h3 class="section-header">Defined In</h3>
+  <ul>
+    <li>lib/ruby-prof/printers/call_stack_printer.rb
+  </ul>
+</nav>
+
+    
+  </div>
+
+  <div id="class-metadata">
+    
+    <nav id="parent-class-section" class="section">
+  <h3 class="section-header">Parent</h3>
+  
+  <p class="link"><a href="AbstractPrinter.html">RubyProf::AbstractPrinter</a>
+  
+</nav>
+
+    <!-- Included Modules -->
+<nav id="includes-section" class="section">
+  <h3 class="section-header">Included Modules</h3>
+
+  <ul class="link-list">
+  
+  
+    <li><span class="include">ERB::Util</span>
+  
+  
+  </ul>
+</nav>
+
+    <!-- Method Quickref -->
+<nav id="method-list-section" class="section">
+  <h3 class="section-header">Methods</h3>
+
+  <ul class="link-list">
+    
+    <li><a href="#method-i-application">#application</a>
+    
+    <li><a href="#method-i-arguments">#arguments</a>
+    
+    <li><a href="#method-i-color">#color</a>
+    
+    <li><a href="#method-i-copy_image_files">#copy_image_files</a>
+    
+    <li><a href="#method-i-dump">#dump</a>
+    
+    <li><a href="#method-i-expansion">#expansion</a>
+    
+    <li><a href="#method-i-graph_link">#graph_link</a>
+    
+    <li><a href="#method-i-link">#link</a>
+    
+    <li><a href="#method-i-method_href">#method_href</a>
+    
+    <li><a href="#method-i-name">#name</a>
+    
+    <li><a href="#method-i-print">#print</a>
+    
+    <li><a href="#method-i-print_commands">#print_commands</a>
+    
+    <li><a href="#method-i-print_css">#print_css</a>
+    
+    <li><a href="#method-i-print_footer">#print_footer</a>
+    
+    <li><a href="#method-i-print_header">#print_header</a>
+    
+    <li><a href="#method-i-print_help">#print_help</a>
+    
+    <li><a href="#method-i-print_java_script">#print_java_script</a>
+    
+    <li><a href="#method-i-print_stack">#print_stack</a>
+    
+    <li><a href="#method-i-print_title_bar">#print_title_bar</a>
+    
+    <li><a href="#method-i-sum">#sum</a>
+    
+    <li><a href="#method-i-threshold">#threshold</a>
+    
+    <li><a href="#method-i-title">#title</a>
+    
+    <li><a href="#method-i-total_time">#total_time</a>
+    
+  </ul>
+</nav>
+
+  </div>
+
+  <div id="project-metadata">
+    <nav id="fileindex-section" class="section project-section">
+  <h3 class="section-header">Pages</h3>
+
+  <ul>
+  
+    <li class="file"><a href="../LICENSE.html">LICENSE</a>
+  
+    <li class="file"><a href="../README_rdoc.html">README</a>
+  
+    <li class="file"><a href="../examples/flat_txt.html">flat</a>
+  
+    <li class="file"><a href="../examples/graph_txt.html">graph</a>
+  
+  </ul>
+</nav>
+
+    <nav id="classindex-section" class="section project-section">
+  <h3 class="section-header">Class and Module Index</h3>
+
+  <ul class="link-list">
+  
+    <li><a href="../RubyProf.html">RubyProf</a>
+  
+    <li><a href="../RubyProf/AbstractPrinter.html">RubyProf::AbstractPrinter</a>
+  
+    <li><a href="../RubyProf/AggregateCallInfo.html">RubyProf::AggregateCallInfo</a>
+  
+    <li><a href="../RubyProf/CallInfo.html">RubyProf::CallInfo</a>
+  
+    <li><a href="../RubyProf/CallInfoPrinter.html">RubyProf::CallInfoPrinter</a>
+  
+    <li><a href="../RubyProf/CallInfoVisitor.html">RubyProf::CallInfoVisitor</a>
+  
+    <li><a href="../RubyProf/CallStackPrinter.html">RubyProf::CallStackPrinter</a>
+  
+    <li><a href="../RubyProf/CallTreePrinter.html">RubyProf::CallTreePrinter</a>
+  
+    <li><a href="../RubyProf/Cmd.html">RubyProf::Cmd</a>
+  
+    <li><a href="../RubyProf/DotPrinter.html">RubyProf::DotPrinter</a>
+  
+    <li><a href="../RubyProf/FlatPrinter.html">RubyProf::FlatPrinter</a>
+  
+    <li><a href="../RubyProf/FlatPrinterWithLineNumbers.html">RubyProf::FlatPrinterWithLineNumbers</a>
+  
+    <li><a href="../RubyProf/GraphHtmlPrinter.html">RubyProf::GraphHtmlPrinter</a>
+  
+    <li><a href="../RubyProf/GraphPrinter.html">RubyProf::GraphPrinter</a>
+  
+    <li><a href="../RubyProf/MethodInfo.html">RubyProf::MethodInfo</a>
+  
+    <li><a href="../RubyProf/MultiPrinter.html">RubyProf::MultiPrinter</a>
+  
+    <li><a href="../RubyProf/Profile.html">RubyProf::Profile</a>
+  
+    <li><a href="../RubyProf/ProfileTask.html">RubyProf::ProfileTask</a>
+  
+    <li><a href="../RubyProf/Test.html">RubyProf::Test</a>
+  
+    <li><a href="../RubyProf/Thread.html">RubyProf::Thread</a>
+  
+    <li><a href="../Rack.html">Rack</a>
+  
+    <li><a href="../Rack/RubyProf.html">Rack::RubyProf</a>
+  
+  </ul>
+</nav>
+
+  </div>
+</nav>
+
+<div id="documentation">
+  <h1 class="class">class RubyProf::CallStackPrinter</h1>
+
+  <div id="description" class="description">
+    
+<p>prints a HTML visualization of the call tree</p>
+
+  </div><!-- description -->
+
+  
+  
+  
+  <section id="5Buntitled-5D" class="documentation-section">
+    
+
+    
+
+    
+
+    
+
+    <!-- Methods -->
+    
+     <section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
+      <h3 class="section-header">Public Instance Methods</h3>
+
+    
+      <div id="method-i-application" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">application</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="application-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 162</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">application</span>
+  <span class="ruby-ivar">@options</span>[<span class="ruby-value">:application</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">$PROGRAM_NAME</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- application-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- application-method -->
+
+    
+      <div id="method-i-arguments" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">arguments</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="arguments-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 166</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">arguments</span>
+  <span class="ruby-constant">ARGV</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">' '</span>)
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- arguments-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- arguments-method -->
+
+    
+      <div id="method-i-color" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">color</span><span
+            class="method-args">(p)</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="color-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 149</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">color</span>(<span class="ruby-identifier">p</span>)
+  <span class="ruby-keyword">case</span> <span class="ruby-identifier">i</span> = <span class="ruby-identifier">p</span>.<span class="ruby-identifier">to_i</span>
+  <span class="ruby-keyword">when</span> <span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-value">5</span>
+    <span class="ruby-string">"01"</span>
+  <span class="ruby-keyword">when</span> <span class="ruby-value">5</span><span class="ruby-operator">..</span><span class="ruby-value">10</span>
+    <span class="ruby-string">"05"</span>
+  <span class="ruby-keyword">when</span> <span class="ruby-value">100</span>
+    <span class="ruby-string">"9"</span>
+  <span class="ruby-keyword">else</span>
+    <span class="ruby-node">"#{i/10}"</span>
+  <span class="ruby-keyword">end</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- color-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- color-method -->
+
+    
+      <div id="method-i-copy_image_files" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">copy_image_files</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="copy_image_files-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 182</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">copy_image_files</span>
+  <span class="ruby-keyword">if</span> <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">File</span>)
+    <span class="ruby-identifier">target_dir</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-ivar">@output</span>.<span class="ruby-identifier">path</span>)
+    <span class="ruby-identifier">image_dir</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-keyword">__FILE__</span>), <span class="ruby-string">'..'</span>, <span class="ruby-string">'images'</span>)
+    <span class="ruby-node">%w(empty plus minus)</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">img</span><span class="ruby-operator">|</span>
+      <span class="ruby-identifier">source_file</span> = <span class="ruby-node">"#{image_dir}/#{img}.png"</span>
+      <span class="ruby-identifier">target_file</span> = <span class="ruby-node">"#{target_dir}/#{img}.png"</span>
+      <span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">cp</span>(<span class="ruby-identifier">source_file</span>, <span class="ruby-identifier">target_file</span>) <span class="ruby-keyword">unless</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-identifier">target_file</span>)
+    <span class="ruby-keyword">end</span>
+  <span class="ruby-keyword">end</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- copy_image_files-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- copy_image_files-method -->
+
+    
+      <div id="method-i-dump" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">dump</span><span
+            class="method-args">(ci)</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="dump-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 145</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">dump</span>(<span class="ruby-identifier">ci</span>)
+  <span class="ruby-identifier">$stderr</span>.<span class="ruby-identifier">printf</span> <span class="ruby-string">"%s/%d t:%f s:%f w:%f  \n"</span>, <span class="ruby-identifier">ci</span>, <span class="ruby-identifier">ci</span>.<span class="ruby-identifier">object_id</span>, <span class="ruby-identifier">ci</span>.<span class="ruby-identifier">total_time</span>, <span class="ruby-identifier">ci</span>.<span class="ruby-identifier">self_time</span>, <span class="ruby-identi [...]
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- dump-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- dump-method -->
+
+    
+      <div id="method-i-expansion" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">expansion</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="expansion-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 178</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">expansion</span>
+  <span class="ruby-ivar">@options</span>[<span class="ruby-value">:expansion</span>] <span class="ruby-operator">||</span> <span class="ruby-value">10.0</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- expansion-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- expansion-method -->
+
+    
+      <div id="method-i-graph_link" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">graph_link</span><span
+            class="method-args">(call_info)</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="graph_link-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 126</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">graph_link</span>(<span class="ruby-identifier">call_info</span>)
+  <span class="ruby-identifier">total_calls</span> = <span class="ruby-identifier">call_info</span>.<span class="ruby-identifier">target</span>.<span class="ruby-identifier">call_infos</span>.<span class="ruby-identifier">inject</span>(<span class="ruby-value">0</span>){<span class="ruby-operator">|</span><span class="ruby-identifier">t</span>, <span class="ruby-identifier">ci</span><span class="ruby-operator">|</span> <span class="ruby-identifier">t</span> <span class="ruby-operator">+= [...]
+  <span class="ruby-identifier">href</span> = <span class="ruby-node">"#{@graph_html}##{method_href(call_info.target)}"</span>
+  <span class="ruby-identifier">totals</span> = <span class="ruby-ivar">@graph_html</span> <span class="ruby-operator">?</span> <span class="ruby-node">"<a href='#{href}'>#{total_calls}</a>"</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">total_calls</span>.<span class="ruby-identifier">to_s</span>
+  <span class="ruby-node">"[#{call_info.called} calls, #{totals} total]"</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- graph_link-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- graph_link-method -->
+
+    
+      <div id="method-i-link" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">link</span><span
+            class="method-args">(call_info)</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="link-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 112</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">link</span>(<span class="ruby-identifier">call_info</span>)
+  <span class="ruby-identifier">method</span> = <span class="ruby-identifier">call_info</span>.<span class="ruby-identifier">target</span>
+  <span class="ruby-identifier">file</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-identifier">method</span>.<span class="ruby-identifier">source_file</span>)
+  <span class="ruby-keyword">if</span> <span class="ruby-identifier">file</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">%r\/ruby_runtime$/</span>
+    <span class="ruby-identifier">h</span>(<span class="ruby-identifier">name</span>(<span class="ruby-identifier">call_info</span>))
+  <span class="ruby-keyword">else</span>
+    <span class="ruby-keyword">if</span> <span class="ruby-constant">RUBY_PLATFORM</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">%rdarwin/</span>
+      <span class="ruby-node">"<a href=\"txmt://open?url=file://#{file}&line=#{method.line}\">#{h(name(call_info))}</a>"</span>
+    <span class="ruby-keyword">else</span>
+      <span class="ruby-node">"<a href=\"file://#{file}##{method.line}\">#{h(name(call_info))}</a>"</span>
+    <span class="ruby-keyword">end</span>
+  <span class="ruby-keyword">end</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- link-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- link-method -->
+
+    
+      <div id="method-i-method_href" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">method_href</span><span
+            class="method-args">(method)</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="method_href-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 133</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">method_href</span>(<span class="ruby-identifier">method</span>)
+  <span class="ruby-identifier">h</span>(<span class="ruby-identifier">method</span>.<span class="ruby-identifier">full_name</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-node">%r[><#\.\?=:]/</span>,<span class="ruby-string">"_"</span>) <span class="ruby-operator">+</span> <span class="ruby-string">"_"</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@current_thread_id</span>.<span class="ruby-identifier">to_s</span>)
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- method_href-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- method_href-method -->
+
+    
+      <div id="method-i-name" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">name</span><span
+            class="method-args">(call_info)</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="name-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 107</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">name</span>(<span class="ruby-identifier">call_info</span>)
+  <span class="ruby-identifier">method</span> = <span class="ruby-identifier">call_info</span>.<span class="ruby-identifier">target</span>
+  <span class="ruby-identifier">method</span>.<span class="ruby-identifier">full_name</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- name-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- name-method -->
+
+    
+      <div id="method-i-print" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">print</span><span
+            class="method-args">(output = STDOUT, options = {})</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          <p>Specify print options.</p>
+
+<p>options - Hash table</p>
+
+<pre>:min_percent - Number 0 to 100 that specifes the minimum
+               %self (the methods self time divided by the
+               overall total time) that a method must take
+               for it to be printed out in the report.
+               Default value is 0.
+
+:print_file  - True or false. Specifies if a method's source
+               file should be printed.  Default value if false.
+
+:threshold   - a float from 0 to 100 that sets the threshold of
+               results displayed.
+               Default value is 1.0
+
+:title       - a String to overide the default "ruby-prof call tree"
+               title of the report.
+
+:expansion   - a float from 0 to 100 that sets the threshold of
+               results that are expanded, if the percent_total
+               exceeds it.
+               Default value is 10.0
+
+:application - a String to overide the name of the application,
+               as it appears on the report.</pre>
+          
+
+          
+          <div class="method-source-code" id="print-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 37</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">print</span>(<span class="ruby-identifier">output</span> = <span class="ruby-constant">STDOUT</span>, <span class="ruby-identifier">options</span> = {})
+  <span class="ruby-ivar">@output</span> = <span class="ruby-identifier">output</span>
+  <span class="ruby-identifier">setup_options</span>(<span class="ruby-identifier">options</span>)
+  <span class="ruby-keyword">if</span> <span class="ruby-ivar">@graph_html</span> = <span class="ruby-identifier">options</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value">:graph</span>)
+    <span class="ruby-ivar">@graph_html</span> = <span class="ruby-string">"file://"</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@graph_html</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@graph_html</span>[<span class="ruby-value">0</span>]<span class="ruby-operator">==</span><span class="ruby-string">"/"</span>
+  <span class="ruby-keyword">end</span>
+
+  <span class="ruby-identifier">print_header</span>
+
+  <span class="ruby-ivar">@overall_threads_time</span> = <span class="ruby-ivar">@result</span>.<span class="ruby-identifier">threads</span>.<span class="ruby-identifier">inject</span>(<span class="ruby-value">0</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">val</span>, <span class="ruby-identifier">thread</span><span class="ruby-operator">|</span>
+    <span class="ruby-identifier">val</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">thread</span>.<span class="ruby-identifier">total_time</span>
+  <span class="ruby-keyword">end</span>
+
+  <span class="ruby-ivar">@result</span>.<span class="ruby-identifier">threads</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">thread</span><span class="ruby-operator">|</span>
+    <span class="ruby-ivar">@current_thread_id</span> = <span class="ruby-identifier">thread</span>.<span class="ruby-identifier">fiber_id</span>
+    <span class="ruby-ivar">@overall_time</span> = <span class="ruby-identifier">thread</span>.<span class="ruby-identifier">total_time</span>
+    <span class="ruby-identifier">thread_info</span> = <span class="ruby-node">"Thread: #{thread.id}"</span>
+    <span class="ruby-identifier">thread_info</span> <span class="ruby-operator"><<</span> <span class="ruby-node">", Fiber: #{thread.fiber_id}"</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">thread</span>.<span class="ruby-identifier">id</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">thread</span>.<span class="ruby-identifier">fiber_id</span>
+    <span class="ruby-identifier">thread_info</span> <span class="ruby-operator"><<</span> <span class="ruby-node">" (#{"%4.2f%%" % ((@overall_time/@overall_threads_time)*100)} ~ #{@overall_time})"</span>
+    <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">print</span> <span class="ruby-node">"<div class=\"thread\">#{thread_info}</div>"</span>
+    <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">print</span> <span class="ruby-string">"<ul name=\"thread\">"</span>
+    <span class="ruby-identifier">thread</span>.<span class="ruby-identifier">methods</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">m</span><span class="ruby-operator">|</span>
+      <span class="ruby-comment"># $stderr.print m.dump</span>
+      <span class="ruby-keyword">next</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">m</span>.<span class="ruby-identifier">root?</span>
+      <span class="ruby-identifier">m</span>.<span class="ruby-identifier">call_infos</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">ci</span><span class="ruby-operator">|</span>
+        <span class="ruby-keyword">next</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">ci</span>.<span class="ruby-identifier">root?</span>
+        <span class="ruby-identifier">print_stack</span> <span class="ruby-identifier">ci</span>, <span class="ruby-identifier">thread</span>.<span class="ruby-identifier">total_time</span>
+      <span class="ruby-keyword">end</span>
+    <span class="ruby-keyword">end</span>
+    <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">print</span> <span class="ruby-string">"</ul>"</span>
+  <span class="ruby-keyword">end</span>
+
+  <span class="ruby-identifier">print_footer</span>
+
+  <span class="ruby-identifier">copy_image_files</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- print-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- print-method -->
+
+    
+      <div id="method-i-print_commands" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">print_commands</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="print_commands-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 740</span>
+    <span class="ruby-keyword">def</span> <span class="ruby-identifier">print_commands</span>
+      <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">puts</span> <span class="ruby-string">"<div id=\"commands\">
+<span style=\"font-size: 11pt; font-weight: bold;\">Threshold:</span>
+<input value=\"#{h threshold}\" size=\"3\" id=\"threshold\" type=\"text\">
+<input value=\"Apply\" onclick=\"setThreshold();\" type=\"submit\">
+<input value=\"Expand All\" onclick=\"expandAll(event);\" type=\"submit\">
+<input value=\"Collapse All\" onclick=\"collapseAll(event);\" type=\"submit\">
+<input value=\"Show Help\" onclick=\"toggleHelp(this);\" type=\"submit\">
+</div>
+"</span>
+    <span class="ruby-keyword">end</span></pre>
+          </div><!-- print_commands-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- print_commands-method -->
+
+    
+      <div id="method-i-print_css" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">print_css</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="print_css-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 210</span>
+    <span class="ruby-keyword">def</span> <span class="ruby-identifier">print_css</span>
+      <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">puts</span> <span class="ruby-string">"<style type="text/css">
+<!--
+body {
+    font-size:70%;
+    padding:0px;
+    margin:5px;
+    margin-right:0px;
+    margin-left:0px;
+    background: #ffffff;
+}
+ul {
+    margin-left:0px;
+    margin-top:0px;
+    margin-bottom:0px;
+    padding-left:0px;
+    list-style-type:none;
+}
+li {
+    margin-left:11px;
+    padding:0px;
+    white-space:nowrap;
+    border-top:1px solid #cccccc;
+    border-left:1px solid #cccccc;
+    border-bottom:none;
+}
+.thread {
+    margin-left:11px;
+    background:#708090;
+    padding-top:3px;
+    padding-left:12px;
+    padding-bottom:2px;
+    border-left:1px solid #CCCCCC;
+    border-top:1px solid #CCCCCC;
+    font-weight:bold;
+}
+.hidden {
+    display:none;
+    width:0px;
+    height:0px;
+    margin:0px;
+    padding:0px;
+    border-style:none;
+}
+.color01 { background:#adbdeb }
+.color05 { background:#9daddb }
+.color0 { background:#8d9dcb }
+.color1 { background:#89bccb }
+.color2 { background:#56e3e7 }
+.color3 { background:#32cd70 }
+.color4 { background:#a3d53c }
+.color5 { background:#c4cb34 }
+.color6 { background:#dcb66d }
+.color7 { background:#cda59e }
+.color8 { background:#be9d9c }
+.color9 { background:#cf947a }
+#commands {
+    font-size:10pt;
+    padding:10px;
+    margin-left:11px;
+    margin-bottom:0px;
+    margin-top:0px;
+    background:#708090;
+    border-top:1px solid #cccccc;
+    border-left:1px solid #cccccc;
+    border-bottom:none;
+}
+#titlebar {
+    font-size:10pt;
+    padding:10px;
+    margin-left:11px;
+    margin-bottom:0px;
+    margin-top:10px;
+    background:#8090a0;
+    border-top:1px solid #cccccc;
+    border-left:1px solid #cccccc;
+    border-bottom:none;
+}
+#help {
+    font-size:10pt;
+    padding:10px;
+    margin-left:11px;
+    margin-bottom:0px;
+    margin-top:0px;
+    background:#8090a0;
+    display:none;
+    border-top:1px solid #cccccc;
+    border-left:1px solid #cccccc;
+    border-bottom:none;
+}
+#sentinel {
+    height: 400px;
+    margin-left:11px;
+    background:#8090a0;
+    border-top:1px solid #cccccc;
+    border-left:1px solid #cccccc;
+    border-bottom:none;
+ }
+input { margin-left:10px; }
+-->
+</style>
+"</span>
+    <span class="ruby-keyword">end</span></pre>
+          </div><!-- print_css-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- print_css-method -->
+
+    
+      <div id="method-i-print_footer" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">print_footer</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="print_footer-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 206</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">print_footer</span>
+  <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">puts</span> <span class="ruby-string">'<div id="sentinel"></div></div></body></html>'</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- print_footer-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- print_footer-method -->
+
+    
+      <div id="method-i-print_header" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">print_header</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="print_header-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 194</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">print_header</span>
+  <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">puts</span> <span class="ruby-string">"<html><head>"</span>
+  <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">puts</span> <span class="ruby-string">'<meta http-equiv="content-type" content="text/html; charset=utf-8">'</span>
+  <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">"<title>#{h title}</title>"</span>
+  <span class="ruby-identifier">print_css</span>
+  <span class="ruby-identifier">print_java_script</span>
+  <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">puts</span> <span class="ruby-string">'</head><body><div style="display: inline-block;">'</span>
+  <span class="ruby-identifier">print_title_bar</span>
+  <span class="ruby-identifier">print_commands</span>
+  <span class="ruby-identifier">print_help</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- print_header-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- print_header-method -->
+
+    
+      <div id="method-i-print_help" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">print_help</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="print_help-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 753</span>
+    <span class="ruby-keyword">def</span> <span class="ruby-identifier">print_help</span>
+      <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">puts</span> <span class="ruby-string">"<div style="display: none;" id="help">
+<img src="empty.png"> Enter a decimal value <i>d</i> into the threshold field and click "Apply"
+to hide all nodes marked with time values lower than <i>d</i>.<br>
+<img src="empty.png"> Click on "Expand All" for full tree expansion.<br>
+<img src="empty.png"> Click on "Collapse All" to show only top level nodes.<br>
+<img src="empty.png"> Use a, s, d, w as in Quake or Urban Terror to navigate the tree.<br>
+<img src="empty.png"> Use f and b to navigate the tree in preorder forward and backwards.<br>
+<img src="empty.png"> Use x to toggle visibility of a subtree.<br>
+<img src="empty.png"> Use * to expand/collapse a whole subtree.<br>
+<img src="empty.png"> Use h to navigate to thread root.<br>
+<img src="empty.png"> Use n and p to navigate between threads.<br>
+<img src="empty.png"> Click on background to move focus to a subtree.<br>
+</div>
+"</span>
+    <span class="ruby-keyword">end</span></pre>
+          </div><!-- print_help-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- print_help-method -->
+
+    
+      <div id="method-i-print_java_script" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">print_java_script</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="print_java_script-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 315</span>
+    <span class="ruby-keyword">def</span> <span class="ruby-identifier">print_java_script</span>
+      <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">puts</span> <span class="ruby-string">"<script type="text/javascript">
+/*
+   Copyright (C) 2005,2009  Stefan Kaes
+   skaes at railsexpress.de
+*/
+
+function rootNode() {
+  return currentThread;
+}
+
+function hideUL(node) {
+  var lis = node.childNodes
+  var l = lis.length;
+  for (var i=0; i < l ; i++ ) {
+    hideLI(lis[i]);
+  }
+}
+
+function showUL(node) {
+  var lis = node.childNodes;
+  var l = lis.length;
+  for (var i=0; i < l ; i++ ) {
+    showLI(lis[i]);
+  }
+}
+
+function findUlChild(li){
+  var ul = li.childNodes[2];
+  while (ul && ul.nodeName != "UL") {
+    ul = ul.nextSibling;
+  }
+  return ul;
+}
+
+function isLeafNode(li) {
+  var img = li.firstChild;
+  return (img.src.indexOf('empty.png') > -1);
+}
+
+function hideLI(li) {
+  if (isLeafNode(li))
+    return;
+
+  var img = li.firstChild;
+  img.src = 'plus.png';
+
+  var ul = findUlChild(li);
+  if (ul) {
+    ul.style.display = 'none';
+    hideUL(ul);
+  }
+}
+
+function showLI(li) {
+  if (isLeafNode(li))
+    return;
+
+  var img = li.firstChild;
+  img.src = 'minus.png';
+
+  var ul = findUlChild(li);
+  if (ul) {
+    ul.style.display = 'block';
+    showUL(ul);
+  }
+}
+
+function toggleLI(li) {
+  var img = li.firstChild;
+  if (img.src.indexOf("minus.png")>-1)
+    hideLI(li);
+  else {
+    if (img.src.indexOf("plus.png")>-1)
+      showLI(li);
+  }
+}
+
+function aboveThreshold(text, threshold) {
+  var match = text.match(/\d+[.,]\d+/);
+  return (match && parseFloat(match[0].replace(/,/, '.'))>=threshold);
+}
+
+function setThresholdLI(li, threshold) {
+  var img = li.firstChild;
+  var text = img.nextSibling;
+  var ul = findUlChild(li);
+
+  var visible = aboveThreshold(text.nodeValue, threshold) ? 1 : 0;
+
+  var count = 0;
+  if (ul) {
+    count = setThresholdUL(ul, threshold);
+  }
+  if (count>0) {
+    img.src = 'minus.png';
+  }
+  else {
+    img.src = 'empty.png';
+  }
+  if (visible) {
+    li.style.display = 'block'
+  }
+  else {
+    li.style.display = 'none'
+  }
+  return visible;
+}
+
+function setThresholdUL(node, threshold) {
+  var lis = node.childNodes;
+  var l = lis.length;
+
+  var count = 0;
+  for ( var i = 0; i < l ; i++ ) {
+    count = count + setThresholdLI(lis[i], threshold);
+  }
+
+  var visible = (count > 0) ? 1 : 0;
+  if (visible) {
+    node.style.display = 'block';
+  }
+  else {
+    node.style.display = 'none';
+  }
+  return visible;
+}
+
+function toggleChildren(img, event) {
+  event.cancelBubble=true;
+
+  if (img.src.indexOf('empty.png') > -1)
+    return;
+
+  var minus = (img.src.indexOf('minus.png') > -1);
+
+  if (minus) {
+    img.src = 'plus.png';
+  }
+  else
+    img.src = 'minus.png';
+
+  var li = img.parentNode;
+  var ul = findUlChild(li);
+  if (ul) {
+    if (minus)
+      ul.style.display = 'none';
+    else
+      ul.style.display = 'block';
+  }
+  if (minus)
+    moveSelectionIfNecessary(li);
+}
+
+function showChildren(li) {
+  var img = li.firstChild;
+  if (img.src.indexOf('empty.png') > -1)
+    return;
+  img.src = 'minus.png';
+
+  var ul = findUlChild(li);
+  if (ul) {
+    ul.style.display = 'block';
+  }
+}
+
+function setThreshold() {
+ var tv = document.getElementById("threshold").value;
+ if (tv.match(/[0-9]+([.,][0-9]+)?/)) {
+   var f = parseFloat(tv.replace(/,/, '.'));
+   var threads = document.getElementsByName("thread");
+   var l = threads.length;
+   for ( var i = 0; i < l ; i++ ) {
+     setThresholdUL(threads[i], f);
+   }
+   var p = selectedNode;
+   while (p && p.style.display=='none')
+     p=p.parentNode.parentNode;
+   if (p && p.nodeName=="LI")
+    selectNode(p);
+ }
+ else {
+   alert("Please specify a decimal number as threshold value!");
+ }
+}
+
+function collapseAll(event) {
+  event.cancelBubble=true;
+  var threads = document.getElementsByName("thread");
+  var l = threads.length;
+  for ( var i = 0; i < l ; i++ ) {
+    hideUL(threads[i]);
+  }
+  selectNode(rootNode(), null);
+}
+
+function expandAll(event) {
+  event.cancelBubble=true;
+  var threads = document.getElementsByName("thread");
+  var l = threads.length;
+  for ( var i = 0; i < l ; i++ ) {
+    showUL(threads[i]);
+  }
+}
+
+function toggleHelp(node) {
+  var help = document.getElementById("help");
+  if (node.value == "Show Help") {
+    node.value = "Hide Help";
+    help.style.display = 'block';
+  }
+  else {
+    node.value = "Show Help";
+    help.style.display = 'none';
+  }
+}
+
+var selectedNode = null;
+var selectedColor = null;
+var selectedThread = null;
+
+function descendentOf(a,b){
+  while (a!=b && b!=null)
+    b=b.parentNode;
+  return (a==b);
+}
+
+function moveSelectionIfNecessary(node){
+  if (descendentOf(node, selectedNode))
+    selectNode(node, null);
+}
+
+function selectNode(node, event) {
+  if (event) {
+    event.cancelBubble = true;
+    thread = findThread(node);
+    selectThread(thread);
+  }
+  if (selectedNode) {
+    selectedNode.style.background = selectedColor;
+  }
+  selectedNode = node;
+  selectedColor = node.style.background;
+  selectedNode.style.background = "red";
+  selectedNode.scrollIntoView();
+  window.scrollBy(0,-400);
+}
+
+function moveUp(){
+  var p = selectedNode.previousSibling;
+  while (p && p.style.display == 'none')
+    p = p.previousSibling;
+  if (p && p.nodeName == "LI") {
+    selectNode(p, null);
+  }
+}
+
+function moveDown(){
+  var p = selectedNode.nextSibling;
+  while (p && p.style.display == 'none')
+    p = p.nextSibling;
+  if (p && p.nodeName == "LI") {
+    selectNode(p, null);
+  }
+}
+
+function moveLeft(){
+  var p = selectedNode.parentNode.parentNode;
+  if (p && p.nodeName=="LI") {
+    selectNode(p, null);
+  }
+}
+
+function moveRight(){
+  if (!isLeafNode(selectedNode)) {
+    showChildren(selectedNode);
+    var ul = findUlChild(selectedNode);
+    if (ul) {
+      selectNode(ul.firstChild, null);
+    }
+  }
+}
+
+function moveForward(){
+  if (isLeafNode(selectedNode)) {
+    var p = selectedNode;
+    while ((p.nextSibling == null || p.nextSibling.style.display=='none') && p.nodeName=="LI") {
+      p = p.parentNode.parentNode;
+    }
+    if (p.nodeName=="LI")
+      selectNode(p.nextSibling, null);
+  }
+  else {
+    moveRight();
+  }
+}
+
+function isExpandedNode(li){
+  var img = li.firstChild;
+  return(img.src.indexOf('minus.png')>-1);
+}
+
+function moveBackward(){
+  var p = selectedNode;
+  var q = p.previousSibling;
+  while (q != null && q.style.display=='none')
+    q = q.previousSibling;
+  if (q == null) {
+    p = p.parentNode.parentNode;
+  } else {
+    while (!isLeafNode(q) && isExpandedNode(q)) {
+      q = findUlChild(q).lastChild;
+      while (q.style.display=='none')
+        q = q.previousSibling;
+    }
+    p = q;
+  }
+  if (p.nodeName=="LI")
+    selectNode(p, null);
+}
+
+function moveHome() {
+  selectNode(currentThread);
+}
+
+var currentThreadIndex = null;
+
+function findThread(node){
+  while (node && node.parentNode.nodeName!="BODY") {
+    node = node.parentNode;
+  }
+  return node.firstChild;
+}
+
+function selectThread(node){
+  var threads = document.getElementsByName("thread");
+  currentThread = node;
+  for (var i=0; i<threads.length; i++) {
+    if (threads[i]==currentThread.parentNode)
+      currentThreadIndex = i;
+  }
+}
+
+function nextThread(){
+  var threads = document.getElementsByName("thread");
+  if (currentThreadIndex==threads.length-1)
+    currentThreadIndex = 0;
+  else
+    currentThreadIndex += 1
+  currentThread = threads[currentThreadIndex].firstChild;
+  selectNode(currentThread, null);
+}
+
+function previousThread(){
+  var threads = document.getElementsByName("thread");
+  if (currentThreadIndex==0)
+    currentThreadIndex = threads.length-1;
+  else
+    currentThreadIndex -= 1
+  currentThread = threads[currentThreadIndex].firstChild;
+  selectNode(currentThread, null);
+}
+
+function switchThread(node, event){
+  event.cancelBubble = true;
+  selectThread(node.nextSibling.firstChild);
+  selectNode(currentThread, null);
+}
+
+function handleKeyEvent(event){
+  var code = event.charCode ? event.charCode : event.keyCode;
+  var str = String.fromCharCode(code);
+  switch (str) {
+    case "a": moveLeft();  break;
+    case "s": moveDown();  break;
+    case "d": moveRight(); break;
+    case "w": moveUp();    break;
+    case "f": moveForward(); break;
+    case "b": moveBackward(); break;
+    case "x": toggleChildren(selectedNode.firstChild, event); break;
+    case "*": toggleLI(selectedNode); break;
+    case "n": nextThread(); break;
+    case "h": moveHome(); break;
+    case "p": previousThread(); break;
+  }
+}
+document.onkeypress=function(event){ handleKeyEvent(event) };
+
+window.onload=function(){
+  var images = document.getElementsByTagName("img");
+  for (var i=0; i<images.length; i++) {
+    var img = images[i];
+    if (img.className == "toggle") {
+      img.onclick = function(event){ toggleChildren(this, event); };
+    }
+  }
+  var divs = document.getElementsByTagName("div");
+  for (i=0; i<divs.length; i++) {
+    var div = divs[i];
+    if (div.className == "thread")
+      div.onclick = function(event){ switchThread(this, event) };
+  }
+  var lis = document.getElementsByTagName("li");
+  for (var i=0; i<lis.length; i++) {
+    lis[i].onclick = function(event){ selectNode(this, event); };
+  }
+  var threads = document.getElementsByName("thread");
+  currentThreadIndex = 0;
+  currentThread = threads[0].firstChild;
+  selectNode(currentThread, null);
+}
+</script>
+"</span>
+    <span class="ruby-keyword">end</span></pre>
+          </div><!-- print_java_script-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- print_java_script-method -->
+
+    
+      <div id="method-i-print_stack" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">print_stack</span><span
+            class="method-args">(call_info, parent_time)</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="print_stack-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 74</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">print_stack</span>(<span class="ruby-identifier">call_info</span>, <span class="ruby-identifier">parent_time</span>)
+  <span class="ruby-identifier">total_time</span> = <span class="ruby-identifier">call_info</span>.<span class="ruby-identifier">total_time</span>
+  <span class="ruby-identifier">percent_parent</span> = (<span class="ruby-identifier">total_time</span><span class="ruby-operator">/</span><span class="ruby-identifier">parent_time</span>)*<span class="ruby-value">100</span>
+  <span class="ruby-identifier">percent_total</span> = (<span class="ruby-identifier">total_time</span><span class="ruby-operator">/</span><span class="ruby-ivar">@overall_time</span>)*<span class="ruby-value">100</span>
+  <span class="ruby-keyword">return</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">percent_total</span> <span class="ruby-operator">></span> <span class="ruby-identifier">min_percent</span>
+  <span class="ruby-identifier">color</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">color</span>(<span class="ruby-identifier">percent_total</span>)
+  <span class="ruby-identifier">kids</span> = <span class="ruby-identifier">call_info</span>.<span class="ruby-identifier">children</span>
+  <span class="ruby-identifier">visible</span> = <span class="ruby-identifier">percent_total</span> <span class="ruby-operator">>=</span> <span class="ruby-identifier">threshold</span>
+  <span class="ruby-identifier">expanded</span> = <span class="ruby-identifier">percent_total</span> <span class="ruby-operator">>=</span> <span class="ruby-identifier">expansion</span>
+  <span class="ruby-identifier">display</span> = <span class="ruby-identifier">visible</span> <span class="ruby-operator">?</span> <span class="ruby-string">"block"</span> <span class="ruby-operator">:</span> <span class="ruby-string">"none"</span>
+  <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">print</span> <span class="ruby-node">"<li class=\"color#{color}\" style=\"display:#{display}\">"</span>
+  <span class="ruby-keyword">if</span> <span class="ruby-identifier">kids</span>.<span class="ruby-identifier">empty?</span>
+    <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">print</span> <span class="ruby-string">"<img src=\"empty.png\">"</span>
+  <span class="ruby-keyword">else</span>
+    <span class="ruby-identifier">visible_children</span> = <span class="ruby-identifier">kids</span>.<span class="ruby-identifier">any?</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">ci</span><span class="ruby-operator">|</span> (<span class="ruby-identifier">ci</span>.<span class="ruby-identifier">total_time</span><span class="ruby-operator">/</span><span class="ruby-ivar">@overall_time</span>)*<span class="ruby-value">100</span> <span class="ruby-operator">&g [...]
+    <span class="ruby-identifier">image</span> = <span class="ruby-identifier">visible_children</span> <span class="ruby-operator">?</span> (<span class="ruby-identifier">expanded</span> <span class="ruby-operator">?</span> <span class="ruby-string">"minus"</span> <span class="ruby-operator">:</span> <span class="ruby-string">"plus"</span>) <span class="ruby-operator">:</span> <span class="ruby-string">"empty"</span>
+    <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">print</span> <span class="ruby-node">"<img class=\"toggle\" src=\"#{image}.png\">"</span>
+  <span class="ruby-keyword">end</span>
+  <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">printf</span> <span class="ruby-string">" %4.2f%% (%4.2f%%) %s %s\n"</span>, <span class="ruby-identifier">percent_total</span>, <span class="ruby-identifier">percent_parent</span>, <span class="ruby-identifier">link</span>(<span class="ruby-identifier">call_info</span>), <span class="ruby-identifier">graph_link</span>(<span class="ruby-identifier">call_info</span>)
+  <span class="ruby-keyword">unless</span> <span class="ruby-identifier">kids</span>.<span class="ruby-identifier">empty?</span>
+    <span class="ruby-keyword">if</span> <span class="ruby-identifier">expanded</span>
+      <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">print</span> <span class="ruby-string">"<ul>"</span>
+    <span class="ruby-keyword">else</span>
+      <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">print</span> <span class="ruby-string">'<ul style="display:none">'</span>
+    <span class="ruby-keyword">end</span>
+    <span class="ruby-identifier">kids</span>.<span class="ruby-identifier">sort_by</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">c</span><span class="ruby-operator">|</span> <span class="ruby-operator">-</span><span class="ruby-identifier">c</span>.<span class="ruby-identifier">total_time</span>}.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">callinfo</span><span  [...]
+      <span class="ruby-identifier">print_stack</span> <span class="ruby-identifier">callinfo</span>, <span class="ruby-identifier">total_time</span>
+    <span class="ruby-keyword">end</span>
+    <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">print</span> <span class="ruby-string">"</ul>"</span>
+  <span class="ruby-keyword">end</span>
+  <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">print</span> <span class="ruby-string">"</li>"</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- print_stack-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- print_stack-method -->
+
+    
+      <div id="method-i-print_title_bar" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">print_title_bar</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="print_title_bar-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 731</span>
+    <span class="ruby-keyword">def</span> <span class="ruby-identifier">print_title_bar</span>
+      <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">puts</span> <span class="ruby-string">"<div id="titlebar">
+Call tree for application <b>#{h application} #{h arguments}</b><br/>
+Generated on #{Time.now} with options #{h @options.inspect}<br/>
+</div>
+"</span>
+    <span class="ruby-keyword">end</span></pre>
+          </div><!-- print_title_bar-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- print_title_bar-method -->
+
+    
+      <div id="method-i-sum" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">sum</span><span
+            class="method-args">(a)</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="sum-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 141</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">sum</span>(<span class="ruby-identifier">a</span>)
+  <span class="ruby-identifier">a</span>.<span class="ruby-identifier">inject</span>(<span class="ruby-value">0.0</span>){<span class="ruby-operator">|</span><span class="ruby-identifier">s</span>,<span class="ruby-identifier">t</span><span class="ruby-operator">|</span> <span class="ruby-identifier">s</span><span class="ruby-operator">+=</span><span class="ruby-identifier">t</span>}
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- sum-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- sum-method -->
+
+    
+      <div id="method-i-threshold" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">threshold</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="threshold-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 174</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">threshold</span>
+  <span class="ruby-ivar">@options</span>[<span class="ruby-value">:threshold</span>] <span class="ruby-operator">||</span> <span class="ruby-value">1.0</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- threshold-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- threshold-method -->
+
+    
+      <div id="method-i-title" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">title</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="title-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 170</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">title</span>
+  <span class="ruby-ivar">@title</span> <span class="ruby-operator">||=</span> <span class="ruby-ivar">@options</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value">:title</span>) <span class="ruby-operator">||</span> <span class="ruby-string">"ruby-prof call tree"</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- title-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- title-method -->
+
+    
+      <div id="method-i-total_time" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">total_time</span><span
+            class="method-args">(call_infos)</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="total_time-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 137</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">total_time</span>(<span class="ruby-identifier">call_infos</span>)
+  <span class="ruby-identifier">sum</span>(<span class="ruby-identifier">call_infos</span>.<span class="ruby-identifier">map</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">ci</span><span class="ruby-operator">|</span> <span class="ruby-identifier">ci</span>.<span class="ruby-identifier">total_time</span>})
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- total_time-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- total_time-method -->
+
+    
+    </section><!-- public-instance-method-details -->
+  
+  </section><!-- 5Buntitled-5D -->
+
+</div><!-- documentation -->
+
+
+<footer id="validator-badges">
+  <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
+  <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.1.
+  <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
+</footer>
+
diff --git a/doc/RubyProf/CallTreePrinter.html b/doc/RubyProf/CallTreePrinter.html
new file mode 100644
index 0000000..d4988d4
--- /dev/null
+++ b/doc/RubyProf/CallTreePrinter.html
@@ -0,0 +1,413 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+
+<title>class RubyProf::CallTreePrinter - ruby-prof</title>
+
+<link type="text/css" media="screen" href="../rdoc.css" rel="stylesheet">
+
+<script type="text/javascript">
+  var rdoc_rel_prefix = "../";
+</script>
+
+<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/navigation.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/search_index.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/search.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/searcher.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/darkfish.js"></script>
+
+
+<body id="top" class="class">
+<nav id="metadata">
+  <nav id="home-section" class="section">
+  <h3 class="section-header">
+    <a href="../index.html">Home</a>
+    <a href="../table_of_contents.html#classes">Classes</a>
+    <a href="../table_of_contents.html#methods">Methods</a>
+  </h3>
+</nav>
+
+
+  <nav id="search-section" class="section project-section" class="initially-hidden">
+  <form action="#" method="get" accept-charset="utf-8">
+    <h3 class="section-header">
+      <input type="text" name="search" placeholder="Search" id="search-field"
+             title="Type to search, Up and Down to navigate, Enter to load">
+    </h3>
+  </form>
+
+  <ul id="search-results" class="initially-hidden"></ul>
+</nav>
+
+
+  <div id="file-metadata">
+    <nav id="file-list-section" class="section">
+  <h3 class="section-header">Defined In</h3>
+  <ul>
+    <li>lib/ruby-prof/printers/call_tree_printer.rb
+  </ul>
+</nav>
+
+    
+  </div>
+
+  <div id="class-metadata">
+    
+    <nav id="parent-class-section" class="section">
+  <h3 class="section-header">Parent</h3>
+  
+  <p class="link"><a href="AbstractPrinter.html">RubyProf::AbstractPrinter</a>
+  
+</nav>
+
+    
+    <!-- Method Quickref -->
+<nav id="method-list-section" class="section">
+  <h3 class="section-header">Methods</h3>
+
+  <ul class="link-list">
+    
+    <li><a href="#method-i-convert">#convert</a>
+    
+    <li><a href="#method-i-file">#file</a>
+    
+    <li><a href="#method-i-print">#print</a>
+    
+    <li><a href="#method-i-print_thread">#print_thread</a>
+    
+    <li><a href="#method-i-print_threads">#print_threads</a>
+    
+  </ul>
+</nav>
+
+  </div>
+
+  <div id="project-metadata">
+    <nav id="fileindex-section" class="section project-section">
+  <h3 class="section-header">Pages</h3>
+
+  <ul>
+  
+    <li class="file"><a href="../LICENSE.html">LICENSE</a>
+  
+    <li class="file"><a href="../README_rdoc.html">README</a>
+  
+    <li class="file"><a href="../examples/flat_txt.html">flat</a>
+  
+    <li class="file"><a href="../examples/graph_txt.html">graph</a>
+  
+  </ul>
+</nav>
+
+    <nav id="classindex-section" class="section project-section">
+  <h3 class="section-header">Class and Module Index</h3>
+
+  <ul class="link-list">
+  
+    <li><a href="../RubyProf.html">RubyProf</a>
+  
+    <li><a href="../RubyProf/AbstractPrinter.html">RubyProf::AbstractPrinter</a>
+  
+    <li><a href="../RubyProf/AggregateCallInfo.html">RubyProf::AggregateCallInfo</a>
+  
+    <li><a href="../RubyProf/CallInfo.html">RubyProf::CallInfo</a>
+  
+    <li><a href="../RubyProf/CallInfoPrinter.html">RubyProf::CallInfoPrinter</a>
+  
+    <li><a href="../RubyProf/CallInfoVisitor.html">RubyProf::CallInfoVisitor</a>
+  
+    <li><a href="../RubyProf/CallStackPrinter.html">RubyProf::CallStackPrinter</a>
+  
+    <li><a href="../RubyProf/CallTreePrinter.html">RubyProf::CallTreePrinter</a>
+  
+    <li><a href="../RubyProf/Cmd.html">RubyProf::Cmd</a>
+  
+    <li><a href="../RubyProf/DotPrinter.html">RubyProf::DotPrinter</a>
+  
+    <li><a href="../RubyProf/FlatPrinter.html">RubyProf::FlatPrinter</a>
+  
+    <li><a href="../RubyProf/FlatPrinterWithLineNumbers.html">RubyProf::FlatPrinterWithLineNumbers</a>
+  
+    <li><a href="../RubyProf/GraphHtmlPrinter.html">RubyProf::GraphHtmlPrinter</a>
+  
+    <li><a href="../RubyProf/GraphPrinter.html">RubyProf::GraphPrinter</a>
+  
+    <li><a href="../RubyProf/MethodInfo.html">RubyProf::MethodInfo</a>
+  
+    <li><a href="../RubyProf/MultiPrinter.html">RubyProf::MultiPrinter</a>
+  
+    <li><a href="../RubyProf/Profile.html">RubyProf::Profile</a>
+  
+    <li><a href="../RubyProf/ProfileTask.html">RubyProf::ProfileTask</a>
+  
+    <li><a href="../RubyProf/Test.html">RubyProf::Test</a>
+  
+    <li><a href="../RubyProf/Thread.html">RubyProf::Thread</a>
+  
+    <li><a href="../Rack.html">Rack</a>
+  
+    <li><a href="../Rack/RubyProf.html">Rack::RubyProf</a>
+  
+  </ul>
+</nav>
+
+  </div>
+</nav>
+
+<div id="documentation">
+  <h1 class="class">class RubyProf::CallTreePrinter</h1>
+
+  <div id="description" class="description">
+    
+<p>Generate profiling information in calltree format for use by kcachegrind
+and similar tools.</p>
+
+  </div><!-- description -->
+
+  
+  
+  
+  <section id="5Buntitled-5D" class="documentation-section">
+    
+
+    
+
+    
+
+    
+
+    <!-- Methods -->
+    
+     <section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
+      <h3 class="section-header">Public Instance Methods</h3>
+
+    
+      <div id="method-i-convert" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">convert</span><span
+            class="method-args">(value)</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="convert-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_tree_printer.rb, line 61</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">convert</span>(<span class="ruby-identifier">value</span>)
+  (<span class="ruby-identifier">value</span> * <span class="ruby-ivar">@value_scale</span>).<span class="ruby-identifier">round</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- convert-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- convert-method -->
+
+    
+      <div id="method-i-file" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">file</span><span
+            class="method-args">(method)</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="file-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_tree_printer.rb, line 65</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">file</span>(<span class="ruby-identifier">method</span>)
+  <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-identifier">method</span>.<span class="ruby-identifier">source_file</span>)
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- file-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- file-method -->
+
+    
+      <div id="method-i-print" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">print</span><span
+            class="method-args">(output = STDOUT, options = {})</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          <p>Specify print options.</p>
+
+<p>options - Hash table</p>
+
+<pre>:min_percent - Number 0 to 100 that specifes the minimum
+               %self (the methods self time divided by the
+               overall total time) that a method must take
+               for it to be printed out in the report.
+               Default value is 0.
+
+:print_file  - True or false. Specifies if a method's source
+               file should be printed.  Default value if false.</pre>
+          
+
+          
+          <div class="method-source-code" id="print-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_tree_printer.rb, line 19</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">print</span>(<span class="ruby-identifier">output</span> = <span class="ruby-constant">STDOUT</span>, <span class="ruby-identifier">options</span> = {})
+  <span class="ruby-ivar">@output</span> = <span class="ruby-identifier">output</span>
+  <span class="ruby-identifier">setup_options</span>(<span class="ruby-identifier">options</span>)
+
+  <span class="ruby-comment"># add a header - this information is somewhat arbitrary</span>
+  <span class="ruby-ivar">@output</span> <span class="ruby-operator"><<</span> <span class="ruby-string">"events: "</span>
+  <span class="ruby-keyword">case</span> <span class="ruby-constant">RubyProf</span>.<span class="ruby-identifier">measure_mode</span>
+    <span class="ruby-keyword">when</span> <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">PROCESS_TIME</span>
+      <span class="ruby-ivar">@value_scale</span> = <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">CLOCKS_PER_SEC</span>;
+      <span class="ruby-ivar">@output</span> <span class="ruby-operator"><<</span> <span class="ruby-string">'process_time'</span>
+    <span class="ruby-keyword">when</span> <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">WALL_TIME</span>
+      <span class="ruby-ivar">@value_scale</span> = <span class="ruby-value">1_000_000</span>
+      <span class="ruby-ivar">@output</span> <span class="ruby-operator"><<</span> <span class="ruby-string">'wall_time'</span>
+    <span class="ruby-keyword">when</span> <span class="ruby-constant">RubyProf</span>.<span class="ruby-identifier">const_defined?</span>(<span class="ruby-value">:CPU_TIME</span>) <span class="ruby-operator">&&</span> <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">CPU_TIME</span>
+      <span class="ruby-ivar">@value_scale</span> = <span class="ruby-constant">RubyProf</span>.<span class="ruby-identifier">cpu_frequency</span>
+      <span class="ruby-ivar">@output</span> <span class="ruby-operator"><<</span> <span class="ruby-string">'cpu_time'</span>
+    <span class="ruby-keyword">when</span> <span class="ruby-constant">RubyProf</span>.<span class="ruby-identifier">const_defined?</span>(<span class="ruby-value">:ALLOCATIONS</span>) <span class="ruby-operator">&&</span> <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">ALLOCATIONS</span>
+      <span class="ruby-ivar">@value_scale</span> = <span class="ruby-value">1</span>
+      <span class="ruby-ivar">@output</span> <span class="ruby-operator"><<</span> <span class="ruby-string">'allocations'</span>
+    <span class="ruby-keyword">when</span> <span class="ruby-constant">RubyProf</span>.<span class="ruby-identifier">const_defined?</span>(<span class="ruby-value">:MEMORY</span>) <span class="ruby-operator">&&</span> <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">MEMORY</span>
+      <span class="ruby-ivar">@value_scale</span> = <span class="ruby-value">1</span>
+      <span class="ruby-ivar">@output</span> <span class="ruby-operator"><<</span> <span class="ruby-string">'memory'</span>
+    <span class="ruby-keyword">when</span> <span class="ruby-constant">RubyProf</span>.<span class="ruby-identifier">const_defined?</span>(<span class="ruby-value">:GC_RUNS</span>) <span class="ruby-operator">&&</span> <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">GC_RUNS</span>
+      <span class="ruby-ivar">@value_scale</span> = <span class="ruby-value">1</span>
+      <span class="ruby-ivar">@output</span> <span class="ruby-operator"><<</span> <span class="ruby-string">'gc_runs'</span>
+    <span class="ruby-keyword">when</span> <span class="ruby-constant">RubyProf</span>.<span class="ruby-identifier">const_defined?</span>(<span class="ruby-value">:GC_TIME</span>) <span class="ruby-operator">&&</span> <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">GC_TIME</span>
+      <span class="ruby-ivar">@value_scale</span> = <span class="ruby-value">1000000</span>
+      <span class="ruby-ivar">@output</span> <span class="ruby-operator"><<</span> <span class="ruby-string">'gc_time'</span>
+    <span class="ruby-keyword">else</span>
+      <span class="ruby-identifier">raise</span> <span class="ruby-node">"Unknown measure mode: #{RubyProf.measure_mode}"</span>
+  <span class="ruby-keyword">end</span>
+  <span class="ruby-ivar">@output</span> <span class="ruby-operator"><<</span> <span class="ruby-string">"\n\n"</span>
+
+  <span class="ruby-identifier">print_threads</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- print-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- print-method -->
+
+    
+      <div id="method-i-print_thread" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">print_thread</span><span
+            class="method-args">(thread)</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="print_thread-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_tree_printer.rb, line 69</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">print_thread</span>(<span class="ruby-identifier">thread</span>)
+  <span class="ruby-identifier">thread</span>.<span class="ruby-identifier">methods</span>.<span class="ruby-identifier">reverse_each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">method</span><span class="ruby-operator">|</span>
+    <span class="ruby-comment"># Print out the file and method name</span>
+    <span class="ruby-ivar">@output</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"fl=#{file(method)}\n"</span>
+    <span class="ruby-ivar">@output</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"fn=#{method_name(method)}\n"</span>
+
+    <span class="ruby-comment"># Now print out the function line number and its self time</span>
+    <span class="ruby-ivar">@output</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"#{method.line} #{convert(method.self_time)}\n"</span>
+
+    <span class="ruby-comment"># Now print out all the children methods</span>
+    <span class="ruby-identifier">method</span>.<span class="ruby-identifier">children</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">callee</span><span class="ruby-operator">|</span>
+      <span class="ruby-ivar">@output</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"cfl=#{file(callee.target)}\n"</span>
+      <span class="ruby-ivar">@output</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"cfn=#{method_name(callee.target)}\n"</span>
+      <span class="ruby-ivar">@output</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"calls=#{callee.called} #{callee.line}\n"</span>
+
+      <span class="ruby-comment"># Print out total times here!</span>
+      <span class="ruby-ivar">@output</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"#{callee.line} #{convert(callee.total_time)}\n"</span>
+    <span class="ruby-keyword">end</span>
+  <span class="ruby-ivar">@output</span> <span class="ruby-operator"><<</span> <span class="ruby-string">"\n"</span>
+  <span class="ruby-keyword">end</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- print_thread-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- print_thread-method -->
+
+    
+      <div id="method-i-print_threads" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">print_threads</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="print_threads-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_tree_printer.rb, line 55</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">print_threads</span>
+  <span class="ruby-ivar">@result</span>.<span class="ruby-identifier">threads</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">thread</span><span class="ruby-operator">|</span>
+    <span class="ruby-identifier">print_thread</span>(<span class="ruby-identifier">thread</span>)
+  <span class="ruby-keyword">end</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- print_threads-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- print_threads-method -->
+
+    
+    </section><!-- public-instance-method-details -->
+  
+  </section><!-- 5Buntitled-5D -->
+
+</div><!-- documentation -->
+
+
+<footer id="validator-badges">
+  <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
+  <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.1.
+  <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
+</footer>
+
diff --git a/doc/RubyProf/Cmd.html b/doc/RubyProf/Cmd.html
new file mode 100644
index 0000000..3a85982
--- /dev/null
+++ b/doc/RubyProf/Cmd.html
@@ -0,0 +1,669 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+
+<title>class RubyProf::Cmd - ruby-prof</title>
+
+<link type="text/css" media="screen" href="../rdoc.css" rel="stylesheet">
+
+<script type="text/javascript">
+  var rdoc_rel_prefix = "../";
+</script>
+
+<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/navigation.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/search_index.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/search.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/searcher.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/darkfish.js"></script>
+
+
+<body id="top" class="class">
+<nav id="metadata">
+  <nav id="home-section" class="section">
+  <h3 class="section-header">
+    <a href="../index.html">Home</a>
+    <a href="../table_of_contents.html#classes">Classes</a>
+    <a href="../table_of_contents.html#methods">Methods</a>
+  </h3>
+</nav>
+
+
+  <nav id="search-section" class="section project-section" class="initially-hidden">
+  <form action="#" method="get" accept-charset="utf-8">
+    <h3 class="section-header">
+      <input type="text" name="search" placeholder="Search" id="search-field"
+             title="Type to search, Up and Down to navigate, Enter to load">
+    </h3>
+  </form>
+
+  <ul id="search-results" class="initially-hidden"></ul>
+</nav>
+
+
+  <div id="file-metadata">
+    <nav id="file-list-section" class="section">
+  <h3 class="section-header">Defined In</h3>
+  <ul>
+    <li>bin/ruby-prof
+  </ul>
+</nav>
+
+    
+  </div>
+
+  <div id="class-metadata">
+    
+    <nav id="parent-class-section" class="section">
+  <h3 class="section-header">Parent</h3>
+  
+  <p class="link">Object
+  
+</nav>
+
+    
+    <!-- Method Quickref -->
+<nav id="method-list-section" class="section">
+  <h3 class="section-header">Methods</h3>
+
+  <ul class="link-list">
+    
+    <li><a href="#method-c-new">::new</a>
+    
+    <li><a href="#method-i-load_pre_execs">#load_pre_execs</a>
+    
+    <li><a href="#method-i-load_pre_libs">#load_pre_libs</a>
+    
+    <li><a href="#method-i-option_parser">#option_parser</a>
+    
+    <li><a href="#method-i-parse_args">#parse_args</a>
+    
+    <li><a href="#method-i-run">#run</a>
+    
+    <li><a href="#method-i-setup_options">#setup_options</a>
+    
+  </ul>
+</nav>
+
+  </div>
+
+  <div id="project-metadata">
+    <nav id="fileindex-section" class="section project-section">
+  <h3 class="section-header">Pages</h3>
+
+  <ul>
+  
+    <li class="file"><a href="../LICENSE.html">LICENSE</a>
+  
+    <li class="file"><a href="../README_rdoc.html">README</a>
+  
+    <li class="file"><a href="../examples/flat_txt.html">flat</a>
+  
+    <li class="file"><a href="../examples/graph_txt.html">graph</a>
+  
+  </ul>
+</nav>
+
+    <nav id="classindex-section" class="section project-section">
+  <h3 class="section-header">Class and Module Index</h3>
+
+  <ul class="link-list">
+  
+    <li><a href="../RubyProf.html">RubyProf</a>
+  
+    <li><a href="../RubyProf/AbstractPrinter.html">RubyProf::AbstractPrinter</a>
+  
+    <li><a href="../RubyProf/AggregateCallInfo.html">RubyProf::AggregateCallInfo</a>
+  
+    <li><a href="../RubyProf/CallInfo.html">RubyProf::CallInfo</a>
+  
+    <li><a href="../RubyProf/CallInfoPrinter.html">RubyProf::CallInfoPrinter</a>
+  
+    <li><a href="../RubyProf/CallInfoVisitor.html">RubyProf::CallInfoVisitor</a>
+  
+    <li><a href="../RubyProf/CallStackPrinter.html">RubyProf::CallStackPrinter</a>
+  
+    <li><a href="../RubyProf/CallTreePrinter.html">RubyProf::CallTreePrinter</a>
+  
+    <li><a href="../RubyProf/Cmd.html">RubyProf::Cmd</a>
+  
+    <li><a href="../RubyProf/DotPrinter.html">RubyProf::DotPrinter</a>
+  
+    <li><a href="../RubyProf/FlatPrinter.html">RubyProf::FlatPrinter</a>
+  
+    <li><a href="../RubyProf/FlatPrinterWithLineNumbers.html">RubyProf::FlatPrinterWithLineNumbers</a>
+  
+    <li><a href="../RubyProf/GraphHtmlPrinter.html">RubyProf::GraphHtmlPrinter</a>
+  
+    <li><a href="../RubyProf/GraphPrinter.html">RubyProf::GraphPrinter</a>
+  
+    <li><a href="../RubyProf/MethodInfo.html">RubyProf::MethodInfo</a>
+  
+    <li><a href="../RubyProf/MultiPrinter.html">RubyProf::MultiPrinter</a>
+  
+    <li><a href="../RubyProf/Profile.html">RubyProf::Profile</a>
+  
+    <li><a href="../RubyProf/ProfileTask.html">RubyProf::ProfileTask</a>
+  
+    <li><a href="../RubyProf/Test.html">RubyProf::Test</a>
+  
+    <li><a href="../RubyProf/Thread.html">RubyProf::Thread</a>
+  
+    <li><a href="../Rack.html">Rack</a>
+  
+    <li><a href="../Rack/RubyProf.html">Rack::RubyProf</a>
+  
+  </ul>
+</nav>
+
+  </div>
+</nav>
+
+<div id="documentation">
+  <h1 class="class">class RubyProf::Cmd</h1>
+
+  <div id="description" class="description">
+    
+  </div><!-- description -->
+
+  
+  
+  
+  <section id="5Buntitled-5D" class="documentation-section">
+    
+
+    
+
+    
+
+    
+    <!-- Attributes -->
+    <section id="attribute-method-details" class="method-section section">
+      <h3 class="section-header">Attributes</h3>
+
+      
+      <div id="attribute-i-options" class="method-detail">
+        <div class="method-heading attribute-method-heading">
+          <span class="method-name">options</span><span
+            class="attribute-access-type">[RW]</span>
+        </div>
+
+        <div class="method-description">
+        
+        
+        
+        </div>
+      </div>
+      
+    </section><!-- attribute-method-details -->
+    
+
+    <!-- Methods -->
+    
+     <section id="public-class-5Buntitled-5D-method-details" class="method-section section">
+      <h3 class="section-header">Public Class Methods</h3>
+
+    
+      <div id="method-c-new" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">new</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="new-source">
+            <pre><span class="ruby-comment"># File bin/ruby-prof, line 28</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>
+  <span class="ruby-identifier">setup_options</span>
+  <span class="ruby-identifier">parse_args</span>
+
+  <span class="ruby-identifier">load_pre_libs</span>
+  <span class="ruby-identifier">load_pre_execs</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- new-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- new-method -->
+
+    
+    </section><!-- public-class-method-details -->
+  
+     <section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
+      <h3 class="section-header">Public Instance Methods</h3>
+
+    
+      <div id="method-i-load_pre_execs" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">load_pre_execs</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="load_pre_execs-source">
+            <pre><span class="ruby-comment"># File bin/ruby-prof, line 262</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">load_pre_execs</span>
+  <span class="ruby-identifier">options</span>.<span class="ruby-identifier">pre_execs</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">exec</span><span class="ruby-operator">|</span>
+    <span class="ruby-identifier">eval</span>(<span class="ruby-identifier">exec</span>)
+  <span class="ruby-keyword">end</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- load_pre_execs-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- load_pre_execs-method -->
+
+    
+      <div id="method-i-load_pre_libs" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">load_pre_libs</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="load_pre_libs-source">
+            <pre><span class="ruby-comment"># File bin/ruby-prof, line 256</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">load_pre_libs</span>
+  <span class="ruby-identifier">options</span>.<span class="ruby-identifier">pre_libs</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">lib</span><span class="ruby-operator">|</span>
+    <span class="ruby-identifier">require</span> <span class="ruby-identifier">lib</span>
+  <span class="ruby-keyword">end</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- load_pre_libs-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- load_pre_libs-method -->
+
+    
+      <div id="method-i-option_parser" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">option_parser</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="option_parser-source">
+            <pre><span class="ruby-comment"># File bin/ruby-prof, line 49</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">option_parser</span>
+  <span class="ruby-constant">OptionParser</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">opts</span><span class="ruby-operator">|</span>
+    <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">banner</span> = <span class="ruby-node">"ruby_prof #{RubyProf::VERSION}\n"</span> <span class="ruby-operator">+</span>
+        <span class="ruby-string">"Usage: ruby-prof [options] <script.rb> [--] [profiled-script-command-line-options]"</span>
+
+    <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">separator</span> <span class="ruby-string">""</span>
+    <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">separator</span> <span class="ruby-string">"Options:"</span>
+
+    <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-string">'-p printer'</span>, <span class="ruby-string">'--printer=printer'</span>, [<span class="ruby-value">:flat</span>, <span class="ruby-value">:flat_with_line_numbers</span>, <span class="ruby-value">:graph</span>, <span class="ruby-value">:graph_html</span>, <span class="ruby-value">:call_tree</span>, <span class="ruby-value">:call_stack</span>, <span class="ruby- [...]
+            <span class="ruby-string">'Select a printer:'</span>,
+            <span class="ruby-string">'  flat - Prints a flat profile as text (default).'</span>,
+            <span class="ruby-string">'  flat_with_line_numbers - same as flat, with line numbers.'</span>,
+            <span class="ruby-string">'  graph - Prints a graph profile as text.'</span>,
+            <span class="ruby-string">'  graph_html - Prints a graph profile as html.'</span>,
+            <span class="ruby-string">'  call_tree - format for KCacheGrind'</span>,
+            <span class="ruby-string">'  call_stack - prints a HTML visualization of the call tree'</span>,
+            <span class="ruby-string">'  dot - Prints a graph profile as a dot file'</span>
+    ) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">printer</span><span class="ruby-operator">|</span>
+
+
+      <span class="ruby-keyword">case</span> <span class="ruby-identifier">printer</span>
+      <span class="ruby-keyword">when</span> <span class="ruby-value">:flat</span>
+        <span class="ruby-identifier">options</span>.<span class="ruby-identifier">printer</span> = <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">FlatPrinter</span>
+      <span class="ruby-keyword">when</span> <span class="ruby-value">:flat_with_line_numbers</span>
+        <span class="ruby-identifier">options</span>.<span class="ruby-identifier">printer</span> = <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">FlatPrinterWithLineNumbers</span>
+      <span class="ruby-keyword">when</span> <span class="ruby-value">:graph</span>
+        <span class="ruby-identifier">options</span>.<span class="ruby-identifier">printer</span> = <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">GraphPrinter</span>
+      <span class="ruby-keyword">when</span> <span class="ruby-value">:graph_html</span>
+        <span class="ruby-identifier">options</span>.<span class="ruby-identifier">printer</span> = <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">GraphHtmlPrinter</span>
+      <span class="ruby-keyword">when</span> <span class="ruby-value">:call_tree</span>
+        <span class="ruby-identifier">options</span>.<span class="ruby-identifier">printer</span> = <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">CallTreePrinter</span>
+      <span class="ruby-keyword">when</span> <span class="ruby-value">:call_stack</span>
+        <span class="ruby-identifier">options</span>.<span class="ruby-identifier">printer</span> = <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">CallStackPrinter</span>
+      <span class="ruby-keyword">when</span> <span class="ruby-value">:dot</span>
+        <span class="ruby-identifier">options</span>.<span class="ruby-identifier">printer</span> = <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">DotPrinter</span>
+      <span class="ruby-keyword">end</span>
+    <span class="ruby-keyword">end</span>
+
+    <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-string">'-m min_percent'</span>, <span class="ruby-string">'--min_percent=min_percent'</span>, <span class="ruby-constant">Float</span>,
+            <span class="ruby-string">'The minimum percent a method must take before '</span>,
+            <span class="ruby-string">'  being included in output reports.'</span>,
+            <span class="ruby-string">'  this option is not supported for call tree.'</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">min_percent</span><span class="ruby-operator">|</span>
+      <span class="ruby-identifier">options</span>.<span class="ruby-identifier">min_percent</span> = <span class="ruby-identifier">min_percent</span>
+    <span class="ruby-keyword">end</span>
+
+    <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-string">'-f path'</span>, <span class="ruby-string">'--file=path'</span>,
+            <span class="ruby-string">'Output results to a file instead of standard out.'</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">file</span><span class="ruby-operator">|</span>
+      <span class="ruby-identifier">options</span>.<span class="ruby-identifier">file</span> = <span class="ruby-identifier">file</span>
+      <span class="ruby-identifier">options</span>.<span class="ruby-identifier">old_wd</span> = <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">pwd</span>
+    <span class="ruby-keyword">end</span>
+
+    <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-string">'--mode=measure_mode'</span>,
+            [<span class="ruby-value">:process</span>, <span class="ruby-value">:wall</span>, <span class="ruby-value">:cpu</span>, <span class="ruby-value">:allocations</span>, <span class="ruby-value">:memory</span>, <span class="ruby-value">:gc_runs</span>, <span class="ruby-value">:gc_time</span>],
+            <span class="ruby-string">'Select what ruby-prof should measure:'</span>,
+            <span class="ruby-string">'  process - Process time (default).'</span>,
+            <span class="ruby-string">'  wall - Wall time.'</span>,
+            <span class="ruby-string">'  cpu - CPU time (Pentium and PowerPCs only).'</span>,
+            <span class="ruby-string">'  allocations - Object allocations (requires patched Ruby interpreter).'</span>,
+            <span class="ruby-string">'  memory - Allocated memory in KB (requires patched Ruby interpreter).'</span>,
+            <span class="ruby-string">'  gc_runs - Number of garbage collections (requires patched Ruby interpreter).'</span>,
+            <span class="ruby-string">'  gc_time - Time spent in garbage collection (requires patched Ruby interpreter).'</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">measure_mode</span><span class="ruby-operator">|</span>
+
+      <span class="ruby-keyword">case</span> <span class="ruby-identifier">measure_mode</span>
+      <span class="ruby-keyword">when</span> <span class="ruby-value">:process</span>
+        <span class="ruby-identifier">options</span>.<span class="ruby-identifier">measure_mode</span> = <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">PROCESS_TIME</span>
+      <span class="ruby-keyword">when</span> <span class="ruby-value">:wall</span>
+        <span class="ruby-identifier">options</span>.<span class="ruby-identifier">measure_mode</span> = <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">WALL_TIME</span>
+      <span class="ruby-keyword">when</span> <span class="ruby-value">:cpu</span>
+        <span class="ruby-identifier">options</span>.<span class="ruby-identifier">measure_mode</span> = <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">CPU_TIME</span>
+      <span class="ruby-keyword">when</span> <span class="ruby-value">:allocations</span>
+        <span class="ruby-identifier">options</span>.<span class="ruby-identifier">measure_mode</span> = <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">ALLOCATIONS</span>
+      <span class="ruby-keyword">when</span> <span class="ruby-value">:memory</span>
+        <span class="ruby-identifier">options</span>.<span class="ruby-identifier">measure_mode</span> = <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">MEMORY</span>
+      <span class="ruby-keyword">when</span> <span class="ruby-value">:gc_runs</span>
+        <span class="ruby-identifier">options</span>.<span class="ruby-identifier">measure_mode</span> = <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">GC_RUNS</span>
+      <span class="ruby-keyword">when</span> <span class="ruby-value">:gc_time</span>
+        <span class="ruby-identifier">options</span>.<span class="ruby-identifier">measure_mode</span> = <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">GC_TIME</span>
+      <span class="ruby-keyword">end</span>
+    <span class="ruby-keyword">end</span>
+
+    <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-string">'-s sort_mode'</span>, <span class="ruby-string">'--sort=sort_mode'</span>, [<span class="ruby-value">:total</span>, <span class="ruby-value">:self</span>, <span class="ruby-value">:wait</span>, <span class="ruby-value">:child</span>],
+            <span class="ruby-string">'Select how ruby-prof results should be sorted:'</span>,
+            <span class="ruby-string">'  total - Total time'</span>,
+            <span class="ruby-string">'  self - Self time'</span>,
+            <span class="ruby-string">'  wait - Wait time'</span>,
+            <span class="ruby-string">'  child - Child time'</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">sort_mode</span><span class="ruby-operator">|</span>
+
+      <span class="ruby-identifier">options</span>.<span class="ruby-identifier">sort_method</span> = <span class="ruby-keyword">case</span> <span class="ruby-identifier">sort_mode</span>
+                            <span class="ruby-keyword">when</span> <span class="ruby-value">:total</span>
+                              <span class="ruby-value">:total_time</span>
+                            <span class="ruby-keyword">when</span> <span class="ruby-value">:self</span>
+                              <span class="ruby-value">:self_time</span>
+                            <span class="ruby-keyword">when</span> <span class="ruby-value">:wait</span>
+                              <span class="ruby-value">:wait_time</span>
+                            <span class="ruby-keyword">when</span> <span class="ruby-value">:child</span>
+                              <span class="ruby-value">:children_time</span>
+                            <span class="ruby-keyword">end</span>
+    <span class="ruby-keyword">end</span>
+
+    <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-string">"--replace-progname"</span>, <span class="ruby-string">"Replace $0 when loading the .rb files."</span>) <span class="ruby-keyword">do</span>
+      <span class="ruby-identifier">options</span>.<span class="ruby-identifier">replace_prog_name</span> = <span class="ruby-keyword">true</span>
+    <span class="ruby-keyword">end</span>
+
+    <span class="ruby-keyword">if</span> <span class="ruby-keyword">defined?</span>(<span class="ruby-constant">VM</span>)
+      <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-string">"--specialized-instruction"</span>, <span class="ruby-string">"Turn on specified instruction."</span>) <span class="ruby-keyword">do</span>
+        <span class="ruby-identifier">options</span>.<span class="ruby-identifier">specialized_instruction</span> = <span class="ruby-keyword">true</span>
+      <span class="ruby-keyword">end</span>
+    <span class="ruby-keyword">end</span>
+
+    <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on_tail</span>(<span class="ruby-string">"-h"</span>, <span class="ruby-string">"--help"</span>, <span class="ruby-string">"Show help message"</span>) <span class="ruby-keyword">do</span>
+      <span class="ruby-identifier">puts</span> <span class="ruby-identifier">opts</span>
+      <span class="ruby-identifier">exit</span>
+    <span class="ruby-keyword">end</span>
+
+    <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on_tail</span>(<span class="ruby-string">"--version"</span>, <span class="ruby-node">"Show version #{RubyProf::VERSION}"</span>) <span class="ruby-keyword">do</span>
+      <span class="ruby-identifier">puts</span> <span class="ruby-string">"ruby_prof "</span> <span class="ruby-operator">+</span> <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">VERSION</span>
+      <span class="ruby-identifier">exit</span>
+    <span class="ruby-keyword">end</span>
+
+    <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-string">"-v"</span>,<span class="ruby-string">"Show version, set $VERBOSE to true, profile script if option given"</span>) <span class="ruby-keyword">do</span>
+      <span class="ruby-identifier">puts</span> <span class="ruby-string">"ruby version: "</span> <span class="ruby-operator">+</span> [<span class="ruby-constant">RUBY_PATCHLEVEL</span>, <span class="ruby-constant">RUBY_PLATFORM</span>, <span class="ruby-constant">RUBY_VERSION</span>].<span class="ruby-identifier">join</span>(<span class="ruby-string">' '</span>)
+      <span class="ruby-identifier">$VERBOSE</span> = <span class="ruby-keyword">true</span>
+    <span class="ruby-keyword">end</span>
+
+    <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-string">"-d"</span>, <span class="ruby-string">"Set $DEBUG to true"</span>) <span class="ruby-keyword">do</span>
+      <span class="ruby-identifier">$DEBUG</span> = <span class="ruby-keyword">true</span>
+    <span class="ruby-keyword">end</span>
+
+    <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-string">'-R lib'</span>, <span class="ruby-string">'--require-noprof lib'</span>, <span class="ruby-string">'require a specific library (not profiled)'</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">lib</span><span class="ruby-operator">|</span>
+      <span class="ruby-identifier">options</span>.<span class="ruby-identifier">pre_libs</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">lib</span>
+    <span class="ruby-keyword">end</span>
+
+    <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-string">'-E code'</span>, <span class="ruby-string">'--eval-noprof code'</span>, <span class="ruby-string">'execute the ruby statements (not profiled)'</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">code</span><span class="ruby-operator">|</span>
+      <span class="ruby-identifier">options</span>.<span class="ruby-identifier">pre_execs</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">code</span>
+    <span class="ruby-keyword">end</span>
+
+    <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-string">'-x regexp'</span>, <span class="ruby-string">'--exclude regexp'</span>, <span class="ruby-string">'exclude methods by regexp (see method elimination)'</span>) <span class="ruby-keyword">do</span><span class="ruby-operator">|</span><span class="ruby-identifier">meth</span><span class="ruby-operator">|</span>
+      <span class="ruby-identifier">options</span>.<span class="ruby-identifier">eliminate_methods</span> <span class="ruby-operator">||=</span> []
+      <span class="ruby-identifier">options</span>.<span class="ruby-identifier">eliminate_methods</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">meth</span>)
+    <span class="ruby-keyword">end</span>
+
+    <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-string">'-X file'</span>, <span class="ruby-string">'--exclude-file file'</span>, <span class="ruby-string">'exclude methods by regexp listed in file (see method elimination)'</span>) <span class="ruby-keyword">do</span><span class="ruby-operator">|</span><span class="ruby-identifier">file</span><span class="ruby-operator">|</span>
+      <span class="ruby-identifier">options</span>.<span class="ruby-identifier">eliminate_methods_files</span> <span class="ruby-operator">||=</span> []
+      <span class="ruby-identifier">options</span>.<span class="ruby-identifier">eliminate_methods_files</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">file</span>
+    <span class="ruby-keyword">end</span>
+
+    <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-string">'--exclude-common-cycles'</span>, <span class="ruby-string">'make common iterators like Integer#times appear inlined'</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">meth</span><span class="ruby-operator">|</span>
+      <span class="ruby-identifier">options</span>.<span class="ruby-identifier">eliminate_methods</span> <span class="ruby-operator">||=</span> []
+      <span class="ruby-identifier">options</span>.<span class="ruby-identifier">eliminate_methods</span> <span class="ruby-operator">+=</span> <span class="ruby-node">%w{
+        Integer#times
+        Integer#upto
+        Integer#downto
+        Enumerator#each
+        Enumerator#each_with_index
+        Enumerator#each_with_object
+
+        Array#each
+        Array#each_index
+        Array#reverse_each
+        Array#map
+
+        Hash#each
+        Hash#each_pair
+        Hash#each_key
+        Hash#each_value
+
+        Range#each
+        Enumerable#each_cons
+        Enumerable#each_entry
+        Enumerable#each_slice
+        Enumerable#each_with_index
+        Enumerable#each_with_object
+        Enumerable#reverse_each
+        Enumerable#inject
+        Enumerable#collect
+        Enumerable#reduce
+      }</span>
+      <span class="ruby-comment">#TODO: may be the whole Enumerable module should be excluded via 'Enumerable#.*', we need feedback on use cases.</span>
+    <span class="ruby-keyword">end</span>
+
+    <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-string">'--exclude-common-callbacks'</span>, <span class="ruby-string">'make common callbacks invocations like Integer#times appear inlined so you can see call origins in graph'</span>) <span class="ruby-keyword">do</span><span class="ruby-operator">|</span><span class="ruby-identifier">meth</span><span class="ruby-operator">|</span>
+      <span class="ruby-identifier">options</span>.<span class="ruby-identifier">eliminate_methods</span> <span class="ruby-operator">||=</span> []
+      <span class="ruby-identifier">options</span>.<span class="ruby-identifier">eliminate_methods</span> <span class="ruby-operator">+=</span> <span class="ruby-node">%w{
+        Method#call
+        Proc#call
+        ActiveSupport::Callbacks::ClassMethods#__run_callback
+      }</span>
+    <span class="ruby-keyword">end</span>
+  <span class="ruby-keyword">end</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- option_parser-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- option_parser-method -->
+
+    
+      <div id="method-i-parse_args" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">parse_args</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="parse_args-source">
+            <pre><span class="ruby-comment"># File bin/ruby-prof, line 240</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">parse_args</span>
+  <span class="ruby-comment"># Make sure the user specified at least one file</span>
+  <span class="ruby-keyword">if</span> <span class="ruby-constant">ARGV</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator"><</span> <span class="ruby-value">1</span> <span class="ruby-keyword">and</span> <span class="ruby-keyword">not</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">exec</span>
+    <span class="ruby-identifier">puts</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">option_parser</span>
+    <span class="ruby-identifier">puts</span> <span class="ruby-string">""</span>
+    <span class="ruby-identifier">puts</span> <span class="ruby-string">"Must specify a script to run"</span>
+    <span class="ruby-identifier">exit</span>(<span class="ruby-value">-1</span>)
+  <span class="ruby-keyword">end</span>
+
+  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">option_parser</span>.<span class="ruby-identifier">parse!</span> <span class="ruby-constant">ARGV</span>
+<span class="ruby-keyword">rescue</span> <span class="ruby-constant">OptionParser</span><span class="ruby-operator">::</span><span class="ruby-constant">InvalidOption</span>, <span class="ruby-constant">OptionParser</span><span class="ruby-operator">::</span><span class="ruby-constant">InvalidArgument</span>, <span class="ruby-constant">OptionParser</span><span class="ruby-operator">::</span><span class="ruby-constant">MissingArgument</span> =<span class="ruby-operator">></span> <span [...]
+  <span class="ruby-identifier">puts</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">option_parser</span>
+  <span class="ruby-identifier">puts</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">message</span>
+  <span class="ruby-identifier">exit</span>(<span class="ruby-value">-1</span>)
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- parse_args-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- parse_args-method -->
+
+    
+      <div id="method-i-run" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">run</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="run-source">
+            <pre><span class="ruby-comment"># File bin/ruby-prof, line 268</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">run</span>
+  <span class="ruby-comment"># Get the script we will execute</span>
+  <span class="ruby-identifier">script</span> = <span class="ruby-constant">ARGV</span>.<span class="ruby-identifier">shift</span>
+  <span class="ruby-keyword">if</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">replace_prog_name</span>
+    <span class="ruby-identifier">$0</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-identifier">script</span>)
+  <span class="ruby-keyword">end</span>
+
+  <span class="ruby-comment"># Set VM compile option</span>
+  <span class="ruby-keyword">if</span> <span class="ruby-keyword">defined?</span>(<span class="ruby-constant">VM</span>)
+    <span class="ruby-constant">VM</span><span class="ruby-operator">::</span><span class="ruby-constant">InstructionSequence</span>.<span class="ruby-identifier">compile_option</span> = {
+        <span class="ruby-value">:trace_instruction</span> =<span class="ruby-operator">></span> <span class="ruby-keyword">true</span>,
+        <span class="ruby-value">:specialized_instruction</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">specialized_instruction</span>
+    }
+  <span class="ruby-keyword">end</span>
+
+  <span class="ruby-comment"># Set the measure mode</span>
+  <span class="ruby-constant">RubyProf</span>.<span class="ruby-identifier">measure_mode</span> = <span class="ruby-identifier">options</span>.<span class="ruby-identifier">measure_mode</span>
+  <span class="ruby-constant">RubyProf</span>.<span class="ruby-identifier">start_script</span>(<span class="ruby-identifier">script</span>)
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- run-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- run-method -->
+
+    
+      <div id="method-i-setup_options" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">setup_options</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="setup_options-source">
+            <pre><span class="ruby-comment"># File bin/ruby-prof, line 36</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">setup_options</span>
+  <span class="ruby-ivar">@options</span> = <span class="ruby-constant">OpenStruct</span>.<span class="ruby-identifier">new</span>
+  <span class="ruby-identifier">options</span>.<span class="ruby-identifier">measure_mode</span> = <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">PROCESS_TIME</span>
+  <span class="ruby-identifier">options</span>.<span class="ruby-identifier">printer</span> = <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">FlatPrinter</span>
+  <span class="ruby-identifier">options</span>.<span class="ruby-identifier">min_percent</span> = <span class="ruby-value">0</span>
+  <span class="ruby-identifier">options</span>.<span class="ruby-identifier">file</span> = <span class="ruby-keyword">nil</span>
+  <span class="ruby-identifier">options</span>.<span class="ruby-identifier">replace_prog_name</span> = <span class="ruby-keyword">false</span>
+  <span class="ruby-identifier">options</span>.<span class="ruby-identifier">specialized_instruction</span> = <span class="ruby-keyword">false</span>
+
+  <span class="ruby-identifier">options</span>.<span class="ruby-identifier">pre_libs</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
+  <span class="ruby-identifier">options</span>.<span class="ruby-identifier">pre_execs</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- setup_options-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- setup_options-method -->
+
+    
+    </section><!-- public-instance-method-details -->
+  
+  </section><!-- 5Buntitled-5D -->
+
+</div><!-- documentation -->
+
+
+<footer id="validator-badges">
+  <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
+  <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.1.
+  <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
+</footer>
+
diff --git a/doc/RubyProf/DotPrinter.html b/doc/RubyProf/DotPrinter.html
new file mode 100644
index 0000000..12a8b39
--- /dev/null
+++ b/doc/RubyProf/DotPrinter.html
@@ -0,0 +1,312 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+
+<title>class RubyProf::DotPrinter - ruby-prof</title>
+
+<link type="text/css" media="screen" href="../rdoc.css" rel="stylesheet">
+
+<script type="text/javascript">
+  var rdoc_rel_prefix = "../";
+</script>
+
+<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/navigation.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/search_index.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/search.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/searcher.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/darkfish.js"></script>
+
+
+<body id="top" class="class">
+<nav id="metadata">
+  <nav id="home-section" class="section">
+  <h3 class="section-header">
+    <a href="../index.html">Home</a>
+    <a href="../table_of_contents.html#classes">Classes</a>
+    <a href="../table_of_contents.html#methods">Methods</a>
+  </h3>
+</nav>
+
+
+  <nav id="search-section" class="section project-section" class="initially-hidden">
+  <form action="#" method="get" accept-charset="utf-8">
+    <h3 class="section-header">
+      <input type="text" name="search" placeholder="Search" id="search-field"
+             title="Type to search, Up and Down to navigate, Enter to load">
+    </h3>
+  </form>
+
+  <ul id="search-results" class="initially-hidden"></ul>
+</nav>
+
+
+  <div id="file-metadata">
+    <nav id="file-list-section" class="section">
+  <h3 class="section-header">Defined In</h3>
+  <ul>
+    <li>lib/ruby-prof/printers/dot_printer.rb
+  </ul>
+</nav>
+
+    
+  </div>
+
+  <div id="class-metadata">
+    
+    <nav id="parent-class-section" class="section">
+  <h3 class="section-header">Parent</h3>
+  
+  <p class="link"><a href="AbstractPrinter.html">RubyProf::AbstractPrinter</a>
+  
+</nav>
+
+    
+    <!-- Method Quickref -->
+<nav id="method-list-section" class="section">
+  <h3 class="section-header">Methods</h3>
+
+  <ul class="link-list">
+    
+    <li><a href="#method-c-new">::new</a>
+    
+    <li><a href="#method-i-print">#print</a>
+    
+  </ul>
+</nav>
+
+  </div>
+
+  <div id="project-metadata">
+    <nav id="fileindex-section" class="section project-section">
+  <h3 class="section-header">Pages</h3>
+
+  <ul>
+  
+    <li class="file"><a href="../LICENSE.html">LICENSE</a>
+  
+    <li class="file"><a href="../README_rdoc.html">README</a>
+  
+    <li class="file"><a href="../examples/flat_txt.html">flat</a>
+  
+    <li class="file"><a href="../examples/graph_txt.html">graph</a>
+  
+  </ul>
+</nav>
+
+    <nav id="classindex-section" class="section project-section">
+  <h3 class="section-header">Class and Module Index</h3>
+
+  <ul class="link-list">
+  
+    <li><a href="../RubyProf.html">RubyProf</a>
+  
+    <li><a href="../RubyProf/AbstractPrinter.html">RubyProf::AbstractPrinter</a>
+  
+    <li><a href="../RubyProf/AggregateCallInfo.html">RubyProf::AggregateCallInfo</a>
+  
+    <li><a href="../RubyProf/CallInfo.html">RubyProf::CallInfo</a>
+  
+    <li><a href="../RubyProf/CallInfoPrinter.html">RubyProf::CallInfoPrinter</a>
+  
+    <li><a href="../RubyProf/CallInfoVisitor.html">RubyProf::CallInfoVisitor</a>
+  
+    <li><a href="../RubyProf/CallStackPrinter.html">RubyProf::CallStackPrinter</a>
+  
+    <li><a href="../RubyProf/CallTreePrinter.html">RubyProf::CallTreePrinter</a>
+  
+    <li><a href="../RubyProf/Cmd.html">RubyProf::Cmd</a>
+  
+    <li><a href="../RubyProf/DotPrinter.html">RubyProf::DotPrinter</a>
+  
+    <li><a href="../RubyProf/FlatPrinter.html">RubyProf::FlatPrinter</a>
+  
+    <li><a href="../RubyProf/FlatPrinterWithLineNumbers.html">RubyProf::FlatPrinterWithLineNumbers</a>
+  
+    <li><a href="../RubyProf/GraphHtmlPrinter.html">RubyProf::GraphHtmlPrinter</a>
+  
+    <li><a href="../RubyProf/GraphPrinter.html">RubyProf::GraphPrinter</a>
+  
+    <li><a href="../RubyProf/MethodInfo.html">RubyProf::MethodInfo</a>
+  
+    <li><a href="../RubyProf/MultiPrinter.html">RubyProf::MultiPrinter</a>
+  
+    <li><a href="../RubyProf/Profile.html">RubyProf::Profile</a>
+  
+    <li><a href="../RubyProf/ProfileTask.html">RubyProf::ProfileTask</a>
+  
+    <li><a href="../RubyProf/Test.html">RubyProf::Test</a>
+  
+    <li><a href="../RubyProf/Thread.html">RubyProf::Thread</a>
+  
+    <li><a href="../Rack.html">Rack</a>
+  
+    <li><a href="../Rack/RubyProf.html">Rack::RubyProf</a>
+  
+  </ul>
+</nav>
+
+  </div>
+</nav>
+
+<div id="documentation">
+  <h1 class="class">class RubyProf::DotPrinter</h1>
+
+  <div id="description" class="description">
+    
+<p>Generates a graphviz graph in dot format. To use the dot printer:</p>
+
+<pre>result = RubyProf.profile do
+  [code to profile]
+end
+
+printer = RubyProf::DotPrinter.new(result)
+printer.print(STDOUT)</pre>
+
+<p>You can use either dot viewer such as GraphViz, or the dot command line
+tool to reformat the output into a wide variety of outputs:</p>
+
+<pre>dot -Tpng graph.dot > graph.png</pre>
+
+  </div><!-- description -->
+
+  
+  
+  
+  <section id="5Buntitled-5D" class="documentation-section">
+    
+
+    
+
+    
+    <!-- Constants -->
+    <section id="constants-list" class="section">
+      <h3 class="section-header">Constants</h3>
+      <dl>
+      
+        <dt id="CLASS_COLOR">CLASS_COLOR
+        
+        <dd class="description">
+        
+      
+        <dt id="EDGE_COLOR">EDGE_COLOR
+        
+        <dd class="description">
+        
+      
+      </dl>
+    </section>
+    
+
+    
+
+    <!-- Methods -->
+    
+     <section id="public-class-5Buntitled-5D-method-details" class="method-section section">
+      <h3 class="section-header">Public Class Methods</h3>
+
+    
+      <div id="method-c-new" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">new</span><span
+            class="method-args">(result)</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          <p>Creates the <a href="DotPrinter.html">DotPrinter</a> using a
+RubyProf::Result.</p>
+          
+
+          
+          <div class="method-source-code" id="new-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/printers/dot_printer.rb, line 25</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">result</span>)
+  <span class="ruby-keyword">super</span>(<span class="ruby-identifier">result</span>)
+  <span class="ruby-ivar">@seen_methods</span> = <span class="ruby-constant">Set</span>.<span class="ruby-identifier">new</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- new-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- new-method -->
+
+    
+    </section><!-- public-class-method-details -->
+  
+     <section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
+      <h3 class="section-header">Public Instance Methods</h3>
+
+    
+      <div id="method-i-print" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">print</span><span
+            class="method-args">(output = STDOUT, options = {})</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          <p>Print a graph report to the provided output.</p>
+
+<p>output - Any IO object, including STDOUT or a file. The default value is
+STDOUT.</p>
+
+<p>options - Hash of print options.  See <a
+href="AbstractPrinter.html#method-i-setup_options">setup_options</a>  for
+more information.</p>
+
+<p>When profiling results that cover a large number of method calls it helps
+to use the :min_percent option, for example:</p>
+
+<pre class="ruby"><span class="ruby-constant">DotPrinter</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">result</span>).<span class="ruby-identifier">print</span>(<span class="ruby-constant">STDOUT</span>, :<span class="ruby-identifier">min_percent=</span><span class="ruby-operator">></span><span class="ruby-value">5</span>)
+</pre>
+          
+
+          
+          <div class="method-source-code" id="print-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/printers/dot_printer.rb, line 43</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">print</span>(<span class="ruby-identifier">output</span> = <span class="ruby-constant">STDOUT</span>, <span class="ruby-identifier">options</span> = {})
+  <span class="ruby-ivar">@output</span> = <span class="ruby-identifier">output</span>
+  <span class="ruby-identifier">setup_options</span>(<span class="ruby-identifier">options</span>)
+  
+  <span class="ruby-identifier">puts</span> <span class="ruby-string">'digraph "Profile" {'</span>
+  <span class="ruby-comment">#puts "label=\"#{mode_name} >=#{min_percent}%\\nTotal: #{total_time}\";"</span>
+  <span class="ruby-identifier">puts</span> <span class="ruby-string">"labelloc=t;"</span>
+  <span class="ruby-identifier">puts</span> <span class="ruby-string">"labeljust=l;"</span>
+  <span class="ruby-identifier">print_threads</span>
+  <span class="ruby-identifier">puts</span> <span class="ruby-string">'}'</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- print-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- print-method -->
+
+    
+    </section><!-- public-instance-method-details -->
+  
+  </section><!-- 5Buntitled-5D -->
+
+</div><!-- documentation -->
+
+
+<footer id="validator-badges">
+  <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
+  <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.1.
+  <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
+</footer>
+
diff --git a/doc/RubyProf/FlatPrinter.html b/doc/RubyProf/FlatPrinter.html
new file mode 100644
index 0000000..d3c85f8
--- /dev/null
+++ b/doc/RubyProf/FlatPrinter.html
@@ -0,0 +1,229 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+
+<title>class RubyProf::FlatPrinter - ruby-prof</title>
+
+<link type="text/css" media="screen" href="../rdoc.css" rel="stylesheet">
+
+<script type="text/javascript">
+  var rdoc_rel_prefix = "../";
+</script>
+
+<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/navigation.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/search_index.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/search.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/searcher.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/darkfish.js"></script>
+
+
+<body id="top" class="class">
+<nav id="metadata">
+  <nav id="home-section" class="section">
+  <h3 class="section-header">
+    <a href="../index.html">Home</a>
+    <a href="../table_of_contents.html#classes">Classes</a>
+    <a href="../table_of_contents.html#methods">Methods</a>
+  </h3>
+</nav>
+
+
+  <nav id="search-section" class="section project-section" class="initially-hidden">
+  <form action="#" method="get" accept-charset="utf-8">
+    <h3 class="section-header">
+      <input type="text" name="search" placeholder="Search" id="search-field"
+             title="Type to search, Up and Down to navigate, Enter to load">
+    </h3>
+  </form>
+
+  <ul id="search-results" class="initially-hidden"></ul>
+</nav>
+
+
+  <div id="file-metadata">
+    <nav id="file-list-section" class="section">
+  <h3 class="section-header">Defined In</h3>
+  <ul>
+    <li>lib/ruby-prof/printers/flat_printer.rb
+  </ul>
+</nav>
+
+    
+  </div>
+
+  <div id="class-metadata">
+    
+    <nav id="parent-class-section" class="section">
+  <h3 class="section-header">Parent</h3>
+  
+  <p class="link"><a href="AbstractPrinter.html">RubyProf::AbstractPrinter</a>
+  
+</nav>
+
+    
+    <!-- Method Quickref -->
+<nav id="method-list-section" class="section">
+  <h3 class="section-header">Methods</h3>
+
+  <ul class="link-list">
+    
+    <li><a href="#method-i-sort_method">#sort_method</a>
+    
+  </ul>
+</nav>
+
+  </div>
+
+  <div id="project-metadata">
+    <nav id="fileindex-section" class="section project-section">
+  <h3 class="section-header">Pages</h3>
+
+  <ul>
+  
+    <li class="file"><a href="../LICENSE.html">LICENSE</a>
+  
+    <li class="file"><a href="../README_rdoc.html">README</a>
+  
+    <li class="file"><a href="../examples/flat_txt.html">flat</a>
+  
+    <li class="file"><a href="../examples/graph_txt.html">graph</a>
+  
+  </ul>
+</nav>
+
+    <nav id="classindex-section" class="section project-section">
+  <h3 class="section-header">Class and Module Index</h3>
+
+  <ul class="link-list">
+  
+    <li><a href="../RubyProf.html">RubyProf</a>
+  
+    <li><a href="../RubyProf/AbstractPrinter.html">RubyProf::AbstractPrinter</a>
+  
+    <li><a href="../RubyProf/AggregateCallInfo.html">RubyProf::AggregateCallInfo</a>
+  
+    <li><a href="../RubyProf/CallInfo.html">RubyProf::CallInfo</a>
+  
+    <li><a href="../RubyProf/CallInfoPrinter.html">RubyProf::CallInfoPrinter</a>
+  
+    <li><a href="../RubyProf/CallInfoVisitor.html">RubyProf::CallInfoVisitor</a>
+  
+    <li><a href="../RubyProf/CallStackPrinter.html">RubyProf::CallStackPrinter</a>
+  
+    <li><a href="../RubyProf/CallTreePrinter.html">RubyProf::CallTreePrinter</a>
+  
+    <li><a href="../RubyProf/Cmd.html">RubyProf::Cmd</a>
+  
+    <li><a href="../RubyProf/DotPrinter.html">RubyProf::DotPrinter</a>
+  
+    <li><a href="../RubyProf/FlatPrinter.html">RubyProf::FlatPrinter</a>
+  
+    <li><a href="../RubyProf/FlatPrinterWithLineNumbers.html">RubyProf::FlatPrinterWithLineNumbers</a>
+  
+    <li><a href="../RubyProf/GraphHtmlPrinter.html">RubyProf::GraphHtmlPrinter</a>
+  
+    <li><a href="../RubyProf/GraphPrinter.html">RubyProf::GraphPrinter</a>
+  
+    <li><a href="../RubyProf/MethodInfo.html">RubyProf::MethodInfo</a>
+  
+    <li><a href="../RubyProf/MultiPrinter.html">RubyProf::MultiPrinter</a>
+  
+    <li><a href="../RubyProf/Profile.html">RubyProf::Profile</a>
+  
+    <li><a href="../RubyProf/ProfileTask.html">RubyProf::ProfileTask</a>
+  
+    <li><a href="../RubyProf/Test.html">RubyProf::Test</a>
+  
+    <li><a href="../RubyProf/Thread.html">RubyProf::Thread</a>
+  
+    <li><a href="../Rack.html">Rack</a>
+  
+    <li><a href="../Rack/RubyProf.html">Rack::RubyProf</a>
+  
+  </ul>
+</nav>
+
+  </div>
+</nav>
+
+<div id="documentation">
+  <h1 class="class">class RubyProf::FlatPrinter</h1>
+
+  <div id="description" class="description">
+    
+<p>Generates <a href="../files/examples/flat_txt.html">flat</a> profile
+reports as text. To use the flat printer:</p>
+
+<pre>result = RubyProf.profile do
+  [code to profile]
+end
+
+printer = RubyProf::FlatPrinter.new(result)
+printer.print(STDOUT, {})</pre>
+
+  </div><!-- description -->
+
+  
+  
+  
+  <section id="5Buntitled-5D" class="documentation-section">
+    
+
+    
+
+    
+
+    
+
+    <!-- Methods -->
+    
+     <section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
+      <h3 class="section-header">Public Instance Methods</h3>
+
+    
+      <div id="method-i-sort_method" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">sort_method</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          <p>Override for this printer to sort by self time by default</p>
+          
+
+          
+          <div class="method-source-code" id="sort_method-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/printers/flat_printer.rb, line 15</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">sort_method</span>
+  <span class="ruby-ivar">@options</span>[<span class="ruby-value">:sort_method</span>] <span class="ruby-operator">||</span> <span class="ruby-value">:self_time</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- sort_method-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- sort_method-method -->
+
+    
+    </section><!-- public-instance-method-details -->
+  
+  </section><!-- 5Buntitled-5D -->
+
+</div><!-- documentation -->
+
+
+<footer id="validator-badges">
+  <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
+  <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.1.
+  <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
+</footer>
+
diff --git a/doc/RubyProf/FlatPrinterWithLineNumbers.html b/doc/RubyProf/FlatPrinterWithLineNumbers.html
new file mode 100644
index 0000000..8dde666
--- /dev/null
+++ b/doc/RubyProf/FlatPrinterWithLineNumbers.html
@@ -0,0 +1,267 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+
+<title>class RubyProf::FlatPrinterWithLineNumbers - ruby-prof</title>
+
+<link type="text/css" media="screen" href="../rdoc.css" rel="stylesheet">
+
+<script type="text/javascript">
+  var rdoc_rel_prefix = "../";
+</script>
+
+<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/navigation.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/search_index.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/search.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/searcher.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/darkfish.js"></script>
+
+
+<body id="top" class="class">
+<nav id="metadata">
+  <nav id="home-section" class="section">
+  <h3 class="section-header">
+    <a href="../index.html">Home</a>
+    <a href="../table_of_contents.html#classes">Classes</a>
+    <a href="../table_of_contents.html#methods">Methods</a>
+  </h3>
+</nav>
+
+
+  <nav id="search-section" class="section project-section" class="initially-hidden">
+  <form action="#" method="get" accept-charset="utf-8">
+    <h3 class="section-header">
+      <input type="text" name="search" placeholder="Search" id="search-field"
+             title="Type to search, Up and Down to navigate, Enter to load">
+    </h3>
+  </form>
+
+  <ul id="search-results" class="initially-hidden"></ul>
+</nav>
+
+
+  <div id="file-metadata">
+    <nav id="file-list-section" class="section">
+  <h3 class="section-header">Defined In</h3>
+  <ul>
+    <li>lib/ruby-prof/printers/flat_printer_with_line_numbers.rb
+  </ul>
+</nav>
+
+    
+  </div>
+
+  <div id="class-metadata">
+    
+    <nav id="parent-class-section" class="section">
+  <h3 class="section-header">Parent</h3>
+  
+  <p class="link"><a href="FlatPrinter.html">RubyProf::FlatPrinter</a>
+  
+</nav>
+
+    
+    <!-- Method Quickref -->
+<nav id="method-list-section" class="section">
+  <h3 class="section-header">Methods</h3>
+
+  <ul class="link-list">
+    
+    <li><a href="#method-i-print_methods">#print_methods</a>
+    
+  </ul>
+</nav>
+
+  </div>
+
+  <div id="project-metadata">
+    <nav id="fileindex-section" class="section project-section">
+  <h3 class="section-header">Pages</h3>
+
+  <ul>
+  
+    <li class="file"><a href="../LICENSE.html">LICENSE</a>
+  
+    <li class="file"><a href="../README_rdoc.html">README</a>
+  
+    <li class="file"><a href="../examples/flat_txt.html">flat</a>
+  
+    <li class="file"><a href="../examples/graph_txt.html">graph</a>
+  
+  </ul>
+</nav>
+
+    <nav id="classindex-section" class="section project-section">
+  <h3 class="section-header">Class and Module Index</h3>
+
+  <ul class="link-list">
+  
+    <li><a href="../RubyProf.html">RubyProf</a>
+  
+    <li><a href="../RubyProf/AbstractPrinter.html">RubyProf::AbstractPrinter</a>
+  
+    <li><a href="../RubyProf/AggregateCallInfo.html">RubyProf::AggregateCallInfo</a>
+  
+    <li><a href="../RubyProf/CallInfo.html">RubyProf::CallInfo</a>
+  
+    <li><a href="../RubyProf/CallInfoPrinter.html">RubyProf::CallInfoPrinter</a>
+  
+    <li><a href="../RubyProf/CallInfoVisitor.html">RubyProf::CallInfoVisitor</a>
+  
+    <li><a href="../RubyProf/CallStackPrinter.html">RubyProf::CallStackPrinter</a>
+  
+    <li><a href="../RubyProf/CallTreePrinter.html">RubyProf::CallTreePrinter</a>
+  
+    <li><a href="../RubyProf/Cmd.html">RubyProf::Cmd</a>
+  
+    <li><a href="../RubyProf/DotPrinter.html">RubyProf::DotPrinter</a>
+  
+    <li><a href="../RubyProf/FlatPrinter.html">RubyProf::FlatPrinter</a>
+  
+    <li><a href="../RubyProf/FlatPrinterWithLineNumbers.html">RubyProf::FlatPrinterWithLineNumbers</a>
+  
+    <li><a href="../RubyProf/GraphHtmlPrinter.html">RubyProf::GraphHtmlPrinter</a>
+  
+    <li><a href="../RubyProf/GraphPrinter.html">RubyProf::GraphPrinter</a>
+  
+    <li><a href="../RubyProf/MethodInfo.html">RubyProf::MethodInfo</a>
+  
+    <li><a href="../RubyProf/MultiPrinter.html">RubyProf::MultiPrinter</a>
+  
+    <li><a href="../RubyProf/Profile.html">RubyProf::Profile</a>
+  
+    <li><a href="../RubyProf/ProfileTask.html">RubyProf::ProfileTask</a>
+  
+    <li><a href="../RubyProf/Test.html">RubyProf::Test</a>
+  
+    <li><a href="../RubyProf/Thread.html">RubyProf::Thread</a>
+  
+    <li><a href="../Rack.html">Rack</a>
+  
+    <li><a href="../Rack/RubyProf.html">Rack::RubyProf</a>
+  
+  </ul>
+</nav>
+
+  </div>
+</nav>
+
+<div id="documentation">
+  <h1 class="class">class RubyProf::FlatPrinterWithLineNumbers</h1>
+
+  <div id="description" class="description">
+    
+<p>Generates <a href="../files/examples/flat_txt.html">flat</a> profile
+reports as text. To use the flat printer with line numbers:</p>
+
+<pre>result = RubyProf.profile do
+  [code to profile]
+end
+
+printer = RubyProf::FlatPrinterWithLineNumbers.new(result)
+printer.print(STDOUT, {})</pre>
+
+  </div><!-- description -->
+
+  
+  
+  
+  <section id="5Buntitled-5D" class="documentation-section">
+    
+
+    
+
+    
+
+    
+
+    <!-- Methods -->
+    
+     <section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
+      <h3 class="section-header">Public Instance Methods</h3>
+
+    
+      <div id="method-i-print_methods" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">print_methods</span><span
+            class="method-args">(thread)</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="print_methods-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/printers/flat_printer_with_line_numbers.rb, line 14</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">print_methods</span>(<span class="ruby-identifier">thread</span>)
+  <span class="ruby-identifier">total_time</span> = <span class="ruby-identifier">thread</span>.<span class="ruby-identifier">total_time</span>
+
+  <span class="ruby-identifier">methods</span> = <span class="ruby-identifier">thread</span>.<span class="ruby-identifier">methods</span>.<span class="ruby-identifier">sort_by</span>(&<span class="ruby-identifier">sort_method</span>).<span class="ruby-identifier">reverse</span>
+  <span class="ruby-identifier">sum</span> = <span class="ruby-value">0</span>
+  <span class="ruby-identifier">methods</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">method</span><span class="ruby-operator">|</span>
+    <span class="ruby-identifier">self_percent</span> = (<span class="ruby-identifier">method</span>.<span class="ruby-identifier">self_time</span> <span class="ruby-operator">/</span> <span class="ruby-identifier">total_time</span>) * <span class="ruby-value">100</span>
+    <span class="ruby-keyword">next</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">self_percent</span> <span class="ruby-operator"><</span> <span class="ruby-identifier">min_percent</span>
+
+    <span class="ruby-identifier">sum</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">method</span>.<span class="ruby-identifier">self_time</span>
+    <span class="ruby-comment">#self_time_called = method.called > 0 ? method.self_time/method.called : 0</span>
+    <span class="ruby-comment">#total_time_called = method.called > 0? method.total_time/method.called : 0</span>
+
+    <span class="ruby-ivar">@output</span> <span class="ruby-operator"><<</span> <span class="ruby-string">"%6.2f  %9.3f %9.3f %9.3f %9.3f %8d  %s%s \n"</span> <span class="ruby-operator">%</span> [
+        <span class="ruby-identifier">method</span>.<span class="ruby-identifier">self_time</span> <span class="ruby-operator">/</span> <span class="ruby-identifier">total_time</span> * <span class="ruby-value">100</span>, <span class="ruby-comment"># %self</span>
+        <span class="ruby-identifier">method</span>.<span class="ruby-identifier">total_time</span>,                   <span class="ruby-comment"># total</span>
+        <span class="ruby-identifier">method</span>.<span class="ruby-identifier">self_time</span>,                    <span class="ruby-comment"># self</span>
+        <span class="ruby-identifier">method</span>.<span class="ruby-identifier">wait_time</span>,                    <span class="ruby-comment"># wait</span>
+        <span class="ruby-identifier">method</span>.<span class="ruby-identifier">children_time</span>,                <span class="ruby-comment"># children</span>
+        <span class="ruby-identifier">method</span>.<span class="ruby-identifier">called</span>,                       <span class="ruby-comment"># calls</span>
+        <span class="ruby-identifier">method</span>.<span class="ruby-identifier">recursive?</span> <span class="ruby-operator">?</span> <span class="ruby-string">"*"</span> <span class="ruby-operator">:</span> <span class="ruby-string">" "</span>,       <span class="ruby-comment"># cycle</span>
+        <span class="ruby-identifier">method_name</span>(<span class="ruby-identifier">method</span>)                  <span class="ruby-comment"># name</span>
+    ]
+     <span class="ruby-keyword">if</span> <span class="ruby-identifier">method</span>.<span class="ruby-identifier">source_file</span> <span class="ruby-operator">!=</span> <span class="ruby-string">'ruby_runtime'</span>
+       <span class="ruby-ivar">@output</span> <span class="ruby-operator"><<</span> <span class="ruby-string">"  %s:%s"</span> <span class="ruby-operator">%</span> [<span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-identifier">method</span>.<span class="ruby-identifier">source_file</span>), <span class="ruby-identifier">method</span>.<span class="ruby-identifier">line</span>]
+     <span class="ruby-keyword">end</span>
+     <span class="ruby-ivar">@output</span> <span class="ruby-operator"><<</span> <span class="ruby-string">"\n\tcalled from: "</span>
+
+     <span class="ruby-comment"># make sure they're unique</span>
+     <span class="ruby-identifier">method</span>.<span class="ruby-identifier">call_infos</span>.<span class="ruby-identifier">map</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">ci</span><span class="ruby-operator">|</span>
+       <span class="ruby-keyword">if</span> <span class="ruby-identifier">ci</span>.<span class="ruby-identifier">parent</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">ci</span>.<span class="ruby-identifier">parent</span>.<span class="ruby-identifier">target</span>.<span class="ruby-identifier">source_file</span> <span class="ruby-operator">!=</span> <span class="ruby-string">'ruby_runtime'</span>
+          [<span class="ruby-identifier">method_name</span>(<span class="ruby-identifier">ci</span>.<span class="ruby-identifier">parent</span>.<span class="ruby-identifier">target</span>), <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-identifier">ci</span>.<span class="ruby-identifier">parent</span>.<span class="ruby-identifier">target</span>.<span class="ruby-identifier">source_file</span>), <span class="ruby-identifier">ci</ [...]
+       <span class="ruby-keyword">else</span>
+          <span class="ruby-keyword">nil</span>
+       <span class="ruby-keyword">end</span>
+     }.<span class="ruby-identifier">compact</span>.<span class="ruby-identifier">uniq</span>.<span class="ruby-identifier">each</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">args</span><span class="ruby-operator">|</span>
+         <span class="ruby-ivar">@output</span> <span class="ruby-operator"><<</span> <span class="ruby-string">" %s (%s:%s) "</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">args</span>
+     }
+     <span class="ruby-ivar">@output</span> <span class="ruby-operator"><<</span> <span class="ruby-string">"\n\n"</span>
+  <span class="ruby-keyword">end</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- print_methods-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- print_methods-method -->
+
+    
+    </section><!-- public-instance-method-details -->
+  
+  </section><!-- 5Buntitled-5D -->
+
+</div><!-- documentation -->
+
+
+<footer id="validator-badges">
+  <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
+  <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.1.
+  <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
+</footer>
+
diff --git a/doc/RubyProf/GraphHtmlPrinter.html b/doc/RubyProf/GraphHtmlPrinter.html
new file mode 100644
index 0000000..ca2ab6a
--- /dev/null
+++ b/doc/RubyProf/GraphHtmlPrinter.html
@@ -0,0 +1,630 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+
+<title>class RubyProf::GraphHtmlPrinter - ruby-prof</title>
+
+<link type="text/css" media="screen" href="../rdoc.css" rel="stylesheet">
+
+<script type="text/javascript">
+  var rdoc_rel_prefix = "../";
+</script>
+
+<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/navigation.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/search_index.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/search.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/searcher.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/darkfish.js"></script>
+
+
+<body id="top" class="class">
+<nav id="metadata">
+  <nav id="home-section" class="section">
+  <h3 class="section-header">
+    <a href="../index.html">Home</a>
+    <a href="../table_of_contents.html#classes">Classes</a>
+    <a href="../table_of_contents.html#methods">Methods</a>
+  </h3>
+</nav>
+
+
+  <nav id="search-section" class="section project-section" class="initially-hidden">
+  <form action="#" method="get" accept-charset="utf-8">
+    <h3 class="section-header">
+      <input type="text" name="search" placeholder="Search" id="search-field"
+             title="Type to search, Up and Down to navigate, Enter to load">
+    </h3>
+  </form>
+
+  <ul id="search-results" class="initially-hidden"></ul>
+</nav>
+
+
+  <div id="file-metadata">
+    <nav id="file-list-section" class="section">
+  <h3 class="section-header">Defined In</h3>
+  <ul>
+    <li>lib/ruby-prof/printers/graph_html_printer.rb
+  </ul>
+</nav>
+
+    
+  </div>
+
+  <div id="class-metadata">
+    
+    <nav id="parent-class-section" class="section">
+  <h3 class="section-header">Parent</h3>
+  
+  <p class="link"><a href="AbstractPrinter.html">RubyProf::AbstractPrinter</a>
+  
+</nav>
+
+    <!-- Included Modules -->
+<nav id="includes-section" class="section">
+  <h3 class="section-header">Included Modules</h3>
+
+  <ul class="link-list">
+  
+  
+    <li><span class="include">ERB::Util</span>
+  
+  
+  </ul>
+</nav>
+
+    <!-- Method Quickref -->
+<nav id="method-list-section" class="section">
+  <h3 class="section-header">Methods</h3>
+
+  <ul class="link-list">
+    
+    <li><a href="#method-i-create_link">#create_link</a>
+    
+    <li><a href="#method-i-file_link">#file_link</a>
+    
+    <li><a href="#method-i-method_href">#method_href</a>
+    
+    <li><a href="#method-i-print">#print</a>
+    
+    <li><a href="#method-i-setup_options">#setup_options</a>
+    
+    <li><a href="#method-i-template">#template</a>
+    
+  </ul>
+</nav>
+
+  </div>
+
+  <div id="project-metadata">
+    <nav id="fileindex-section" class="section project-section">
+  <h3 class="section-header">Pages</h3>
+
+  <ul>
+  
+    <li class="file"><a href="../LICENSE.html">LICENSE</a>
+  
+    <li class="file"><a href="../README_rdoc.html">README</a>
+  
+    <li class="file"><a href="../examples/flat_txt.html">flat</a>
+  
+    <li class="file"><a href="../examples/graph_txt.html">graph</a>
+  
+  </ul>
+</nav>
+
+    <nav id="classindex-section" class="section project-section">
+  <h3 class="section-header">Class and Module Index</h3>
+
+  <ul class="link-list">
+  
+    <li><a href="../RubyProf.html">RubyProf</a>
+  
+    <li><a href="../RubyProf/AbstractPrinter.html">RubyProf::AbstractPrinter</a>
+  
+    <li><a href="../RubyProf/AggregateCallInfo.html">RubyProf::AggregateCallInfo</a>
+  
+    <li><a href="../RubyProf/CallInfo.html">RubyProf::CallInfo</a>
+  
+    <li><a href="../RubyProf/CallInfoPrinter.html">RubyProf::CallInfoPrinter</a>
+  
+    <li><a href="../RubyProf/CallInfoVisitor.html">RubyProf::CallInfoVisitor</a>
+  
+    <li><a href="../RubyProf/CallStackPrinter.html">RubyProf::CallStackPrinter</a>
+  
+    <li><a href="../RubyProf/CallTreePrinter.html">RubyProf::CallTreePrinter</a>
+  
+    <li><a href="../RubyProf/Cmd.html">RubyProf::Cmd</a>
+  
+    <li><a href="../RubyProf/DotPrinter.html">RubyProf::DotPrinter</a>
+  
+    <li><a href="../RubyProf/FlatPrinter.html">RubyProf::FlatPrinter</a>
+  
+    <li><a href="../RubyProf/FlatPrinterWithLineNumbers.html">RubyProf::FlatPrinterWithLineNumbers</a>
+  
+    <li><a href="../RubyProf/GraphHtmlPrinter.html">RubyProf::GraphHtmlPrinter</a>
+  
+    <li><a href="../RubyProf/GraphPrinter.html">RubyProf::GraphPrinter</a>
+  
+    <li><a href="../RubyProf/MethodInfo.html">RubyProf::MethodInfo</a>
+  
+    <li><a href="../RubyProf/MultiPrinter.html">RubyProf::MultiPrinter</a>
+  
+    <li><a href="../RubyProf/Profile.html">RubyProf::Profile</a>
+  
+    <li><a href="../RubyProf/ProfileTask.html">RubyProf::ProfileTask</a>
+  
+    <li><a href="../RubyProf/Test.html">RubyProf::Test</a>
+  
+    <li><a href="../RubyProf/Thread.html">RubyProf::Thread</a>
+  
+    <li><a href="../Rack.html">Rack</a>
+  
+    <li><a href="../Rack/RubyProf.html">Rack::RubyProf</a>
+  
+  </ul>
+</nav>
+
+  </div>
+</nav>
+
+<div id="documentation">
+  <h1 class="class">class RubyProf::GraphHtmlPrinter</h1>
+
+  <div id="description" class="description">
+    
+<p>Generates <a href="../files/examples/graph_html.html">graph</a> profile
+reports as html. To use the graph html printer:</p>
+
+<pre class="ruby"><span class="ruby-identifier">result</span> = <span class="ruby-constant">RubyProf</span>.<span class="ruby-identifier">profile</span> <span class="ruby-keyword">do</span>
+  [<span class="ruby-identifier">code</span> <span class="ruby-identifier">to</span> <span class="ruby-identifier">profile</span>]
+<span class="ruby-keyword">end</span>
+
+<span class="ruby-identifier">printer</span> = <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">GraphHtmlPrinter</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">result</span>)
+<span class="ruby-identifier">printer</span>.<span class="ruby-identifier">print</span>(<span class="ruby-constant">STDOUT</span>, :<span class="ruby-identifier">min_percent=</span><span class="ruby-operator">></span><span class="ruby-value">0</span>)
+</pre>
+
+<p>The Graph printer takes the following options in its print methods:</p>
+
+<pre>:filename    - specify a file to use that contains the ERB
+               template to use, instead of the built-in self.template
+
+:template    - specify an ERB template to use, instead of the
+               built-in self.template</pre>
+
+  </div><!-- description -->
+
+  
+  
+  
+  <section id="5Buntitled-5D" class="documentation-section">
+    
+
+    
+
+    
+    <!-- Constants -->
+    <section id="constants-list" class="section">
+      <h3 class="section-header">Constants</h3>
+      <dl>
+      
+        <dt id="CALL_WIDTH">CALL_WIDTH
+        
+        <dd class="description">
+        
+      
+        <dt id="PERCENTAGE_WIDTH">PERCENTAGE_WIDTH
+        
+        <dd class="description">
+        
+      
+        <dt id="TIME_WIDTH">TIME_WIDTH
+        
+        <dd class="description">
+        
+      
+      </dl>
+    </section>
+    
+
+    
+
+    <!-- Methods -->
+    
+     <section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
+      <h3 class="section-header">Public Instance Methods</h3>
+
+    
+      <div id="method-i-create_link" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">create_link</span><span
+            class="method-args">(thread, overall_time, method)</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          <p>Creates a link to a method.  Note that we do not create links to methods
+which are under the min_perecent specified by the user, since they will not
+be printed out.</p>
+          
+
+          
+          <div class="method-source-code" id="create_link-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/printers/graph_html_printer.rb, line 49</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">create_link</span>(<span class="ruby-identifier">thread</span>, <span class="ruby-identifier">overall_time</span>, <span class="ruby-identifier">method</span>)
+  <span class="ruby-identifier">total_percent</span> = (<span class="ruby-identifier">method</span>.<span class="ruby-identifier">total_time</span><span class="ruby-operator">/</span><span class="ruby-identifier">overall_time</span>) * <span class="ruby-value">100</span>
+  <span class="ruby-keyword">if</span> <span class="ruby-identifier">total_percent</span> <span class="ruby-operator"><</span> <span class="ruby-identifier">min_percent</span>
+    <span class="ruby-comment"># Just return name</span>
+    <span class="ruby-identifier">h</span> <span class="ruby-identifier">method</span>.<span class="ruby-identifier">full_name</span>
+  <span class="ruby-keyword">else</span>
+    <span class="ruby-identifier">href</span> = <span class="ruby-string">'#'</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">method_href</span>(<span class="ruby-identifier">thread</span>, <span class="ruby-identifier">method</span>)
+    <span class="ruby-node">"<a href=\"#{href}\">#{h method.full_name}</a>"</span>
+  <span class="ruby-keyword">end</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- create_link-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- create_link-method -->
+
+    
+      <div id="method-i-file_link" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">file_link</span><span
+            class="method-args">(path, linenum)</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="file_link-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/printers/graph_html_printer.rb, line 64</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">file_link</span>(<span class="ruby-identifier">path</span>, <span class="ruby-identifier">linenum</span>)
+  <span class="ruby-identifier">srcfile</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-identifier">path</span>)
+  <span class="ruby-keyword">if</span> <span class="ruby-identifier">srcfile</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">%r\/ruby_runtime$/</span>
+    <span class="ruby-string">""</span>
+  <span class="ruby-keyword">else</span>
+    <span class="ruby-keyword">if</span> <span class="ruby-constant">RUBY_PLATFORM</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">%rdarwin/</span>
+      <span class="ruby-node">"<a href=\"txmt://open?url=file://#{h srcfile}&line=#{linenum}\" title=\"#{h srcfile}:#{linenum}\">#{linenum}</a>"</span>
+    <span class="ruby-keyword">else</span>
+      <span class="ruby-node">"<a href=\"file://#{h srcfile}##{linenum}\" title=\"#{h srcfile}:#{linenum}\">#{linenum}</a>"</span>
+    <span class="ruby-keyword">end</span>
+  <span class="ruby-keyword">end</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- file_link-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- file_link-method -->
+
+    
+      <div id="method-i-method_href" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">method_href</span><span
+            class="method-args">(thread, method)</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="method_href-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/printers/graph_html_printer.rb, line 60</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">method_href</span>(<span class="ruby-identifier">thread</span>, <span class="ruby-identifier">method</span>)
+  <span class="ruby-identifier">h</span>(<span class="ruby-identifier">method</span>.<span class="ruby-identifier">full_name</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-node">%r[><#\.\?=:]/</span>,<span class="ruby-string">"_"</span>) <span class="ruby-operator">+</span> <span class="ruby-string">"_"</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">thread</span>.<span class="ruby-identifier">fiber_id</span>.<span c [...]
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- method_href-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- method_href-method -->
+
+    
+      <div id="method-i-print" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">print</span><span
+            class="method-args">(output = STDOUT, options = {})</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="print-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/printers/graph_html_printer.rb, line 39</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">print</span>(<span class="ruby-identifier">output</span> = <span class="ruby-constant">STDOUT</span>, <span class="ruby-identifier">options</span> = {})
+  <span class="ruby-ivar">@output</span> = <span class="ruby-identifier">output</span>
+  <span class="ruby-identifier">setup_options</span>(<span class="ruby-identifier">options</span>)
+  <span class="ruby-ivar">@output</span> <span class="ruby-operator"><<</span> <span class="ruby-ivar">@erb</span>.<span class="ruby-identifier">result</span>(<span class="ruby-identifier">binding</span>)
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- print-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- print-method -->
+
+    
+      <div id="method-i-setup_options" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">setup_options</span><span
+            class="method-args">(options)</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="setup_options-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/printers/graph_html_printer.rb, line 30</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">setup_options</span>(<span class="ruby-identifier">options</span>)
+  <span class="ruby-keyword">super</span>(<span class="ruby-identifier">options</span>)
+
+  <span class="ruby-identifier">filename</span> = <span class="ruby-identifier">options</span>[<span class="ruby-value">:filename</span>]
+  <span class="ruby-identifier">template</span> = <span class="ruby-identifier">filename</span> <span class="ruby-operator">?</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">filename</span>).<span class="ruby-identifier">untaint</span> <span class="ruby-operator">:</span> (<span class="ruby-identifier">options</span>[<span class="ruby-value">:template</span>] <span class="ruby-operator">||</span> <span class="ruby-key [...]
+  <span class="ruby-ivar">@erb</span> = <span class="ruby-constant">ERB</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">template</span>, <span class="ruby-keyword">nil</span>, <span class="ruby-keyword">nil</span>)
+  <span class="ruby-ivar">@erb</span>.<span class="ruby-identifier">filename</span> = <span class="ruby-identifier">filename</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- setup_options-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- setup_options-method -->
+
+    
+      <div id="method-i-template" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">template</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="template-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/printers/graph_html_printer.rb, line 77</span>
+    <span class="ruby-keyword">def</span> <span class="ruby-identifier">template</span>
+<span class="ruby-string">'
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+  <style media="all" type="text/css">
+    table {
+      border-collapse: collapse;
+      border: 1px solid #CCC;
+      font-family: Verdana, Arial, Helvetica, sans-serif;
+      font-size: 9pt;
+      line-height: normal;
+      width: 100%;
+    }
+
+    th {
+      text-align: center;
+      border-top: 1px solid #FB7A31;
+      border-bottom: 1px solid #FB7A31;
+      background: #FFC;
+      padding: 0.3em;
+      border-left: 1px solid silver;
+    }
+
+    tr.break td {
+      border: 0;
+      border-top: 1px solid #FB7A31;
+      padding: 0;
+      margin: 0;
+    }
+
+    tr.method td {
+      font-weight: bold;
+    }
+
+    td {
+      padding: 0.3em;
+    }
+
+    td:first-child {
+      width: 190px;
+      }
+
+    td {
+      border-left: 1px solid #CCC;
+      text-align: center;
+    }
+
+    .method_name {
+      text-align: left;
+    }
+
+    tfoot td {
+      text-align: left;
+    }
+  </style>
+  </head>
+  <body>
+    <h1>Profile Report</h1>
+    <!-- Threads Table -->
+    <table>
+      <tr>
+        <th>Thread ID</th>
+        <% if RUBY_VERSION >= "1.9" %>
+        <th>Fiber ID</th>
+        <% end %>
+        <th>Total Time</th>
+      </tr>
+      <% for thread in @result.threads %>
+      <tr>
+        <% if RUBY_VERSION >= "1.9" %>
+        <td><%= thread.id %></td>
+        <% end %>
+        <td><a href="#<%= thread.fiber_id %>"><%= thread.fiber_id %></a></td>
+        <td><%= thread.total_time %></td>
+      </tr>
+      <% end %>
+    </table>
+
+    <!-- Methods Tables -->
+    <% for thread in @result.threads
+         methods = thread.methods
+         total_time = thread.total_time %>
+      <% if RUBY_VERSION >= "1.9" %>
+      <h2><a name="<%= thread.fiber_id %>">Thread <%= thread.id %>, Fiber: <%= thread.fiber_id %></a></h2>
+      <% else %>
+      <h2><a name="<%= thread.fiber_id %>">Thread <%= thread.fiber_id %></a></h2>
+      <% end %>
+      <table>
+        <thead>
+          <tr>
+            <th><%= sprintf("%#{PERCENTAGE_WIDTH}s", "%Total") %></th>
+            <th><%= sprintf("%#{PERCENTAGE_WIDTH}s", "%Self") %></th>
+            <th><%= sprintf("%#{TIME_WIDTH}s", "Total") %></th>
+            <th><%= sprintf("%#{TIME_WIDTH}s", "Self") %></th>
+            <th><%= sprintf("%#{TIME_WIDTH}s", "Wait") %></th>
+            <th><%= sprintf("%#{TIME_WIDTH+2}s", "Child") %></th>
+            <th><%= sprintf("%#{CALL_WIDTH}s", "Calls") %></th>
+            <th class="method_name">Name</th>
+            <th>Line</th>
+          </tr>
+        </thead>
+
+        <tbody>
+          <% min_time = @options[:min_time] || (@options[:nonzero] ? 0.005 : nil)
+             methods.sort_by(&sort_method).reverse_each do |method|
+              total_percentage = (method.total_time/total_time) * 100
+              next if total_percentage < min_percent
+              next if min_time && method.total_time < min_time
+              self_percentage = (method.self_time/total_time) * 100 %>
+
+              <!-- Parents -->
+              <% for caller in method.aggregate_parents.sort_by(&:total_time)
+                   next unless caller.parent
+                   next if min_time && caller.total_time < min_time  %>
+                <tr>
+                  <td>&nbsp;</td>
+                  <td>&nbsp;</td>
+                  <td><%= sprintf("%#{TIME_WIDTH}.2f", caller.total_time) %></td>
+                  <td><%= sprintf("%#{TIME_WIDTH}.2f", caller.self_time) %></td>
+                  <td><%= sprintf("%#{TIME_WIDTH}.2f", caller.wait_time) %></td>
+                  <td><%= sprintf("%#{TIME_WIDTH}.2f", caller.children_time) %></td>
+                  <% called = "#{caller.called}/#{method.called}" %>
+                  <td><%= sprintf("%#{CALL_WIDTH}s", called) %></td>
+                  <td class="method_name"><%= create_link(thread, total_time, caller.parent.target) %></td>
+                  <td><%= file_link(caller.parent.target.source_file, caller.line) %></td>
+                </tr>
+              <% end %>
+
+              <tr class="method">
+                <td><%= sprintf("%#{PERCENTAGE_WIDTH-1}.2f\%", total_percentage) %></td>
+                <td><%= sprintf("%#{PERCENTAGE_WIDTH-1}.2f\%", self_percentage) %></td>
+                <td><%= sprintf("%#{TIME_WIDTH}.2f", method.total_time) %></td>
+                <td><%= sprintf("%#{TIME_WIDTH}.2f", method.self_time) %></td>
+                <td><%= sprintf("%#{TIME_WIDTH}.2f", method.wait_time) %></td>
+                <td><%= sprintf("%#{TIME_WIDTH}.2f", method.children_time) %></td>
+                <td><%= sprintf("%#{CALL_WIDTH}i", method.called) %></td>
+                <td class="method_name">
+                  <a name="<%= method_href(thread, method) %>">
+                    <%= method.recursive? ? "*" : " "%><%= h method.full_name %>
+                  </a>
+                </td>
+                <td><%= file_link(method.source_file, method.line) %></td>
+              </tr>
+
+              <!-- Children -->
+              <% for callee in method.aggregate_children.sort_by(&:total_time).reverse %>
+              <%   next if min_time && callee.total_time < min_time  %>
+                <tr>
+                  <td>&nbsp;</td>
+                  <td>&nbsp;</td>
+                  <td><%= sprintf("%#{TIME_WIDTH}.2f", callee.total_time) %></td>
+                  <td><%= sprintf("%#{TIME_WIDTH}.2f", callee.self_time) %></td>
+                  <td><%= sprintf("%#{TIME_WIDTH}.2f", callee.wait_time) %></td>
+                  <td><%= sprintf("%#{TIME_WIDTH}.2f", callee.children_time) %></td>
+                  <% called = "#{callee.called}/#{callee.target.called}" %>
+                  <td><%= sprintf("%#{CALL_WIDTH}s", called) %></td>
+                  <td class="method_name"><%= create_link(thread, total_time, callee.target) %></td>
+                  <td><%= file_link(method.source_file, callee.line) %></td>
+                </tr>
+              <% end %>
+              <!-- Create divider row -->
+              <tr class="break"><td colspan="9"></td></tr>
+          <% end %>
+        </tbody>
+        <tfoot>
+          <tr>
+            <td colspan="9">* indicates recursively called methods</td>
+          </tr>
+        </tfoot>
+      </table>
+    <% end %>
+  </body>
+</html>'</span>
+    <span class="ruby-keyword">end</span></pre>
+          </div><!-- template-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- template-method -->
+
+    
+    </section><!-- public-instance-method-details -->
+  
+  </section><!-- 5Buntitled-5D -->
+
+</div><!-- documentation -->
+
+
+<footer id="validator-badges">
+  <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
+  <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.1.
+  <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
+</footer>
+
diff --git a/doc/RubyProf/GraphPrinter.html b/doc/RubyProf/GraphPrinter.html
new file mode 100644
index 0000000..7e0fd7a
--- /dev/null
+++ b/doc/RubyProf/GraphPrinter.html
@@ -0,0 +1,209 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+
+<title>class RubyProf::GraphPrinter - ruby-prof</title>
+
+<link type="text/css" media="screen" href="../rdoc.css" rel="stylesheet">
+
+<script type="text/javascript">
+  var rdoc_rel_prefix = "../";
+</script>
+
+<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/navigation.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/search_index.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/search.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/searcher.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/darkfish.js"></script>
+
+
+<body id="top" class="class">
+<nav id="metadata">
+  <nav id="home-section" class="section">
+  <h3 class="section-header">
+    <a href="../index.html">Home</a>
+    <a href="../table_of_contents.html#classes">Classes</a>
+    <a href="../table_of_contents.html#methods">Methods</a>
+  </h3>
+</nav>
+
+
+  <nav id="search-section" class="section project-section" class="initially-hidden">
+  <form action="#" method="get" accept-charset="utf-8">
+    <h3 class="section-header">
+      <input type="text" name="search" placeholder="Search" id="search-field"
+             title="Type to search, Up and Down to navigate, Enter to load">
+    </h3>
+  </form>
+
+  <ul id="search-results" class="initially-hidden"></ul>
+</nav>
+
+
+  <div id="file-metadata">
+    <nav id="file-list-section" class="section">
+  <h3 class="section-header">Defined In</h3>
+  <ul>
+    <li>lib/ruby-prof/printers/graph_printer.rb
+  </ul>
+</nav>
+
+    
+  </div>
+
+  <div id="class-metadata">
+    
+    <nav id="parent-class-section" class="section">
+  <h3 class="section-header">Parent</h3>
+  
+  <p class="link"><a href="AbstractPrinter.html">RubyProf::AbstractPrinter</a>
+  
+</nav>
+
+    
+    
+  </div>
+
+  <div id="project-metadata">
+    <nav id="fileindex-section" class="section project-section">
+  <h3 class="section-header">Pages</h3>
+
+  <ul>
+  
+    <li class="file"><a href="../LICENSE.html">LICENSE</a>
+  
+    <li class="file"><a href="../README_rdoc.html">README</a>
+  
+    <li class="file"><a href="../examples/flat_txt.html">flat</a>
+  
+    <li class="file"><a href="../examples/graph_txt.html">graph</a>
+  
+  </ul>
+</nav>
+
+    <nav id="classindex-section" class="section project-section">
+  <h3 class="section-header">Class and Module Index</h3>
+
+  <ul class="link-list">
+  
+    <li><a href="../RubyProf.html">RubyProf</a>
+  
+    <li><a href="../RubyProf/AbstractPrinter.html">RubyProf::AbstractPrinter</a>
+  
+    <li><a href="../RubyProf/AggregateCallInfo.html">RubyProf::AggregateCallInfo</a>
+  
+    <li><a href="../RubyProf/CallInfo.html">RubyProf::CallInfo</a>
+  
+    <li><a href="../RubyProf/CallInfoPrinter.html">RubyProf::CallInfoPrinter</a>
+  
+    <li><a href="../RubyProf/CallInfoVisitor.html">RubyProf::CallInfoVisitor</a>
+  
+    <li><a href="../RubyProf/CallStackPrinter.html">RubyProf::CallStackPrinter</a>
+  
+    <li><a href="../RubyProf/CallTreePrinter.html">RubyProf::CallTreePrinter</a>
+  
+    <li><a href="../RubyProf/Cmd.html">RubyProf::Cmd</a>
+  
+    <li><a href="../RubyProf/DotPrinter.html">RubyProf::DotPrinter</a>
+  
+    <li><a href="../RubyProf/FlatPrinter.html">RubyProf::FlatPrinter</a>
+  
+    <li><a href="../RubyProf/FlatPrinterWithLineNumbers.html">RubyProf::FlatPrinterWithLineNumbers</a>
+  
+    <li><a href="../RubyProf/GraphHtmlPrinter.html">RubyProf::GraphHtmlPrinter</a>
+  
+    <li><a href="../RubyProf/GraphPrinter.html">RubyProf::GraphPrinter</a>
+  
+    <li><a href="../RubyProf/MethodInfo.html">RubyProf::MethodInfo</a>
+  
+    <li><a href="../RubyProf/MultiPrinter.html">RubyProf::MultiPrinter</a>
+  
+    <li><a href="../RubyProf/Profile.html">RubyProf::Profile</a>
+  
+    <li><a href="../RubyProf/ProfileTask.html">RubyProf::ProfileTask</a>
+  
+    <li><a href="../RubyProf/Test.html">RubyProf::Test</a>
+  
+    <li><a href="../RubyProf/Thread.html">RubyProf::Thread</a>
+  
+    <li><a href="../Rack.html">Rack</a>
+  
+    <li><a href="../Rack/RubyProf.html">Rack::RubyProf</a>
+  
+  </ul>
+</nav>
+
+  </div>
+</nav>
+
+<div id="documentation">
+  <h1 class="class">class RubyProf::GraphPrinter</h1>
+
+  <div id="description" class="description">
+    
+<p>Generates <a href="../files/examples/graph_txt.html">graph</a> profile
+reports as text. To use the graph printer:</p>
+
+<pre>result = RubyProf.profile do
+  [code to profile]
+end
+
+printer = RubyProf::GraphPrinter.new(result)
+printer.print(STDOUT, {})</pre>
+
+<p>The constructor takes two arguments. See the <a
+href="../README_rdoc.html">README</a></p>
+
+  </div><!-- description -->
+
+  
+  
+  
+  <section id="5Buntitled-5D" class="documentation-section">
+    
+
+    
+
+    
+    <!-- Constants -->
+    <section id="constants-list" class="section">
+      <h3 class="section-header">Constants</h3>
+      <dl>
+      
+        <dt id="CALL_WIDTH">CALL_WIDTH
+        
+        <dd class="description">
+        
+      
+        <dt id="PERCENTAGE_WIDTH">PERCENTAGE_WIDTH
+        
+        <dd class="description">
+        
+      
+        <dt id="TIME_WIDTH">TIME_WIDTH
+        
+        <dd class="description">
+        
+      
+      </dl>
+    </section>
+    
+
+    
+
+    <!-- Methods -->
+    
+  </section><!-- 5Buntitled-5D -->
+
+</div><!-- documentation -->
+
+
+<footer id="validator-badges">
+  <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
+  <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.1.
+  <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
+</footer>
+
diff --git a/doc/RubyProf/MethodInfo.html b/doc/RubyProf/MethodInfo.html
new file mode 100644
index 0000000..a6306a4
--- /dev/null
+++ b/doc/RubyProf/MethodInfo.html
@@ -0,0 +1,713 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+
+<title>class RubyProf::MethodInfo - ruby-prof</title>
+
+<link type="text/css" media="screen" href="../rdoc.css" rel="stylesheet">
+
+<script type="text/javascript">
+  var rdoc_rel_prefix = "../";
+</script>
+
+<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/navigation.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/search_index.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/search.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/searcher.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/darkfish.js"></script>
+
+
+<body id="top" class="class">
+<nav id="metadata">
+  <nav id="home-section" class="section">
+  <h3 class="section-header">
+    <a href="../index.html">Home</a>
+    <a href="../table_of_contents.html#classes">Classes</a>
+    <a href="../table_of_contents.html#methods">Methods</a>
+  </h3>
+</nav>
+
+
+  <nav id="search-section" class="section project-section" class="initially-hidden">
+  <form action="#" method="get" accept-charset="utf-8">
+    <h3 class="section-header">
+      <input type="text" name="search" placeholder="Search" id="search-field"
+             title="Type to search, Up and Down to navigate, Enter to load">
+    </h3>
+  </form>
+
+  <ul id="search-results" class="initially-hidden"></ul>
+</nav>
+
+
+  <div id="file-metadata">
+    <nav id="file-list-section" class="section">
+  <h3 class="section-header">Defined In</h3>
+  <ul>
+    <li>lib/ruby-prof/method_info.rb
+  </ul>
+</nav>
+
+    
+  </div>
+
+  <div id="class-metadata">
+    
+    <nav id="parent-class-section" class="section">
+  <h3 class="section-header">Parent</h3>
+  
+  <p class="link">Object
+  
+</nav>
+
+    <!-- Included Modules -->
+<nav id="includes-section" class="section">
+  <h3 class="section-header">Included Modules</h3>
+
+  <ul class="link-list">
+  
+  
+    <li><span class="include">Comparable</span>
+  
+  
+  </ul>
+</nav>
+
+    <!-- Method Quickref -->
+<nav id="method-list-section" class="section">
+  <h3 class="section-header">Methods</h3>
+
+  <ul class="link-list">
+    
+    <li><a href="#method-i-3C-3D-3E">#<=></a>
+    
+    <li><a href="#method-i-aggregate_children">#aggregate_children</a>
+    
+    <li><a href="#method-i-aggregate_parents">#aggregate_parents</a>
+    
+    <li><a href="#method-i-called">#called</a>
+    
+    <li><a href="#method-i-children">#children</a>
+    
+    <li><a href="#method-i-children_time">#children_time</a>
+    
+    <li><a href="#method-i-eliminate-21">#eliminate!</a>
+    
+    <li><a href="#method-i-min_depth">#min_depth</a>
+    
+    <li><a href="#method-i-recursive-3F">#recursive?</a>
+    
+    <li><a href="#method-i-root-3F">#root?</a>
+    
+    <li><a href="#method-i-self_time">#self_time</a>
+    
+    <li><a href="#method-i-to_s">#to_s</a>
+    
+    <li><a href="#method-i-total_time">#total_time</a>
+    
+    <li><a href="#method-i-wait_time">#wait_time</a>
+    
+  </ul>
+</nav>
+
+  </div>
+
+  <div id="project-metadata">
+    <nav id="fileindex-section" class="section project-section">
+  <h3 class="section-header">Pages</h3>
+
+  <ul>
+  
+    <li class="file"><a href="../LICENSE.html">LICENSE</a>
+  
+    <li class="file"><a href="../README_rdoc.html">README</a>
+  
+    <li class="file"><a href="../examples/flat_txt.html">flat</a>
+  
+    <li class="file"><a href="../examples/graph_txt.html">graph</a>
+  
+  </ul>
+</nav>
+
+    <nav id="classindex-section" class="section project-section">
+  <h3 class="section-header">Class and Module Index</h3>
+
+  <ul class="link-list">
+  
+    <li><a href="../RubyProf.html">RubyProf</a>
+  
+    <li><a href="../RubyProf/AbstractPrinter.html">RubyProf::AbstractPrinter</a>
+  
+    <li><a href="../RubyProf/AggregateCallInfo.html">RubyProf::AggregateCallInfo</a>
+  
+    <li><a href="../RubyProf/CallInfo.html">RubyProf::CallInfo</a>
+  
+    <li><a href="../RubyProf/CallInfoPrinter.html">RubyProf::CallInfoPrinter</a>
+  
+    <li><a href="../RubyProf/CallInfoVisitor.html">RubyProf::CallInfoVisitor</a>
+  
+    <li><a href="../RubyProf/CallStackPrinter.html">RubyProf::CallStackPrinter</a>
+  
+    <li><a href="../RubyProf/CallTreePrinter.html">RubyProf::CallTreePrinter</a>
+  
+    <li><a href="../RubyProf/Cmd.html">RubyProf::Cmd</a>
+  
+    <li><a href="../RubyProf/DotPrinter.html">RubyProf::DotPrinter</a>
+  
+    <li><a href="../RubyProf/FlatPrinter.html">RubyProf::FlatPrinter</a>
+  
+    <li><a href="../RubyProf/FlatPrinterWithLineNumbers.html">RubyProf::FlatPrinterWithLineNumbers</a>
+  
+    <li><a href="../RubyProf/GraphHtmlPrinter.html">RubyProf::GraphHtmlPrinter</a>
+  
+    <li><a href="../RubyProf/GraphPrinter.html">RubyProf::GraphPrinter</a>
+  
+    <li><a href="../RubyProf/MethodInfo.html">RubyProf::MethodInfo</a>
+  
+    <li><a href="../RubyProf/MultiPrinter.html">RubyProf::MultiPrinter</a>
+  
+    <li><a href="../RubyProf/Profile.html">RubyProf::Profile</a>
+  
+    <li><a href="../RubyProf/ProfileTask.html">RubyProf::ProfileTask</a>
+  
+    <li><a href="../RubyProf/Test.html">RubyProf::Test</a>
+  
+    <li><a href="../RubyProf/Thread.html">RubyProf::Thread</a>
+  
+    <li><a href="../Rack.html">Rack</a>
+  
+    <li><a href="../Rack/RubyProf.html">Rack::RubyProf</a>
+  
+  </ul>
+</nav>
+
+  </div>
+</nav>
+
+<div id="documentation">
+  <h1 class="class">class RubyProf::MethodInfo</h1>
+
+  <div id="description" class="description">
+    
+  </div><!-- description -->
+
+  
+  
+  
+  <section id="5Buntitled-5D" class="documentation-section">
+    
+
+    
+
+    
+
+    
+
+    <!-- Methods -->
+    
+     <section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
+      <h3 class="section-header">Public Instance Methods</h3>
+
+    
+      <div id="method-i-3C-3D-3E" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name"><=></span><span
+            class="method-args">(other)</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="3C-3D-3E-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/method_info.rb, line 6</span>
+<span class="ruby-keyword">def</span> <span class="ruby-operator"><=></span>(<span class="ruby-identifier">other</span>)
+  <span class="ruby-keyword">if</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">total_time</span> <span class="ruby-operator"><</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">total_time</span>
+    <span class="ruby-value">-1</span>
+  <span class="ruby-keyword">elsif</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">total_time</span> <span class="ruby-operator">></span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">total_time</span>
+    <span class="ruby-value">1</span>
+  <span class="ruby-keyword">elsif</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">min_depth</span> <span class="ruby-operator"><</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">min_depth</span>
+    <span class="ruby-value">1</span>
+  <span class="ruby-keyword">elsif</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">min_depth</span> <span class="ruby-operator">></span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">min_depth</span>
+    <span class="ruby-value">-1</span>
+  <span class="ruby-keyword">else</span>
+    <span class="ruby-keyword">self</span>.<span class="ruby-identifier">full_name</span> <span class="ruby-operator"><=></span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">full_name</span>
+  <span class="ruby-keyword">end</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- 3C-3D-3E-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- 3C-3D-3E-method -->
+
+    
+      <div id="method-i-aggregate_children" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">aggregate_children</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="aggregate_children-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/method_info.rb, line 105</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">aggregate_children</span>
+  <span class="ruby-comment"># Group call info's based on their targets</span>
+  <span class="ruby-identifier">groups</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">children</span>.<span class="ruby-identifier">inject</span>(<span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">hash</span>, <span class="ruby-identifier">call_info</span><span class="ruby-operator">|</span>
+    <span class="ruby-identifier">key</span> = <span class="ruby-identifier">call_info</span>.<span class="ruby-identifier">target</span>
+    (<span class="ruby-identifier">hash</span>[<span class="ruby-identifier">key</span>] <span class="ruby-operator">||=</span> []) <span class="ruby-operator"><<</span> <span class="ruby-identifier">call_info</span>
+    <span class="ruby-identifier">hash</span>
+  <span class="ruby-keyword">end</span>
+
+  <span class="ruby-identifier">groups</span>.<span class="ruby-identifier">map</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span><span class="ruby-operator">|</span>
+    <span class="ruby-constant">AggregateCallInfo</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">value</span>)
+  <span class="ruby-keyword">end</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- aggregate_children-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- aggregate_children-method -->
+
+    
+      <div id="method-i-aggregate_parents" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">aggregate_parents</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="aggregate_parents-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/method_info.rb, line 92</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">aggregate_parents</span>
+  <span class="ruby-comment"># Group call info's based on their parents</span>
+  <span class="ruby-identifier">groups</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">call_infos</span>.<span class="ruby-identifier">inject</span>(<span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">hash</span>, <span class="ruby-identifier">call_info</span><span class="ruby-operator">|</span>
+    <span class="ruby-identifier">key</span> = <span class="ruby-identifier">call_info</span>.<span class="ruby-identifier">parent</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">call_info</span>.<span class="ruby-identifier">parent</span>.<span class="ruby-identifier">target</span> <span class="ruby-operator">:</span> <span class="ruby-keyword">self</span>
+    (<span class="ruby-identifier">hash</span>[<span class="ruby-identifier">key</span>] <span class="ruby-operator">||=</span> []) <span class="ruby-operator"><<</span> <span class="ruby-identifier">call_info</span>
+    <span class="ruby-identifier">hash</span>
+  <span class="ruby-keyword">end</span>
+
+  <span class="ruby-identifier">groups</span>.<span class="ruby-identifier">map</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span><span class="ruby-operator">|</span>
+    <span class="ruby-constant">AggregateCallInfo</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">value</span>)
+  <span class="ruby-keyword">end</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- aggregate_parents-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- aggregate_parents-method -->
+
+    
+      <div id="method-i-called" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">called</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="called-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/method_info.rb, line 20</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">called</span>
+  <span class="ruby-ivar">@called</span> <span class="ruby-operator">||=</span> <span class="ruby-keyword">begin</span>
+    <span class="ruby-identifier">call_infos</span>.<span class="ruby-identifier">inject</span>(<span class="ruby-value">0</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">sum</span>, <span class="ruby-identifier">call_info</span><span class="ruby-operator">|</span>
+      <span class="ruby-identifier">sum</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">call_info</span>.<span class="ruby-identifier">called</span>
+    <span class="ruby-keyword">end</span>
+  <span class="ruby-keyword">end</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- called-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- called-method -->
+
+    
+      <div id="method-i-children" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">children</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="children-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/method_info.rb, line 84</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">children</span>
+  <span class="ruby-ivar">@children</span> <span class="ruby-operator">||=</span> <span class="ruby-keyword">begin</span>
+    <span class="ruby-identifier">call_infos</span>.<span class="ruby-identifier">map</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">call_info</span><span class="ruby-operator">|</span>
+      <span class="ruby-identifier">call_info</span>.<span class="ruby-identifier">children</span>
+    <span class="ruby-keyword">end</span>.<span class="ruby-identifier">flatten</span>
+  <span class="ruby-keyword">end</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- children-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- children-method -->
+
+    
+      <div id="method-i-children_time" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">children_time</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="children_time-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/method_info.rb, line 55</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">children_time</span>
+  <span class="ruby-ivar">@children_time</span> <span class="ruby-operator">||=</span> <span class="ruby-keyword">begin</span>
+    <span class="ruby-identifier">call_infos</span>.<span class="ruby-identifier">inject</span>(<span class="ruby-value">0</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">sum</span>, <span class="ruby-identifier">call_info</span><span class="ruby-operator">|</span>
+      <span class="ruby-identifier">sum</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">call_info</span>.<span class="ruby-identifier">children_time</span>  <span class="ruby-keyword">unless</span> <span class="ruby-identifier">call_info</span>.<span class="ruby-identifier">recursive</span>
+      <span class="ruby-identifier">sum</span>
+    <span class="ruby-keyword">end</span>
+  <span class="ruby-keyword">end</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- children_time-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- children_time-method -->
+
+    
+      <div id="method-i-eliminate-21" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">eliminate!</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          <p>remove method from the call graph. should not be called directly.</p>
+          
+
+          
+          <div class="method-source-code" id="eliminate-21-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/method_info.rb, line 123</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">eliminate!</span>
+  <span class="ruby-comment"># $stderr.puts "eliminating #{self}"</span>
+  <span class="ruby-identifier">call_infos</span>.<span class="ruby-identifier">each</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">call_info</span><span class="ruby-operator">|</span> <span class="ruby-identifier">call_info</span>.<span class="ruby-identifier">eliminate!</span> }
+  <span class="ruby-identifier">call_infos</span>.<span class="ruby-identifier">clear</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- eliminate-21-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- eliminate-21-method -->
+
+    
+      <div id="method-i-min_depth" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">min_depth</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="min_depth-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/method_info.rb, line 64</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">min_depth</span>
+  <span class="ruby-ivar">@min_depth</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">call_infos</span>.<span class="ruby-identifier">map</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">call_info</span><span class="ruby-operator">|</span>
+    <span class="ruby-identifier">call_info</span>.<span class="ruby-identifier">depth</span>
+  <span class="ruby-keyword">end</span>.<span class="ruby-identifier">min</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- min_depth-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- min_depth-method -->
+
+    
+      <div id="method-i-recursive-3F" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">recursive?</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="recursive-3F-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/method_info.rb, line 78</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">recursive?</span>
+  <span class="ruby-identifier">call_infos</span>.<span class="ruby-identifier">detect</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">call_info</span><span class="ruby-operator">|</span>
+    <span class="ruby-identifier">call_info</span>.<span class="ruby-identifier">recursive</span>
+  <span class="ruby-keyword">end</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- recursive-3F-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- recursive-3F-method -->
+
+    
+      <div id="method-i-root-3F" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">root?</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="root-3F-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/method_info.rb, line 70</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">root?</span>
+  <span class="ruby-ivar">@root</span> <span class="ruby-operator">||=</span> <span class="ruby-keyword">begin</span>
+    <span class="ruby-identifier">call_infos</span>.<span class="ruby-identifier">find</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">call_info</span><span class="ruby-operator">|</span>
+      <span class="ruby-keyword">not</span> <span class="ruby-identifier">call_info</span>.<span class="ruby-identifier">root?</span>
+    <span class="ruby-keyword">end</span>.<span class="ruby-identifier">nil?</span>
+  <span class="ruby-keyword">end</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- root-3F-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- root-3F-method -->
+
+    
+      <div id="method-i-self_time" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">self_time</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="self_time-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/method_info.rb, line 37</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">self_time</span>
+  <span class="ruby-ivar">@self_time</span> <span class="ruby-operator">||=</span> <span class="ruby-keyword">begin</span>
+    <span class="ruby-identifier">call_infos</span>.<span class="ruby-identifier">inject</span>(<span class="ruby-value">0</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">sum</span>, <span class="ruby-identifier">call_info</span><span class="ruby-operator">|</span>
+      <span class="ruby-identifier">sum</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">call_info</span>.<span class="ruby-identifier">self_time</span>  <span class="ruby-keyword">unless</span> <span class="ruby-identifier">call_info</span>.<span class="ruby-identifier">recursive</span>
+      <span class="ruby-identifier">sum</span>
+    <span class="ruby-keyword">end</span>
+  <span class="ruby-keyword">end</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- self_time-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- self_time-method -->
+
+    
+      <div id="method-i-to_s" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">to_s</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="to_s-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/method_info.rb, line 118</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">to_s</span>
+  <span class="ruby-node">"#{self.full_name} (c: #{self.called}, tt: #{self.total_time}, st: #{self.self_time}, ct: #{self.children_time})"</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- to_s-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- to_s-method -->
+
+    
+      <div id="method-i-total_time" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">total_time</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="total_time-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/method_info.rb, line 28</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">total_time</span>
+  <span class="ruby-ivar">@total_time</span> <span class="ruby-operator">||=</span> <span class="ruby-keyword">begin</span>
+    <span class="ruby-identifier">call_infos</span>.<span class="ruby-identifier">inject</span>(<span class="ruby-value">0</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">sum</span>, <span class="ruby-identifier">call_info</span><span class="ruby-operator">|</span>
+      <span class="ruby-identifier">sum</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">call_info</span>.<span class="ruby-identifier">total_time</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">call_info</span>.<span class="ruby-identifier">recursive</span>
+      <span class="ruby-identifier">sum</span>
+    <span class="ruby-keyword">end</span>
+  <span class="ruby-keyword">end</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- total_time-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- total_time-method -->
+
+    
+      <div id="method-i-wait_time" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">wait_time</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="wait_time-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/method_info.rb, line 46</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">wait_time</span>
+  <span class="ruby-ivar">@wait_time</span> <span class="ruby-operator">||=</span> <span class="ruby-keyword">begin</span>
+    <span class="ruby-identifier">call_infos</span>.<span class="ruby-identifier">inject</span>(<span class="ruby-value">0</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">sum</span>, <span class="ruby-identifier">call_info</span><span class="ruby-operator">|</span>
+      <span class="ruby-identifier">sum</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">call_info</span>.<span class="ruby-identifier">wait_time</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">call_info</span>.<span class="ruby-identifier">recursive</span>
+      <span class="ruby-identifier">sum</span>
+    <span class="ruby-keyword">end</span>
+  <span class="ruby-keyword">end</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- wait_time-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- wait_time-method -->
+
+    
+    </section><!-- public-instance-method-details -->
+  
+  </section><!-- 5Buntitled-5D -->
+
+</div><!-- documentation -->
+
+
+<footer id="validator-badges">
+  <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
+  <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.1.
+  <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
+</footer>
+
diff --git a/doc/RubyProf/MultiPrinter.html b/doc/RubyProf/MultiPrinter.html
new file mode 100644
index 0000000..10091ec
--- /dev/null
+++ b/doc/RubyProf/MultiPrinter.html
@@ -0,0 +1,407 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+
+<title>class RubyProf::MultiPrinter - ruby-prof</title>
+
+<link type="text/css" media="screen" href="../rdoc.css" rel="stylesheet">
+
+<script type="text/javascript">
+  var rdoc_rel_prefix = "../";
+</script>
+
+<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/navigation.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/search_index.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/search.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/searcher.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/darkfish.js"></script>
+
+
+<body id="top" class="class">
+<nav id="metadata">
+  <nav id="home-section" class="section">
+  <h3 class="section-header">
+    <a href="../index.html">Home</a>
+    <a href="../table_of_contents.html#classes">Classes</a>
+    <a href="../table_of_contents.html#methods">Methods</a>
+  </h3>
+</nav>
+
+
+  <nav id="search-section" class="section project-section" class="initially-hidden">
+  <form action="#" method="get" accept-charset="utf-8">
+    <h3 class="section-header">
+      <input type="text" name="search" placeholder="Search" id="search-field"
+             title="Type to search, Up and Down to navigate, Enter to load">
+    </h3>
+  </form>
+
+  <ul id="search-results" class="initially-hidden"></ul>
+</nav>
+
+
+  <div id="file-metadata">
+    <nav id="file-list-section" class="section">
+  <h3 class="section-header">Defined In</h3>
+  <ul>
+    <li>lib/ruby-prof/printers/multi_printer.rb
+  </ul>
+</nav>
+
+    
+  </div>
+
+  <div id="class-metadata">
+    
+    <nav id="parent-class-section" class="section">
+  <h3 class="section-header">Parent</h3>
+  
+  <p class="link">Object
+  
+</nav>
+
+    
+    <!-- Method Quickref -->
+<nav id="method-list-section" class="section">
+  <h3 class="section-header">Methods</h3>
+
+  <ul class="link-list">
+    
+    <li><a href="#method-c-new">::new</a>
+    
+    <li><a href="#method-i-flat_profile">#flat_profile</a>
+    
+    <li><a href="#method-i-graph_profile">#graph_profile</a>
+    
+    <li><a href="#method-i-print">#print</a>
+    
+    <li><a href="#method-i-stack_profile">#stack_profile</a>
+    
+    <li><a href="#method-i-tree_profile">#tree_profile</a>
+    
+  </ul>
+</nav>
+
+  </div>
+
+  <div id="project-metadata">
+    <nav id="fileindex-section" class="section project-section">
+  <h3 class="section-header">Pages</h3>
+
+  <ul>
+  
+    <li class="file"><a href="../LICENSE.html">LICENSE</a>
+  
+    <li class="file"><a href="../README_rdoc.html">README</a>
+  
+    <li class="file"><a href="../examples/flat_txt.html">flat</a>
+  
+    <li class="file"><a href="../examples/graph_txt.html">graph</a>
+  
+  </ul>
+</nav>
+
+    <nav id="classindex-section" class="section project-section">
+  <h3 class="section-header">Class and Module Index</h3>
+
+  <ul class="link-list">
+  
+    <li><a href="../RubyProf.html">RubyProf</a>
+  
+    <li><a href="../RubyProf/AbstractPrinter.html">RubyProf::AbstractPrinter</a>
+  
+    <li><a href="../RubyProf/AggregateCallInfo.html">RubyProf::AggregateCallInfo</a>
+  
+    <li><a href="../RubyProf/CallInfo.html">RubyProf::CallInfo</a>
+  
+    <li><a href="../RubyProf/CallInfoPrinter.html">RubyProf::CallInfoPrinter</a>
+  
+    <li><a href="../RubyProf/CallInfoVisitor.html">RubyProf::CallInfoVisitor</a>
+  
+    <li><a href="../RubyProf/CallStackPrinter.html">RubyProf::CallStackPrinter</a>
+  
+    <li><a href="../RubyProf/CallTreePrinter.html">RubyProf::CallTreePrinter</a>
+  
+    <li><a href="../RubyProf/Cmd.html">RubyProf::Cmd</a>
+  
+    <li><a href="../RubyProf/DotPrinter.html">RubyProf::DotPrinter</a>
+  
+    <li><a href="../RubyProf/FlatPrinter.html">RubyProf::FlatPrinter</a>
+  
+    <li><a href="../RubyProf/FlatPrinterWithLineNumbers.html">RubyProf::FlatPrinterWithLineNumbers</a>
+  
+    <li><a href="../RubyProf/GraphHtmlPrinter.html">RubyProf::GraphHtmlPrinter</a>
+  
+    <li><a href="../RubyProf/GraphPrinter.html">RubyProf::GraphPrinter</a>
+  
+    <li><a href="../RubyProf/MethodInfo.html">RubyProf::MethodInfo</a>
+  
+    <li><a href="../RubyProf/MultiPrinter.html">RubyProf::MultiPrinter</a>
+  
+    <li><a href="../RubyProf/Profile.html">RubyProf::Profile</a>
+  
+    <li><a href="../RubyProf/ProfileTask.html">RubyProf::ProfileTask</a>
+  
+    <li><a href="../RubyProf/Test.html">RubyProf::Test</a>
+  
+    <li><a href="../RubyProf/Thread.html">RubyProf::Thread</a>
+  
+    <li><a href="../Rack.html">Rack</a>
+  
+    <li><a href="../Rack/RubyProf.html">Rack::RubyProf</a>
+  
+  </ul>
+</nav>
+
+  </div>
+</nav>
+
+<div id="documentation">
+  <h1 class="class">class RubyProf::MultiPrinter</h1>
+
+  <div id="description" class="description">
+    
+<p>Helper class to simplify printing profiles of several types from one
+profiling run. Currently prints a flat profile, a callgrind profile, a call
+stack profile and a graph profile.</p>
+
+  </div><!-- description -->
+
+  
+  
+  
+  <section id="5Buntitled-5D" class="documentation-section">
+    
+
+    
+
+    
+
+    
+
+    <!-- Methods -->
+    
+     <section id="public-class-5Buntitled-5D-method-details" class="method-section section">
+      <h3 class="section-header">Public Class Methods</h3>
+
+    
+      <div id="method-c-new" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">new</span><span
+            class="method-args">(result)</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="new-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/printers/multi_printer.rb, line 7</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">result</span>)
+  <span class="ruby-ivar">@stack_printer</span> = <span class="ruby-constant">CallStackPrinter</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">result</span>)
+  <span class="ruby-ivar">@graph_printer</span> = <span class="ruby-constant">GraphHtmlPrinter</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">result</span>)
+  <span class="ruby-ivar">@tree_printer</span> = <span class="ruby-constant">CallTreePrinter</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">result</span>)
+  <span class="ruby-ivar">@flat_printer</span> = <span class="ruby-constant">FlatPrinter</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">result</span>)
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- new-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- new-method -->
+
+    
+    </section><!-- public-class-method-details -->
+  
+     <section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
+      <h3 class="section-header">Public Instance Methods</h3>
+
+    
+      <div id="method-i-flat_profile" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">flat_profile</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          <p>the name of the flat profile file</p>
+          
+
+          
+          <div class="method-source-code" id="flat_profile-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/printers/multi_printer.rb, line 50</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">flat_profile</span>
+  <span class="ruby-node">"#{@directory}/#{@profile}.flat.txt"</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- flat_profile-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- flat_profile-method -->
+
+    
+      <div id="method-i-graph_profile" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">graph_profile</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          <p>the name of the graph profile file</p>
+          
+
+          
+          <div class="method-source-code" id="graph_profile-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/printers/multi_printer.rb, line 40</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">graph_profile</span>
+  <span class="ruby-node">"#{@directory}/#{@profile}.graph.html"</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- graph_profile-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- graph_profile-method -->
+
+    
+      <div id="method-i-print" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">print</span><span
+            class="method-args">(options)</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          <p>create profile files under <a href="http://:path">options</a> or the
+current directory. <a href="http://:profile">options</a> is used as the
+base name for the pofile file, defaults to “profile”.</p>
+          
+
+          
+          <div class="method-source-code" id="print-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/printers/multi_printer.rb, line 17</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">print</span>(<span class="ruby-identifier">options</span>)
+  <span class="ruby-ivar">@profile</span> = <span class="ruby-identifier">options</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value">:profile</span>) <span class="ruby-operator">||</span> <span class="ruby-string">"profile"</span>
+  <span class="ruby-ivar">@directory</span> = <span class="ruby-identifier">options</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value">:path</span>) <span class="ruby-operator">||</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-string">"."</span>)
+  <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">stack_profile</span>, <span class="ruby-string">"w"</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span>
+    <span class="ruby-ivar">@stack_printer</span>.<span class="ruby-identifier">print</span>(<span class="ruby-identifier">f</span>, <span class="ruby-identifier">options</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-value">:graph</span> =<span class="ruby-operator">></span> <span class="ruby-node">"#{@profile}.graph.html"</span>))
+  <span class="ruby-keyword">end</span>
+  <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">graph_profile</span>, <span class="ruby-string">"w"</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span>
+    <span class="ruby-ivar">@graph_printer</span>.<span class="ruby-identifier">print</span>(<span class="ruby-identifier">f</span>, <span class="ruby-identifier">options</span>)
+  <span class="ruby-keyword">end</span>
+  <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">tree_profile</span>, <span class="ruby-string">"w"</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span>
+    <span class="ruby-ivar">@tree_printer</span>.<span class="ruby-identifier">print</span>(<span class="ruby-identifier">f</span>, <span class="ruby-identifier">options</span>)
+  <span class="ruby-keyword">end</span>
+  <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">flat_profile</span>, <span class="ruby-string">"w"</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span>
+    <span class="ruby-ivar">@flat_printer</span>.<span class="ruby-identifier">print</span>(<span class="ruby-identifier">f</span>, <span class="ruby-identifier">options</span>)
+  <span class="ruby-keyword">end</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- print-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- print-method -->
+
+    
+      <div id="method-i-stack_profile" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">stack_profile</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          <p>the name of the call stack profile file</p>
+          
+
+          
+          <div class="method-source-code" id="stack_profile-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/printers/multi_printer.rb, line 35</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">stack_profile</span>
+  <span class="ruby-node">"#{@directory}/#{@profile}.stack.html"</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- stack_profile-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- stack_profile-method -->
+
+    
+      <div id="method-i-tree_profile" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">tree_profile</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          <p>the name of the callgrind profile file</p>
+          
+
+          
+          <div class="method-source-code" id="tree_profile-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/printers/multi_printer.rb, line 45</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">tree_profile</span>
+  <span class="ruby-node">"#{@directory}/#{@profile}.grind.dat"</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- tree_profile-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- tree_profile-method -->
+
+    
+    </section><!-- public-instance-method-details -->
+  
+  </section><!-- 5Buntitled-5D -->
+
+</div><!-- documentation -->
+
+
+<footer id="validator-badges">
+  <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
+  <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.1.
+  <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
+</footer>
+
diff --git a/doc/RubyProf/Profile.html b/doc/RubyProf/Profile.html
new file mode 100644
index 0000000..e098ed4
--- /dev/null
+++ b/doc/RubyProf/Profile.html
@@ -0,0 +1,821 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+
+<title>class RubyProf::Profile - ruby-prof</title>
+
+<link type="text/css" media="screen" href="../rdoc.css" rel="stylesheet">
+
+<script type="text/javascript">
+  var rdoc_rel_prefix = "../";
+</script>
+
+<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/navigation.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/search_index.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/search.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/searcher.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/darkfish.js"></script>
+
+
+<body id="top" class="class">
+<nav id="metadata">
+  <nav id="home-section" class="section">
+  <h3 class="section-header">
+    <a href="../index.html">Home</a>
+    <a href="../table_of_contents.html#classes">Classes</a>
+    <a href="../table_of_contents.html#methods">Methods</a>
+  </h3>
+</nav>
+
+
+  <nav id="search-section" class="section project-section" class="initially-hidden">
+  <form action="#" method="get" accept-charset="utf-8">
+    <h3 class="section-header">
+      <input type="text" name="search" placeholder="Search" id="search-field"
+             title="Type to search, Up and Down to navigate, Enter to load">
+    </h3>
+  </form>
+
+  <ul id="search-results" class="initially-hidden"></ul>
+</nav>
+
+
+  <div id="file-metadata">
+    <nav id="file-list-section" class="section">
+  <h3 class="section-header">Defined In</h3>
+  <ul>
+    <li>lib/ruby-prof/profile.rb
+    <li>ext/ruby_prof/ruby_prof.c
+  </ul>
+</nav>
+
+    
+  </div>
+
+  <div id="class-metadata">
+    
+    <nav id="parent-class-section" class="section">
+  <h3 class="section-header">Parent</h3>
+  
+  <p class="link">Object
+  
+</nav>
+
+    
+    <!-- Method Quickref -->
+<nav id="method-list-section" class="section">
+  <h3 class="section-header">Methods</h3>
+
+  <ul class="link-list">
+    
+    <li><a href="#method-c-new">::new</a>
+    
+    <li><a href="#method-c-profile">::profile</a>
+    
+    <li><a href="#method-i-detect_recursion">#detect_recursion</a>
+    
+    <li><a href="#method-i-eliminate_methods-21">#eliminate_methods!</a>
+    
+    <li><a href="#method-i-pause">#pause</a>
+    
+    <li><a href="#method-i-paused-3F">#paused?</a>
+    
+    <li><a href="#method-i-post_process">#post_process</a>
+    
+    <li><a href="#method-i-resume">#resume</a>
+    
+    <li><a href="#method-i-running-3F">#running?</a>
+    
+    <li><a href="#method-i-start">#start</a>
+    
+    <li><a href="#method-i-stop">#stop</a>
+    
+    <li><a href="#method-i-threads">#threads</a>
+    
+  </ul>
+</nav>
+
+  </div>
+
+  <div id="project-metadata">
+    <nav id="fileindex-section" class="section project-section">
+  <h3 class="section-header">Pages</h3>
+
+  <ul>
+  
+    <li class="file"><a href="../LICENSE.html">LICENSE</a>
+  
+    <li class="file"><a href="../README_rdoc.html">README</a>
+  
+    <li class="file"><a href="../examples/flat_txt.html">flat</a>
+  
+    <li class="file"><a href="../examples/graph_txt.html">graph</a>
+  
+  </ul>
+</nav>
+
+    <nav id="classindex-section" class="section project-section">
+  <h3 class="section-header">Class and Module Index</h3>
+
+  <ul class="link-list">
+  
+    <li><a href="../RubyProf.html">RubyProf</a>
+  
+    <li><a href="../RubyProf/AbstractPrinter.html">RubyProf::AbstractPrinter</a>
+  
+    <li><a href="../RubyProf/AggregateCallInfo.html">RubyProf::AggregateCallInfo</a>
+  
+    <li><a href="../RubyProf/CallInfo.html">RubyProf::CallInfo</a>
+  
+    <li><a href="../RubyProf/CallInfoPrinter.html">RubyProf::CallInfoPrinter</a>
+  
+    <li><a href="../RubyProf/CallInfoVisitor.html">RubyProf::CallInfoVisitor</a>
+  
+    <li><a href="../RubyProf/CallStackPrinter.html">RubyProf::CallStackPrinter</a>
+  
+    <li><a href="../RubyProf/CallTreePrinter.html">RubyProf::CallTreePrinter</a>
+  
+    <li><a href="../RubyProf/Cmd.html">RubyProf::Cmd</a>
+  
+    <li><a href="../RubyProf/DotPrinter.html">RubyProf::DotPrinter</a>
+  
+    <li><a href="../RubyProf/FlatPrinter.html">RubyProf::FlatPrinter</a>
+  
+    <li><a href="../RubyProf/FlatPrinterWithLineNumbers.html">RubyProf::FlatPrinterWithLineNumbers</a>
+  
+    <li><a href="../RubyProf/GraphHtmlPrinter.html">RubyProf::GraphHtmlPrinter</a>
+  
+    <li><a href="../RubyProf/GraphPrinter.html">RubyProf::GraphPrinter</a>
+  
+    <li><a href="../RubyProf/MethodInfo.html">RubyProf::MethodInfo</a>
+  
+    <li><a href="../RubyProf/MultiPrinter.html">RubyProf::MultiPrinter</a>
+  
+    <li><a href="../RubyProf/Profile.html">RubyProf::Profile</a>
+  
+    <li><a href="../RubyProf/ProfileTask.html">RubyProf::ProfileTask</a>
+  
+    <li><a href="../RubyProf/Test.html">RubyProf::Test</a>
+  
+    <li><a href="../RubyProf/Thread.html">RubyProf::Thread</a>
+  
+    <li><a href="../Rack.html">Rack</a>
+  
+    <li><a href="../Rack/RubyProf.html">Rack::RubyProf</a>
+  
+  </ul>
+</nav>
+
+  </div>
+</nav>
+
+<div id="documentation">
+  <h1 class="class">class RubyProf::Profile</h1>
+
+  <div id="description" class="description">
+    
+  </div><!-- description -->
+
+  
+  
+  
+  <section id="5Buntitled-5D" class="documentation-section">
+    
+
+    
+
+    
+
+    
+
+    <!-- Methods -->
+    
+     <section id="public-class-5Buntitled-5D-method-details" class="method-section section">
+      <h3 class="section-header">Public Class Methods</h3>
+
+    
+      <div id="method-c-new" class="method-detail ">
+        
+        
+        <div class="method-heading">
+          <span class="method-callseq">
+            RubyProf::Profile.new(mode, exclude_threads) → instance
+          </span>
+          
+          <span class="method-click-advice">click to toggle source</span>
+          
+        </div>
+        
+        
+
+        <div class="method-description">
+          
+          <p>Returns a new profiler.</p>
+
+<h2 id="method-c-new-label-Parameters">Parameters</h2>
+<dl class="rdoc-list note-list"><dt>mode
+<dd>
+<p>Measure mode (optional). Specifies the profile measure mode.  If not
+specified, defaults to RubyProf::WALL_TIME.</p>
+</dd><dt>exclude_threads
+<dd>
+<p>Threads to exclude from the profiling results (optional).</p>
+</dd></dl>
+          
+
+          
+          <div class="method-source-code" id="new-source">
+            <pre>static VALUE
+prof_initialize(int argc,  VALUE *argv, VALUE self)
+{
+    prof_profile_t* profile = prof_get_profile(self);
+    VALUE mode;
+    prof_measure_mode_t measurer = MEASURE_WALL_TIME;
+    VALUE exclude_threads;
+    int i;
+    
+    switch (rb_scan_args(argc, argv, "02", &mode, &exclude_threads))
+    {
+      case 0:
+      {
+        measurer = MEASURE_WALL_TIME;
+        exclude_threads = rb_ary_new();
+        break;
+      }
+      case 1:
+      {
+        measurer = (prof_measure_mode_t)NUM2INT(mode);
+        exclude_threads = rb_ary_new();
+        break;
+      }
+      case 2:
+      {
+        Check_Type(exclude_threads, T_ARRAY);
+        measurer = (prof_measure_mode_t)NUM2INT(mode);
+        break;
+      }
+    }
+
+    profile->measurer = prof_get_measurer(measurer);
+
+    for (i = 0; i < RARRAY_LEN(exclude_threads); i++)
+    {
+        VALUE thread = rb_ary_entry(exclude_threads, i);
+        VALUE thread_id = rb_obj_id(thread);
+        st_insert(profile->exclude_threads_tbl, thread_id, Qtrue);
+    }
+
+    return self;
+}</pre>
+          </div><!-- new-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- new-method -->
+
+    
+      <div id="method-c-profile" class="method-detail ">
+        
+        
+        <div class="method-heading">
+          <span class="method-callseq">
+            profile {block} → RubyProf::Result
+          </span>
+          
+          <span class="method-click-advice">click to toggle source</span>
+          
+        </div>
+        
+        
+
+        <div class="method-description">
+          
+          <p>Profiles the specified block and returns a RubyProf::Result object.</p>
+          
+
+          
+          <div class="method-source-code" id="profile-source">
+            <pre>static VALUE
+prof_profile(int argc,  VALUE *argv, VALUE klass)
+{
+    int result;
+    VALUE profile = rb_class_new_instance(argc, argv, cProfile);
+
+    if (!rb_block_given_p())
+    {
+        rb_raise(rb_eArgError, "A block must be provided to the profile method.");
+    }
+
+    prof_start(profile);
+    rb_protect(rb_yield, profile, &result);
+    return prof_stop(profile);
+}</pre>
+          </div><!-- profile-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- profile-method -->
+
+    
+    </section><!-- public-class-method-details -->
+  
+     <section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
+      <h3 class="section-header">Public Instance Methods</h3>
+
+    
+      <div id="method-i-detect_recursion" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">detect_recursion</span><span
+            class="method-args">(thread)</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          <p>This method detect recursive calls in the call graph.</p>
+          
+
+          
+          <div class="method-source-code" id="detect_recursion-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/profile.rb, line 15</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">detect_recursion</span>(<span class="ruby-identifier">thread</span>)
+  <span class="ruby-identifier">visited_methods</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">hash</span>, <span class="ruby-identifier">key</span><span class="ruby-operator">|</span>
+    <span class="ruby-identifier">hash</span>[<span class="ruby-identifier">key</span>] = <span class="ruby-value">0</span>
+  <span class="ruby-keyword">end</span>
+
+  <span class="ruby-identifier">visitor</span> = <span class="ruby-constant">CallInfoVisitor</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">thread</span>)
+  <span class="ruby-identifier">visitor</span>.<span class="ruby-identifier">visit</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">call_info</span>, <span class="ruby-identifier">event</span><span class="ruby-operator">|</span>
+    <span class="ruby-keyword">case</span> <span class="ruby-identifier">event</span>
+    <span class="ruby-keyword">when</span> <span class="ruby-value">:enter</span>
+      <span class="ruby-identifier">visited_methods</span>[<span class="ruby-identifier">call_info</span>.<span class="ruby-identifier">target</span>] <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
+      <span class="ruby-identifier">call_info</span>.<span class="ruby-identifier">recursive</span> = (<span class="ruby-identifier">visited_methods</span>[<span class="ruby-identifier">call_info</span>.<span class="ruby-identifier">target</span>] <span class="ruby-operator">></span> <span class="ruby-value">1</span>)
+    <span class="ruby-keyword">when</span> <span class="ruby-value">:exit</span>
+      <span class="ruby-identifier">visited_methods</span>[<span class="ruby-identifier">call_info</span>.<span class="ruby-identifier">target</span>] <span class="ruby-operator">-=</span> <span class="ruby-value">1</span>
+      <span class="ruby-keyword">if</span> <span class="ruby-identifier">visited_methods</span>[<span class="ruby-identifier">call_info</span>.<span class="ruby-identifier">target</span>] <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
+        <span class="ruby-identifier">visited_methods</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">call_info</span>.<span class="ruby-identifier">target</span>)
+      <span class="ruby-keyword">end</span>
+    <span class="ruby-keyword">end</span>
+  <span class="ruby-keyword">end</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- detect_recursion-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- detect_recursion-method -->
+
+    
+      <div id="method-i-eliminate_methods-21" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">eliminate_methods!</span><span
+            class="method-args">(matchers)</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          <p>eliminate some calls from the graph by merging the information into
+callers. matchers can be a list of strings or regular expressions or the
+name of a file containing regexps.</p>
+          
+
+          
+          <div class="method-source-code" id="eliminate_methods-21-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/profile.rb, line 37</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">eliminate_methods!</span>(<span class="ruby-identifier">matchers</span>)
+  <span class="ruby-identifier">matchers</span> = <span class="ruby-identifier">read_regexps_from_file</span>(<span class="ruby-identifier">matchers</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">matchers</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">String</span>)
+  <span class="ruby-identifier">eliminated</span> = []
+  <span class="ruby-identifier">threads</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">thread</span><span class="ruby-operator">|</span>
+    <span class="ruby-identifier">matchers</span>.<span class="ruby-identifier">each</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">matcher</span><span class="ruby-operator">|</span> <span class="ruby-identifier">eliminated</span>.<span class="ruby-identifier">concat</span>(<span class="ruby-identifier">eliminate_methods</span>(<span class="ruby-identifier">thread</span>.<span class="ruby-identifier">methods</span>, <span class="ruby-identifier">matcher</span>)) }
+  <span class="ruby-keyword">end</span>
+  <span class="ruby-identifier">eliminated</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- eliminate_methods-21-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- eliminate_methods-21-method -->
+
+    
+      <div id="method-i-pause" class="method-detail ">
+        
+        
+        <div class="method-heading">
+          <span class="method-callseq">
+            pause → RubyProf
+          </span>
+          
+          <span class="method-click-advice">click to toggle source</span>
+          
+        </div>
+        
+        
+
+        <div class="method-description">
+          
+          <p>Pauses collecting profile data.</p>
+          
+
+          
+          <div class="method-source-code" id="pause-source">
+            <pre>static VALUE
+prof_pause(VALUE self)
+{
+    prof_profile_t* profile = prof_get_profile(self);
+    if (profile->running == Qfalse)
+    {
+        rb_raise(rb_eRuntimeError, "RubyProf is not running.");
+    }
+
+    if (profile->paused == Qfalse)
+    {
+        profile->paused = Qtrue;
+        profile->measurement_at_pause_resume = profile->measurer->measure();
+        st_foreach(profile->threads_tbl, pause_thread, (st_data_t) profile);
+    }
+
+    return self;
+}</pre>
+          </div><!-- pause-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- pause-method -->
+
+    
+      <div id="method-i-paused-3F" class="method-detail ">
+        
+        
+        <div class="method-heading">
+          <span class="method-callseq">
+            paused? → boolean
+          </span>
+          
+          <span class="method-click-advice">click to toggle source</span>
+          
+        </div>
+        
+        
+
+        <div class="method-description">
+          
+          <p>Returns whether a profile is currently paused.</p>
+          
+
+          
+          <div class="method-source-code" id="paused-3F-source">
+            <pre>static VALUE
+prof_paused(VALUE self)
+{
+    prof_profile_t* profile = prof_get_profile(self);
+    return profile->paused;
+}</pre>
+          </div><!-- paused-3F-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- paused-3F-method -->
+
+    
+      <div id="method-i-post_process" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">post_process</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          <p>This method gets called once profiling has been completed but before
+results are returned to the user.  Thus it provides a hook to do any
+necessary post-processing on the call graph.</p>
+          
+
+          
+          <div class="method-source-code" id="post_process-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/profile.rb, line 8</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">post_process</span>
+  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">threads</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">thread</span><span class="ruby-operator">|</span>
+    <span class="ruby-identifier">detect_recursion</span>(<span class="ruby-identifier">thread</span>)
+  <span class="ruby-keyword">end</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- post_process-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- post_process-method -->
+
+    
+      <div id="method-i-resume" class="method-detail ">
+        
+        
+        <div class="method-heading">
+          <span class="method-callseq">
+            resume {block} → RubyProf
+          </span>
+          
+          <span class="method-click-advice">click to toggle source</span>
+          
+        </div>
+        
+        
+
+        <div class="method-description">
+          
+          <p>Resumes recording profile data.</p>
+          
+
+          
+          <div class="method-source-code" id="resume-source">
+            <pre>static VALUE
+prof_resume(VALUE self)
+{
+    prof_profile_t* profile = prof_get_profile(self);
+    if (profile->running == Qfalse)
+    {
+        rb_raise(rb_eRuntimeError, "RubyProf is not running.");
+    }
+
+    if (profile->paused == Qtrue)
+    {
+        profile->paused = Qfalse;
+        profile->measurement_at_pause_resume = profile->measurer->measure();
+        st_foreach(profile->threads_tbl, unpause_thread, (st_data_t) profile);
+    }
+
+    return rb_block_given_p() ? rb_ensure(rb_yield, self, prof_pause, self) : self;
+}</pre>
+          </div><!-- resume-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- resume-method -->
+
+    
+      <div id="method-i-running-3F" class="method-detail ">
+        
+        
+        <div class="method-heading">
+          <span class="method-callseq">
+            running? → boolean
+          </span>
+          
+          <span class="method-click-advice">click to toggle source</span>
+          
+        </div>
+        
+        
+
+        <div class="method-description">
+          
+          <p>Returns whether a profile is currently running.</p>
+          
+
+          
+          <div class="method-source-code" id="running-3F-source">
+            <pre>static VALUE
+prof_running(VALUE self)
+{
+    prof_profile_t* profile = prof_get_profile(self);
+    return profile->running;
+}</pre>
+          </div><!-- running-3F-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- running-3F-method -->
+
+    
+      <div id="method-i-start" class="method-detail ">
+        
+        
+        <div class="method-heading">
+          <span class="method-callseq">
+            start → RubyProf
+          </span>
+          
+          <span class="method-click-advice">click to toggle source</span>
+          
+        </div>
+        
+        
+
+        <div class="method-description">
+          
+          <p>Starts recording profile data.</p>
+          
+
+          
+          <div class="method-source-code" id="start-source">
+            <pre>static VALUE
+prof_start(VALUE self)
+{
+    char* trace_file_name;
+
+    prof_profile_t* profile = prof_get_profile(self);
+        
+    if (profile->running == Qtrue)
+    {
+        rb_raise(rb_eRuntimeError, "RubyProf.start was already called");
+    }
+
+#ifndef RUBY_VM
+        if (pCurrentProfile != NULL)
+    {
+        rb_raise(rb_eRuntimeError, "Only one profile can run at a time on Ruby 1.8.*");
+    }
+#endif
+
+    profile->running = Qtrue;
+    profile->paused = Qfalse;
+    profile->last_thread_data = NULL;
+
+
+    /* open trace file if environment wants it */
+    trace_file_name = getenv("RUBY_PROF_TRACE");
+    if (trace_file_name != NULL) 
+    {
+      if (strcmp(trace_file_name, "stdout") == 0) 
+      {
+        trace_file = stdout;
+      } 
+      else if (strcmp(trace_file_name, "stderr") == 0)
+      {
+        trace_file = stderr;
+      }
+      else 
+      {
+        trace_file = fopen(trace_file_name, "w");
+      }
+    }
+
+    prof_install_hook(self);
+    return self;
+}</pre>
+          </div><!-- start-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- start-method -->
+
+    
+      <div id="method-i-stop" class="method-detail ">
+        
+        
+        <div class="method-heading">
+          <span class="method-callseq">
+            stop → self
+          </span>
+          
+          <span class="method-click-advice">click to toggle source</span>
+          
+        </div>
+        
+        
+
+        <div class="method-description">
+          
+          <p>Stops collecting profile data.</p>
+          
+
+          
+          <div class="method-source-code" id="stop-source">
+            <pre>static VALUE
+prof_stop(VALUE self)
+{
+    prof_profile_t* profile = prof_get_profile(self);
+
+    if (profile->running == Qfalse)
+    {
+        rb_raise(rb_eRuntimeError, "RubyProf.start was not yet called");
+    }
+  
+    prof_remove_hook();
+
+    /* close trace file if open */
+    if (trace_file != NULL) 
+    {
+      if (trace_file !=stderr && trace_file != stdout)
+      {
+#ifdef _MSC_VER
+          _fcloseall();
+#else
+        fclose(trace_file);
+#endif
+      }
+      trace_file = NULL;
+    }
+    
+    prof_pop_threads(profile);
+
+    /* Unset the last_thread_data (very important!)
+       and the threads table */
+    profile->running = profile->paused = Qfalse;
+    profile->last_thread_data = NULL;
+
+    /* Post process result */
+    rb_funcall(self, rb_intern("post_process") , 0);
+
+    return self;
+}</pre>
+          </div><!-- stop-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- stop-method -->
+
+    
+      <div id="method-i-threads" class="method-detail ">
+        
+        
+        <div class="method-heading">
+          <span class="method-callseq">
+            threads → Array of RubyProf::Thread
+          </span>
+          
+          <span class="method-click-advice">click to toggle source</span>
+          
+        </div>
+        
+        
+
+        <div class="method-description">
+          
+          <p>Returns an array of <a href="Thread.html">RubyProf::Thread</a> instances
+that were executed while the the program was being run.</p>
+          
+
+          
+          <div class="method-source-code" id="threads-source">
+            <pre>static VALUE
+prof_threads(VALUE self)
+{
+        VALUE result = rb_ary_new();
+    prof_profile_t* profile = prof_get_profile(self);
+    st_foreach(profile->threads_tbl, collect_threads, result);
+    return result;
+}</pre>
+          </div><!-- threads-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- threads-method -->
+
+    
+    </section><!-- public-instance-method-details -->
+  
+  </section><!-- 5Buntitled-5D -->
+
+</div><!-- documentation -->
+
+
+<footer id="validator-badges">
+  <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
+  <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.1.
+  <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
+</footer>
+
diff --git a/doc/RubyProf/ProfileTask.html b/doc/RubyProf/ProfileTask.html
new file mode 100644
index 0000000..3952057
--- /dev/null
+++ b/doc/RubyProf/ProfileTask.html
@@ -0,0 +1,532 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+
+<title>class RubyProf::ProfileTask - ruby-prof</title>
+
+<link type="text/css" media="screen" href="../rdoc.css" rel="stylesheet">
+
+<script type="text/javascript">
+  var rdoc_rel_prefix = "../";
+</script>
+
+<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/navigation.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/search_index.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/search.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/searcher.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/darkfish.js"></script>
+
+
+<body id="top" class="class">
+<nav id="metadata">
+  <nav id="home-section" class="section">
+  <h3 class="section-header">
+    <a href="../index.html">Home</a>
+    <a href="../table_of_contents.html#classes">Classes</a>
+    <a href="../table_of_contents.html#methods">Methods</a>
+  </h3>
+</nav>
+
+
+  <nav id="search-section" class="section project-section" class="initially-hidden">
+  <form action="#" method="get" accept-charset="utf-8">
+    <h3 class="section-header">
+      <input type="text" name="search" placeholder="Search" id="search-field"
+             title="Type to search, Up and Down to navigate, Enter to load">
+    </h3>
+  </form>
+
+  <ul id="search-results" class="initially-hidden"></ul>
+</nav>
+
+
+  <div id="file-metadata">
+    <nav id="file-list-section" class="section">
+  <h3 class="section-header">Defined In</h3>
+  <ul>
+    <li>lib/ruby-prof/task.rb
+  </ul>
+</nav>
+
+    
+  </div>
+
+  <div id="class-metadata">
+    
+    <nav id="parent-class-section" class="section">
+  <h3 class="section-header">Parent</h3>
+  
+  <p class="link">Rake::TestTask
+  
+</nav>
+
+    
+    <!-- Method Quickref -->
+<nav id="method-list-section" class="section">
+  <h3 class="section-header">Methods</h3>
+
+  <ul class="link-list">
+    
+    <li><a href="#method-c-new">::new</a>
+    
+    <li><a href="#method-i-clean_output_directory">#clean_output_directory</a>
+    
+    <li><a href="#method-i-create_output_directory">#create_output_directory</a>
+    
+    <li><a href="#method-i-define">#define</a>
+    
+    <li><a href="#method-i-output_directory">#output_directory</a>
+    
+    <li><a href="#method-i-run_script">#run_script</a>
+    
+  </ul>
+</nav>
+
+  </div>
+
+  <div id="project-metadata">
+    <nav id="fileindex-section" class="section project-section">
+  <h3 class="section-header">Pages</h3>
+
+  <ul>
+  
+    <li class="file"><a href="../LICENSE.html">LICENSE</a>
+  
+    <li class="file"><a href="../README_rdoc.html">README</a>
+  
+    <li class="file"><a href="../examples/flat_txt.html">flat</a>
+  
+    <li class="file"><a href="../examples/graph_txt.html">graph</a>
+  
+  </ul>
+</nav>
+
+    <nav id="classindex-section" class="section project-section">
+  <h3 class="section-header">Class and Module Index</h3>
+
+  <ul class="link-list">
+  
+    <li><a href="../RubyProf.html">RubyProf</a>
+  
+    <li><a href="../RubyProf/AbstractPrinter.html">RubyProf::AbstractPrinter</a>
+  
+    <li><a href="../RubyProf/AggregateCallInfo.html">RubyProf::AggregateCallInfo</a>
+  
+    <li><a href="../RubyProf/CallInfo.html">RubyProf::CallInfo</a>
+  
+    <li><a href="../RubyProf/CallInfoPrinter.html">RubyProf::CallInfoPrinter</a>
+  
+    <li><a href="../RubyProf/CallInfoVisitor.html">RubyProf::CallInfoVisitor</a>
+  
+    <li><a href="../RubyProf/CallStackPrinter.html">RubyProf::CallStackPrinter</a>
+  
+    <li><a href="../RubyProf/CallTreePrinter.html">RubyProf::CallTreePrinter</a>
+  
+    <li><a href="../RubyProf/Cmd.html">RubyProf::Cmd</a>
+  
+    <li><a href="../RubyProf/DotPrinter.html">RubyProf::DotPrinter</a>
+  
+    <li><a href="../RubyProf/FlatPrinter.html">RubyProf::FlatPrinter</a>
+  
+    <li><a href="../RubyProf/FlatPrinterWithLineNumbers.html">RubyProf::FlatPrinterWithLineNumbers</a>
+  
+    <li><a href="../RubyProf/GraphHtmlPrinter.html">RubyProf::GraphHtmlPrinter</a>
+  
+    <li><a href="../RubyProf/GraphPrinter.html">RubyProf::GraphPrinter</a>
+  
+    <li><a href="../RubyProf/MethodInfo.html">RubyProf::MethodInfo</a>
+  
+    <li><a href="../RubyProf/MultiPrinter.html">RubyProf::MultiPrinter</a>
+  
+    <li><a href="../RubyProf/Profile.html">RubyProf::Profile</a>
+  
+    <li><a href="../RubyProf/ProfileTask.html">RubyProf::ProfileTask</a>
+  
+    <li><a href="../RubyProf/Test.html">RubyProf::Test</a>
+  
+    <li><a href="../RubyProf/Thread.html">RubyProf::Thread</a>
+  
+    <li><a href="../Rack.html">Rack</a>
+  
+    <li><a href="../Rack/RubyProf.html">Rack::RubyProf</a>
+  
+  </ul>
+</nav>
+
+  </div>
+</nav>
+
+<div id="documentation">
+  <h1 class="class">class RubyProf::ProfileTask</h1>
+
+  <div id="description" class="description">
+    
+<p>Define a task library for profiling unit tests with ruby-prof.</p>
+
+<p>All of the options provided by the Rake:TestTask are supported except the
+loader which is set to ruby-prof.  For detailed information please refer to
+the Rake:TestTask documentation.</p>
+
+<p>ruby-prof specific options include:</p>
+
+<pre>output_dir - For each file specified an output
+             file with profile information will be
+             written to the output directory.
+             By default, the output directory is
+             called "profile" and is created underneath
+             the current working directory.
+
+printer - Specifies the output printer.  Valid values include
+          :flat, :graph, :graph_html and :call_tree.
+
+min_percent - Methods that take less than the specified percent
+              will not be written out.</pre>
+
+<p>Example:</p>
+
+<pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">'ruby-prof/task'</span>
+
+<span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">ProfileTask</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">t</span><span class="ruby-operator">|</span>
+  <span class="ruby-identifier">t</span>.<span class="ruby-identifier">test_files</span> = <span class="ruby-constant">FileList</span>[<span class="ruby-string">'test/test*.rb'</span>]
+  <span class="ruby-identifier">t</span>.<span class="ruby-identifier">output_dir</span> = <span class="ruby-string">"c:/temp"</span>
+  <span class="ruby-identifier">t</span>.<span class="ruby-identifier">printer</span> = :<span class="ruby-identifier">graph</span>
+  <span class="ruby-identifier">t</span>.<span class="ruby-identifier">min_percent</span> = <span class="ruby-value">10</span>
+<span class="ruby-keyword">end</span>
+</pre>
+
+<p>If rake is invoked with a “TEST=filename” command line option, then the
+list of test files will be overridden to include only the filename
+specified on the command line.  This provides an easy way to run just one
+test.</p>
+
+<p>If rake is invoked with a “TESTOPTS=options” command line option, then the
+given options are passed to the test process after a '–'.  This
+allows Test::Unit options to be passed to the test suite.</p>
+
+<p>Examples:</p>
+
+<pre>rake profile                           # run tests normally
+rake profile TEST=just_one_file.rb     # run just one test file.
+rake profile TESTOPTS="-v"             # run in verbose mode
+rake profile TESTOPTS="--runner=fox"   # use the fox test runner</pre>
+
+  </div><!-- description -->
+
+  
+  
+  
+  <section id="5Buntitled-5D" class="documentation-section">
+    
+
+    
+
+    
+
+    
+    <!-- Attributes -->
+    <section id="attribute-method-details" class="method-section section">
+      <h3 class="section-header">Attributes</h3>
+
+      
+      <div id="attribute-i-min_percent" class="method-detail">
+        <div class="method-heading attribute-method-heading">
+          <span class="method-name">min_percent</span><span
+            class="attribute-access-type">[RW]</span>
+        </div>
+
+        <div class="method-description">
+        
+        
+        
+        </div>
+      </div>
+      
+      <div id="attribute-i-output_dir" class="method-detail">
+        <div class="method-heading attribute-method-heading">
+          <span class="method-name">output_dir</span><span
+            class="attribute-access-type">[RW]</span>
+        </div>
+
+        <div class="method-description">
+        
+        
+        
+        </div>
+      </div>
+      
+      <div id="attribute-i-printer" class="method-detail">
+        <div class="method-heading attribute-method-heading">
+          <span class="method-name">printer</span><span
+            class="attribute-access-type">[RW]</span>
+        </div>
+
+        <div class="method-description">
+        
+        
+        
+        </div>
+      </div>
+      
+    </section><!-- attribute-method-details -->
+    
+
+    <!-- Methods -->
+    
+     <section id="public-class-5Buntitled-5D-method-details" class="method-section section">
+      <h3 class="section-header">Public Class Methods</h3>
+
+    
+      <div id="method-c-new" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">new</span><span
+            class="method-args">(name = :profile)</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="new-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/task.rb, line 63</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">name</span> = <span class="ruby-value">:profile</span>)
+  <span class="ruby-keyword">super</span>(<span class="ruby-identifier">name</span>)
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- new-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- new-method -->
+
+    
+    </section><!-- public-class-method-details -->
+  
+     <section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
+      <h3 class="section-header">Public Instance Methods</h3>
+
+    
+      <div id="method-i-clean_output_directory" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">clean_output_directory</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="clean_output_directory-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/task.rb, line 134</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">clean_output_directory</span>
+  <span class="ruby-keyword">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-identifier">output_directory</span>)
+    <span class="ruby-identifier">files</span> = <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">glob</span>(<span class="ruby-identifier">output_directory</span> <span class="ruby-operator">+</span> <span class="ruby-string">'/*'</span>)
+    <span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">rm</span>(<span class="ruby-identifier">files</span>)
+  <span class="ruby-keyword">end</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- clean_output_directory-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- clean_output_directory-method -->
+
+    
+      <div id="method-i-create_output_directory" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">create_output_directory</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="create_output_directory-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/task.rb, line 128</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">create_output_directory</span>
+  <span class="ruby-keyword">if</span> <span class="ruby-keyword">not</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-identifier">output_directory</span>)
+    <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">mkdir</span>(<span class="ruby-identifier">output_directory</span>)
+  <span class="ruby-keyword">end</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- create_output_directory-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- create_output_directory-method -->
+
+    
+      <div id="method-i-define" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">define</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          <p>Create the tasks defined by this task lib.</p>
+          
+
+          
+          <div class="method-source-code" id="define-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/task.rb, line 68</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">define</span>
+  <span class="ruby-identifier">lib_path</span> = <span class="ruby-ivar">@libs</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">File</span><span class="ruby-operator">::</span><span class="ruby-constant">PATH_SEPARATOR</span>)
+  <span class="ruby-identifier">desc</span> <span class="ruby-string">"Profile"</span> <span class="ruby-operator">+</span> (<span class="ruby-ivar">@name</span><span class="ruby-operator">==</span><span class="ruby-value">:profile</span> <span class="ruby-operator">?</span> <span class="ruby-string">""</span> <span class="ruby-operator">:</span> <span class="ruby-node">" for #{@name}"</span>)
+
+  <span class="ruby-identifier">task</span> <span class="ruby-ivar">@name</span> <span class="ruby-keyword">do</span>
+    <span class="ruby-identifier">create_output_directory</span>
+
+    <span class="ruby-ivar">@ruby_opts</span>.<span class="ruby-identifier">unshift</span>( <span class="ruby-node">"-I#{lib_path}"</span> )
+    <span class="ruby-ivar">@ruby_opts</span>.<span class="ruby-identifier">unshift</span>( <span class="ruby-string">"-w"</span> ) <span class="ruby-keyword">if</span> <span class="ruby-ivar">@warning</span>
+    <span class="ruby-ivar">@ruby_opts</span>.<span class="ruby-identifier">push</span>(<span class="ruby-string">"-S ruby-prof"</span>)
+    <span class="ruby-ivar">@ruby_opts</span>.<span class="ruby-identifier">push</span>(<span class="ruby-node">"--printer #{@printer}"</span>)
+    <span class="ruby-ivar">@ruby_opts</span>.<span class="ruby-identifier">push</span>(<span class="ruby-node">"--min_percent #{@min_percent}"</span>)
+
+    <span class="ruby-identifier">file_list</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">file_path</span><span class="ruby-operator">|</span>
+      <span class="ruby-identifier">run_script</span>(<span class="ruby-identifier">file_path</span>)
+    <span class="ruby-keyword">end</span>
+  <span class="ruby-keyword">end</span>
+  <span class="ruby-keyword">self</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- define-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- define-method -->
+
+    
+      <div id="method-i-output_directory" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">output_directory</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="output_directory-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/task.rb, line 124</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">output_directory</span>
+  <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-ivar">@output_dir</span>)
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- output_directory-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- output_directory-method -->
+
+    
+      <div id="method-i-run_script" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">run_script</span><span
+            class="method-args">(script_path)</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          <p>Run script</p>
+          
+
+          
+          <div class="method-source-code" id="run_script-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/task.rb, line 89</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">run_script</span>(<span class="ruby-identifier">script_path</span>)
+  <span class="ruby-identifier">run_code</span> = <span class="ruby-string">''</span>
+  <span class="ruby-constant">RakeFileUtils</span>.<span class="ruby-identifier">verbose</span>(<span class="ruby-ivar">@verbose</span>) <span class="ruby-keyword">do</span>
+    <span class="ruby-identifier">file_name</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">basename</span>(<span class="ruby-identifier">script_path</span>, <span class="ruby-constant">File</span>.<span class="ruby-identifier">extname</span>(<span class="ruby-identifier">script_path</span>))
+    <span class="ruby-keyword">case</span> <span class="ruby-ivar">@printer</span>
+      <span class="ruby-keyword">when</span> <span class="ruby-value">:flat</span>, <span class="ruby-value">:graph</span>, <span class="ruby-value">:call_tree</span>
+        <span class="ruby-identifier">file_name</span> <span class="ruby-operator">+=</span> <span class="ruby-string">".txt"</span>
+      <span class="ruby-keyword">when</span> <span class="ruby-value">:graph_html</span>
+        <span class="ruby-identifier">file_name</span> <span class="ruby-operator">+=</span> <span class="ruby-string">".html"</span>
+      <span class="ruby-keyword">else</span>
+        <span class="ruby-identifier">file_name</span> <span class="ruby-operator">+=</span> <span class="ruby-string">".txt"</span>
+    <span class="ruby-keyword">end</span>
+
+    <span class="ruby-identifier">output_file_path</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">output_directory</span>, <span class="ruby-identifier">file_name</span>)
+
+    <span class="ruby-identifier">command_line</span> = <span class="ruby-ivar">@ruby_opts</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">" "</span>) <span class="ruby-operator">+</span>
+                  <span class="ruby-string">" --file="</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">output_file_path</span> <span class="ruby-operator">+</span>
+                  <span class="ruby-string">" "</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">script_path</span>
+
+    <span class="ruby-identifier">puts</span> <span class="ruby-string">"ruby "</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">command_line</span>
+    <span class="ruby-comment"># We have to catch the exeption to continue on.  However,</span>
+    <span class="ruby-comment"># the error message will have been output to STDERR</span>
+    <span class="ruby-comment"># already by the time we get here so we don't have to</span>
+    <span class="ruby-comment"># do that again</span>
+    <span class="ruby-keyword">begin</span>
+      <span class="ruby-identifier">ruby</span> <span class="ruby-identifier">command_line</span>
+    <span class="ruby-keyword">rescue</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
+      <span class="ruby-constant">STDOUT</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">e</span> <span class="ruby-operator"><<</span> <span class="ruby-string">"\n"</span>
+      <span class="ruby-constant">STDOUT</span>.<span class="ruby-identifier">flush</span>
+    <span class="ruby-keyword">end</span>
+    <span class="ruby-identifier">puts</span> <span class="ruby-string">""</span>
+    <span class="ruby-identifier">puts</span> <span class="ruby-string">""</span>
+  <span class="ruby-keyword">end</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- run_script-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- run_script-method -->
+
+    
+    </section><!-- public-instance-method-details -->
+  
+  </section><!-- 5Buntitled-5D -->
+
+</div><!-- documentation -->
+
+
+<footer id="validator-badges">
+  <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
+  <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.1.
+  <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
+</footer>
+
diff --git a/doc/RubyProf/Test.html b/doc/RubyProf/Test.html
new file mode 100644
index 0000000..fa32251
--- /dev/null
+++ b/doc/RubyProf/Test.html
@@ -0,0 +1,578 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+
+<title>module RubyProf::Test - ruby-prof</title>
+
+<link type="text/css" media="screen" href="../rdoc.css" rel="stylesheet">
+
+<script type="text/javascript">
+  var rdoc_rel_prefix = "../";
+</script>
+
+<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/navigation.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/search_index.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/search.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/searcher.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/darkfish.js"></script>
+
+
+<body id="top" class="module">
+<nav id="metadata">
+  <nav id="home-section" class="section">
+  <h3 class="section-header">
+    <a href="../index.html">Home</a>
+    <a href="../table_of_contents.html#classes">Classes</a>
+    <a href="../table_of_contents.html#methods">Methods</a>
+  </h3>
+</nav>
+
+
+  <nav id="search-section" class="section project-section" class="initially-hidden">
+  <form action="#" method="get" accept-charset="utf-8">
+    <h3 class="section-header">
+      <input type="text" name="search" placeholder="Search" id="search-field"
+             title="Type to search, Up and Down to navigate, Enter to load">
+    </h3>
+  </form>
+
+  <ul id="search-results" class="initially-hidden"></ul>
+</nav>
+
+
+  <div id="file-metadata">
+    <nav id="file-list-section" class="section">
+  <h3 class="section-header">Defined In</h3>
+  <ul>
+    <li>lib/ruby-prof/test.rb
+  </ul>
+</nav>
+
+    
+  </div>
+
+  <div id="class-metadata">
+    
+    
+    
+    <!-- Method Quickref -->
+<nav id="method-list-section" class="section">
+  <h3 class="section-header">Methods</h3>
+
+  <ul class="link-list">
+    
+    <li><a href="#method-i-format_profile_total">#format_profile_total</a>
+    
+    <li><a href="#method-i-measure_mode_name">#measure_mode_name</a>
+    
+    <li><a href="#method-i-output_dir">#output_dir</a>
+    
+    <li><a href="#method-i-report_filename">#report_filename</a>
+    
+    <li><a href="#method-i-report_profile">#report_profile</a>
+    
+    <li><a href="#method-i-run">#run</a>
+    
+    <li><a href="#method-i-run_profile">#run_profile</a>
+    
+    <li><a href="#method-i-run_test">#run_test</a>
+    
+    <li><a href="#method-i-run_warmup">#run_warmup</a>
+    
+  </ul>
+</nav>
+
+  </div>
+
+  <div id="project-metadata">
+    <nav id="fileindex-section" class="section project-section">
+  <h3 class="section-header">Pages</h3>
+
+  <ul>
+  
+    <li class="file"><a href="../LICENSE.html">LICENSE</a>
+  
+    <li class="file"><a href="../README_rdoc.html">README</a>
+  
+    <li class="file"><a href="../examples/flat_txt.html">flat</a>
+  
+    <li class="file"><a href="../examples/graph_txt.html">graph</a>
+  
+  </ul>
+</nav>
+
+    <nav id="classindex-section" class="section project-section">
+  <h3 class="section-header">Class and Module Index</h3>
+
+  <ul class="link-list">
+  
+    <li><a href="../RubyProf.html">RubyProf</a>
+  
+    <li><a href="../RubyProf/AbstractPrinter.html">RubyProf::AbstractPrinter</a>
+  
+    <li><a href="../RubyProf/AggregateCallInfo.html">RubyProf::AggregateCallInfo</a>
+  
+    <li><a href="../RubyProf/CallInfo.html">RubyProf::CallInfo</a>
+  
+    <li><a href="../RubyProf/CallInfoPrinter.html">RubyProf::CallInfoPrinter</a>
+  
+    <li><a href="../RubyProf/CallInfoVisitor.html">RubyProf::CallInfoVisitor</a>
+  
+    <li><a href="../RubyProf/CallStackPrinter.html">RubyProf::CallStackPrinter</a>
+  
+    <li><a href="../RubyProf/CallTreePrinter.html">RubyProf::CallTreePrinter</a>
+  
+    <li><a href="../RubyProf/Cmd.html">RubyProf::Cmd</a>
+  
+    <li><a href="../RubyProf/DotPrinter.html">RubyProf::DotPrinter</a>
+  
+    <li><a href="../RubyProf/FlatPrinter.html">RubyProf::FlatPrinter</a>
+  
+    <li><a href="../RubyProf/FlatPrinterWithLineNumbers.html">RubyProf::FlatPrinterWithLineNumbers</a>
+  
+    <li><a href="../RubyProf/GraphHtmlPrinter.html">RubyProf::GraphHtmlPrinter</a>
+  
+    <li><a href="../RubyProf/GraphPrinter.html">RubyProf::GraphPrinter</a>
+  
+    <li><a href="../RubyProf/MethodInfo.html">RubyProf::MethodInfo</a>
+  
+    <li><a href="../RubyProf/MultiPrinter.html">RubyProf::MultiPrinter</a>
+  
+    <li><a href="../RubyProf/Profile.html">RubyProf::Profile</a>
+  
+    <li><a href="../RubyProf/ProfileTask.html">RubyProf::ProfileTask</a>
+  
+    <li><a href="../RubyProf/Test.html">RubyProf::Test</a>
+  
+    <li><a href="../RubyProf/Thread.html">RubyProf::Thread</a>
+  
+    <li><a href="../Rack.html">Rack</a>
+  
+    <li><a href="../Rack/RubyProf.html">Rack::RubyProf</a>
+  
+  </ul>
+</nav>
+
+  </div>
+</nav>
+
+<div id="documentation">
+  <h1 class="module">module RubyProf::Test</h1>
+
+  <div id="description" class="description">
+    
+  </div><!-- description -->
+
+  
+  
+  
+  <section id="5Buntitled-5D" class="documentation-section">
+    
+
+    
+
+    
+    <!-- Constants -->
+    <section id="constants-list" class="section">
+      <h3 class="section-header">Constants</h3>
+      <dl>
+      
+        <dt id="PROFILE_OPTIONS">PROFILE_OPTIONS
+        
+        <dd class="description">
+        
+      
+      </dl>
+    </section>
+    
+
+    
+
+    <!-- Methods -->
+    
+     <section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
+      <h3 class="section-header">Public Instance Methods</h3>
+
+    
+      <div id="method-i-format_profile_total" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">format_profile_total</span><span
+            class="method-args">(total, measure_mode)</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="format_profile_total-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/test.rb, line 96</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">format_profile_total</span>(<span class="ruby-identifier">total</span>, <span class="ruby-identifier">measure_mode</span>)
+  <span class="ruby-keyword">case</span> <span class="ruby-identifier">measure_mode</span>
+    <span class="ruby-keyword">when</span> <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">PROCESS_TIME</span>, <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">WALL_TIME</span>
+      <span class="ruby-string">"%.2f seconds"</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">total</span>
+    <span class="ruby-keyword">when</span> <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">MEMORY</span>
+      <span class="ruby-string">"%.2f kilobytes"</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">total</span>
+    <span class="ruby-keyword">when</span> <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">ALLOCATIONS</span>
+      <span class="ruby-string">"%d allocations"</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">total</span>
+    <span class="ruby-keyword">else</span>
+      <span class="ruby-node">"%.2f #{measure_mode}"</span>
+  <span class="ruby-keyword">end</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- format_profile_total-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- format_profile_total-method -->
+
+    
+      <div id="method-i-measure_mode_name" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">measure_mode_name</span><span
+            class="method-args">(measure_mode)</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="measure_mode_name-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/test.rb, line 139</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">measure_mode_name</span>(<span class="ruby-identifier">measure_mode</span>)
+  <span class="ruby-keyword">case</span> <span class="ruby-identifier">measure_mode</span>
+    <span class="ruby-keyword">when</span> <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">PROCESS_TIME</span>; <span class="ruby-string">'process_time'</span>
+    <span class="ruby-keyword">when</span> <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">WALL_TIME</span>; <span class="ruby-string">'wall_time'</span>
+    <span class="ruby-keyword">when</span> <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">MEMORY</span>; <span class="ruby-string">'memory'</span>
+    <span class="ruby-keyword">when</span> <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">ALLOCATIONS</span>; <span class="ruby-string">'allocations'</span>
+    <span class="ruby-keyword">else</span> <span class="ruby-node">"measure#{measure_mode}"</span>
+  <span class="ruby-keyword">end</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- measure_mode_name-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- measure_mode_name-method -->
+
+    
+      <div id="method-i-output_dir" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">output_dir</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="output_dir-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/test.rb, line 16</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">output_dir</span>
+  <span class="ruby-constant">PROFILE_OPTIONS</span>[<span class="ruby-value">:output_dir</span>]
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- output_dir-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- output_dir-method -->
+
+    
+      <div id="method-i-report_filename" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">report_filename</span><span
+            class="method-args">(printer, measure_mode)</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          <p>The report filename is test_name + measure_mode + report_type</p>
+          
+
+          
+          <div class="method-source-code" id="report_filename-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/test.rb, line 126</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">report_filename</span>(<span class="ruby-identifier">printer</span>, <span class="ruby-identifier">measure_mode</span>)
+  <span class="ruby-identifier">suffix</span> =
+    <span class="ruby-keyword">case</span> <span class="ruby-identifier">printer</span>
+      <span class="ruby-keyword">when</span> <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">FlatPrinter</span>; <span class="ruby-string">'flat.txt'</span>
+      <span class="ruby-keyword">when</span> <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">GraphPrinter</span>; <span class="ruby-string">'graph.txt'</span>
+      <span class="ruby-keyword">when</span> <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">GraphHtmlPrinter</span>; <span class="ruby-string">'graph.html'</span>
+      <span class="ruby-keyword">when</span> <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">CallTreePrinter</span>; <span class="ruby-string">'tree.txt'</span>
+      <span class="ruby-keyword">else</span> <span class="ruby-identifier">printer</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">downcase</span>
+    <span class="ruby-keyword">end</span>
+
+  <span class="ruby-node">"#{output_dir}/#{method_name}_#{measure_mode_name(measure_mode)}_#{suffix}"</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- report_filename-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- report_filename-method -->
+
+    
+      <div id="method-i-report_profile" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">report_profile</span><span
+            class="method-args">(data, measure_mode)</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="report_profile-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/test.rb, line 109</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">report_profile</span>(<span class="ruby-identifier">data</span>, <span class="ruby-identifier">measure_mode</span>)
+  <span class="ruby-constant">PROFILE_OPTIONS</span>[<span class="ruby-value">:printers</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">printer_klass</span><span class="ruby-operator">|</span>
+    <span class="ruby-identifier">printer</span> = <span class="ruby-identifier">printer_klass</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">data</span>)
+
+    <span class="ruby-comment"># Makes sure the output directory exits</span>
+    <span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">mkdir_p</span>(<span class="ruby-identifier">output_dir</span>)
+
+    <span class="ruby-comment"># Open the file</span>
+    <span class="ruby-identifier">file_name</span> = <span class="ruby-identifier">report_filename</span>(<span class="ruby-identifier">printer</span>, <span class="ruby-identifier">measure_mode</span>)
+
+    <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">file_name</span>, <span class="ruby-string">'wb'</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">file</span><span class="ruby-operator">|</span>
+      <span class="ruby-identifier">printer</span>.<span class="ruby-identifier">print</span>(<span class="ruby-identifier">file</span>, <span class="ruby-constant">PROFILE_OPTIONS</span>)
+    <span class="ruby-keyword">end</span>
+  <span class="ruby-keyword">end</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- report_profile-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- report_profile-method -->
+
+    
+      <div id="method-i-run" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">run</span><span
+            class="method-args">(result) { |STARTED, name| ... }</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="run-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/test.rb, line 20</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">run</span>(<span class="ruby-identifier">result</span>)
+  <span class="ruby-keyword">return</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@method_name</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">==</span> <span class="ruby-string">"default_test"</span>
+
+  <span class="ruby-keyword">yield</span>(<span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span><span class="ruby-operator">::</span><span class="ruby-constant">STARTED</span>, <span class="ruby-identifier">name</span>)
+  <span class="ruby-ivar">@_result</span> = <span class="ruby-identifier">result</span>
+  <span class="ruby-identifier">run_warmup</span>
+  <span class="ruby-constant">PROFILE_OPTIONS</span>[<span class="ruby-value">:measure_modes</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">measure_mode</span><span class="ruby-operator">|</span>
+    <span class="ruby-identifier">data</span> = <span class="ruby-identifier">run_profile</span>(<span class="ruby-identifier">measure_mode</span>)
+    <span class="ruby-identifier">report_profile</span>(<span class="ruby-identifier">data</span>, <span class="ruby-identifier">measure_mode</span>)
+    <span class="ruby-identifier">result</span>.<span class="ruby-identifier">add_run</span>
+  <span class="ruby-keyword">end</span>
+  <span class="ruby-keyword">yield</span>(<span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span><span class="ruby-operator">::</span><span class="ruby-constant">FINISHED</span>, <span class="ruby-identifier">name</span>)
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- run-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- run-method -->
+
+    
+      <div id="method-i-run_profile" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">run_profile</span><span
+            class="method-args">(measure_mode)</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="run_profile-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/test.rb, line 64</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">run_profile</span>(<span class="ruby-identifier">measure_mode</span>)
+  <span class="ruby-constant">RubyProf</span>.<span class="ruby-identifier">measure_mode</span> = <span class="ruby-identifier">measure_mode</span>
+
+  <span class="ruby-identifier">print</span> <span class="ruby-string">'  '</span>
+  <span class="ruby-constant">PROFILE_OPTIONS</span>[<span class="ruby-value">:count</span>].<span class="ruby-identifier">times</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
+    <span class="ruby-identifier">run_test</span> <span class="ruby-keyword">do</span>
+      <span class="ruby-keyword">begin</span>
+        <span class="ruby-identifier">print</span> <span class="ruby-string">'.'</span>
+        <span class="ruby-identifier">$stdout</span>.<span class="ruby-identifier">flush</span>
+        <span class="ruby-constant">GC</span>.<span class="ruby-identifier">disable</span>
+
+        <span class="ruby-constant">RubyProf</span>.<span class="ruby-identifier">resume</span> <span class="ruby-keyword">do</span>
+          <span class="ruby-identifier">__send__</span>(<span class="ruby-ivar">@method_name</span>)
+        <span class="ruby-keyword">end</span>
+      <span class="ruby-keyword">ensure</span>
+        <span class="ruby-constant">GC</span>.<span class="ruby-identifier">enable</span>
+      <span class="ruby-keyword">end</span>
+    <span class="ruby-keyword">end</span>
+  <span class="ruby-keyword">end</span>
+
+  <span class="ruby-identifier">data</span> = <span class="ruby-constant">RubyProf</span>.<span class="ruby-identifier">stop</span>
+  <span class="ruby-identifier">bench</span> = <span class="ruby-identifier">data</span>.<span class="ruby-identifier">threads</span>.<span class="ruby-identifier">values</span>.<span class="ruby-identifier">inject</span>(<span class="ruby-value">0</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">total</span>, <span class="ruby-identifier">method_infos</span><span class="ruby-operator">|</span>
+    <span class="ruby-identifier">top</span> = <span class="ruby-identifier">method_infos</span>.<span class="ruby-identifier">max</span>
+    <span class="ruby-identifier">total</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">top</span>.<span class="ruby-identifier">total_time</span>
+    <span class="ruby-identifier">total</span>
+  <span class="ruby-keyword">end</span>
+
+  <span class="ruby-identifier">puts</span> <span class="ruby-node">"\n  #{measure_mode_name(measure_mode)}: #{format_profile_total(bench, measure_mode)}\n"</span>
+
+  <span class="ruby-identifier">data</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- run_profile-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- run_profile-method -->
+
+    
+      <div id="method-i-run_test" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">run_test</span><span
+            class="method-args">() { || ... }</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="run_test-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/test.rb, line 34</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">run_test</span>
+  <span class="ruby-keyword">begin</span>
+    <span class="ruby-identifier">setup</span>
+    <span class="ruby-keyword">yield</span>
+  <span class="ruby-keyword">rescue</span> <span class="ruby-operator">::</span><span class="ruby-constant">Test</span><span class="ruby-operator">::</span><span class="ruby-constant">Unit</span><span class="ruby-operator">::</span><span class="ruby-constant">AssertionFailedError</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
+    <span class="ruby-identifier">add_failure</span>(<span class="ruby-identifier">e</span>.<span class="ruby-identifier">message</span>, <span class="ruby-identifier">e</span>.<span class="ruby-identifier">backtrace</span>)
+  <span class="ruby-keyword">rescue</span> <span class="ruby-constant">StandardError</span>, <span class="ruby-constant">ScriptError</span>
+    <span class="ruby-identifier">add_error</span>(<span class="ruby-identifier">$!</span>)
+  <span class="ruby-keyword">ensure</span>
+    <span class="ruby-keyword">begin</span>
+      <span class="ruby-identifier">teardown</span>
+    <span class="ruby-keyword">rescue</span> <span class="ruby-operator">::</span><span class="ruby-constant">Test</span><span class="ruby-operator">::</span><span class="ruby-constant">Unit</span><span class="ruby-operator">::</span><span class="ruby-constant">AssertionFailedError</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
+      <span class="ruby-identifier">add_failure</span>(<span class="ruby-identifier">e</span>.<span class="ruby-identifier">message</span>, <span class="ruby-identifier">e</span>.<span class="ruby-identifier">backtrace</span>)
+    <span class="ruby-keyword">rescue</span> <span class="ruby-constant">StandardError</span>, <span class="ruby-constant">ScriptError</span>
+      <span class="ruby-identifier">add_error</span>(<span class="ruby-identifier">$!</span>)
+    <span class="ruby-keyword">end</span>
+  <span class="ruby-keyword">end</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- run_test-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- run_test-method -->
+
+    
+      <div id="method-i-run_warmup" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">run_warmup</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="run_warmup-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/test.rb, line 53</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">run_warmup</span>
+  <span class="ruby-identifier">print</span> <span class="ruby-node">"\n#{self.class.name}##{method_name}"</span>
+
+  <span class="ruby-identifier">run_test</span> <span class="ruby-keyword">do</span>
+    <span class="ruby-identifier">bench</span> = <span class="ruby-constant">Benchmark</span>.<span class="ruby-identifier">realtime</span> <span class="ruby-keyword">do</span>
+      <span class="ruby-identifier">__send__</span>(<span class="ruby-ivar">@method_name</span>)
+    <span class="ruby-keyword">end</span>
+    <span class="ruby-identifier">puts</span> <span class="ruby-string">" (%.2fs warmup)"</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">bench</span>
+  <span class="ruby-keyword">end</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- run_warmup-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- run_warmup-method -->
+
+    
+    </section><!-- public-instance-method-details -->
+  
+  </section><!-- 5Buntitled-5D -->
+
+</div><!-- documentation -->
+
+
+<footer id="validator-badges">
+  <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
+  <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.1.
+  <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
+</footer>
+
diff --git a/doc/RubyProf/Thread.html b/doc/RubyProf/Thread.html
new file mode 100644
index 0000000..cb19f4a
--- /dev/null
+++ b/doc/RubyProf/Thread.html
@@ -0,0 +1,262 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+
+<title>class RubyProf::Thread - ruby-prof</title>
+
+<link type="text/css" media="screen" href="../rdoc.css" rel="stylesheet">
+
+<script type="text/javascript">
+  var rdoc_rel_prefix = "../";
+</script>
+
+<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/navigation.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/search_index.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/search.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/searcher.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/darkfish.js"></script>
+
+
+<body id="top" class="class">
+<nav id="metadata">
+  <nav id="home-section" class="section">
+  <h3 class="section-header">
+    <a href="../index.html">Home</a>
+    <a href="../table_of_contents.html#classes">Classes</a>
+    <a href="../table_of_contents.html#methods">Methods</a>
+  </h3>
+</nav>
+
+
+  <nav id="search-section" class="section project-section" class="initially-hidden">
+  <form action="#" method="get" accept-charset="utf-8">
+    <h3 class="section-header">
+      <input type="text" name="search" placeholder="Search" id="search-field"
+             title="Type to search, Up and Down to navigate, Enter to load">
+    </h3>
+  </form>
+
+  <ul id="search-results" class="initially-hidden"></ul>
+</nav>
+
+
+  <div id="file-metadata">
+    <nav id="file-list-section" class="section">
+  <h3 class="section-header">Defined In</h3>
+  <ul>
+    <li>lib/ruby-prof/thread.rb
+  </ul>
+</nav>
+
+    
+  </div>
+
+  <div id="class-metadata">
+    
+    <nav id="parent-class-section" class="section">
+  <h3 class="section-header">Parent</h3>
+  
+  <p class="link">Object
+  
+</nav>
+
+    
+    <!-- Method Quickref -->
+<nav id="method-list-section" class="section">
+  <h3 class="section-header">Methods</h3>
+
+  <ul class="link-list">
+    
+    <li><a href="#method-i-top_methods">#top_methods</a>
+    
+    <li><a href="#method-i-total_time">#total_time</a>
+    
+  </ul>
+</nav>
+
+  </div>
+
+  <div id="project-metadata">
+    <nav id="fileindex-section" class="section project-section">
+  <h3 class="section-header">Pages</h3>
+
+  <ul>
+  
+    <li class="file"><a href="../LICENSE.html">LICENSE</a>
+  
+    <li class="file"><a href="../README_rdoc.html">README</a>
+  
+    <li class="file"><a href="../examples/flat_txt.html">flat</a>
+  
+    <li class="file"><a href="../examples/graph_txt.html">graph</a>
+  
+  </ul>
+</nav>
+
+    <nav id="classindex-section" class="section project-section">
+  <h3 class="section-header">Class and Module Index</h3>
+
+  <ul class="link-list">
+  
+    <li><a href="../RubyProf.html">RubyProf</a>
+  
+    <li><a href="../RubyProf/AbstractPrinter.html">RubyProf::AbstractPrinter</a>
+  
+    <li><a href="../RubyProf/AggregateCallInfo.html">RubyProf::AggregateCallInfo</a>
+  
+    <li><a href="../RubyProf/CallInfo.html">RubyProf::CallInfo</a>
+  
+    <li><a href="../RubyProf/CallInfoPrinter.html">RubyProf::CallInfoPrinter</a>
+  
+    <li><a href="../RubyProf/CallInfoVisitor.html">RubyProf::CallInfoVisitor</a>
+  
+    <li><a href="../RubyProf/CallStackPrinter.html">RubyProf::CallStackPrinter</a>
+  
+    <li><a href="../RubyProf/CallTreePrinter.html">RubyProf::CallTreePrinter</a>
+  
+    <li><a href="../RubyProf/Cmd.html">RubyProf::Cmd</a>
+  
+    <li><a href="../RubyProf/DotPrinter.html">RubyProf::DotPrinter</a>
+  
+    <li><a href="../RubyProf/FlatPrinter.html">RubyProf::FlatPrinter</a>
+  
+    <li><a href="../RubyProf/FlatPrinterWithLineNumbers.html">RubyProf::FlatPrinterWithLineNumbers</a>
+  
+    <li><a href="../RubyProf/GraphHtmlPrinter.html">RubyProf::GraphHtmlPrinter</a>
+  
+    <li><a href="../RubyProf/GraphPrinter.html">RubyProf::GraphPrinter</a>
+  
+    <li><a href="../RubyProf/MethodInfo.html">RubyProf::MethodInfo</a>
+  
+    <li><a href="../RubyProf/MultiPrinter.html">RubyProf::MultiPrinter</a>
+  
+    <li><a href="../RubyProf/Profile.html">RubyProf::Profile</a>
+  
+    <li><a href="../RubyProf/ProfileTask.html">RubyProf::ProfileTask</a>
+  
+    <li><a href="../RubyProf/Test.html">RubyProf::Test</a>
+  
+    <li><a href="../RubyProf/Thread.html">RubyProf::Thread</a>
+  
+    <li><a href="../Rack.html">Rack</a>
+  
+    <li><a href="../Rack/RubyProf.html">Rack::RubyProf</a>
+  
+  </ul>
+</nav>
+
+  </div>
+</nav>
+
+<div id="documentation">
+  <h1 class="class">class RubyProf::Thread</h1>
+
+  <div id="description" class="description">
+    
+  </div><!-- description -->
+
+  
+  
+  
+  <section id="5Buntitled-5D" class="documentation-section">
+    
+
+    
+
+    
+
+    
+
+    <!-- Methods -->
+    
+     <section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
+      <h3 class="section-header">Public Instance Methods</h3>
+
+    
+      <div id="method-i-top_methods" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">top_methods</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="top_methods-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/thread.rb, line 3</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">top_methods</span>
+  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">methods</span>.<span class="ruby-identifier">select</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">method_info</span><span class="ruby-operator">|</span>
+    <span class="ruby-identifier">method_info</span>.<span class="ruby-identifier">call_infos</span>.<span class="ruby-identifier">detect</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">call_info</span><span class="ruby-operator">|</span>
+      <span class="ruby-identifier">call_info</span>.<span class="ruby-identifier">parent</span>.<span class="ruby-identifier">nil?</span>
+    <span class="ruby-keyword">end</span>
+  <span class="ruby-keyword">end</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- top_methods-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- top_methods-method -->
+
+    
+      <div id="method-i-total_time" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">total_time</span><span
+            class="method-args">()</span>
+          <span class="method-click-advice">click to toggle source</span>
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+
+          
+          <div class="method-source-code" id="total_time-source">
+            <pre><span class="ruby-comment"># File lib/ruby-prof/thread.rb, line 11</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">total_time</span>
+  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">top_methods</span>.<span class="ruby-identifier">inject</span>(<span class="ruby-value">0</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">sum</span>, <span class="ruby-identifier">method_info</span><span class="ruby-operator">|</span>
+    <span class="ruby-identifier">method_info</span>.<span class="ruby-identifier">call_infos</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">call_info</span><span class="ruby-operator">|</span>
+      <span class="ruby-keyword">if</span> <span class="ruby-identifier">call_info</span>.<span class="ruby-identifier">parent</span>.<span class="ruby-identifier">nil?</span>
+        <span class="ruby-identifier">sum</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">call_info</span>.<span class="ruby-identifier">total_time</span>
+      <span class="ruby-keyword">end</span>
+    <span class="ruby-keyword">end</span>
+    <span class="ruby-identifier">sum</span>
+  <span class="ruby-keyword">end</span>
+<span class="ruby-keyword">end</span></pre>
+          </div><!-- total_time-source -->
+          
+        </div>
+
+        
+
+        
+      </div><!-- total_time-method -->
+
+    
+    </section><!-- public-instance-method-details -->
+  
+  </section><!-- 5Buntitled-5D -->
+
+</div><!-- documentation -->
+
+
+<footer id="validator-badges">
+  <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
+  <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.1.
+  <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
+</footer>
+
diff --git a/doc/created.rid b/doc/created.rid
new file mode 100644
index 0000000..0c89bd8
--- /dev/null
+++ b/doc/created.rid
@@ -0,0 +1,32 @@
+Sat, 14 Dec 2013 08:43:58 +0100
+bin/ruby-prof	Sat, 02 Feb 2013 10:23:19 +0100
+bin/ruby-prof-check-trace	Sun, 10 Mar 2013 10:57:14 +0100
+examples/flat.txt	Tue, 29 Jan 2013 16:43:39 +0100
+examples/graph.txt	Tue, 29 Jan 2013 16:43:39 +0100
+examples/graph.html	Tue, 29 Jan 2013 16:43:39 +0100
+lib/ruby-prof.rb	Tue, 29 Jan 2013 16:44:27 +0100
+lib/ruby-prof/aggregate_call_info.rb	Tue, 29 Jan 2013 16:43:39 +0100
+lib/ruby-prof/call_info.rb	Tue, 29 Jan 2013 16:44:27 +0100
+lib/ruby-prof/call_info_visitor.rb	Tue, 29 Jan 2013 16:44:27 +0100
+lib/ruby-prof/compatibility.rb	Sun, 03 Feb 2013 12:16:49 +0100
+lib/ruby-prof/method_info.rb	Tue, 29 Jan 2013 16:44:27 +0100
+lib/ruby-prof/printers/abstract_printer.rb	Tue, 29 Jan 2013 16:43:39 +0100
+lib/ruby-prof/printers/call_info_printer.rb	Sun, 10 Mar 2013 10:57:14 +0100
+lib/ruby-prof/printers/call_stack_printer.rb	Sun, 10 Mar 2013 10:57:14 +0100
+lib/ruby-prof/printers/call_tree_printer.rb	Tue, 29 Jan 2013 16:43:39 +0100
+lib/ruby-prof/printers/dot_printer.rb	Tue, 29 Jan 2013 16:44:27 +0100
+lib/ruby-prof/printers/flat_printer.rb	Sun, 10 Mar 2013 10:57:14 +0100
+lib/ruby-prof/printers/flat_printer_with_line_numbers.rb	Tue, 29 Jan 2013 16:44:27 +0100
+lib/ruby-prof/printers/graph_html_printer.rb	Thu, 11 Apr 2013 13:47:28 +0200
+lib/ruby-prof/printers/graph_printer.rb	Sun, 10 Mar 2013 10:57:14 +0100
+lib/ruby-prof/printers/multi_printer.rb	Tue, 29 Jan 2013 16:43:39 +0100
+lib/ruby-prof/profile.rb	Tue, 29 Jan 2013 16:44:27 +0100
+lib/ruby-prof/rack.rb	Sun, 10 Mar 2013 10:56:55 +0100
+lib/ruby-prof/task.rb	Tue, 29 Jan 2013 16:43:39 +0100
+lib/ruby-prof/test.rb	Tue, 29 Jan 2013 16:43:39 +0100
+lib/ruby-prof/thread.rb	Tue, 29 Jan 2013 16:44:27 +0100
+lib/unprof.rb	Tue, 29 Jan 2013 16:43:39 +0100
+ext/ruby_prof/ruby_prof.c	Sun, 10 Mar 2013 10:57:14 +0100
+ext/ruby_prof/version.h	Sat, 14 Dec 2013 08:38:44 +0100
+README.rdoc	Tue, 26 Nov 2013 08:07:21 +0100
+LICENSE	Tue, 29 Jan 2013 16:43:39 +0100
diff --git a/doc/examples/flat_txt.html b/doc/examples/flat_txt.html
new file mode 100644
index 0000000..977b5d7
--- /dev/null
+++ b/doc/examples/flat_txt.html
@@ -0,0 +1,191 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+
+<title>flat - ruby-prof</title>
+
+<link type="text/css" media="screen" href="../rdoc.css" rel="stylesheet">
+
+<script type="text/javascript">
+  var rdoc_rel_prefix = "../";
+</script>
+
+<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/navigation.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/search_index.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/search.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/searcher.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/darkfish.js"></script>
+
+
+<body class="file">
+<nav id="metadata">
+  <nav id="home-section" class="section">
+  <h3 class="section-header">
+    <a href="../index.html">Home</a>
+    <a href="../table_of_contents.html#classes">Classes</a>
+    <a href="../table_of_contents.html#methods">Methods</a>
+  </h3>
+</nav>
+
+
+  <nav id="search-section" class="section project-section" class="initially-hidden">
+  <form action="#" method="get" accept-charset="utf-8">
+    <h3 class="section-header">
+      <input type="text" name="search" placeholder="Search" id="search-field"
+             title="Type to search, Up and Down to navigate, Enter to load">
+    </h3>
+  </form>
+
+  <ul id="search-results" class="initially-hidden"></ul>
+</nav>
+
+
+  <div id="project-metadata">
+    <nav id="fileindex-section" class="section project-section">
+  <h3 class="section-header">Pages</h3>
+
+  <ul>
+  
+    <li class="file"><a href="../LICENSE.html">LICENSE</a>
+  
+    <li class="file"><a href="../README_rdoc.html">README</a>
+  
+    <li class="file"><a href="../examples/flat_txt.html">flat</a>
+  
+    <li class="file"><a href="../examples/graph_txt.html">graph</a>
+  
+  </ul>
+</nav>
+
+    <nav id="classindex-section" class="section project-section">
+  <h3 class="section-header">Class and Module Index</h3>
+
+  <ul class="link-list">
+  
+    <li><a href="../RubyProf.html">RubyProf</a>
+  
+    <li><a href="../RubyProf/AbstractPrinter.html">RubyProf::AbstractPrinter</a>
+  
+    <li><a href="../RubyProf/AggregateCallInfo.html">RubyProf::AggregateCallInfo</a>
+  
+    <li><a href="../RubyProf/CallInfo.html">RubyProf::CallInfo</a>
+  
+    <li><a href="../RubyProf/CallInfoPrinter.html">RubyProf::CallInfoPrinter</a>
+  
+    <li><a href="../RubyProf/CallInfoVisitor.html">RubyProf::CallInfoVisitor</a>
+  
+    <li><a href="../RubyProf/CallStackPrinter.html">RubyProf::CallStackPrinter</a>
+  
+    <li><a href="../RubyProf/CallTreePrinter.html">RubyProf::CallTreePrinter</a>
+  
+    <li><a href="../RubyProf/Cmd.html">RubyProf::Cmd</a>
+  
+    <li><a href="../RubyProf/DotPrinter.html">RubyProf::DotPrinter</a>
+  
+    <li><a href="../RubyProf/FlatPrinter.html">RubyProf::FlatPrinter</a>
+  
+    <li><a href="../RubyProf/FlatPrinterWithLineNumbers.html">RubyProf::FlatPrinterWithLineNumbers</a>
+  
+    <li><a href="../RubyProf/GraphHtmlPrinter.html">RubyProf::GraphHtmlPrinter</a>
+  
+    <li><a href="../RubyProf/GraphPrinter.html">RubyProf::GraphPrinter</a>
+  
+    <li><a href="../RubyProf/MethodInfo.html">RubyProf::MethodInfo</a>
+  
+    <li><a href="../RubyProf/MultiPrinter.html">RubyProf::MultiPrinter</a>
+  
+    <li><a href="../RubyProf/Profile.html">RubyProf::Profile</a>
+  
+    <li><a href="../RubyProf/ProfileTask.html">RubyProf::ProfileTask</a>
+  
+    <li><a href="../RubyProf/Test.html">RubyProf::Test</a>
+  
+    <li><a href="../RubyProf/Thread.html">RubyProf::Thread</a>
+  
+    <li><a href="../Rack.html">Rack</a>
+  
+    <li><a href="../Rack/RubyProf.html">Rack::RubyProf</a>
+  
+  </ul>
+</nav>
+
+  </div>
+</nav>
+
+<div id="documentation" class="description">
+  
+<h1 id="label-Flat+Profiles">Flat Profiles</h1>
+
+<p>Flat profiles show the total amount of time spent in each method. As an
+example, here is the output from running printers_test.rb.</p>
+
+<p>Thread ID: 21277412</p>
+
+<pre>%self  cumulative  total     self   children  calls self/call total/call  name
+46.34     4.06      8.72     4.06     4.66      501     0.01     0.02     Integer#upto
+23.89     6.16      2.09     2.09     0.00       61     0.03     0.03     Kernel.sleep
+15.12     7.48      1.33     1.33     0.00   250862     0.00     0.00     Fixnum#%
+14.13     8.72      1.24     1.24     0.00   250862     0.00     0.00     Fixnum#==
+ 0.18     8.74      0.02     0.02     0.00        1     0.02     0.02     Array#each_index
+ 0.17     8.75      6.64     0.01     6.63      500     0.00     0.01     Object#is_prime
+ 0.17     8.77      6.66     0.01     6.64        1     0.01     6.66     Array#select
+ 0.00     8.77      0.00     0.00     0.00      501     0.00     0.00     Fixnum#-
+ 0.00     8.77      0.00     0.00     0.00        1     0.00     0.00     Array#first
+ 0.00     8.77      0.00     0.00     0.00        1     0.00     0.00     Array#length
+ 0.00     8.77      0.00     0.00     0.00        1     0.00     0.00     Array#initialize
+ 0.00     8.77      8.77     0.00     8.77        1     0.00     8.77     Object#run_primes
+ 0.00     8.77      0.00     0.00     0.00        1     0.00     0.00     Integer#to_int
+ 0.00     8.77      6.66     0.00     6.66        1     0.00     6.66     Object#find_primes
+ 0.00     8.77      2.09     0.00     2.09        1     0.00     2.09     Object#find_largest
+ 0.00     8.77      0.02     0.00     0.02        1     0.00     0.02     Object#make_random_array
+ 0.00     8.77      0.00     0.00     0.00        1     0.00     0.00     Class#new
+ 0.00     8.77      0.00     0.00     0.00      500     0.00     0.00     Array#[]=
+ 0.00     8.77      0.00     0.00     0.00       61     0.00     0.00     Fixnum#>
+ 0.00     8.77      0.00     0.00     0.00       61     0.00     0.00     Array#[]
+ 0.00     8.77      8.77     0.00     8.77        1     0.00     8.77     #toplevel
+ 0.00     8.77      0.00     0.00     0.00      500     0.00     0.00     Kernel.rand</pre>
+
+<p>All values are in seconds.</p>
+
+<p>The columns are:</p>
+
+<pre>      %self        - The percentage of time spent in this method, derived from self_time/total_time
+      cumulative   - The sum of the time spent in this method and all the methods listed above it.
+      total        - The time spent in this method and its children.
+      self         - The time spent in this method.
+      children     - The time spent in this method's children.
+      calls        - The number of times this method was called.
+      self/call    - The average time spent per call in this method.
+total/call   - The average time spent per call in this method and its children.
+name         - The name of the method.</pre>
+
+<p>Methods are sorted based on %self, therefore the methods that execute the
+longest are listed first.</p>
+
+<p>The interpretation of method names is:</p>
+<ul><li>
+<p>toplevel - The root method that calls all other methods</p>
+</li><li>
+<p>MyObject#test - An instance method “test” of the class “MyObject”</p>
+</li><li>
+<p><Object:MyObject>test - The <> characters indicate a singleton
+method on a singleton class.</p>
+</li></ul>
+
+<p>For example, wee can see that Integer#upto took the most time, 4.06
+seconds.  An additional 4.66 seconds were spent in its children, for a
+total time of 8.72 seconds.</p>
+
+</div>
+
+
+
+<footer id="validator-badges">
+  <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
+  <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.1.
+  <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
+</footer>
+
diff --git a/doc/examples/graph_txt.html b/doc/examples/graph_txt.html
new file mode 100644
index 0000000..28f7aff
--- /dev/null
+++ b/doc/examples/graph_txt.html
@@ -0,0 +1,305 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+
+<title>graph - ruby-prof</title>
+
+<link type="text/css" media="screen" href="../rdoc.css" rel="stylesheet">
+
+<script type="text/javascript">
+  var rdoc_rel_prefix = "../";
+</script>
+
+<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/navigation.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/search_index.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/search.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/searcher.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/darkfish.js"></script>
+
+
+<body class="file">
+<nav id="metadata">
+  <nav id="home-section" class="section">
+  <h3 class="section-header">
+    <a href="../index.html">Home</a>
+    <a href="../table_of_contents.html#classes">Classes</a>
+    <a href="../table_of_contents.html#methods">Methods</a>
+  </h3>
+</nav>
+
+
+  <nav id="search-section" class="section project-section" class="initially-hidden">
+  <form action="#" method="get" accept-charset="utf-8">
+    <h3 class="section-header">
+      <input type="text" name="search" placeholder="Search" id="search-field"
+             title="Type to search, Up and Down to navigate, Enter to load">
+    </h3>
+  </form>
+
+  <ul id="search-results" class="initially-hidden"></ul>
+</nav>
+
+
+  <div id="project-metadata">
+    <nav id="fileindex-section" class="section project-section">
+  <h3 class="section-header">Pages</h3>
+
+  <ul>
+  
+    <li class="file"><a href="../LICENSE.html">LICENSE</a>
+  
+    <li class="file"><a href="../README_rdoc.html">README</a>
+  
+    <li class="file"><a href="../examples/flat_txt.html">flat</a>
+  
+    <li class="file"><a href="../examples/graph_txt.html">graph</a>
+  
+  </ul>
+</nav>
+
+    <nav id="classindex-section" class="section project-section">
+  <h3 class="section-header">Class and Module Index</h3>
+
+  <ul class="link-list">
+  
+    <li><a href="../RubyProf.html">RubyProf</a>
+  
+    <li><a href="../RubyProf/AbstractPrinter.html">RubyProf::AbstractPrinter</a>
+  
+    <li><a href="../RubyProf/AggregateCallInfo.html">RubyProf::AggregateCallInfo</a>
+  
+    <li><a href="../RubyProf/CallInfo.html">RubyProf::CallInfo</a>
+  
+    <li><a href="../RubyProf/CallInfoPrinter.html">RubyProf::CallInfoPrinter</a>
+  
+    <li><a href="../RubyProf/CallInfoVisitor.html">RubyProf::CallInfoVisitor</a>
+  
+    <li><a href="../RubyProf/CallStackPrinter.html">RubyProf::CallStackPrinter</a>
+  
+    <li><a href="../RubyProf/CallTreePrinter.html">RubyProf::CallTreePrinter</a>
+  
+    <li><a href="../RubyProf/Cmd.html">RubyProf::Cmd</a>
+  
+    <li><a href="../RubyProf/DotPrinter.html">RubyProf::DotPrinter</a>
+  
+    <li><a href="../RubyProf/FlatPrinter.html">RubyProf::FlatPrinter</a>
+  
+    <li><a href="../RubyProf/FlatPrinterWithLineNumbers.html">RubyProf::FlatPrinterWithLineNumbers</a>
+  
+    <li><a href="../RubyProf/GraphHtmlPrinter.html">RubyProf::GraphHtmlPrinter</a>
+  
+    <li><a href="../RubyProf/GraphPrinter.html">RubyProf::GraphPrinter</a>
+  
+    <li><a href="../RubyProf/MethodInfo.html">RubyProf::MethodInfo</a>
+  
+    <li><a href="../RubyProf/MultiPrinter.html">RubyProf::MultiPrinter</a>
+  
+    <li><a href="../RubyProf/Profile.html">RubyProf::Profile</a>
+  
+    <li><a href="../RubyProf/ProfileTask.html">RubyProf::ProfileTask</a>
+  
+    <li><a href="../RubyProf/Test.html">RubyProf::Test</a>
+  
+    <li><a href="../RubyProf/Thread.html">RubyProf::Thread</a>
+  
+    <li><a href="../Rack.html">Rack</a>
+  
+    <li><a href="../Rack/RubyProf.html">Rack::RubyProf</a>
+  
+  </ul>
+</nav>
+
+  </div>
+</nav>
+
+<div id="documentation" class="description">
+  
+<h1 id="label-Graph+Profiles">Graph Profiles</h1>
+
+<p>Graph profiles show how long each method runs, which methods call it and
+which methods it calls.</p>
+
+<p>As an example, here is the output from running printers_test.rb:</p>
+
+<p>Thread ID: 21277412</p>
+
+<pre> %total   %self     total      self    children               calls   Name
+-------------------------------------------------------------------------------- 
+100.00%   0.00%      8.77      0.00      8.77                   1     #toplevel
+                     8.77      0.00      8.77                 1/1     Object#run_primes
+-------------------------------------------------------------------------------- 
+                     8.77      0.00      8.77                 1/1     #toplevel
+100.00%   0.00%      8.77      0.00      8.77                   1     Object#run_primes
+                     0.02      0.00      0.02                 1/1     Object#make_random_array
+                     2.09      0.00      2.09                 1/1     Object#find_largest
+                     6.66      0.00      6.66                 1/1     Object#find_primes
+-------------------------------------------------------------------------------- 
+                     6.63      4.06      2.56             500/501     Object#is_prime
+                     2.09      0.00      2.09               1/501     Object#find_largest
+ 99.48%  46.34%      8.72      4.06      4.66                 501     Integer#upto
+                     0.00      0.00      0.00               61/61     Array#[]
+                     0.00      0.00      0.00               61/61     Fixnum#>
+                     2.09      2.09      0.00               61/61     Kernel.sleep
+                     1.24      1.24      0.00       250862/250862     Fixnum#==
+                     1.33      1.33      0.00       250862/250862     Fixnum#%
+-------------------------------------------------------------------------------- 
+                     6.66      0.01      6.64                 1/1     Object#find_primes
+ 75.93%   0.17%      6.66      0.01      6.64                   1     Array#select
+                     6.64      0.01      6.63             500/500     Object#is_prime
+-------------------------------------------------------------------------------- 
+                     6.66      0.00      6.66                 1/1     Object#run_primes
+ 75.93%   0.00%      6.66      0.00      6.66                   1     Object#find_primes
+                     6.66      0.01      6.64                 1/1     Array#select
+-------------------------------------------------------------------------------- 
+                     6.64      0.01      6.63             500/500     Array#select
+ 75.76%   0.17%      6.64      0.01      6.63                 500     Object#is_prime
+                     0.00      0.00      0.00             500/501     Fixnum#-
+                     6.63      4.06      2.56             500/501     Integer#upto
+-------------------------------------------------------------------------------- 
+                     2.09      0.00      2.09                 1/1     Object#run_primes
+ 23.89%   0.00%      2.09      0.00      2.09                   1     Object#find_largest
+                     0.00      0.00      0.00               1/501     Fixnum#-
+                     2.09      0.00      2.09               1/501     Integer#upto
+                     0.00      0.00      0.00                 1/1     Array#first
+                     0.00      0.00      0.00                 1/1     Array#length
+-------------------------------------------------------------------------------- 
+                     2.09      2.09      0.00               61/61     Integer#upto
+ 23.89%  23.89%      2.09      2.09      0.00                  61     Kernel.sleep
+-------------------------------------------------------------------------------- 
+                     1.33      1.33      0.00       250862/250862     Integer#upto
+ 15.12%  15.12%      1.33      1.33      0.00              250862     Fixnum#%
+-------------------------------------------------------------------------------- 
+                     1.24      1.24      0.00       250862/250862     Integer#upto
+ 14.13%  14.13%      1.24      1.24      0.00              250862     Fixnum#==
+-------------------------------------------------------------------------------- 
+                     0.02      0.00      0.02                 1/1     Object#run_primes
+  0.18%   0.00%      0.02      0.00      0.02                   1     Object#make_random_array
+                     0.02      0.02      0.00                 1/1     Array#each_index
+                     0.00      0.00      0.00                 1/1     Class#new
+-------------------------------------------------------------------------------- 
+                     0.02      0.02      0.00                 1/1     Object#make_random_array
+  0.18%   0.18%      0.02      0.02      0.00                   1     Array#each_index
+                     0.00      0.00      0.00             500/500     Kernel.rand
+                     0.00      0.00      0.00             500/500     Array#[]=
+-------------------------------------------------------------------------------- 
+                     0.00      0.00      0.00             500/501     Object#is_prime
+                     0.00      0.00      0.00               1/501     Object#find_largest
+  0.00%   0.00%      0.00      0.00      0.00                 501     Fixnum#-
+-------------------------------------------------------------------------------- 
+                     0.00      0.00      0.00                 1/1     Kernel.rand
+  0.00%   0.00%      0.00      0.00      0.00                   1     Integer#to_int
+-------------------------------------------------------------------------------- 
+                     0.00      0.00      0.00                 1/1     Object#find_largest
+  0.00%   0.00%      0.00      0.00      0.00                   1     Array#first
+-------------------------------------------------------------------------------- 
+                     0.00      0.00      0.00                 1/1     Class#new
+  0.00%   0.00%      0.00      0.00      0.00                   1     Array#initialize
+-------------------------------------------------------------------------------- 
+                     0.00      0.00      0.00                 1/1     Object#find_largest
+  0.00%   0.00%      0.00      0.00      0.00                   1     Array#length
+-------------------------------------------------------------------------------- 
+                     0.00      0.00      0.00                 1/1     Object#make_random_array
+  0.00%   0.00%      0.00      0.00      0.00                   1     Class#new
+                     0.00      0.00      0.00                 1/1     Array#initialize
+-------------------------------------------------------------------------------- 
+                     0.00      0.00      0.00               61/61     Integer#upto
+  0.00%   0.00%      0.00      0.00      0.00                  61     Fixnum#>
+-------------------------------------------------------------------------------- 
+                     0.00      0.00      0.00               61/61     Integer#upto
+  0.00%   0.00%      0.00      0.00      0.00                  61     Array#[]
+-------------------------------------------------------------------------------- 
+                     0.00      0.00      0.00             500/500     Array#each_index
+  0.00%   0.00%      0.00      0.00      0.00                 500     Array#[]=
+-------------------------------------------------------------------------------- 
+                     0.00      0.00      0.00             500/500     Array#each_index
+  0.00%   0.00%      0.00      0.00      0.00                 500     Kernel.rand
+                     0.00      0.00      0.00                 1/1     Integer#to_int</pre>
+
+<h2 id="label-Overview">Overview</h2>
+
+<p>Dashed lines divide the report into entries, with one entry per method. 
+Entries are sorted by total time which is the  time spent in the method
+plus its children.</p>
+
+<p>Each entry has a primary line demarked by values in the  %total and %self
+columns.  The primary line represents  the method being profiled.  Lines
+above it are the methods that called this method (parents) while the lines
+below it are the methods it called (children).</p>
+
+<p>All values are in seconds.  For the primary line, the columns represent:</p>
+
+<pre>%total       - The percentage of time spent in this method and its children
+%self        - The percentage of time spent in this method
+total        - The time spent in this method and its children.
+self         - The time spent in this method.
+children     - The time spent in this method's children.
+calls        - The number of times this method was called.
+name         - The name of the method.</pre>
+
+<p>The interpretation of method names is:</p>
+<ul><li>
+<p>toplevel - The root method that calls all other methods</p>
+</li><li>
+<p>MyObject#test - An instance method “test” of the class “MyObject”</p>
+</li><li>
+<p><Object:MyObject>test - The <> characters indicate a singleton
+method on a singleton class.</p>
+</li></ul>
+
+<p>For example, we see that 99.48% of the time was spent in Integer#upto and
+its children. Of that time, 4.06 seconds was spent in Integer#upto itself
+and 4.66 in its children. Overall, Integer#upto was called 501 times.</p>
+
+<h2 id="label-Parents">Parents</h2>
+
+<p>In each entry, the lines above the primary line are the methods that 
+called the current method.  If the current method is a root method then no
+parents are shown.</p>
+
+<p>For parent lines, the columns represent:</p>
+
+<pre>total        - The time spent in the current method and it children on behalf of the parent method.
+self         - The time spent in this method on behalf of the parent method.
+children     - The time spent in this method's children on behalf of the parent.
+calls        - The number of times the parent method called this child</pre>
+
+<p>Looking at Integer#upto again, we see that it was called 500 times from
+Object#is_prime and 1 time from find_largest.  Of the 8.72 total seconds
+spent in Integer#upto, 6.63 were done for Object#is_prime and 2.09 for
+Object#find_largest.</p>
+
+<h2 id="label-Children">Children</h2>
+
+<p>In each entry, the lines below the primary line are the methods that  the
+current method called.  If the current method is a leaf method then no
+children are shown.</p>
+
+<p>For children lines, the columns represent:</p>
+
+<pre>total        - The time spent in the child, and its children, on behalf of the current method
+self         - The time spent in the child on behalf of the current method.
+children     - The time spent in the child's children (ie, granchildren) in behalf of the current method
+calls        - The number of times the child method was called by the current method.</pre>
+
+<p>Taking our example of Integer#upto, we see that it called five other
+methods - Array#[], Fixnum#>, Kernel.sleep, Fixnum#= and Fixnum#%. 
+Looking at Kernel.sleep, we see that  its spent 2.09 seconds working for
+Integer#upto and its children spent 0 time working for Integer#upto.  To
+see the overall time Kernel.sleep took we would have to look up its entry
+in the graph table.</p>
+
+<p></p>
+
+</div>
+
+
+
+<footer id="validator-badges">
+  <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
+  <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.1.
+  <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
+</footer>
+
diff --git a/doc/images/add.png b/doc/images/add.png
new file mode 100755
index 0000000..6332fef
Binary files /dev/null and b/doc/images/add.png differ
diff --git a/doc/images/brick.png b/doc/images/brick.png
new file mode 100644
index 0000000..7851cf3
Binary files /dev/null and b/doc/images/brick.png differ
diff --git a/doc/images/brick_link.png b/doc/images/brick_link.png
new file mode 100644
index 0000000..9ebf013
Binary files /dev/null and b/doc/images/brick_link.png differ
diff --git a/doc/images/bug.png b/doc/images/bug.png
new file mode 100644
index 0000000..2d5fb90
Binary files /dev/null and b/doc/images/bug.png differ
diff --git a/doc/images/bullet_black.png b/doc/images/bullet_black.png
new file mode 100644
index 0000000..5761970
Binary files /dev/null and b/doc/images/bullet_black.png differ
diff --git a/doc/images/bullet_toggle_minus.png b/doc/images/bullet_toggle_minus.png
new file mode 100644
index 0000000..b47ce55
Binary files /dev/null and b/doc/images/bullet_toggle_minus.png differ
diff --git a/doc/images/bullet_toggle_plus.png b/doc/images/bullet_toggle_plus.png
new file mode 100644
index 0000000..9ab4a89
Binary files /dev/null and b/doc/images/bullet_toggle_plus.png differ
diff --git a/doc/images/date.png b/doc/images/date.png
new file mode 100644
index 0000000..783c833
Binary files /dev/null and b/doc/images/date.png differ
diff --git a/doc/images/delete.png b/doc/images/delete.png
new file mode 100755
index 0000000..08f2493
Binary files /dev/null and b/doc/images/delete.png differ
diff --git a/doc/images/find.png b/doc/images/find.png
new file mode 100644
index 0000000..1547479
Binary files /dev/null and b/doc/images/find.png differ
diff --git a/doc/images/loadingAnimation.gif b/doc/images/loadingAnimation.gif
new file mode 100644
index 0000000..82290f4
Binary files /dev/null and b/doc/images/loadingAnimation.gif differ
diff --git a/doc/images/macFFBgHack.png b/doc/images/macFFBgHack.png
new file mode 100644
index 0000000..c6473b3
Binary files /dev/null and b/doc/images/macFFBgHack.png differ
diff --git a/doc/images/package.png b/doc/images/package.png
new file mode 100644
index 0000000..da3c2a2
Binary files /dev/null and b/doc/images/package.png differ
diff --git a/doc/images/page_green.png b/doc/images/page_green.png
new file mode 100644
index 0000000..de8e003
Binary files /dev/null and b/doc/images/page_green.png differ
diff --git a/doc/images/page_white_text.png b/doc/images/page_white_text.png
new file mode 100644
index 0000000..813f712
Binary files /dev/null and b/doc/images/page_white_text.png differ
diff --git a/doc/images/page_white_width.png b/doc/images/page_white_width.png
new file mode 100644
index 0000000..1eb8809
Binary files /dev/null and b/doc/images/page_white_width.png differ
diff --git a/doc/images/plugin.png b/doc/images/plugin.png
new file mode 100644
index 0000000..6187b15
Binary files /dev/null and b/doc/images/plugin.png differ
diff --git a/doc/images/ruby.png b/doc/images/ruby.png
new file mode 100644
index 0000000..f763a16
Binary files /dev/null and b/doc/images/ruby.png differ
diff --git a/doc/images/tag_blue.png b/doc/images/tag_blue.png
new file mode 100755
index 0000000..3f02b5f
Binary files /dev/null and b/doc/images/tag_blue.png differ
diff --git a/doc/images/tag_green.png b/doc/images/tag_green.png
new file mode 100644
index 0000000..83ec984
Binary files /dev/null and b/doc/images/tag_green.png differ
diff --git a/doc/images/transparent.png b/doc/images/transparent.png
new file mode 100644
index 0000000..d665e17
Binary files /dev/null and b/doc/images/transparent.png differ
diff --git a/doc/images/wrench.png b/doc/images/wrench.png
new file mode 100644
index 0000000..5c8213f
Binary files /dev/null and b/doc/images/wrench.png differ
diff --git a/doc/images/wrench_orange.png b/doc/images/wrench_orange.png
new file mode 100644
index 0000000..565a933
Binary files /dev/null and b/doc/images/wrench_orange.png differ
diff --git a/doc/images/zoom.png b/doc/images/zoom.png
new file mode 100644
index 0000000..908612e
Binary files /dev/null and b/doc/images/zoom.png differ
diff --git a/doc/index.html b/doc/index.html
new file mode 100644
index 0000000..3d81b5a
--- /dev/null
+++ b/doc/index.html
@@ -0,0 +1,647 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+
+<title>ruby-prof</title>
+
+<link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">
+
+<script type="text/javascript">
+  var rdoc_rel_prefix = "./";
+</script>
+
+<script type="text/javascript" charset="utf-8" src="./js/jquery.js"></script>
+<script type="text/javascript" charset="utf-8" src="./js/navigation.js"></script>
+<script type="text/javascript" charset="utf-8" src="./js/search_index.js"></script>
+<script type="text/javascript" charset="utf-8" src="./js/search.js"></script>
+<script type="text/javascript" charset="utf-8" src="./js/searcher.js"></script>
+<script type="text/javascript" charset="utf-8" src="./js/darkfish.js"></script>
+
+
+<body>
+<nav id="metadata">
+  <nav id="home-section" class="section">
+  <h3 class="section-header">
+    <a href="./index.html">Home</a>
+    <a href="./table_of_contents.html#classes">Classes</a>
+    <a href="./table_of_contents.html#methods">Methods</a>
+  </h3>
+</nav>
+
+
+  <nav id="search-section" class="section project-section" class="initially-hidden">
+  <form action="#" method="get" accept-charset="utf-8">
+    <h3 class="section-header">
+      <input type="text" name="search" placeholder="Search" id="search-field"
+             title="Type to search, Up and Down to navigate, Enter to load">
+    </h3>
+  </form>
+
+  <ul id="search-results" class="initially-hidden"></ul>
+</nav>
+
+
+  <div id="project-metadata">
+    <nav id="fileindex-section" class="section project-section">
+  <h3 class="section-header">Pages</h3>
+
+  <ul>
+  
+    <li class="file"><a href="./LICENSE.html">LICENSE</a>
+  
+    <li class="file"><a href="./README_rdoc.html">README</a>
+  
+    <li class="file"><a href="./examples/flat_txt.html">flat</a>
+  
+    <li class="file"><a href="./examples/graph_txt.html">graph</a>
+  
+  </ul>
+</nav>
+
+    <nav id="classindex-section" class="section project-section">
+  <h3 class="section-header">Class and Module Index</h3>
+
+  <ul class="link-list">
+  
+    <li><a href="./RubyProf.html">RubyProf</a>
+  
+    <li><a href="./RubyProf/AbstractPrinter.html">RubyProf::AbstractPrinter</a>
+  
+    <li><a href="./RubyProf/AggregateCallInfo.html">RubyProf::AggregateCallInfo</a>
+  
+    <li><a href="./RubyProf/CallInfo.html">RubyProf::CallInfo</a>
+  
+    <li><a href="./RubyProf/CallInfoPrinter.html">RubyProf::CallInfoPrinter</a>
+  
+    <li><a href="./RubyProf/CallInfoVisitor.html">RubyProf::CallInfoVisitor</a>
+  
+    <li><a href="./RubyProf/CallStackPrinter.html">RubyProf::CallStackPrinter</a>
+  
+    <li><a href="./RubyProf/CallTreePrinter.html">RubyProf::CallTreePrinter</a>
+  
+    <li><a href="./RubyProf/Cmd.html">RubyProf::Cmd</a>
+  
+    <li><a href="./RubyProf/DotPrinter.html">RubyProf::DotPrinter</a>
+  
+    <li><a href="./RubyProf/FlatPrinter.html">RubyProf::FlatPrinter</a>
+  
+    <li><a href="./RubyProf/FlatPrinterWithLineNumbers.html">RubyProf::FlatPrinterWithLineNumbers</a>
+  
+    <li><a href="./RubyProf/GraphHtmlPrinter.html">RubyProf::GraphHtmlPrinter</a>
+  
+    <li><a href="./RubyProf/GraphPrinter.html">RubyProf::GraphPrinter</a>
+  
+    <li><a href="./RubyProf/MethodInfo.html">RubyProf::MethodInfo</a>
+  
+    <li><a href="./RubyProf/MultiPrinter.html">RubyProf::MultiPrinter</a>
+  
+    <li><a href="./RubyProf/Profile.html">RubyProf::Profile</a>
+  
+    <li><a href="./RubyProf/ProfileTask.html">RubyProf::ProfileTask</a>
+  
+    <li><a href="./RubyProf/Test.html">RubyProf::Test</a>
+  
+    <li><a href="./RubyProf/Thread.html">RubyProf::Thread</a>
+  
+    <li><a href="./Rack.html">Rack</a>
+  
+    <li><a href="./Rack/RubyProf.html">Rack::RubyProf</a>
+  
+  </ul>
+</nav>
+
+  </div>
+</nav>
+
+<div id="documentation" class="description">
+  
+<h1 id="label-ruby-prof">ruby-prof</h1>
+
+<p><a href="https://travis-ci.org/ruby-prof/ruby-prof"><img
+src="https://travis-ci.org/ruby-prof/ruby-prof.png?branch=master"
+alt="Build Status" /></a></p>
+
+<h2 id="label-Overview">Overview</h2>
+
+<p>ruby-prof is a fast code profiler for Ruby.  Its features include:</p>
+<ul><li>
+<p>Speed - it is a C extension and therefore many times faster than the
+standard Ruby profiler.</p>
+</li><li>
+<p>Modes - Ruby prof can measure a number of different parameters, including
+call times, memory usage and object allocations.</p>
+</li><li>
+<p>Reports - can generate text and cross-referenced html reports</p>
+<ul><li>
+<p>Flat Profiles - similar to the reports generated by the standard Ruby
+profiler</p>
+</li><li>
+<p>Graph profiles - similar to GProf, these show how long a method runs, which
+methods call it and which methods it calls.</p>
+</li><li>
+<p>Call tree profiles - outputs results in the calltree format suitable for
+the KCacheGrind profiling tool.</p>
+</li><li>
+<p>Many more – see reports section of this <a
+href="README_rdoc.html">README</a>.</p>
+</li></ul>
+</li><li>
+<p>Threads - supports profiling multiple threads simultaneously</p>
+</li></ul>
+
+<h2 id="label-Requirements">Requirements</h2>
+
+<p>ruby-prof requires Ruby 1.8.7 or 1.9.2 and higher.</p>
+
+<p>If you are running Linux or Unix you'll need a C compiler so the
+extension can be compiled when it is installed.</p>
+
+<p>If you are running Windows, then you may need to install the Windows
+specific RubyGem which includes an already built extension (see Install
+section).</p>
+
+<h2 id="label-Install">Install</h2>
+
+<p>The easiest way to install ruby-prof is by using Ruby Gems.  To install:</p>
+
+<pre>gem install ruby-prof</pre>
+
+<p>If you're on windows then a prebuilt binary gem is available.  You may
+of course compile it yourself via use of devkit on MinGW.</p>
+
+<h2 id="label-Usage">Usage</h2>
+
+<p>There are two ways of running ruby-prof, via the command line or via its
+API.</p>
+
+<h3 id="label-ruby-prof+executable">ruby-prof executable</h3>
+
+<p>The first is to use ruby-prof to run the Ruby program you want to profile.
+For more information refer to the documentation of the ruby-prof command.</p>
+
+<h3 id="label-ruby-prof+API">ruby-prof API</h3>
+
+<p>The second way is to use the ruby-prof API to profile particular segments
+of code.</p>
+
+<pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">'ruby-prof'</span>
+
+<span class="ruby-comment"># Profile the code</span>
+<span class="ruby-constant">RubyProf</span>.<span class="ruby-identifier">start</span>
+<span class="ruby-operator">...</span>
+[<span class="ruby-identifier">code</span> <span class="ruby-identifier">to</span> <span class="ruby-identifier">profile</span>]
+<span class="ruby-operator">...</span>
+<span class="ruby-identifier">result</span> = <span class="ruby-constant">RubyProf</span>.<span class="ruby-identifier">stop</span>
+
+<span class="ruby-comment"># Print a flat profile to text</span>
+<span class="ruby-identifier">printer</span> = <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">FlatPrinter</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">result</span>)
+<span class="ruby-identifier">printer</span>.<span class="ruby-identifier">print</span>(<span class="ruby-constant">STDOUT</span>)
+</pre>
+
+<p>Alternatively, you can use a block to tell ruby-prof what to profile:</p>
+
+<pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">'ruby-prof'</span>
+
+<span class="ruby-comment"># Profile the code</span>
+<span class="ruby-identifier">result</span> = <span class="ruby-constant">RubyProf</span>.<span class="ruby-identifier">profile</span> <span class="ruby-keyword">do</span>
+  <span class="ruby-operator">...</span>
+  [<span class="ruby-identifier">code</span> <span class="ruby-identifier">to</span> <span class="ruby-identifier">profile</span>]
+  <span class="ruby-operator">...</span>
+<span class="ruby-keyword">end</span>
+
+<span class="ruby-comment"># Print a graph profile to text</span>
+<span class="ruby-identifier">printer</span> = <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">GraphPrinter</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">result</span>)
+<span class="ruby-identifier">printer</span>.<span class="ruby-identifier">print</span>(<span class="ruby-constant">STDOUT</span>, {})
+</pre>
+
+<p>ruby-prof also supports pausing and resuming profiling runs.</p>
+
+<pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">'ruby-prof'</span>
+
+<span class="ruby-comment"># Profile the code</span>
+<span class="ruby-constant">RubyProf</span>.<span class="ruby-identifier">start</span>
+[<span class="ruby-identifier">code</span> <span class="ruby-identifier">to</span> <span class="ruby-identifier">profile</span>]
+<span class="ruby-constant">RubyProf</span>.<span class="ruby-identifier">pause</span>
+[<span class="ruby-identifier">other</span> <span class="ruby-identifier">code</span>]
+<span class="ruby-constant">RubyProf</span>.<span class="ruby-identifier">resume</span>
+[<span class="ruby-identifier">code</span> <span class="ruby-identifier">to</span> <span class="ruby-identifier">profile</span>]
+<span class="ruby-identifier">result</span> = <span class="ruby-constant">RubyProf</span>.<span class="ruby-identifier">stop</span>
+</pre>
+
+<p>Note that resume will automatically call start if a profiling run has not
+yet started.  In addition, resume can also take a block:</p>
+
+<pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">'ruby-prof'</span>
+
+<span class="ruby-comment"># Profile the code</span>
+<span class="ruby-constant">RubyProf</span>.<span class="ruby-identifier">resume</span> <span class="ruby-keyword">do</span>
+  [<span class="ruby-identifier">code</span> <span class="ruby-identifier">to</span> <span class="ruby-identifier">profile</span>]
+<span class="ruby-keyword">end</span>
+
+<span class="ruby-identifier">data</span> = <span class="ruby-constant">RubyProf</span>.<span class="ruby-identifier">stop</span>
+</pre>
+
+<p>With this usage, resume will automatically call pause at the end of the
+block.</p>
+
+<h2 id="label-Method+and+Thread+Elimination">Method and Thread Elimination</h2>
+
+<p>ruby-prof supports eliminating specific methods and threads from profiling
+results. This is useful for reducing connectivity in the call graph, making
+it easier to identify the source of performance problems when using a graph
+printer.</p>
+
+<p>For example, consider Integer#times: it's hardly ever useful to know
+how much time is spent in the method itself. We're much more interested
+in how much the passed in block contributes to the time spent in the method
+which contains the Integer#times call.</p>
+
+<p>Methods are eliminated from the collected data by calling
+`eliminate_methods!` on the profiling result, before submitting it to a
+printer.</p>
+
+<pre>result = RubyProf.stop
+result.eliminate_methods!([/Integer#times/])</pre>
+
+<p>The argument given to `eliminate_methods!` is either an array of regular
+expressions, or the name of a file containing a list of regular expressions
+(line separated text).</p>
+
+<p>After eliminating methods the resulting profile will appear exactly as if
+those methods had been inlined at their call sites.</p>
+
+<p>In a similar manner, threads can be excluded so they are not profiled at
+all.  To do this, pass an array of threads to exclude to ruby-prof:</p>
+
+<pre>RubyProf::exclude_threads = [ thread2 ]
+RubyProf.start</pre>
+
+<p>Note that the excluded threads must be specified <strong>before</strong>
+profiling.</p>
+
+<h2 id="label-Benchmarking+full+load+time+including+rubygems+startup+cost+%3D%3D">Benchmarking full load time including rubygems startup cost ==</h2>
+
+<p>If you want to get a more accurate measurement of what takes all of a
+gem's bin/xxx command to load, you may want to also measure
+rubygems' startup penalty. You can do this by calling into
+bin/ruby-prof directly, ex:</p>
+
+<p>$ gem which ruby-prof</p>
+
+<pre>g:/192/lib/ruby/gems/1.9.1/gems/ruby-prof-0.10.2/lib/ruby-prof.rb</pre>
+
+<p>now run it thus (substitute lib/ruby-prof.rb with bin/ruby-prof):</p>
+
+<p>$ ruby g:/192/lib/ruby/gems/1.9.1/gems/ruby-prof-0.10.2/bin/ruby-prof
+g:192binsome_installed_gem_command</p>
+
+<p>or</p>
+
+<p>$ ruby g:/192/lib/ruby/gems/1.9.1/gems/ruby-prof-0.10.2/bin/ruby-prof
+./some_file_that_does_a_require_rubygems_at_the_beginning.rb</p>
+
+<h2 id="label-Profiling+Tests">Profiling Tests</h2>
+
+<p>ruby-prof supports profiling tests cases written using Ruby's built-in
+unit test framework (ie, test derived from Test::Unit::TestCase).  To
+enable profiling simply add the following line of code to within your test
+class:</p>
+
+<pre>include RubyProf::Test</pre>
+
+<p>Each test method is profiled separately.  ruby-prof will run each test
+method once as a warmup and then ten additional times to gather profile
+data. Note that the profile data will <strong>not</strong> include the
+class's setup or teardown methods.</p>
+
+<p>Separate reports are generated for each method and saved, by default, in
+the test process's working directory.  To change this, or other
+profiling options, modify your test class's PROFILE_OPTIONS hash table.
+To globally change test profiling options, modify
+RubyProf::Test::PROFILE_OPTIONS.</p>
+
+<h2 id="label-Profiling+Rails">Profiling Rails</h2>
+
+<p>To profile a Rails application it is vital to run it using production like
+settings (cache classes, cache view lookups, etc.).  Otherwise, Rail's
+dependency loading code will overwhelm any time spent in the application
+itself (our tests show that Rails dependency loading causes a roughly 6x
+slowdown).  The best way to do this is create a new Rails environment,
+profile.rb.</p>
+
+<p>So to profile Rails:</p>
+<ol><li>
+<p>Create a new profile.rb environment.  Make sure to turn on cache_classes
+and cache_template_loading.  Otherwise your profiling results will be
+overwhelemed by the time Rails spends loading required files.  You should
+likely turn off caching.</p>
+</li><li>
+<p>Add the ruby-prof to your gemfile:</p>
+
+<pre>group :profile do
+  gem 'ruby-prof'
+end</pre>
+</li><li>
+<p>Add the ruby prof rack adapter to your middleware stack.  One way to do
+this is by adding the following code to config.ru:</p>
+
+<pre class="ruby"><span class="ruby-keyword">if</span> <span class="ruby-constant">Rails</span>.<span class="ruby-identifier">env</span>.<span class="ruby-identifier">profile?</span>
+  <span class="ruby-identifier">use</span> <span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">RubyProf</span>, :<span class="ruby-identifier">path</span> =<span class="ruby-operator">></span> <span class="ruby-string">'/temp/profile'</span>
+<span class="ruby-keyword">end</span>
+</pre>
+
+<p>The path is where you want profiling results to be stored.  By default the
+rack adapter will generate a html call graph report and flat text report.</p>
+</li><li>
+<p>Now make a request to your running server.  New profiling information will
+be generated for each request.  Note that each request will overwrite the
+profiling reports created by the previous request!</p>
+</li></ol>
+
+<h2 id="label-Reports">Reports</h2>
+
+<p>ruby-prof can generate a number of different reports:</p>
+<ul><li>
+<p>Flat Reports</p>
+</li><li>
+<p>Graph Reports</p>
+</li><li>
+<p>HTML Graph Reports</p>
+</li><li>
+<p>Call graphs</p>
+</li><li>
+<p>Call stack reports</p>
+</li><li>
+<p>More!</p>
+</li></ul>
+
+<p>Flat profiles show the overall time spent in each method. They are a good
+of quickly identifying which methods take the most time. An example of a
+flat profile and an explanation can be found in <a
+href="http://github.com/ruby-prof/ruby-prof/tree/master/examples/flat.txt">examples/flat.txt</a>.</p>
+
+<p>There are several varieties of these – run $ ruby-prof –help</p>
+
+<p>Graph profiles also show the overall time spent in each method. In
+addition, they also show which methods call the current method and which
+methods its calls.  Thus they are good for understanding how methods gets
+called and provide insight into the flow of your program. An example text
+graph profile is located at <a
+href="http://github.com/ruby-prof/ruby-prof/tree/master/examples/graph.txt">examples/graph.txt</a>.</p>
+
+<p>HTML Graph profiles are the same as graph profiles, except output is
+generated in hyper-linked HTML. Since graph profiles can be quite large,
+the embedded links make it much easier to navigate the results. An example
+html graph profile is located at <a
+href="http://github.com/ruby-prof/ruby-prof/tree/master/examples/graph.html">examples/graph.html</a>.</p>
+
+<p>Call graphs output results in the calltree profile format which is used by
+KCachegrind. Call graph support was generously donated by Carl Shimer. More
+information about the format can be found at the <a
+href="http://kcachegrind.sourceforge.net/cgi-bin/show.cgi/KcacheGrindCalltreeFormat">KCachegrind</a>
+site.</p>
+
+<p>Call stack reports produce a HTML visualization of the time spent in each
+execution path of the profiled code. An example can be found at <a
+href="http://github.com/ruby-prof/ruby-prof/tree/master/examples/call_stack.html">examples/stack.html</a>.</p>
+
+<p>Another good example: [<a
+href="http://twitpic.com/28z94a">twitpic.com/28z94a</a>]</p>
+
+<p>Finally, there's a so called MultiPrinter which can generate several
+reports in one profiling run. See <a
+href="http://github.com/ruby-prof/ruby-prof/tree/master/examples/multi.stack.html">examples/multi.stack.html</a>.</p>
+
+<p>There is also a graphviz .dot visualiser.</p>
+
+<h2 id="label-Printers">Printers</h2>
+
+<p>Reports are created by printers.  Supported printers include:</p>
+<ul><li>
+<p><a href="RubyProf/FlatPrinter.html">RubyProf::FlatPrinter</a> - Creates a
+flat report in text format</p>
+</li><li>
+<p><a
+href="RubyProf/FlatPrinterWithLineNumbers.html">RubyProf::FlatPrinterWithLineNumbers</a>
+- same as above but more verbose</p>
+</li><li>
+<p><a href="RubyProf/GraphPrinter.html">RubyProf::GraphPrinter</a> - Creates a
+call graph report in text format</p>
+</li><li>
+<p><a href="RubyProf/GraphHtmlPrinter.html">RubyProf::GraphHtmlPrinter</a> -
+Creates a call graph report in HTML (separate files per thread)</p>
+</li><li>
+<p><a href="RubyProf/DotPrinter.html">RubyProf::DotPrinter</a> - Creates a
+call graph report in GraphViz's DOT format which can be converted to an
+image</p>
+</li><li>
+<p><a href="RubyProf/CallTreePrinter.html">RubyProf::CallTreePrinter</a> -
+Creates a call tree report compatible with KCachegrind.</p>
+</li><li>
+<p><a href="RubyProf/CallStackPrinter.html">RubyProf::CallStackPrinter</a> -
+Creates a HTML visualization of the Ruby stack</p>
+</li><li>
+<p><a href="RubyProf/MultiPrinter.html">RubyProf::MultiPrinter</a> - Uses the
+other printers to create several reports in one profiling run</p>
+</li><li>
+<p>More!</p>
+</li></ul>
+
+<p>To use a printer:</p>
+
+<pre class="ruby"><span class="ruby-operator">...</span>
+<span class="ruby-identifier">result</span> = <span class="ruby-constant">RubyProf</span>.<span class="ruby-identifier">stop</span>
+<span class="ruby-identifier">printer</span> = <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">GraphPrinter</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">result</span>)
+<span class="ruby-identifier">printer</span>.<span class="ruby-identifier">print</span>(<span class="ruby-constant">STDOUT</span>, :<span class="ruby-identifier">min_percent</span> =<span class="ruby-operator">></span> <span class="ruby-value">2</span>)
+</pre>
+
+<p>The first parameter is any writable IO object such as STDOUT or a file. The
+second parameter, specifies the minimum percentage a method must take to be
+printed.  Percentages should be specified as integers in the range 0 to
+100. For more information please see the documentation for the different
+printers.</p>
+
+<p>The other option is :print_file => true (default false), which adds the
+filename to the output (GraphPrinter only).</p>
+
+<p>The MultiPrinter differs from the other printers in that it requires a
+directory path and a basename for the files it produces.</p>
+
+<pre class="ruby"><span class="ruby-identifier">printer</span> = <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">MultiPrinter</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">result</span>)
+<span class="ruby-identifier">printer</span>.<span class="ruby-identifier">print</span>(:<span class="ruby-identifier">path</span> =<span class="ruby-operator">></span> <span class="ruby-string">"."</span>, :<span class="ruby-identifier">profile</span> =<span class="ruby-operator">></span> <span class="ruby-string">"profile"</span>)
+</pre>
+
+<h2 id="label-Measurements">Measurements</h2>
+
+<p>Depending on the mode and platform, ruby-prof can measure various aspects
+of a Ruby program.  Supported measurements include:</p>
+<ul><li>
+<p>process time (RubyProf::PROCESS_TIME)</p>
+</li><li>
+<p>wall time (RubyProf::WALL_TIME)</p>
+</li><li>
+<p>cpu time (RubyProf::CPU_TIME)</p>
+</li><li>
+<p>object allocations (RubyProf::ALLOCATIONS)</p>
+</li><li>
+<p>memory usage (RubyProf::MEMORY)</p>
+</li><li>
+<p>garbage collections runs (RubyProf::GC_RUNS)</p>
+</li><li>
+<p>garbage collection time (RubyProf::GC_TIME)</p>
+</li></ul>
+
+<p>Process time measures the time used by a process between any two moments.
+It is unaffected by other processes concurrently running on the system.
+Note that Windows does not support measuring process times - therefore,
+measurements on Windows defaults to wall time.</p>
+
+<p>Wall time measures the real-world time elapsed between any two moments. If
+there are other processes concurrently running on the system that use
+significant CPU or disk time during a profiling run then the reported
+results will be too large.</p>
+
+<p>CPU time uses the CPU clock counter to measure time.  The returned values
+are dependent on the correctly setting the CPU's frequency. This mode
+is only supported on Pentium or PowerPC platforms (linux only).</p>
+
+<p>Object allocation reports show how many objects each method in a program
+allocates.  This support was added by Sylvain Joyeux and requires a patched
+Ruby interpreter.  For more information and the patch, please see: <a
+href="http://rubyforge.org/tracker/index.php?func=detail&aid=11497&group_id=426&atid=1700">rubyforge.org/tracker/index.php?func=detail&aid=11497&group_id=426&atid=1700</a></p>
+
+<p>Memory usage reports show how much memory each method in a program uses. 
+This support was added by Alexander Dymo and requires a patched Ruby
+interpreter.  For more information, see: <a
+href="http://rubyforge.org/tracker/index.php?func=detail&aid=17676&group_id=1814&atid=7062">rubyforge.org/tracker/index.php?func=detail&aid=17676&group_id=1814&atid=7062</a></p>
+
+<p>Garbage collection runs report how many times Ruby's garbage collector
+is invoked during a profiling session.  This support was added by Jeremy
+Kemper and requires a patched Ruby interpreter.  For more information, see:
+<a
+href="http://rubyforge.org/tracker/index.php?func=detail&aid=17676&group_id=1814&atid=7062">rubyforge.org/tracker/index.php?func=detail&aid=17676&group_id=1814&atid=7062</a></p>
+
+<p>Garbage collection time reports how much time is spent in Ruby's
+garbage collector during a profiling session.  This support was added by
+Jeremy Kemper and requires a patched Ruby interpreter.  For more
+information, see: <a
+href="http://rubyforge.org/tracker/index.php?func=detail&aid=17676&group_id=1814&atid=7062">rubyforge.org/tracker/index.php?func=detail&aid=17676&group_id=1814&atid=7062</a></p>
+
+<p>To set the measurement:</p>
+<ul><li>
+<p><a href="RubyProf.html#method-c-measure_mode">RubyProf.measure_mode</a> =
+RubyProf::PROCESS_TIME</p>
+</li><li>
+<p><a href="RubyProf.html#method-c-measure_mode">RubyProf.measure_mode</a> =
+RubyProf::WALL_TIME</p>
+</li><li>
+<p><a href="RubyProf.html#method-c-measure_mode">RubyProf.measure_mode</a> =
+RubyProf::CPU_TIME</p>
+</li><li>
+<p><a href="RubyProf.html#method-c-measure_mode">RubyProf.measure_mode</a> =
+RubyProf::ALLOCATIONS</p>
+</li><li>
+<p><a href="RubyProf.html#method-c-measure_mode">RubyProf.measure_mode</a> =
+RubyProf::MEMORY</p>
+</li><li>
+<p><a href="RubyProf.html#method-c-measure_mode">RubyProf.measure_mode</a> =
+RubyProf::GC_RUNS</p>
+</li><li>
+<p><a href="RubyProf.html#method-c-measure_mode">RubyProf.measure_mode</a> =
+RubyProf::GC_TIME</p>
+</li></ul>
+
+<p>The default value is RubyProf::PROCESS_TIME.</p>
+
+<p>You may also specify the measure_mode by using the RUBY_PROF_MEASURE_MODE
+environment variable:</p>
+<ul><li>
+<p>export RUBY_PROF_MEASURE_MODE=process</p>
+</li><li>
+<p>export RUBY_PROF_MEASURE_MODE=wall</p>
+</li><li>
+<p>export RUBY_PROF_MEASURE_MODE=cpu</p>
+</li><li>
+<p>export RUBY_PROF_MEASURE_MODE=allocations</p>
+</li><li>
+<p>export RUBY_PROF_MEASURE_MODE=memory</p>
+</li><li>
+<p>export RUBY_PROF_MEASURE_MODE=gc_runs</p>
+</li><li>
+<p>export RUBY_PROF_MEASURE_MODE=gc_time</p>
+</li></ul>
+
+<p>On Linux, process time is measured using the clock method provided by the C
+runtime library. Note that the clock method does not report time spent in
+the kernel or child processes and therefore does not measure time spent in
+methods such as Kernel.sleep method. If you need to measure these values,
+then use wall time.  Wall time is measured using the gettimeofday kernel
+method.</p>
+
+<p>On Windows, timings default to wall times.  If you set the clock mode to
+PROCESS_TIME, then timing are read using the clock method provided by the C
+runtime library.  Note though, these values are wall times on Windows and
+not process times like on Linux. Wall time is measured using the
+GetLocalTime API.</p>
+
+<p>If you use wall time, the results will be affected by other processes
+running on your computer, network delays, disk access, etc.  As result, for
+the best results, try to make sure your computer is only performing your
+profiling run and is otherwise quiescent.</p>
+
+<p>On both platforms, cpu time is measured using the RDTSC assembly function
+provided by the Pentium and PowerPC platforms. CPU time is dependent on the
+cpu's frequency.  On Linux, ruby-prof attempts to read this value from
+“/proc/cpuinfo.”  On Windows, you must manually specify the clock
+frequency.  This can be done using the RUBY_PROF_CPU_FREQUENCY environment
+variable:</p>
+
+<pre>export RUBY_PROF_CPU_FREQUENCY=<value></pre>
+
+<p>You can also directly set the cpu frequency by calling:</p>
+
+<pre>RubyProf.cpu_frequency = <value></pre>
+
+<h2 id="label-Multi-threaded+Applications">Multi-threaded Applications</h2>
+
+<p>Unfortunately, Ruby does not provide an internal api for detecting thread
+context switches in 1.8.  As a result, the timings ruby-prof reports for
+each thread may be slightly inaccurate.  In particular, this will happen
+for newly spawned threads that go to sleep immediately (their first call).
+For instance, if you use Ruby's timeout library to wait for 2 seconds,
+the 2 seconds will be assigned to the foreground thread and not the newly
+created background thread.  These errors can largely be avoided if the
+background thread performs any operation before going to sleep.</p>
+
+<h2 id="label-Performance">Performance</h2>
+
+<p>Significant effort has been put into reducing ruby-prof's overhead as
+much as possible.  Our tests show that the overhead associated with
+profiling code varies considerably with the code being profiled.  Most
+programs will run approximately twice as slow while highly recursive
+programs (like the fibonacci series test) will run three times slower.</p>
+
+<h2 id="label-License">License</h2>
+
+<p>See <a href="LICENSE.html">LICENSE</a> for license information.</p>
+
+<h2 id="label-Development">Development</h2>
+
+<p>Code is located at <a
+href="https://github.com/ruby-prof/ruby-prof">github.com/ruby-prof/ruby-prof</a></p>
+
+<p>Google group/mailing list: <a
+href="http://groups.google.com/group/ruby-optimization">groups.google.com/group/ruby-optimization</a>
+or start a github issue.</p>
+
+</div>
+
+
+<footer id="validator-badges">
+  <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
+  <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.1.
+  <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
+</footer>
+
diff --git a/doc/js/darkfish.js b/doc/js/darkfish.js
new file mode 100644
index 0000000..f26fd45
--- /dev/null
+++ b/doc/js/darkfish.js
@@ -0,0 +1,155 @@
+/**
+ *
+ * Darkfish Page Functions
+ * $Id: darkfish.js 53 2009-01-07 02:52:03Z deveiant $
+ *
+ * Author: Michael Granger <mgranger at laika.com>
+ *
+ */
+
+/* Provide console simulation for firebug-less environments */
+if (!("console" in window) || !("firebug" in console)) {
+  var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
+    "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
+
+  window.console = {};
+  for (var i = 0; i < names.length; ++i)
+    window.console[names[i]] = function() {};
+};
+
+
+/**
+ * Unwrap the first element that matches the given @expr@ from the targets and return them.
+ */
+$.fn.unwrap = function( expr ) {
+  return this.each( function() {
+    $(this).parents( expr ).eq( 0 ).after( this ).remove();
+  });
+};
+
+
+function showSource( e ) {
+  var target = e.target;
+  var codeSections = $(target).
+    parents('.method-detail').
+    find('.method-source-code');
+
+  $(target).
+    parents('.method-detail').
+    find('.method-source-code').
+    slideToggle();
+};
+
+function hookSourceViews() {
+  $('.method-heading').click( showSource );
+};
+
+function toggleDebuggingSection() {
+  $('.debugging-section').slideToggle();
+};
+
+function hookDebuggingToggle() {
+  $('#debugging-toggle img').click( toggleDebuggingSection );
+};
+
+function hookTableOfContentsToggle() {
+  $('.indexpage li .toc-toggle').each( function() {
+    $(this).click( function() {
+      $(this).toggleClass('open');
+    });
+
+    var section = $(this).next();
+
+    $(this).click( function() {
+      section.slideToggle();
+    });
+  });
+}
+
+function hookSearch() {
+  var input  = $('#search-field').eq(0);
+  var result = $('#search-results').eq(0);
+  $(result).show();
+
+  var search_section = $('#search-section').get(0);
+  $(search_section).show();
+
+  var search = new Search(search_data, input, result);
+
+  search.renderItem = function(result) {
+    var li = document.createElement('li');
+    var html = '';
+
+    // TODO add relative path to <script> per-page
+    html += '<p class="search-match"><a href="' + rdoc_rel_prefix + result.path + '">' + this.hlt(result.title);
+    if (result.params)
+      html += '<span class="params">' + result.params + '</span>';
+    html += '</a>';
+
+
+    if (result.namespace)
+      html += '<p class="search-namespace">' + this.hlt(result.namespace);
+
+    if (result.snippet)
+      html += '<div class="search-snippet">' + result.snippet + '</div>';
+
+    li.innerHTML = html;
+
+    return li;
+  }
+
+  search.select = function(result) {
+    var result_element = result.get(0);
+    window.location.href = result_element.firstChild.firstChild.href;
+  }
+
+  search.scrollIntoView = search.scrollInWindow;
+};
+
+function highlightTarget( anchor ) {
+  console.debug( "Highlighting target '%s'.", anchor );
+
+  $("a[name]").each( function() {
+    if ( $(this).attr("name") == anchor ) {
+      if ( !$(this).parent().parent().hasClass('target-section') ) {
+        console.debug( "Wrapping the target-section" );
+        $('div.method-detail').unwrap( 'div.target-section' );
+        $(this).parent().wrap( '<div class="target-section"></div>' );
+      } else {
+        console.debug( "Already wrapped." );
+      }
+    }
+  });
+};
+
+function highlightLocationTarget() {
+  console.debug( "Location hash: %s", window.location.hash );
+  if ( ! window.location.hash || window.location.hash.length == 0 ) return;
+
+  var anchor = window.location.hash.substring(1);
+  console.debug( "Found anchor: %s; matching %s", anchor, "a[name=" + anchor + "]" );
+
+  highlightTarget( anchor );
+};
+
+function highlightClickTarget( event ) {
+  console.debug( "Highlighting click target for event %o", event.target );
+  try {
+    var anchor = $(event.target).attr( 'href' ).substring(1);
+    console.debug( "Found target anchor: %s", anchor );
+    highlightTarget( anchor );
+  } catch ( err ) {
+    console.error( "Exception while highlighting: %o", err );
+  };
+};
+
+
+$(document).ready( function() {
+  hookSourceViews();
+  hookDebuggingToggle();
+  hookSearch();
+  highlightLocationTarget();
+  hookTableOfContentsToggle();
+
+  $('ul.link-list a').bind( "click", highlightClickTarget );
+});
diff --git a/doc/js/jquery.js b/doc/js/jquery.js
new file mode 100644
index 0000000..48590ec
--- /dev/null
+++ b/doc/js/jquery.js
@@ -0,0 +1,18 @@
+/*!
+ * jQuery JavaScript Library v1.6.2
+ * http://jquery.com/
+ *
+ * Copyright 2011, John Resig
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * Includes Sizzle.js
+ * http://sizzlejs.com/
+ * Copyright 2011, The Dojo Foundation
+ * Released under the MIT, BSD, and GPL Licenses.
+ *
+ * Date: Thu Jun 30 14:16:56 2011 -0400
+ */
+(function(a,b){function cv(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cs(a){if(!cg[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){ch||(ch=c.createElement("iframe"),ch.frameBorder=ch.width=ch.height=0),b.appendChild(ch);if(!ci||!ch.createElement)ci=(ch.contentWindow||ch.contentDocument).document,ci.write((c.compatMode==="CSS1Compat"?"<!doctype html>":"")+"<html><body>"),ci.close();d=ci.createElement( [...]
+shift(),i.sort());if(!!e&&!f.event.customEvent[h]||!!f.event.global[h]){c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.exclusive=j,c.namespace=i.join("."),c.namespace_re=new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)");if(g||!e)c.preventDefault(),c.stopPropagation();if(!e){f.each(f.cache,function(){var a=f.expando,b=this[a];b&&b.events&&b.events[h]&&f.event.trigger(c,d,b.handle.elem)});return}if(e.nodeType===3||e.nodeType===8)return;c.result=b,c.tar [...]
+)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d=a.cloneNode(!0),e,g,h;if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bi(a,d),e=bj(a),g=bj(d);for(h=0;e[h];++h)bi(e[h],g[h])}if(b){bh(a,d);if(c){e=bj(a),g=bj(d);for(h=0;e[h];++h)bh(e[h],g[h])}}e=g=null;return d},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[],i;for(v [...]
\ No newline at end of file
diff --git a/doc/js/navigation.js b/doc/js/navigation.js
new file mode 100644
index 0000000..e412681
--- /dev/null
+++ b/doc/js/navigation.js
@@ -0,0 +1,142 @@
+/*
+ * Navigation allows movement using the arrow keys through the search results.
+ *
+ * When using this library you will need to set scrollIntoView to the
+ * appropriate function for your layout.  Use scrollInWindow if the container
+ * is not scrollable and scrollInElement if the container is a separate
+ * scrolling region.
+ */
+Navigation = new function() {
+  this.initNavigation = function() {
+    var _this = this;
+
+    $(document).keydown(function(e) {
+      _this.onkeydown(e);
+    }).keyup(function(e) {
+      _this.onkeyup(e);
+    });
+
+    this.navigationActive = true;
+  }
+
+  this.setNavigationActive = function(state) {
+    this.navigationActive = state;
+    this.clearMoveTimeout();
+  }
+
+  this.onkeyup = function(e) {
+    if (!this.navigationActive) return;
+
+    switch(e.keyCode) {
+      case 37: //Event.KEY_LEFT:
+      case 38: //Event.KEY_UP:
+      case 39: //Event.KEY_RIGHT:
+      case 40: //Event.KEY_DOWN:
+        this.clearMoveTimeout();
+        break;
+    }
+  }
+
+  this.onkeydown = function(e) {
+    if (!this.navigationActive) return;
+    switch(e.keyCode) {
+      case 37: //Event.KEY_LEFT:
+        if (this.moveLeft()) e.preventDefault();
+        break;
+      case 38: //Event.KEY_UP:
+        if (e.keyCode == 38 || e.ctrlKey) {
+          if (this.moveUp()) e.preventDefault();
+          this.startMoveTimeout(false);
+        }
+        break;
+      case 39: //Event.KEY_RIGHT:
+        if (this.moveRight()) e.preventDefault();
+        break;
+      case 40: //Event.KEY_DOWN:
+        if (e.keyCode == 40 || e.ctrlKey) {
+          if (this.moveDown()) e.preventDefault();
+          this.startMoveTimeout(true);
+        }
+        break;
+      case 13: //Event.KEY_RETURN:
+        if (this.$current)
+          e.preventDefault();
+          this.select(this.$current);
+        break;
+    }
+    if (e.ctrlKey && e.shiftKey) this.select(this.$current);
+  }
+
+  this.clearMoveTimeout = function() {
+    clearTimeout(this.moveTimeout);
+    this.moveTimeout = null;
+  }
+
+  this.startMoveTimeout = function(isDown) {
+    if (!$.browser.mozilla && !$.browser.opera) return;
+    if (this.moveTimeout) this.clearMoveTimeout();
+    var _this = this;
+
+    var go = function() {
+      if (!_this.moveTimeout) return;
+      _this[isDown ? 'moveDown' : 'moveUp']();
+      _this.moveTimout = setTimeout(go, 100);
+    }
+    this.moveTimeout = setTimeout(go, 200);
+  }
+
+  this.moveRight = function() {
+  }
+
+  this.moveLeft = function() {
+  }
+
+  this.move = function(isDown) {
+  }
+
+  this.moveUp = function() {
+    return this.move(false);
+  }
+
+  this.moveDown = function() {
+    return this.move(true);
+  }
+
+  /*
+   * Scrolls to the given element in the scrollable element view.
+   */
+  this.scrollInElement = function(element, view) {
+    var offset, viewHeight, viewScroll, height;
+    offset = element.offsetTop;
+    height = element.offsetHeight;
+    viewHeight = view.offsetHeight;
+    viewScroll = view.scrollTop;
+
+    if (offset - viewScroll + height > viewHeight) {
+      view.scrollTop = offset - viewHeight + height;
+    }
+    if (offset < viewScroll) {
+      view.scrollTop = offset;
+    }
+  }
+
+  /*
+   * Scrolls to the given element in the window.  The second argument is
+   * ignored
+   */
+  this.scrollInWindow = function(element, ignored) {
+    var offset, viewHeight, viewScroll, height;
+    offset = element.offsetTop;
+    height = element.offsetHeight;
+    viewHeight = window.innerHeight;
+    viewScroll = window.scrollY;
+
+    if (offset - viewScroll + height > viewHeight) {
+      window.scrollTo(window.scrollX, offset - viewHeight + height);
+    }
+    if (offset < viewScroll) {
+      window.scrollTo(window.scrollX, offset);
+    }
+  }
+}
+
diff --git a/doc/js/search.js b/doc/js/search.js
new file mode 100644
index 0000000..dbdfdcb
--- /dev/null
+++ b/doc/js/search.js
@@ -0,0 +1,94 @@
+Search = function(data, input, result) {
+  this.data = data;
+  this.$input = $(input);
+  this.$result = $(result);
+
+  this.$current = null;
+  this.$view = this.$result.parent();
+  this.searcher = new Searcher(data.index);
+  this.init();
+}
+
+Search.prototype = $.extend({}, Navigation, new function() {
+  var suid = 1;
+
+  this.init = function() {
+    var _this = this;
+    var observer = function() {
+      _this.search(_this.$input[0].value);
+    };
+    this.$input.keyup(observer);
+    this.$input.click(observer); // mac's clear field
+
+    this.searcher.ready(function(results, isLast) {
+      _this.addResults(results, isLast);
+    })
+
+    this.initNavigation();
+    this.setNavigationActive(false);
+  }
+
+  this.search = function(value, selectFirstMatch) {
+    value = jQuery.trim(value).toLowerCase();
+    if (value) {
+      this.setNavigationActive(true);
+    } else {
+      this.setNavigationActive(false);
+    }
+
+    if (value == '') {
+      this.lastQuery = value;
+      this.$result.empty();
+      this.setNavigationActive(false);
+    } else if (value != this.lastQuery) {
+      this.lastQuery = value;
+      this.firstRun = true;
+      this.searcher.find(value);
+    }
+  }
+
+  this.addResults = function(results, isLast) {
+    var target = this.$result.get(0);
+    if (this.firstRun && (results.length > 0 || isLast)) {
+      this.$current = null;
+      this.$result.empty();
+    }
+
+    for (var i=0, l = results.length; i < l; i++) {
+      target.appendChild(this.renderItem.call(this, results[i]));
+    };
+
+    if (this.firstRun && results.length > 0) {
+      this.firstRun = false;
+      this.$current = $(target.firstChild);
+      this.$current.addClass('current');
+    }
+    if (jQuery.browser.msie) this.$element[0].className += '';
+  }
+
+  this.move = function(isDown) {
+    if (!this.$current) return;
+    var $next = this.$current[isDown ? 'next' : 'prev']();
+    if ($next.length) {
+      this.$current.removeClass('current');
+      $next.addClass('current');
+      this.scrollIntoView($next[0], this.$view[0]);
+      this.$current = $next;
+    }
+    return true;
+  }
+
+  this.hlt = function(html) {
+    return this.escapeHTML(html).
+      replace(/\u0001/g, '<em>').
+      replace(/\u0002/g, '</em>');
+  }
+
+  this.escapeHTML = function(html) {
+    return html.replace(/[&<>]/g, function(c) {
+      return '&#' + c.charCodeAt(0) + ';';
+    });
+  }
+
+});
+
diff --git a/doc/js/search_index.js b/doc/js/search_index.js
new file mode 100644
index 0000000..cf27e8f
--- /dev/null
+++ b/doc/js/search_index.js
@@ -0,0 +1 @@
+var search_data = {"index":{"searchIndex":["rack","rubyprof","rubyprof","abstractprinter","aggregatecallinfo","callinfo","callinfoprinter","callinfovisitor","callstackprinter","calltreeprinter","cmd","dotprinter","flatprinter","flatprinterwithlinenumbers","graphhtmlprinter","graphprinter","methodinfo","multiprinter","profile","profiletask","test","thread","<=>()","aggregate_children()","aggregate_parents()","application()","arguments()","call()","call_sequence()","called()","called()","c [...]
\ No newline at end of file
diff --git a/doc/js/searcher.js b/doc/js/searcher.js
new file mode 100644
index 0000000..f854b54
--- /dev/null
+++ b/doc/js/searcher.js
@@ -0,0 +1,228 @@
+Searcher = function(data) {
+  this.data = data;
+  this.handlers = [];
+}
+
+Searcher.prototype = new function() {
+  // search is performed in chunks of 1000 for non-blocking user input
+  var CHUNK_SIZE = 1000;
+  // do not try to find more than 100 results
+  var MAX_RESULTS = 100;
+  var huid = 1;
+  var suid = 1;
+  var runs = 0;
+
+  this.find = function(query) {
+    var queries = splitQuery(query);
+    var regexps = buildRegexps(queries);
+    var highlighters = buildHilighters(queries);
+    var state = { from: 0, pass: 0, limit: MAX_RESULTS, n: suid++};
+    var _this = this;
+
+    this.currentSuid = state.n;
+
+    if (!query) return;
+
+    var run = function() {
+      // stop current search thread if new search started
+      if (state.n != _this.currentSuid) return;
+
+      var results =
+        performSearch(_this.data, regexps, queries, highlighters, state);
+      var hasMore = (state.limit > 0 && state.pass < 4);
+
+      triggerResults.call(_this, results, !hasMore);
+      if (hasMore) {
+        setTimeout(run, 2);
+      }
+      runs++;
+    };
+    runs = 0;
+
+    // start search thread
+    run();
+  }
+
+  /*  ----- Events ------  */
+  this.ready = function(fn) {
+    fn.huid = huid;
+    this.handlers.push(fn);
+  }
+
+  /*  ----- Utilities ------  */
+  function splitQuery(query) {
+    return jQuery.grep(query.split(/(\s+|::?|\(\)?)/), function(string) {
+      return string.match(/\S/)
+    });
+  }
+
+  function buildRegexps(queries) {
+    return jQuery.map(queries, function(query) {
+      return new RegExp(query.replace(/(.)/g, '([$1])([^$1]*?)'), 'i')
+    });
+  }
+
+  function buildHilighters(queries) {
+    return jQuery.map(queries, function(query) {
+      return jQuery.map(query.split(''), function(l, i) {
+        return '\u0001$' + (i*2+1) + '\u0002$' + (i*2+2);
+      }).join('');
+    });
+  }
+
+  // function longMatchRegexp(index, longIndex, regexps) {
+  //     for (var i = regexps.length - 1; i >= 0; i--){
+  //         if (!index.match(regexps[i]) && !longIndex.match(regexps[i])) return false;
+  //     };
+  //     return true;
+  // }
+
+
+  /*  ----- Mathchers ------  */
+
+  /*
+   * This record matches if the index starts with queries[0] and the record
+   * matches all of the regexps
+   */
+  function matchPassBeginning(index, longIndex, queries, regexps) {
+    if (index.indexOf(queries[0]) != 0) return false;
+    for (var i=1, l = regexps.length; i < l; i++) {
+      if (!index.match(regexps[i]) && !longIndex.match(regexps[i]))
+        return false;
+    };
+    return true;
+  }
+
+  /*
+   * This record matches if the longIndex starts with queries[0] and the
+   * longIndex matches all of the regexps
+   */
+  function matchPassLongIndex(index, longIndex, queries, regexps) {
+    if (longIndex.indexOf(queries[0]) != 0) return false;
+    for (var i=1, l = regexps.length; i < l; i++) {
+      if (!longIndex.match(regexps[i]))
+        return false;
+    };
+    return true;
+  }
+
+  /*
+   * This record matches if the index contains queries[0] and the record
+   * matches all of the regexps
+   */
+  function matchPassContains(index, longIndex, queries, regexps) {
+    if (index.indexOf(queries[0]) == -1) return false;
+    for (var i=1, l = regexps.length; i < l; i++) {
+      if (!index.match(regexps[i]) && !longIndex.match(regexps[i]))
+        return false;
+    };
+    return true;
+  }
+
+  /*
+   * This record matches if regexps[0] matches the index and the record
+   * matches all of the regexps
+   */
+  function matchPassRegexp(index, longIndex, queries, regexps) {
+    if (!index.match(regexps[0])) return false;
+    for (var i=1, l = regexps.length; i < l; i++) {
+      if (!index.match(regexps[i]) && !longIndex.match(regexps[i]))
+        return false;
+    };
+    return true;
+  }
+
+
+  /*  ----- Highlighters ------  */
+  function highlightRegexp(info, queries, regexps, highlighters) {
+    var result = createResult(info);
+    for (var i=0, l = regexps.length; i < l; i++) {
+      result.title = result.title.replace(regexps[i], highlighters[i]);
+      result.namespace = result.namespace.replace(regexps[i], highlighters[i]);
+    };
+    return result;
+  }
+
+  function hltSubstring(string, pos, length) {
+    return string.substring(0, pos) + '\u0001' + string.substring(pos, pos + length) + '\u0002' + string.substring(pos + length);
+  }
+
+  function highlightQuery(info, queries, regexps, highlighters) {
+    var result = createResult(info);
+    var pos = 0;
+    var lcTitle = result.title.toLowerCase();
+
+    pos = lcTitle.indexOf(queries[0]);
+    if (pos != -1) {
+      result.title = hltSubstring(result.title, pos, queries[0].length);
+    }
+
+    result.namespace = result.namespace.replace(regexps[0], highlighters[0]);
+    for (var i=1, l = regexps.length; i < l; i++) {
+      result.title = result.title.replace(regexps[i], highlighters[i]);
+      result.namespace = result.namespace.replace(regexps[i], highlighters[i]);
+    };
+    return result;
+  }
+
+  function createResult(info) {
+    var result = {};
+    result.title = info[0];
+    result.namespace = info[1];
+    result.path = info[2];
+    result.params = info[3];
+    result.snippet = info[4];
+    return result;
+  }
+
+  /*  ----- Searching ------  */
+  function performSearch(data, regexps, queries, highlighters, state) {
+    var searchIndex = data.searchIndex;
+    var longSearchIndex = data.longSearchIndex;
+    var info = data.info;
+    var result = [];
+    var i = state.from;
+    var l = searchIndex.length;
+    var togo = CHUNK_SIZE;
+    var matchFunc, hltFunc;
+
+    while (state.pass < 4 && state.limit > 0 && togo > 0) {
+      if (state.pass == 0) {
+        matchFunc = matchPassBeginning;
+        hltFunc = highlightQuery;
+      } else if (state.pass == 1) {
+        matchFunc = matchPassLongIndex;
+        hltFunc = highlightQuery;
+      } else if (state.pass == 2) {
+        matchFunc = matchPassContains;
+        hltFunc = highlightQuery;
+      } else if (state.pass == 3) {
+        matchFunc = matchPassRegexp;
+        hltFunc = highlightRegexp;
+      }
+
+      for (; togo > 0 && i < l && state.limit > 0; i++, togo--) {
+        if (info[i].n == state.n) continue;
+        if (matchFunc(searchIndex[i], longSearchIndex[i], queries, regexps)) {
+          info[i].n = state.n;
+          result.push(hltFunc(info[i], queries, regexps, highlighters));
+          state.limit--;
+        }
+      };
+      if (searchIndex.length <= i) {
+        state.pass++;
+        i = state.from = 0;
+      } else {
+        state.from = i;
+      }
+    }
+    return result;
+  }
+
+  function triggerResults(results, isLast) {
+    jQuery.each(this.handlers, function(i, fn) {
+      fn.call(this, results, isLast)
+    })
+  }
+}
+
diff --git a/doc/rdoc.css b/doc/rdoc.css
new file mode 100644
index 0000000..755b546
--- /dev/null
+++ b/doc/rdoc.css
@@ -0,0 +1,543 @@
+/*
+ * "Darkfish" Rdoc CSS
+ * $Id: rdoc.css 54 2009-01-27 01:09:48Z deveiant $
+ *
+ * Author: Michael Granger <ged at FaerieMUD.org>
+ *
+ */
+
+/* Base Green is: #6C8C22 */
+
+* { padding: 0; margin: 0; }
+
+body {
+  background: #efefef;
+  font: 14px "Helvetica Neue", Helvetica, Tahoma, sans-serif;
+  margin-left: 40px;
+}
+body.file-popup {
+  font-size: 90%;
+  margin-left: 0;
+}
+
+h1 {
+  font-size: 300%;
+  text-shadow: rgba(135,145,135,0.65) 2px 2px 3px;
+  color: #6C8C22;
+}
+h2,h3,h4 { margin-top: 1.5em; }
+
+:link,
+:visited {
+  color: #6C8C22;
+  text-decoration: none;
+}
+:link:hover,
+:visited:hover {
+  border-bottom: 1px dotted #6C8C22;
+}
+
+pre {
+  background: #ddd;
+  padding: 0.5em 0;
+}
+
+/* @group Generic Classes */
+
+.initially-hidden {
+  display: none;
+}
+
+#search-field {
+  width: 98%;
+  background: #eee;
+  border: none;
+  height: 1.5em;
+  -webkit-border-radius: 4px;
+}
+#search-field:focus {
+  background: #f1edba;
+}
+#search-field:-moz-placeholder,
+#search-field::-webkit-input-placeholder {
+  font-weight: bold;
+  color: #666;
+}
+
+.missing-docs {
+  font-size: 120%;
+  background: white url(images/wrench_orange.png) no-repeat 4px center;
+  color: #ccc;
+  line-height: 2em;
+  border: 1px solid #d00;
+  opacity: 1;
+  padding-left: 20px;
+  text-indent: 24px;
+  letter-spacing: 3px;
+  font-weight: bold;
+  -webkit-border-radius: 5px;
+  -moz-border-radius: 5px;
+}
+
+.target-section {
+  border: 2px solid #dcce90;
+  border-left-width: 8px;
+  padding: 0 1em;
+  background: #fff3c2;
+}
+
+/* @end */
+
+/* @group Index Page, Standalone file pages */
+.indexpage ul {
+  line-height: 160%;
+  list-style: none;
+}
+.indexpage ul :link,
+.indexpage ul :visited {
+  font-size: 16px;
+}
+
+.indexpage li {
+  padding-left: 20px;
+}
+
+.indexpage ul > li {
+  background: url(images/bullet_black.png) no-repeat left 4px;
+}
+.indexpage li.method {
+  background: url(images/plugin.png) no-repeat left 4px;
+}
+.indexpage li.module {
+  background: url(images/package.png) no-repeat left 4px;
+}
+.indexpage li.class {
+  background: url(images/ruby.png) no-repeat left 4px;
+}
+.indexpage li.file {
+  background: url(images/page_white_text.png) no-repeat left 4px;
+}
+.indexpage li li {
+  background: url(images/tag_blue.png) no-repeat left 4px;
+}
+.indexpage li .toc-toggle {
+  width: 16px;
+  height: 16px;
+  background: url(images/add.png) no-repeat;
+}
+
+.indexpage li .toc-toggle.open {
+  background: url(images/delete.png) no-repeat;
+}
+
+/* @end */
+
+/* @group Top-Level Structure */
+
+#metadata {
+  float: left;
+  width: 260px;
+}
+
+#documentation {
+  margin: 2em 1em 5em 300px;
+  min-width: 340px;
+}
+
+#validator-badges {
+  clear: both;
+  margin: 1em 1em 2em;
+  font-size: smaller;
+}
+
+/* @end */
+
+/* @group Metadata Section */
+#metadata .section {
+  background-color: #dedede;
+  -moz-border-radius: 5px;
+  -webkit-border-radius: 5px;
+  border: 1px solid #aaa;
+  margin: 0 8px 8px;
+  font-size: 90%;
+  overflow: hidden;
+}
+#metadata h3.section-header {
+  margin: 0;
+  padding: 2px 8px;
+  background: #ccc;
+  color: #666;
+  -moz-border-radius-topleft: 4px;
+  -moz-border-radius-topright: 4px;
+  -webkit-border-top-left-radius: 4px;
+  -webkit-border-top-right-radius: 4px;
+  border-bottom: 1px solid #aaa;
+}
+#metadata #home-section h3.section-header {
+  border-bottom: 0;
+}
+
+#metadata ul,
+#metadata dl,
+#metadata p {
+  padding:  8px;
+  list-style: none;
+}
+
+#file-metadata {
+  margin-top: 2em;
+}
+
+#file-metadata ul {
+  padding-left: 28px;
+  list-style-image: url(images/page_green.png);
+}
+
+dl.svninfo {
+  color: #666;
+  margin: 0;
+}
+dl.svninfo dt {
+  font-weight: bold;
+}
+
+ul.link-list li {
+  white-space: nowrap;
+}
+ul.link-list .type {
+  font-size: 8px;
+  text-transform: uppercase;
+  color: white;
+  background: #969696;
+  padding: 2px 4px;
+  -webkit-border-radius: 5px;
+}
+
+/* @end */
+
+/* @group Class Metadata Section */
+#class-metadata {
+  margin-top: 2em;
+}
+/* @end */
+
+/* @group Project Metadata Section */
+#project-metadata {
+  margin-top: 2em;
+}
+
+#project-metadata .section {
+  border: 1px solid #aaa;
+}
+#project-metadata h3.section-header {
+  border-bottom: 1px solid #aaa;
+  position: relative;
+}
+
+#project-metadata form {
+  color: #777;
+  background: #ccc;
+}
+
+/* @end */
+
+/* @group Documentation Section */
+.description {
+  font-size: 100%;
+  color: #333;
+}
+
+.description p {
+  margin: 1em 0.4em;
+}
+
+.description li p {
+  margin: 0;
+}
+
+.description ol,
+.description ul {
+  margin-left: 1.5em;
+}
+.description ol li,
+.description ul li {
+  line-height: 1.4em;
+}
+
+.note-list {
+  margin: 8px 0;
+}
+
+.label-list {
+  margin: 8px 1.5em;
+  border: 1px solid #ccc;
+}
+.description .label-list {
+  font-size: 14px;
+}
+
+.note-list dt {
+  font-weight: bold;
+}
+.note-list dd {
+  padding: 0 12px;
+}
+
+.label-list dt {
+  padding: 2px 4px;
+  font-weight: bold;
+  background: #ddd;
+}
+.label-list dd {
+  padding: 2px 12px;
+}
+.label-list dd + dt,
+.note-list dd + dt {
+  margin-top: 0.7em;
+}
+
+#documentation .section {
+  font-size: 90%;
+}
+
+#documentation h2.section-header {
+  margin-top: 1em;
+  padding: 0.25em 0.5em;
+  background: #ccc;
+  color: #333;
+  font-size: 175%;
+  border: 1px solid #bbb;
+  -moz-border-radius: 3px;
+  -webkit-border-radius: 3px;
+}
+
+.documentation-section-title {
+  position: relative;
+}
+.documentation-section-title .section-click-top {
+  position: absolute;
+  top: 6px;
+  right: 12px;
+  font-size: 10px;
+  color: #9b9877;
+  visibility: hidden;
+  padding-right: 0.5px;
+}
+
+.documentation-section-title:hover .section-click-top {
+  visibility: visible;
+}
+
+#documentation h3.section-header {
+  margin-top: 1em;
+  padding: 0.25em 0.5em;
+  background-color: #dedede;
+  color: #333;
+  font-size: 150%;
+  border: 1px solid #bbb;
+  -moz-border-radius: 3px;
+  -webkit-border-radius: 3px;
+}
+
+#constants-list > dl,
+#attributes-list > dl {
+  margin: 1em 0 2em;
+  border: 0;
+}
+#constants-list > dl dt,
+#attributes-list > dl dt {
+  padding-left: 0;
+  font-weight: bold;
+  font-family: Monaco, "Andale Mono";
+  background: inherit;
+}
+#constants-list > dl dt a,
+#attributes-list > dl dt a {
+  color: inherit;
+}
+#constants-list > dl dd,
+#attributes-list > dl dd {
+  margin: 0 0 1em 0;
+  padding: 0;
+  color: #666;
+}
+
+.documentation-section h2 {
+  position: relative;
+}
+
+.documentation-section h2 a {
+  position: absolute;
+  top: 8px;
+  right: 10px;
+  font-size: 12px;
+  color: #9b9877;
+  visibility: hidden;
+}
+
+.documentation-section h2:hover a {
+  visibility: visible;
+}
+
+/* @group Method Details */
+
+#documentation .method-source-code {
+  display: none;
+}
+
+#documentation .method-detail {
+  margin: 0.5em 0;
+  padding: 0.5em 0;
+  cursor: pointer;
+}
+#documentation .method-detail:hover {
+  background-color: #f1edba;
+}
+#documentation .method-heading {
+  position: relative;
+  padding: 2px 4px 0 20px;
+  font-size: 125%;
+  font-weight: bold;
+  color: #333;
+  background: url(images/brick.png) no-repeat left bottom;
+}
+#documentation .method-heading :link,
+#documentation .method-heading :visited {
+  color: inherit;
+}
+#documentation .method-click-advice {
+  position: absolute;
+  top: 2px;
+  right: 5px;
+  font-size: 10px;
+  color: #9b9877;
+  visibility: hidden;
+  padding-right: 20px;
+  line-height: 20px;
+  background: url(images/zoom.png) no-repeat right top;
+}
+#documentation .method-heading:hover .method-click-advice {
+  visibility: visible;
+}
+
+#documentation .method-alias .method-heading {
+  color: #666;
+  background: url(images/brick_link.png) no-repeat left bottom;
+}
+
+#documentation .method-description,
+#documentation .aliases {
+  margin: 0 20px;
+  color: #666;
+}
+
+#documentation .method-description p,
+#documentation .aliases p {
+  line-height: 1.2em;
+}
+
+#documentation .aliases {
+  padding-top: 4px;
+  font-style: italic;
+  cursor: default;
+}
+#documentation .method-description p {
+  margin-bottom: 0.5em;
+}
+#documentation .method-description ul {
+  margin-left: 1.5em;
+}
+pre {
+  margin: 0.5em 0;
+}
+
+#documentation .attribute-method-heading {
+  background: url(images/tag_green.png) no-repeat left bottom;
+}
+#documentation #attribute-method-details .method-detail:hover {
+  background-color: transparent;
+  cursor: default;
+}
+#documentation .attribute-access-type {
+  font-size: 60%;
+  text-transform: uppercase;
+  vertical-align: super;
+  padding: 0 2px;
+}
+/* @end */
+
+/* @end */
+
+/* @group Source Code */
+
+pre {
+  overflow: auto;
+  background: #262626;
+  color: white;
+  border: 1px dashed #999;
+  padding: 0.5em;
+}
+
+.description pre {
+  margin: 0 0.4em;
+}
+
+.ruby-constant   { color: #7fffd4; background: transparent; }
+.ruby-keyword    { color: #00ffff; background: transparent; }
+.ruby-ivar       { color: #eedd82; background: transparent; }
+.ruby-operator   { color: #00ffee; background: transparent; }
+.ruby-identifier { color: #ffdead; background: transparent; }
+.ruby-node       { color: #ffa07a; background: transparent; }
+.ruby-comment    { color: #dc0000; font-weight: bold; background: transparent; }
+.ruby-regexp     { color: #ffa07a; background: transparent; }
+.ruby-value      { color: #7fffd4; background: transparent; }
+
+/* @end */
+
+
+/* @group search results */
+#search-results h1 {
+  font-size: 1em;
+  font-weight: normal;
+  text-shadow: none;
+}
+
+#search-results .current {
+  background: #ccc;
+  border-bottom: 1px solid transparent;
+}
+
+#search-results li {
+  list-style: none;
+  border-bottom: 1px solid #aaa;
+  -moz-border-radius: 4px;
+  -webkit-border-radius: 4px;
+  border-radius: 4px;
+  margin-bottom: 0.5em;
+}
+
+#search-results li:last-child {
+  border-bottom: none;
+  margin-bottom: 0;
+}
+
+#search-results li p {
+  padding: 0;
+  margin: 0.5em;
+}
+
+#search-results .search-namespace {
+  font-weight: bold;
+}
+
+#search-results li em {
+  background: yellow;
+  font-style: normal;
+}
+
+#search-results pre {
+  margin: 0.5em;
+}
+
+/* @end */
+
diff --git a/doc/table_of_contents.html b/doc/table_of_contents.html
new file mode 100644
index 0000000..3a8df64
--- /dev/null
+++ b/doc/table_of_contents.html
@@ -0,0 +1,462 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+
+<title>Table of Contents - ruby-prof</title>
+
+<link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">
+
+<script type="text/javascript">
+  var rdoc_rel_prefix = "./";
+</script>
+
+<script type="text/javascript" charset="utf-8" src="./js/jquery.js"></script>
+<script type="text/javascript" charset="utf-8" src="./js/navigation.js"></script>
+<script type="text/javascript" charset="utf-8" src="./js/search_index.js"></script>
+<script type="text/javascript" charset="utf-8" src="./js/search.js"></script>
+<script type="text/javascript" charset="utf-8" src="./js/searcher.js"></script>
+<script type="text/javascript" charset="utf-8" src="./js/darkfish.js"></script>
+
+
+<body class="indexpage">
+<h1>Table of Contents - ruby-prof</h1>
+
+<h2>Pages</h2>
+<ul>
+  <li class="file">
+    <a href="LICENSE.html">LICENSE</a>
+  </li>
+    <li class="file">
+    <a href="README_rdoc.html">README</a>
+
+    <img class="toc-toggle" src="images/transparent.png" alt="" title="toggle headings">
+    <ul class="initially-hidden">
+      <li><a href="README_rdoc.html#label-ruby-prof">ruby-prof</a>
+      <li><a href="README_rdoc.html#label-Overview">Overview</a>
+      <li><a href="README_rdoc.html#label-Requirements">Requirements</a>
+      <li><a href="README_rdoc.html#label-Install">Install</a>
+      <li><a href="README_rdoc.html#label-Usage">Usage</a>
+      <li><a href="README_rdoc.html#label-ruby-prof+executable">ruby-prof executable</a>
+      <li><a href="README_rdoc.html#label-ruby-prof+API">ruby-prof API</a>
+      <li><a href="README_rdoc.html#label-Method+and+Thread+Elimination">Method and Thread Elimination</a>
+      <li><a href="README_rdoc.html#label-Benchmarking+full+load+time+including+rubygems+startup+cost+%3D%3D">Benchmarking full load time including rubygems startup cost ==</a>
+      <li><a href="README_rdoc.html#label-Profiling+Tests">Profiling Tests</a>
+      <li><a href="README_rdoc.html#label-Profiling+Rails">Profiling Rails</a>
+      <li><a href="README_rdoc.html#label-Reports">Reports</a>
+      <li><a href="README_rdoc.html#label-Printers">Printers</a>
+      <li><a href="README_rdoc.html#label-Measurements">Measurements</a>
+      <li><a href="README_rdoc.html#label-Multi-threaded+Applications">Multi-threaded Applications</a>
+      <li><a href="README_rdoc.html#label-Performance">Performance</a>
+      <li><a href="README_rdoc.html#label-License">License</a>
+      <li><a href="README_rdoc.html#label-Development">Development</a>
+    </ul>
+  </li>
+    <li class="file">
+    <a href="examples/flat_txt.html">flat</a>
+
+    <img class="toc-toggle" src="images/transparent.png" alt="" title="toggle headings">
+    <ul class="initially-hidden">
+      <li><a href="examples/flat_txt.html#label-Flat+Profiles">Flat Profiles</a>
+    </ul>
+  </li>
+    <li class="file">
+    <a href="examples/graph_txt.html">graph</a>
+
+    <img class="toc-toggle" src="images/transparent.png" alt="" title="toggle headings">
+    <ul class="initially-hidden">
+      <li><a href="examples/graph_txt.html#label-Graph+Profiles">Graph Profiles</a>
+      <li><a href="examples/graph_txt.html#label-Overview">Overview</a>
+      <li><a href="examples/graph_txt.html#label-Parents">Parents</a>
+      <li><a href="examples/graph_txt.html#label-Children">Children</a>
+    </ul>
+  </li>
+  
+</ul>
+
+<h2 id="classes">Classes/Modules</h2>
+<ul>
+  <li class="module">
+    <a href="RubyProf.html">RubyProf</a>
+  </li>
+    <li class="class">
+    <a href="RubyProf/AbstractPrinter.html">RubyProf::AbstractPrinter</a>
+  </li>
+    <li class="class">
+    <a href="RubyProf/AggregateCallInfo.html">RubyProf::AggregateCallInfo</a>
+  </li>
+    <li class="class">
+    <a href="RubyProf/CallInfo.html">RubyProf::CallInfo</a>
+  </li>
+    <li class="class">
+    <a href="RubyProf/CallInfoPrinter.html">RubyProf::CallInfoPrinter</a>
+  </li>
+    <li class="class">
+    <a href="RubyProf/CallInfoVisitor.html">RubyProf::CallInfoVisitor</a>
+  </li>
+    <li class="class">
+    <a href="RubyProf/CallStackPrinter.html">RubyProf::CallStackPrinter</a>
+  </li>
+    <li class="class">
+    <a href="RubyProf/CallTreePrinter.html">RubyProf::CallTreePrinter</a>
+  </li>
+    <li class="class">
+    <a href="RubyProf/Cmd.html">RubyProf::Cmd</a>
+  </li>
+    <li class="class">
+    <a href="RubyProf/DotPrinter.html">RubyProf::DotPrinter</a>
+  </li>
+    <li class="class">
+    <a href="RubyProf/FlatPrinter.html">RubyProf::FlatPrinter</a>
+  </li>
+    <li class="class">
+    <a href="RubyProf/FlatPrinterWithLineNumbers.html">RubyProf::FlatPrinterWithLineNumbers</a>
+  </li>
+    <li class="class">
+    <a href="RubyProf/GraphHtmlPrinter.html">RubyProf::GraphHtmlPrinter</a>
+  </li>
+    <li class="class">
+    <a href="RubyProf/GraphPrinter.html">RubyProf::GraphPrinter</a>
+  </li>
+    <li class="class">
+    <a href="RubyProf/MethodInfo.html">RubyProf::MethodInfo</a>
+  </li>
+    <li class="class">
+    <a href="RubyProf/MultiPrinter.html">RubyProf::MultiPrinter</a>
+  </li>
+    <li class="class">
+    <a href="RubyProf/Profile.html">RubyProf::Profile</a>
+  </li>
+    <li class="class">
+    <a href="RubyProf/ProfileTask.html">RubyProf::ProfileTask</a>
+  </li>
+    <li class="module">
+    <a href="RubyProf/Test.html">RubyProf::Test</a>
+  </li>
+    <li class="class">
+    <a href="RubyProf/Thread.html">RubyProf::Thread</a>
+  </li>
+    <li class="module">
+    <a href="Rack.html">Rack</a>
+  </li>
+    <li class="class">
+    <a href="Rack/RubyProf.html">Rack::RubyProf</a>
+  </li>
+  
+</ul>
+
+<h2 id="methods">Methods</h2>
+<ul>
+  
+    <li class="method"><a href="RubyProf.html#method-c-cpu_frequency">::cpu_frequency — RubyProf</a>
+  
+    <li class="method"><a href="RubyProf.html#method-c-cpu_frequency-3D">::cpu_frequency= — RubyProf</a>
+  
+    <li class="method"><a href="RubyProf.html#method-c-exclude_threads">::exclude_threads — RubyProf</a>
+  
+    <li class="method"><a href="RubyProf.html#method-c-exclude_threads-3D">::exclude_threads= — RubyProf</a>
+  
+    <li class="method"><a href="RubyProf.html#method-c-figure_measure_mode">::figure_measure_mode — RubyProf</a>
+  
+    <li class="method"><a href="RubyProf.html#method-c-measure_allocations">::measure_allocations — RubyProf</a>
+  
+    <li class="method"><a href="RubyProf.html#method-c-measure_cpu_time">::measure_cpu_time — RubyProf</a>
+  
+    <li class="method"><a href="RubyProf.html#method-c-measure_gc_runs">::measure_gc_runs — RubyProf</a>
+  
+    <li class="method"><a href="RubyProf.html#method-c-measure_gc_time">::measure_gc_time — RubyProf</a>
+  
+    <li class="method"><a href="RubyProf.html#method-c-measure_memory">::measure_memory — RubyProf</a>
+  
+    <li class="method"><a href="RubyProf.html#method-c-measure_mode">::measure_mode — RubyProf</a>
+  
+    <li class="method"><a href="RubyProf.html#method-c-measure_mode-3D">::measure_mode= — RubyProf</a>
+  
+    <li class="method"><a href="RubyProf.html#method-c-measure_process_time">::measure_process_time — RubyProf</a>
+  
+    <li class="method"><a href="RubyProf.html#method-c-measure_wall_time">::measure_wall_time — RubyProf</a>
+  
+    <li class="method"><a href="RubyProf/Cmd.html#method-c-new">::new — RubyProf::Cmd</a>
+  
+    <li class="method"><a href="RubyProf/AbstractPrinter.html#method-c-new">::new — RubyProf::AbstractPrinter</a>
+  
+    <li class="method"><a href="Rack/RubyProf.html#method-c-new">::new — Rack::RubyProf</a>
+  
+    <li class="method"><a href="RubyProf/AggregateCallInfo.html#method-c-new">::new — RubyProf::AggregateCallInfo</a>
+  
+    <li class="method"><a href="RubyProf/CallInfoVisitor.html#method-c-new">::new — RubyProf::CallInfoVisitor</a>
+  
+    <li class="method"><a href="RubyProf/Profile.html#method-c-new">::new — RubyProf::Profile</a>
+  
+    <li class="method"><a href="RubyProf/ProfileTask.html#method-c-new">::new — RubyProf::ProfileTask</a>
+  
+    <li class="method"><a href="RubyProf/MultiPrinter.html#method-c-new">::new — RubyProf::MultiPrinter</a>
+  
+    <li class="method"><a href="RubyProf/DotPrinter.html#method-c-new">::new — RubyProf::DotPrinter</a>
+  
+    <li class="method"><a href="RubyProf.html#method-c-pause">::pause — RubyProf</a>
+  
+    <li class="method"><a href="RubyProf/Profile.html#method-c-profile">::profile — RubyProf::Profile</a>
+  
+    <li class="method"><a href="RubyProf.html#method-c-profile">::profile — RubyProf</a>
+  
+    <li class="method"><a href="RubyProf.html#method-c-resume">::resume — RubyProf</a>
+  
+    <li class="method"><a href="RubyProf.html#method-c-running-3F">::running? — RubyProf</a>
+  
+    <li class="method"><a href="RubyProf.html#method-c-start">::start — RubyProf</a>
+  
+    <li class="method"><a href="RubyProf.html#method-c-start_script">::start_script — RubyProf</a>
+  
+    <li class="method"><a href="RubyProf.html#method-c-stop">::stop — RubyProf</a>
+  
+    <li class="method"><a href="RubyProf/MethodInfo.html#method-i-3C-3D-3E">#<=> — RubyProf::MethodInfo</a>
+  
+    <li class="method"><a href="RubyProf/MethodInfo.html#method-i-aggregate_children">#aggregate_children — RubyProf::MethodInfo</a>
+  
+    <li class="method"><a href="RubyProf/MethodInfo.html#method-i-aggregate_parents">#aggregate_parents — RubyProf::MethodInfo</a>
+  
+    <li class="method"><a href="RubyProf/CallStackPrinter.html#method-i-application">#application — RubyProf::CallStackPrinter</a>
+  
+    <li class="method"><a href="RubyProf/CallStackPrinter.html#method-i-arguments">#arguments — RubyProf::CallStackPrinter</a>
+  
+    <li class="method"><a href="Rack/RubyProf.html#method-i-call">#call — Rack::RubyProf</a>
+  
+    <li class="method"><a href="RubyProf/CallInfo.html#method-i-call_sequence">#call_sequence — RubyProf::CallInfo</a>
+  
+    <li class="method"><a href="RubyProf/AggregateCallInfo.html#method-i-called">#called — RubyProf::AggregateCallInfo</a>
+  
+    <li class="method"><a href="RubyProf/MethodInfo.html#method-i-called">#called — RubyProf::MethodInfo</a>
+  
+    <li class="method"><a href="RubyProf/AggregateCallInfo.html#method-i-children">#children — RubyProf::AggregateCallInfo</a>
+  
+    <li class="method"><a href="RubyProf/MethodInfo.html#method-i-children">#children — RubyProf::MethodInfo</a>
+  
+    <li class="method"><a href="RubyProf/CallInfo.html#method-i-children_time">#children_time — RubyProf::CallInfo</a>
+  
+    <li class="method"><a href="RubyProf/AggregateCallInfo.html#method-i-children_time">#children_time — RubyProf::AggregateCallInfo</a>
+  
+    <li class="method"><a href="RubyProf/MethodInfo.html#method-i-children_time">#children_time — RubyProf::MethodInfo</a>
+  
+    <li class="method"><a href="RubyProf/ProfileTask.html#method-i-clean_output_directory">#clean_output_directory — RubyProf::ProfileTask</a>
+  
+    <li class="method"><a href="RubyProf/CallStackPrinter.html#method-i-color">#color — RubyProf::CallStackPrinter</a>
+  
+    <li class="method"><a href="RubyProf/CallTreePrinter.html#method-i-convert">#convert — RubyProf::CallTreePrinter</a>
+  
+    <li class="method"><a href="RubyProf/CallStackPrinter.html#method-i-copy_image_files">#copy_image_files — RubyProf::CallStackPrinter</a>
+  
+    <li class="method"><a href="RubyProf/GraphHtmlPrinter.html#method-i-create_link">#create_link — RubyProf::GraphHtmlPrinter</a>
+  
+    <li class="method"><a href="RubyProf/ProfileTask.html#method-i-create_output_directory">#create_output_directory — RubyProf::ProfileTask</a>
+  
+    <li class="method"><a href="RubyProf/ProfileTask.html#method-i-define">#define — RubyProf::ProfileTask</a>
+  
+    <li class="method"><a href="RubyProf/Profile.html#method-i-detect_recursion">#detect_recursion — RubyProf::Profile</a>
+  
+    <li class="method"><a href="RubyProf/CallStackPrinter.html#method-i-dump">#dump — RubyProf::CallStackPrinter</a>
+  
+    <li class="method"><a href="RubyProf/CallInfo.html#method-i-eliminate-21">#eliminate! — RubyProf::CallInfo</a>
+  
+    <li class="method"><a href="RubyProf/MethodInfo.html#method-i-eliminate-21">#eliminate! — RubyProf::MethodInfo</a>
+  
+    <li class="method"><a href="RubyProf/Profile.html#method-i-eliminate_methods-21">#eliminate_methods! — RubyProf::Profile</a>
+  
+    <li class="method"><a href="RubyProf/CallStackPrinter.html#method-i-expansion">#expansion — RubyProf::CallStackPrinter</a>
+  
+    <li class="method"><a href="RubyProf/CallTreePrinter.html#method-i-file">#file — RubyProf::CallTreePrinter</a>
+  
+    <li class="method"><a href="RubyProf/GraphHtmlPrinter.html#method-i-file_link">#file_link — RubyProf::GraphHtmlPrinter</a>
+  
+    <li class="method"><a href="RubyProf/CallInfo.html#method-i-find_call">#find_call — RubyProf::CallInfo</a>
+  
+    <li class="method"><a href="RubyProf/MultiPrinter.html#method-i-flat_profile">#flat_profile — RubyProf::MultiPrinter</a>
+  
+    <li class="method"><a href="RubyProf/Test.html#method-i-format_profile_total">#format_profile_total — RubyProf::Test</a>
+  
+    <li class="method"><a href="RubyProf/CallStackPrinter.html#method-i-graph_link">#graph_link — RubyProf::CallStackPrinter</a>
+  
+    <li class="method"><a href="RubyProf/MultiPrinter.html#method-i-graph_profile">#graph_profile — RubyProf::MultiPrinter</a>
+  
+    <li class="method"><a href="RubyProf/AggregateCallInfo.html#method-i-line">#line — RubyProf::AggregateCallInfo</a>
+  
+    <li class="method"><a href="RubyProf/CallStackPrinter.html#method-i-link">#link — RubyProf::CallStackPrinter</a>
+  
+    <li class="method"><a href="RubyProf/Cmd.html#method-i-load_pre_execs">#load_pre_execs — RubyProf::Cmd</a>
+  
+    <li class="method"><a href="RubyProf/Cmd.html#method-i-load_pre_libs">#load_pre_libs — RubyProf::Cmd</a>
+  
+    <li class="method"><a href="RubyProf/Test.html#method-i-measure_mode_name">#measure_mode_name — RubyProf::Test</a>
+  
+    <li class="method"><a href="RubyProf/CallInfo.html#method-i-merge_call_tree">#merge_call_tree — RubyProf::CallInfo</a>
+  
+    <li class="method"><a href="RubyProf/GraphHtmlPrinter.html#method-i-method_href">#method_href — RubyProf::GraphHtmlPrinter</a>
+  
+    <li class="method"><a href="RubyProf/CallStackPrinter.html#method-i-method_href">#method_href — RubyProf::CallStackPrinter</a>
+  
+    <li class="method"><a href="RubyProf/AbstractPrinter.html#method-i-method_name">#method_name — RubyProf::AbstractPrinter</a>
+  
+    <li class="method"><a href="RubyProf/MethodInfo.html#method-i-min_depth">#min_depth — RubyProf::MethodInfo</a>
+  
+    <li class="method"><a href="RubyProf/AbstractPrinter.html#method-i-min_percent">#min_percent — RubyProf::AbstractPrinter</a>
+  
+    <li class="method"><a href="RubyProf/CallStackPrinter.html#method-i-name">#name — RubyProf::CallStackPrinter</a>
+  
+    <li class="method"><a href="RubyProf/Cmd.html#method-i-option_parser">#option_parser — RubyProf::Cmd</a>
+  
+    <li class="method"><a href="RubyProf/Test.html#method-i-output_dir">#output_dir — RubyProf::Test</a>
+  
+    <li class="method"><a href="RubyProf/ProfileTask.html#method-i-output_directory">#output_directory — RubyProf::ProfileTask</a>
+  
+    <li class="method"><a href="RubyProf/AggregateCallInfo.html#method-i-parent">#parent — RubyProf::AggregateCallInfo</a>
+  
+    <li class="method"><a href="RubyProf/Cmd.html#method-i-parse_args">#parse_args — RubyProf::Cmd</a>
+  
+    <li class="method"><a href="RubyProf/Profile.html#method-i-pause">#pause — RubyProf::Profile</a>
+  
+    <li class="method"><a href="RubyProf/Profile.html#method-i-paused-3F">#paused? — RubyProf::Profile</a>
+  
+    <li class="method"><a href="RubyProf/Profile.html#method-i-post_process">#post_process — RubyProf::Profile</a>
+  
+    <li class="method"><a href="RubyProf/CallTreePrinter.html#method-i-print">#print — RubyProf::CallTreePrinter</a>
+  
+    <li class="method"><a href="RubyProf/AbstractPrinter.html#method-i-print">#print — RubyProf::AbstractPrinter</a>
+  
+    <li class="method"><a href="RubyProf/GraphHtmlPrinter.html#method-i-print">#print — RubyProf::GraphHtmlPrinter</a>
+  
+    <li class="method"><a href="RubyProf/DotPrinter.html#method-i-print">#print — RubyProf::DotPrinter</a>
+  
+    <li class="method"><a href="Rack/RubyProf.html#method-i-print">#print — Rack::RubyProf</a>
+  
+    <li class="method"><a href="RubyProf/MultiPrinter.html#method-i-print">#print — RubyProf::MultiPrinter</a>
+  
+    <li class="method"><a href="RubyProf/CallStackPrinter.html#method-i-print">#print — RubyProf::CallStackPrinter</a>
+  
+    <li class="method"><a href="RubyProf/CallStackPrinter.html#method-i-print_commands">#print_commands — RubyProf::CallStackPrinter</a>
+  
+    <li class="method"><a href="RubyProf/CallStackPrinter.html#method-i-print_css">#print_css — RubyProf::CallStackPrinter</a>
+  
+    <li class="method"><a href="RubyProf/AbstractPrinter.html#method-i-print_file">#print_file — RubyProf::AbstractPrinter</a>
+  
+    <li class="method"><a href="RubyProf/CallStackPrinter.html#method-i-print_footer">#print_footer — RubyProf::CallStackPrinter</a>
+  
+    <li class="method"><a href="RubyProf/AbstractPrinter.html#method-i-print_footer">#print_footer — RubyProf::AbstractPrinter</a>
+  
+    <li class="method"><a href="RubyProf/CallStackPrinter.html#method-i-print_header">#print_header — RubyProf::CallStackPrinter</a>
+  
+    <li class="method"><a href="RubyProf/AbstractPrinter.html#method-i-print_header">#print_header — RubyProf::AbstractPrinter</a>
+  
+    <li class="method"><a href="RubyProf/CallStackPrinter.html#method-i-print_help">#print_help — RubyProf::CallStackPrinter</a>
+  
+    <li class="method"><a href="RubyProf/CallStackPrinter.html#method-i-print_java_script">#print_java_script — RubyProf::CallStackPrinter</a>
+  
+    <li class="method"><a href="RubyProf/FlatPrinterWithLineNumbers.html#method-i-print_methods">#print_methods — RubyProf::FlatPrinterWithLineNumbers</a>
+  
+    <li class="method"><a href="RubyProf/CallStackPrinter.html#method-i-print_stack">#print_stack — RubyProf::CallStackPrinter</a>
+  
+    <li class="method"><a href="RubyProf/AbstractPrinter.html#method-i-print_thread">#print_thread — RubyProf::AbstractPrinter</a>
+  
+    <li class="method"><a href="RubyProf/CallTreePrinter.html#method-i-print_thread">#print_thread — RubyProf::CallTreePrinter</a>
+  
+    <li class="method"><a href="RubyProf/CallTreePrinter.html#method-i-print_threads">#print_threads — RubyProf::CallTreePrinter</a>
+  
+    <li class="method"><a href="RubyProf/AbstractPrinter.html#method-i-print_threads">#print_threads — RubyProf::AbstractPrinter</a>
+  
+    <li class="method"><a href="RubyProf/CallStackPrinter.html#method-i-print_title_bar">#print_title_bar — RubyProf::CallStackPrinter</a>
+  
+    <li class="method"><a href="RubyProf/MethodInfo.html#method-i-recursive-3F">#recursive? — RubyProf::MethodInfo</a>
+  
+    <li class="method"><a href="RubyProf/Test.html#method-i-report_filename">#report_filename — RubyProf::Test</a>
+  
+    <li class="method"><a href="RubyProf/Test.html#method-i-report_profile">#report_profile — RubyProf::Test</a>
+  
+    <li class="method"><a href="RubyProf/Profile.html#method-i-resume">#resume — RubyProf::Profile</a>
+  
+    <li class="method"><a href="RubyProf/MethodInfo.html#method-i-root-3F">#root? — RubyProf::MethodInfo</a>
+  
+    <li class="method"><a href="RubyProf/CallInfo.html#method-i-root-3F">#root? — RubyProf::CallInfo</a>
+  
+    <li class="method"><a href="RubyProf/Cmd.html#method-i-run">#run — RubyProf::Cmd</a>
+  
+    <li class="method"><a href="RubyProf/Test.html#method-i-run">#run — RubyProf::Test</a>
+  
+    <li class="method"><a href="RubyProf/Test.html#method-i-run_profile">#run_profile — RubyProf::Test</a>
+  
+    <li class="method"><a href="RubyProf/ProfileTask.html#method-i-run_script">#run_script — RubyProf::ProfileTask</a>
+  
+    <li class="method"><a href="RubyProf/Test.html#method-i-run_test">#run_test — RubyProf::Test</a>
+  
+    <li class="method"><a href="RubyProf/Test.html#method-i-run_warmup">#run_warmup — RubyProf::Test</a>
+  
+    <li class="method"><a href="RubyProf/Profile.html#method-i-running-3F">#running? — RubyProf::Profile</a>
+  
+    <li class="method"><a href="RubyProf/AggregateCallInfo.html#method-i-self_time">#self_time — RubyProf::AggregateCallInfo</a>
+  
+    <li class="method"><a href="RubyProf/MethodInfo.html#method-i-self_time">#self_time — RubyProf::MethodInfo</a>
+  
+    <li class="method"><a href="RubyProf/GraphHtmlPrinter.html#method-i-setup_options">#setup_options — RubyProf::GraphHtmlPrinter</a>
+  
+    <li class="method"><a href="RubyProf/AbstractPrinter.html#method-i-setup_options">#setup_options — RubyProf::AbstractPrinter</a>
+  
+    <li class="method"><a href="RubyProf/Cmd.html#method-i-setup_options">#setup_options — RubyProf::Cmd</a>
+  
+    <li class="method"><a href="RubyProf/AbstractPrinter.html#method-i-sort_method">#sort_method — RubyProf::AbstractPrinter</a>
+  
+    <li class="method"><a href="RubyProf/FlatPrinter.html#method-i-sort_method">#sort_method — RubyProf::FlatPrinter</a>
+  
+    <li class="method"><a href="RubyProf/CallInfo.html#method-i-stack">#stack — RubyProf::CallInfo</a>
+  
+    <li class="method"><a href="RubyProf/MultiPrinter.html#method-i-stack_profile">#stack_profile — RubyProf::MultiPrinter</a>
+  
+    <li class="method"><a href="RubyProf/Profile.html#method-i-start">#start — RubyProf::Profile</a>
+  
+    <li class="method"><a href="RubyProf/Profile.html#method-i-stop">#stop — RubyProf::Profile</a>
+  
+    <li class="method"><a href="RubyProf/CallStackPrinter.html#method-i-sum">#sum — RubyProf::CallStackPrinter</a>
+  
+    <li class="method"><a href="RubyProf/AggregateCallInfo.html#method-i-target">#target — RubyProf::AggregateCallInfo</a>
+  
+    <li class="method"><a href="RubyProf/GraphHtmlPrinter.html#method-i-template">#template — RubyProf::GraphHtmlPrinter</a>
+  
+    <li class="method"><a href="RubyProf/Profile.html#method-i-threads">#threads — RubyProf::Profile</a>
+  
+    <li class="method"><a href="RubyProf/CallStackPrinter.html#method-i-threshold">#threshold — RubyProf::CallStackPrinter</a>
+  
+    <li class="method"><a href="RubyProf/CallStackPrinter.html#method-i-title">#title — RubyProf::CallStackPrinter</a>
+  
+    <li class="method"><a href="RubyProf/CallInfo.html#method-i-to_s">#to_s — RubyProf::CallInfo</a>
+  
+    <li class="method"><a href="RubyProf/AggregateCallInfo.html#method-i-to_s">#to_s — RubyProf::AggregateCallInfo</a>
+  
+    <li class="method"><a href="RubyProf/MethodInfo.html#method-i-to_s">#to_s — RubyProf::MethodInfo</a>
+  
+    <li class="method"><a href="RubyProf/Thread.html#method-i-top_methods">#top_methods — RubyProf::Thread</a>
+  
+    <li class="method"><a href="RubyProf/Thread.html#method-i-total_time">#total_time — RubyProf::Thread</a>
+  
+    <li class="method"><a href="RubyProf/MethodInfo.html#method-i-total_time">#total_time — RubyProf::MethodInfo</a>
+  
+    <li class="method"><a href="RubyProf/AggregateCallInfo.html#method-i-total_time">#total_time — RubyProf::AggregateCallInfo</a>
+  
+    <li class="method"><a href="RubyProf/CallStackPrinter.html#method-i-total_time">#total_time — RubyProf::CallStackPrinter</a>
+  
+    <li class="method"><a href="RubyProf/MultiPrinter.html#method-i-tree_profile">#tree_profile — RubyProf::MultiPrinter</a>
+  
+    <li class="method"><a href="RubyProf/CallInfoVisitor.html#method-i-visit">#visit — RubyProf::CallInfoVisitor</a>
+  
+    <li class="method"><a href="RubyProf/CallInfoVisitor.html#method-i-visit_call_info">#visit_call_info — RubyProf::CallInfoVisitor</a>
+  
+    <li class="method"><a href="RubyProf/AggregateCallInfo.html#method-i-wait_time">#wait_time — RubyProf::AggregateCallInfo</a>
+  
+    <li class="method"><a href="RubyProf/MethodInfo.html#method-i-wait_time">#wait_time — RubyProf::MethodInfo</a>
+  
+</ul>
+
+
+<footer id="validator-badges">
+  <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
+  <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.1.
+  <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
+</footer>
+
diff --git a/examples/empty.png b/examples/empty.png
new file mode 100755
index 0000000..5ac4d09
Binary files /dev/null and b/examples/empty.png differ
diff --git a/examples/graph.dot b/examples/graph.dot
new file mode 100644
index 0000000..36453a5
--- /dev/null
+++ b/examples/graph.dot
@@ -0,0 +1,106 @@
+digraph "Profile" {
+label="WALL_TIME >=0%\nTotal: 1.382985";
+labelloc=t;
+labeljust=l;
+subgraph "Thread 2148237740" {
+2159427600 [label="[]=\n(0%)"];
+2159427680 [label="%\n(15%)"];
+2159427760 [label="run_primes\n(100%)"];
+2159427760 -> 2159428600 [label="2/2" fontsize=10 fontcolor="#666666"];
+2159427760 -> 2159428300 [label="2/2" fontsize=10 fontcolor="#666666"];
+2159427840 [label="new\n(0%)"];
+2159427840 -> 2159428080 [label="2/2" fontsize=10 fontcolor="#666666"];
+2159427840 -> 2159428760 [label="2/2" fontsize=10 fontcolor="#666666"];
+2159427920 [label="rand\n(0%)"];
+2159428000 [label="-\n(0%)"];
+2159428080 [label="initialize\n(0%)"];
+2159428160 [label="each_index\n(1%)"];
+2159428160 -> 2159427920 [label="20000/20000" fontsize=10 fontcolor="#666666"];
+2159428160 -> 2159427600 [label="20000/20000" fontsize=10 fontcolor="#666666"];
+2159428220 [label="go\n(49%)"];
+2159428220 -> 2159427760 [label="1/2" fontsize=10 fontcolor="#666666"];
+2159428300 [label="make_random_array\n(1%)"];
+2159428300 -> 2159428160 [label="2/2" fontsize=10 fontcolor="#666666"];
+2159428300 -> 2159427840 [label="2/2" fontsize=10 fontcolor="#666666"];
+2159428360 [label="setup\n(100%)"];
+2159428360 -> 2159427760 [label="1/2" fontsize=10 fontcolor="#666666"];
+2159428360 -> 2159428220 [label="1/1" fontsize=10 fontcolor="#666666"];
+2159428440 [label="select\n(99%)"];
+2159428440 -> 2159428520 [label="20000/20000" fontsize=10 fontcolor="#666666"];
+2159428520 [label="is_prime\n(98%)"];
+2159428520 -> 2159428680 [label="20000/20000" fontsize=10 fontcolor="#666666"];
+2159428520 -> 2159428000 [label="20000/20000" fontsize=10 fontcolor="#666666"];
+2159428600 [label="find_primes\n(99%)"];
+2159428600 -> 2159428440 [label="2/2" fontsize=10 fontcolor="#666666"];
+2159428680 [label="upto\n(97%)"];
+2159428680 -> 2159427680 [label="1562487/1562487" fontsize=10 fontcolor="#666666"];
+2159428680 -> 2159428920 [label="1562487/1562487" fontsize=10 fontcolor="#666666"];
+2159428760 [label="allocate\n(0%)"];
+2159428920 [label="==\n(12%)"];
+}
+subgraph cluster_2159103200 {
+label = "Object";
+fontcolor = "#666666";
+fontsize = 16;
+color = "#666666";
+2159428600;
+2159428520;
+2159428300;
+2159427760;
+}
+subgraph cluster_2159103260 {
+label = "Integer";
+fontcolor = "#666666";
+fontsize = 16;
+color = "#666666";
+2159428680;
+}
+subgraph cluster_2159103060 {
+label = "PrintersTest";
+fontcolor = "#666666";
+fontsize = 16;
+color = "#666666";
+2159428360;
+2159428220;
+}
+subgraph cluster_2159103120 {
+label = "Array";
+fontcolor = "#666666";
+fontsize = 16;
+color = "#666666";
+2159428440;
+2159428160;
+2159428080;
+2159427600;
+}
+subgraph cluster_2159103340 {
+label = "<Class::Array>";
+fontcolor = "#666666";
+fontsize = 16;
+color = "#666666";
+2159428760;
+}
+subgraph cluster_2159102840 {
+label = "Class";
+fontcolor = "#666666";
+fontsize = 16;
+color = "#666666";
+2159427840;
+}
+subgraph cluster_2159102980 {
+label = "Kernel";
+fontcolor = "#666666";
+fontsize = 16;
+color = "#666666";
+2159427920;
+}
+subgraph cluster_2159103400 {
+label = "Fixnum";
+fontcolor = "#666666";
+fontsize = 16;
+color = "#666666";
+2159428920;
+2159428000;
+2159427680;
+}
+}
diff --git a/examples/graph.png b/examples/graph.png
new file mode 100644
index 0000000..33ed576
Binary files /dev/null and b/examples/graph.png differ
diff --git a/examples/minus.png b/examples/minus.png
new file mode 100755
index 0000000..7075f1c
Binary files /dev/null and b/examples/minus.png differ
diff --git a/examples/multi.flat.txt b/examples/multi.flat.txt
new file mode 100644
index 0000000..8e768db
--- /dev/null
+++ b/examples/multi.flat.txt
@@ -0,0 +1,23 @@
+Thread ID: 2148387240
+Total: 1.412370
+
+ %self     total     self     wait    child    calls  name
+ 71.15      1.37     1.00     0.00     0.37    20000  Integer#upto
+ 14.16      0.20     0.20     0.00     0.00  1544726  Fixnum#%
+ 11.93      0.17     0.17     0.00     0.00  1544726  Fixnum#==
+  0.98      1.39     0.01     0.00     1.38    20000  Object#is_prime
+  0.62      0.01     0.01     0.00     0.01        2  Array#each_index
+  0.58      1.40     0.01     0.00     1.39        2  Array#select
+  0.23      0.00     0.00     0.00     0.00    20000  Kernel#rand
+  0.19      0.00     0.00     0.00     0.00    20000  Array#[]=
+  0.17      0.00     0.00     0.00     0.00    20000  Fixnum#-
+  0.01      0.00     0.00     0.00     0.00        2  Array#initialize
+  0.00      0.01     0.00     0.00     0.01        2  Object#make_random_array
+  0.00      1.41     0.00     0.00     1.41        2  Object#run_primes
+  0.00      0.00     0.00     0.00     0.00        2  Class#new
+  0.00      1.41     0.00     0.00     1.41        1  PrintersTest#setup
+  0.00      0.71     0.00     0.00     0.71        1  PrintersTest#go
+  0.00      1.40     0.00     0.00     1.40        2  Object#find_primes
+  0.00      0.00     0.00     0.00     0.00        2  <Class::Array>#allocate
+
+
diff --git a/examples/multi.graph.html b/examples/multi.graph.html
new file mode 100644
index 0000000..652aca5
--- /dev/null
+++ b/examples/multi.graph.html
@@ -0,0 +1,906 @@
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+  <style media="all" type="text/css">
+    table {
+      border-collapse: collapse;
+      border: 1px solid #CCC;
+      font-family: Verdana, Arial, Helvetica, sans-serif;
+      font-size: 9pt;
+      line-height: normal;
+      width: 100%;
+    }
+
+    th {
+      text-align: center;
+      border-top: 1px solid #FB7A31;
+      border-bottom: 1px solid #FB7A31;
+      background: #FFC;
+      padding: 0.3em;
+      border-left: 1px solid silver;
+    }
+
+    tr.break td {
+      border: 0;
+      border-top: 1px solid #FB7A31;
+      padding: 0;
+      margin: 0;
+    }
+
+    tr.method td {
+      font-weight: bold;
+    }
+
+    td {
+      padding: 0.3em;
+    }
+
+    td:first-child {
+      width: 190px;
+      }
+
+    td {
+      border-left: 1px solid #CCC;
+      text-align: center;
+    }
+
+    .method_name {
+      text-align: left;
+    }
+  </style>
+  </head>
+  <body>
+    <h1>Profile Report</h1>
+    <!-- Threads Table -->
+    <table>
+      <tr>
+        <th>Thread ID</th>
+        <th>Total Time</th>
+      </tr>
+      
+      <tr>
+        <td><a href="#2148387240">2148387240</a></td>
+        <td>1.41237</td>
+      </tr>
+      
+    </table>
+
+    <!-- Methods Tables -->
+    
+      <h2><a name="2148387240">Thread 2148387240</a></h2>
+
+      <table>
+        <tr>
+          <th>  %Total</th>
+          <th>   %Self</th>
+          <th>     Total</th>
+          <th>      Self</th>
+          <th>      Wait</th>
+          <th>       Child</th>
+          <th>               Calls</th>
+          <th class="method_name">Name</th>
+          <th>Line</th>
+        </tr>
+
+        
+
+            <!-- Parents -->
+            
+
+            <tr class="method">
+              <td> 100.00%</td>
+              <td>   0.00%</td>
+              <td>      1.41</td>
+              <td>      0.00</td>
+              <td>      0.00</td>
+              <td>      1.41</td>
+              <td>                   1</td>
+              <td class="method_name"><a name="PrintersTest_setup_2148387240">PrintersTest#setup</a></td>
+              <td><a href="txmt://open?url=file:///Users/skaes/src/ruby-prof/test/printers_test.rb&line=16" title="/Users/skaes/src/ruby-prof/test/printers_test.rb:16">16</a></td>
+            </tr>
+
+            <!-- Children -->
+            
+            
+              <tr>
+                <td> </td>
+                <td> </td>
+                <td>      0.71</td>
+                <td>      0.00</td>
+                <td>      0.00</td>
+                <td>      0.71</td>
+                
+                <td>                 1/1</td>
+                <td class="method_name"><a href="#PrintersTest_go_2148387240">PrintersTest#go</a></td>
+                <td><a href="txmt://open?url=file:///Users/skaes/src/ruby-prof/test/printers_test.rb&line=17" title="/Users/skaes/src/ruby-prof/test/printers_test.rb:17">17</a></td>
+              </tr>
+            
+            
+              <tr>
+                <td> </td>
+                <td> </td>
+                <td>      0.70</td>
+                <td>      0.00</td>
+                <td>      0.00</td>
+                <td>      0.70</td>
+                
+                <td>                 1/2</td>
+                <td class="method_name"><a href="#Object_run_primes_2148387240">Object#run_primes</a></td>
+                <td><a href="txmt://open?url=file:///Users/skaes/src/ruby-prof/test/printers_test.rb&line=16" title="/Users/skaes/src/ruby-prof/test/printers_test.rb:16">16</a></td>
+              </tr>
+            
+            <!-- Create divider row -->
+            <tr class="break"><td colspan="9"></td></tr>
+        
+
+            <!-- Parents -->
+            
+              <tr>
+                <td> </td>
+                <td> </td>
+                <td>      0.70</td>
+                <td>      0.00</td>
+                <td>      0.00</td>
+                <td>      0.70</td>
+                
+                <td>                 1/2</td>
+                <td class="method_name"><a href="#PrintersTest_setup_2148387240">PrintersTest#setup</a></td>
+                <td><a href="txmt://open?url=file:///Users/skaes/src/ruby-prof/test/printers_test.rb&line=16" title="/Users/skaes/src/ruby-prof/test/printers_test.rb:16">16</a></td>
+              </tr>
+            
+              <tr>
+                <td> </td>
+                <td> </td>
+                <td>      0.71</td>
+                <td>      0.00</td>
+                <td>      0.00</td>
+                <td>      0.71</td>
+                
+                <td>                 1/2</td>
+                <td class="method_name"><a href="#PrintersTest_go_2148387240">PrintersTest#go</a></td>
+                <td><a href="txmt://open?url=file:///Users/skaes/src/ruby-prof/test/printers_test.rb&line=10" title="/Users/skaes/src/ruby-prof/test/printers_test.rb:10">10</a></td>
+              </tr>
+            
+
+            <tr class="method">
+              <td> 100.00%</td>
+              <td>   0.00%</td>
+              <td>      1.41</td>
+              <td>      0.00</td>
+              <td>      0.00</td>
+              <td>      1.41</td>
+              <td>                   2</td>
+              <td class="method_name"><a name="Object_run_primes_2148387240">Object#run_primes</a></td>
+              <td><a href="txmt://open?url=file:///Users/skaes/src/ruby-prof/test/prime.rb&line=46" title="/Users/skaes/src/ruby-prof/test/prime.rb:46">46</a></td>
+            </tr>
+
+            <!-- Children -->
+            
+            
+              <tr>
+                <td> </td>
+                <td> </td>
+                <td>      1.40</td>
+                <td>      0.00</td>
+                <td>      0.00</td>
+                <td>      1.40</td>
+                
+                <td>                 2/2</td>
+                <td class="method_name"><a href="#Object_find_primes_2148387240">Object#find_primes</a></td>
+                <td><a href="txmt://open?url=file:///Users/skaes/src/ruby-prof/test/prime.rb&line=51" title="/Users/skaes/src/ruby-prof/test/prime.rb:51">51</a></td>
+              </tr>
+            
+            
+              <tr>
+                <td> </td>
+                <td> </td>
+                <td>      0.01</td>
+                <td>      0.00</td>
+                <td>      0.00</td>
+                <td>      0.01</td>
+                
+                <td>                 2/2</td>
+                <td class="method_name"><a href="#Object_make_random_array_2148387240">Object#make_random_array</a></td>
+                <td><a href="txmt://open?url=file:///Users/skaes/src/ruby-prof/test/prime.rb&line=48" title="/Users/skaes/src/ruby-prof/test/prime.rb:48">48</a></td>
+              </tr>
+            
+            <!-- Create divider row -->
+            <tr class="break"><td colspan="9"></td></tr>
+        
+
+            <!-- Parents -->
+            
+              <tr>
+                <td> </td>
+                <td> </td>
+                <td>      1.40</td>
+                <td>      0.00</td>
+                <td>      0.00</td>
+                <td>      1.40</td>
+                
+                <td>                 2/2</td>
+                <td class="method_name"><a href="#Object_run_primes_2148387240">Object#run_primes</a></td>
+                <td><a href="txmt://open?url=file:///Users/skaes/src/ruby-prof/test/prime.rb&line=51" title="/Users/skaes/src/ruby-prof/test/prime.rb:51">51</a></td>
+              </tr>
+            
+
+            <tr class="method">
+              <td>  98.95%</td>
+              <td>   0.00%</td>
+              <td>      1.40</td>
+              <td>      0.00</td>
+              <td>      0.00</td>
+              <td>      1.40</td>
+              <td>                   2</td>
+              <td class="method_name"><a name="Object_find_primes_2148387240">Object#find_primes</a></td>
+              <td><a href="txmt://open?url=file:///Users/skaes/src/ruby-prof/test/prime.rb&line=24" title="/Users/skaes/src/ruby-prof/test/prime.rb:24">24</a></td>
+            </tr>
+
+            <!-- Children -->
+            
+            
+              <tr>
+                <td> </td>
+                <td> </td>
+                <td>      1.40</td>
+                <td>      0.01</td>
+                <td>      0.00</td>
+                <td>      1.39</td>
+                
+                <td>                 2/2</td>
+                <td class="method_name"><a href="#Array_select_2148387240">Array#select</a></td>
+                <td><a href="txmt://open?url=file:///Users/skaes/src/ruby-prof/test/prime.rb&line=25" title="/Users/skaes/src/ruby-prof/test/prime.rb:25">25</a></td>
+              </tr>
+            
+            <!-- Create divider row -->
+            <tr class="break"><td colspan="9"></td></tr>
+        
+
+            <!-- Parents -->
+            
+              <tr>
+                <td> </td>
+                <td> </td>
+                <td>      1.40</td>
+                <td>      0.01</td>
+                <td>      0.00</td>
+                <td>      1.39</td>
+                
+                <td>                 2/2</td>
+                <td class="method_name"><a href="#Object_find_primes_2148387240">Object#find_primes</a></td>
+                <td><a href="txmt://open?url=file:///Users/skaes/src/ruby-prof/test/prime.rb&line=25" title="/Users/skaes/src/ruby-prof/test/prime.rb:25">25</a></td>
+              </tr>
+            
+
+            <tr class="method">
+              <td>  98.95%</td>
+              <td>   0.58%</td>
+              <td>      1.40</td>
+              <td>      0.01</td>
+              <td>      0.00</td>
+              <td>      1.39</td>
+              <td>                   2</td>
+              <td class="method_name"><a name="Array_select_2148387240">Array#select</a></td>
+              <td></td>
+            </tr>
+
+            <!-- Children -->
+            
+            
+              <tr>
+                <td> </td>
+                <td> </td>
+                <td>      1.39</td>
+                <td>      0.01</td>
+                <td>      0.00</td>
+                <td>      1.38</td>
+                
+                <td>         20000/20000</td>
+                <td class="method_name"><a href="#Object_is_prime_2148387240">Object#is_prime</a></td>
+                <td></td>
+              </tr>
+            
+            <!-- Create divider row -->
+            <tr class="break"><td colspan="9"></td></tr>
+        
+
+            <!-- Parents -->
+            
+              <tr>
+                <td> </td>
+                <td> </td>
+                <td>      1.39</td>
+                <td>      0.01</td>
+                <td>      0.00</td>
+                <td>      1.38</td>
+                
+                <td>         20000/20000</td>
+                <td class="method_name"><a href="#Array_select_2148387240">Array#select</a></td>
+                <td></td>
+              </tr>
+            
+
+            <tr class="method">
+              <td>  98.37%</td>
+              <td>   0.98%</td>
+              <td>      1.39</td>
+              <td>      0.01</td>
+              <td>      0.00</td>
+              <td>      1.38</td>
+              <td>               20000</td>
+              <td class="method_name"><a name="Object_is_prime_2148387240">Object#is_prime</a></td>
+              <td><a href="txmt://open?url=file:///Users/skaes/src/ruby-prof/test/prime.rb&line=16" title="/Users/skaes/src/ruby-prof/test/prime.rb:16">16</a></td>
+            </tr>
+
+            <!-- Children -->
+            
+            
+              <tr>
+                <td> </td>
+                <td> </td>
+                <td>      1.37</td>
+                <td>      1.00</td>
+                <td>      0.00</td>
+                <td>      0.37</td>
+                
+                <td>         20000/20000</td>
+                <td class="method_name"><a href="#Integer_upto_2148387240">Integer#upto</a></td>
+                <td><a href="txmt://open?url=file:///Users/skaes/src/ruby-prof/test/prime.rb&line=18" title="/Users/skaes/src/ruby-prof/test/prime.rb:18">18</a></td>
+              </tr>
+            
+            
+              <tr>
+                <td> </td>
+                <td> </td>
+                <td>      0.00</td>
+                <td>      0.00</td>
+                <td>      0.00</td>
+                <td>      0.00</td>
+                
+                <td>         20000/20000</td>
+                <td class="method_name"><a href="#Fixnum_-_2148387240">Fixnum#-</a></td>
+                <td><a href="txmt://open?url=file:///Users/skaes/src/ruby-prof/test/prime.rb&line=18" title="/Users/skaes/src/ruby-prof/test/prime.rb:18">18</a></td>
+              </tr>
+            
+            <!-- Create divider row -->
+            <tr class="break"><td colspan="9"></td></tr>
+        
+
+            <!-- Parents -->
+            
+              <tr>
+                <td> </td>
+                <td> </td>
+                <td>      1.37</td>
+                <td>      1.00</td>
+                <td>      0.00</td>
+                <td>      0.37</td>
+                
+                <td>         20000/20000</td>
+                <td class="method_name"><a href="#Object_is_prime_2148387240">Object#is_prime</a></td>
+                <td><a href="txmt://open?url=file:///Users/skaes/src/ruby-prof/test/prime.rb&line=18" title="/Users/skaes/src/ruby-prof/test/prime.rb:18">18</a></td>
+              </tr>
+            
+
+            <tr class="method">
+              <td>  97.23%</td>
+              <td>  71.15%</td>
+              <td>      1.37</td>
+              <td>      1.00</td>
+              <td>      0.00</td>
+              <td>      0.37</td>
+              <td>               20000</td>
+              <td class="method_name"><a name="Integer_upto_2148387240">Integer#upto</a></td>
+              <td></td>
+            </tr>
+
+            <!-- Children -->
+            
+            
+              <tr>
+                <td> </td>
+                <td> </td>
+                <td>      0.20</td>
+                <td>      0.20</td>
+                <td>      0.00</td>
+                <td>      0.00</td>
+                
+                <td>     1544726/1544726</td>
+                <td class="method_name"><a href="#Fixnum_%_2148387240">Fixnum#%</a></td>
+                <td></td>
+              </tr>
+            
+            
+              <tr>
+                <td> </td>
+                <td> </td>
+                <td>      0.17</td>
+                <td>      0.17</td>
+                <td>      0.00</td>
+                <td>      0.00</td>
+                
+                <td>     1544726/1544726</td>
+                <td class="method_name"><a href="#Fixnum____2148387240">Fixnum#==</a></td>
+                <td></td>
+              </tr>
+            
+            <!-- Create divider row -->
+            <tr class="break"><td colspan="9"></td></tr>
+        
+
+            <!-- Parents -->
+            
+              <tr>
+                <td> </td>
+                <td> </td>
+                <td>      0.71</td>
+                <td>      0.00</td>
+                <td>      0.00</td>
+                <td>      0.71</td>
+                
+                <td>                 1/1</td>
+                <td class="method_name"><a href="#PrintersTest_setup_2148387240">PrintersTest#setup</a></td>
+                <td><a href="txmt://open?url=file:///Users/skaes/src/ruby-prof/test/printers_test.rb&line=17" title="/Users/skaes/src/ruby-prof/test/printers_test.rb:17">17</a></td>
+              </tr>
+            
+
+            <tr class="method">
+              <td>  50.24%</td>
+              <td>   0.00%</td>
+              <td>      0.71</td>
+              <td>      0.00</td>
+              <td>      0.00</td>
+              <td>      0.71</td>
+              <td>                   1</td>
+              <td class="method_name"><a name="PrintersTest_go_2148387240">PrintersTest#go</a></td>
+              <td><a href="txmt://open?url=file:///Users/skaes/src/ruby-prof/test/printers_test.rb&line=9" title="/Users/skaes/src/ruby-prof/test/printers_test.rb:9">9</a></td>
+            </tr>
+
+            <!-- Children -->
+            
+            
+              <tr>
+                <td> </td>
+                <td> </td>
+                <td>      0.71</td>
+                <td>      0.00</td>
+                <td>      0.00</td>
+                <td>      0.71</td>
+                
+                <td>                 1/2</td>
+                <td class="method_name"><a href="#Object_run_primes_2148387240">Object#run_primes</a></td>
+                <td><a href="txmt://open?url=file:///Users/skaes/src/ruby-prof/test/printers_test.rb&line=10" title="/Users/skaes/src/ruby-prof/test/printers_test.rb:10">10</a></td>
+              </tr>
+            
+            <!-- Create divider row -->
+            <tr class="break"><td colspan="9"></td></tr>
+        
+
+            <!-- Parents -->
+            
+              <tr>
+                <td> </td>
+                <td> </td>
+                <td>      0.20</td>
+                <td>      0.20</td>
+                <td>      0.00</td>
+                <td>      0.00</td>
+                
+                <td>     1544726/1544726</td>
+                <td class="method_name"><a href="#Integer_upto_2148387240">Integer#upto</a></td>
+                <td></td>
+              </tr>
+            
+
+            <tr class="method">
+              <td>  14.16%</td>
+              <td>  14.16%</td>
+              <td>      0.20</td>
+              <td>      0.20</td>
+              <td>      0.00</td>
+              <td>      0.00</td>
+              <td>             1544726</td>
+              <td class="method_name"><a name="Fixnum_%_2148387240">Fixnum#%</a></td>
+              <td></td>
+            </tr>
+
+            <!-- Children -->
+            
+            <!-- Create divider row -->
+            <tr class="break"><td colspan="9"></td></tr>
+        
+
+            <!-- Parents -->
+            
+              <tr>
+                <td> </td>
+                <td> </td>
+                <td>      0.17</td>
+                <td>      0.17</td>
+                <td>      0.00</td>
+                <td>      0.00</td>
+                
+                <td>     1544726/1544726</td>
+                <td class="method_name"><a href="#Integer_upto_2148387240">Integer#upto</a></td>
+                <td></td>
+              </tr>
+            
+
+            <tr class="method">
+              <td>  11.93%</td>
+              <td>  11.93%</td>
+              <td>      0.17</td>
+              <td>      0.17</td>
+              <td>      0.00</td>
+              <td>      0.00</td>
+              <td>             1544726</td>
+              <td class="method_name"><a name="Fixnum____2148387240">Fixnum#==</a></td>
+              <td></td>
+            </tr>
+
+            <!-- Children -->
+            
+            <!-- Create divider row -->
+            <tr class="break"><td colspan="9"></td></tr>
+        
+
+            <!-- Parents -->
+            
+              <tr>
+                <td> </td>
+                <td> </td>
+                <td>      0.01</td>
+                <td>      0.00</td>
+                <td>      0.00</td>
+                <td>      0.01</td>
+                
+                <td>                 2/2</td>
+                <td class="method_name"><a href="#Object_run_primes_2148387240">Object#run_primes</a></td>
+                <td><a href="txmt://open?url=file:///Users/skaes/src/ruby-prof/test/prime.rb&line=48" title="/Users/skaes/src/ruby-prof/test/prime.rb:48">48</a></td>
+              </tr>
+            
+
+            <tr class="method">
+              <td>   1.05%</td>
+              <td>   0.00%</td>
+              <td>      0.01</td>
+              <td>      0.00</td>
+              <td>      0.00</td>
+              <td>      0.01</td>
+              <td>                   2</td>
+              <td class="method_name"><a name="Object_make_random_array_2148387240">Object#make_random_array</a></td>
+              <td><a href="txmt://open?url=file:///Users/skaes/src/ruby-prof/test/prime.rb&line=7" title="/Users/skaes/src/ruby-prof/test/prime.rb:7">7</a></td>
+            </tr>
+
+            <!-- Children -->
+            
+            
+              <tr>
+                <td> </td>
+                <td> </td>
+                <td>      0.01</td>
+                <td>      0.01</td>
+                <td>      0.00</td>
+                <td>      0.01</td>
+                
+                <td>                 2/2</td>
+                <td class="method_name"><a href="#Array_each_index_2148387240">Array#each_index</a></td>
+                <td><a href="txmt://open?url=file:///Users/skaes/src/ruby-prof/test/prime.rb&line=9" title="/Users/skaes/src/ruby-prof/test/prime.rb:9">9</a></td>
+              </tr>
+            
+            
+              <tr>
+                <td> </td>
+                <td> </td>
+                <td>      0.00</td>
+                <td>      0.00</td>
+                <td>      0.00</td>
+                <td>      0.00</td>
+                
+                <td>                 2/2</td>
+                <td class="method_name"><a href="#Class_new_2148387240">Class#new</a></td>
+                <td><a href="txmt://open?url=file:///Users/skaes/src/ruby-prof/test/prime.rb&line=8" title="/Users/skaes/src/ruby-prof/test/prime.rb:8">8</a></td>
+              </tr>
+            
+            <!-- Create divider row -->
+            <tr class="break"><td colspan="9"></td></tr>
+        
+
+            <!-- Parents -->
+            
+              <tr>
+                <td> </td>
+                <td> </td>
+                <td>      0.01</td>
+                <td>      0.01</td>
+                <td>      0.00</td>
+                <td>      0.01</td>
+                
+                <td>                 2/2</td>
+                <td class="method_name"><a href="#Object_make_random_array_2148387240">Object#make_random_array</a></td>
+                <td><a href="txmt://open?url=file:///Users/skaes/src/ruby-prof/test/prime.rb&line=9" title="/Users/skaes/src/ruby-prof/test/prime.rb:9">9</a></td>
+              </tr>
+            
+
+            <tr class="method">
+              <td>   1.04%</td>
+              <td>   0.62%</td>
+              <td>      0.01</td>
+              <td>      0.01</td>
+              <td>      0.00</td>
+              <td>      0.01</td>
+              <td>                   2</td>
+              <td class="method_name"><a name="Array_each_index_2148387240">Array#each_index</a></td>
+              <td></td>
+            </tr>
+
+            <!-- Children -->
+            
+            
+              <tr>
+                <td> </td>
+                <td> </td>
+                <td>      0.00</td>
+                <td>      0.00</td>
+                <td>      0.00</td>
+                <td>      0.00</td>
+                
+                <td>         20000/20000</td>
+                <td class="method_name"><a href="#Kernel_rand_2148387240">Kernel#rand</a></td>
+                <td></td>
+              </tr>
+            
+            
+              <tr>
+                <td> </td>
+                <td> </td>
+                <td>      0.00</td>
+                <td>      0.00</td>
+                <td>      0.00</td>
+                <td>      0.00</td>
+                
+                <td>         20000/20000</td>
+                <td class="method_name"><a href="#Array_[]__2148387240">Array#[]=</a></td>
+                <td></td>
+              </tr>
+            
+            <!-- Create divider row -->
+            <tr class="break"><td colspan="9"></td></tr>
+        
+
+            <!-- Parents -->
+            
+              <tr>
+                <td> </td>
+                <td> </td>
+                <td>      0.00</td>
+                <td>      0.00</td>
+                <td>      0.00</td>
+                <td>      0.00</td>
+                
+                <td>         20000/20000</td>
+                <td class="method_name"><a href="#Array_each_index_2148387240">Array#each_index</a></td>
+                <td></td>
+              </tr>
+            
+
+            <tr class="method">
+              <td>   0.23%</td>
+              <td>   0.23%</td>
+              <td>      0.00</td>
+              <td>      0.00</td>
+              <td>      0.00</td>
+              <td>      0.00</td>
+              <td>               20000</td>
+              <td class="method_name"><a name="Kernel_rand_2148387240">Kernel#rand</a></td>
+              <td></td>
+            </tr>
+
+            <!-- Children -->
+            
+            <!-- Create divider row -->
+            <tr class="break"><td colspan="9"></td></tr>
+        
+
+            <!-- Parents -->
+            
+              <tr>
+                <td> </td>
+                <td> </td>
+                <td>      0.00</td>
+                <td>      0.00</td>
+                <td>      0.00</td>
+                <td>      0.00</td>
+                
+                <td>         20000/20000</td>
+                <td class="method_name"><a href="#Array_each_index_2148387240">Array#each_index</a></td>
+                <td></td>
+              </tr>
+            
+
+            <tr class="method">
+              <td>   0.19%</td>
+              <td>   0.19%</td>
+              <td>      0.00</td>
+              <td>      0.00</td>
+              <td>      0.00</td>
+              <td>      0.00</td>
+              <td>               20000</td>
+              <td class="method_name"><a name="Array_[]__2148387240">Array#[]=</a></td>
+              <td></td>
+            </tr>
+
+            <!-- Children -->
+            
+            <!-- Create divider row -->
+            <tr class="break"><td colspan="9"></td></tr>
+        
+
+            <!-- Parents -->
+            
+              <tr>
+                <td> </td>
+                <td> </td>
+                <td>      0.00</td>
+                <td>      0.00</td>
+                <td>      0.00</td>
+                <td>      0.00</td>
+                
+                <td>         20000/20000</td>
+                <td class="method_name"><a href="#Object_is_prime_2148387240">Object#is_prime</a></td>
+                <td><a href="txmt://open?url=file:///Users/skaes/src/ruby-prof/test/prime.rb&line=18" title="/Users/skaes/src/ruby-prof/test/prime.rb:18">18</a></td>
+              </tr>
+            
+
+            <tr class="method">
+              <td>   0.17%</td>
+              <td>   0.17%</td>
+              <td>      0.00</td>
+              <td>      0.00</td>
+              <td>      0.00</td>
+              <td>      0.00</td>
+              <td>               20000</td>
+              <td class="method_name"><a name="Fixnum_-_2148387240">Fixnum#-</a></td>
+              <td></td>
+            </tr>
+
+            <!-- Children -->
+            
+            <!-- Create divider row -->
+            <tr class="break"><td colspan="9"></td></tr>
+        
+
+            <!-- Parents -->
+            
+              <tr>
+                <td> </td>
+                <td> </td>
+                <td>      0.00</td>
+                <td>      0.00</td>
+                <td>      0.00</td>
+                <td>      0.00</td>
+                
+                <td>                 2/2</td>
+                <td class="method_name"><a href="#Object_make_random_array_2148387240">Object#make_random_array</a></td>
+                <td><a href="txmt://open?url=file:///Users/skaes/src/ruby-prof/test/prime.rb&line=8" title="/Users/skaes/src/ruby-prof/test/prime.rb:8">8</a></td>
+              </tr>
+            
+
+            <tr class="method">
+              <td>   0.01%</td>
+              <td>   0.00%</td>
+              <td>      0.00</td>
+              <td>      0.00</td>
+              <td>      0.00</td>
+              <td>      0.00</td>
+              <td>                   2</td>
+              <td class="method_name"><a name="Class_new_2148387240">Class#new</a></td>
+              <td></td>
+            </tr>
+
+            <!-- Children -->
+            
+            
+              <tr>
+                <td> </td>
+                <td> </td>
+                <td>      0.00</td>
+                <td>      0.00</td>
+                <td>      0.00</td>
+                <td>      0.00</td>
+                
+                <td>                 2/2</td>
+                <td class="method_name"><a href="#Array_initialize_2148387240">Array#initialize</a></td>
+                <td></td>
+              </tr>
+            
+            
+              <tr>
+                <td> </td>
+                <td> </td>
+                <td>      0.00</td>
+                <td>      0.00</td>
+                <td>      0.00</td>
+                <td>      0.00</td>
+                
+                <td>                 2/2</td>
+                <td class="method_name"><a href="#_Class__Array__allocate_2148387240"><Class::Array>#allocate</a></td>
+                <td></td>
+              </tr>
+            
+            <!-- Create divider row -->
+            <tr class="break"><td colspan="9"></td></tr>
+        
+
+            <!-- Parents -->
+            
+              <tr>
+                <td> </td>
+                <td> </td>
+                <td>      0.00</td>
+                <td>      0.00</td>
+                <td>      0.00</td>
+                <td>      0.00</td>
+                
+                <td>                 2/2</td>
+                <td class="method_name"><a href="#Class_new_2148387240">Class#new</a></td>
+                <td></td>
+              </tr>
+            
+
+            <tr class="method">
+              <td>   0.01%</td>
+              <td>   0.01%</td>
+              <td>      0.00</td>
+              <td>      0.00</td>
+              <td>      0.00</td>
+              <td>      0.00</td>
+              <td>                   2</td>
+              <td class="method_name"><a name="Array_initialize_2148387240">Array#initialize</a></td>
+              <td></td>
+            </tr>
+
+            <!-- Children -->
+            
+            <!-- Create divider row -->
+            <tr class="break"><td colspan="9"></td></tr>
+        
+
+            <!-- Parents -->
+            
+              <tr>
+                <td> </td>
+                <td> </td>
+                <td>      0.00</td>
+                <td>      0.00</td>
+                <td>      0.00</td>
+                <td>      0.00</td>
+                
+                <td>                 2/2</td>
+                <td class="method_name"><a href="#Class_new_2148387240">Class#new</a></td>
+                <td></td>
+              </tr>
+            
+
+            <tr class="method">
+              <td>   0.00%</td>
+              <td>   0.00%</td>
+              <td>      0.00</td>
+              <td>      0.00</td>
+              <td>      0.00</td>
+              <td>      0.00</td>
+              <td>                   2</td>
+              <td class="method_name"><a name="_Class__Array__allocate_2148387240"><Class::Array>#allocate</a></td>
+              <td></td>
+            </tr>
+
+            <!-- Children -->
+            
+            <!-- Create divider row -->
+            <tr class="break"><td colspan="9"></td></tr>
+        
+      </table>
+    
+  </body>
+</html>
\ No newline at end of file
diff --git a/examples/multi.grind.dat b/examples/multi.grind.dat
new file mode 100644
index 0000000..ab87102
--- /dev/null
+++ b/examples/multi.grind.dat
@@ -0,0 +1,194 @@
+events: wall_time
+
+fl=/Users/skaes/src/ruby-prof/test/prime.rb
+fn=Object#make_random_array
+7 7
+cfl=/Users/skaes/src/ruby-prof/ruby_runtime
+cfn=Array#each_index
+calls=1 9
+9 7463
+cfl=/Users/skaes/src/ruby-prof/ruby_runtime
+cfn=Class#new
+calls=1 8
+8 54
+cfl=/Users/skaes/src/ruby-prof/ruby_runtime
+cfn=Array#each_index
+calls=1 9
+9 7256
+cfl=/Users/skaes/src/ruby-prof/ruby_runtime
+cfn=Class#new
+calls=1 8
+8 52
+
+fl=/Users/skaes/src/ruby-prof/ruby_runtime
+fn=Fixnum#%
+0 199945
+
+fl=/Users/skaes/src/ruby-prof/ruby_runtime
+fn=Class#new
+0 6
+cfl=/Users/skaes/src/ruby-prof/ruby_runtime
+cfn=<Class::Array>#allocate
+calls=1 8
+8 1
+cfl=/Users/skaes/src/ruby-prof/ruby_runtime
+cfn=Array#initialize
+calls=1 8
+8 48
+cfl=/Users/skaes/src/ruby-prof/ruby_runtime
+cfn=<Class::Array>#allocate
+calls=1 8
+8 1
+cfl=/Users/skaes/src/ruby-prof/ruby_runtime
+cfn=Array#initialize
+calls=1 8
+8 50
+
+fl=/Users/skaes/src/ruby-prof/ruby_runtime
+fn=Kernel#rand
+0 3238
+
+fl=/Users/skaes/src/ruby-prof/ruby_runtime
+fn=Fixnum#-
+0 2361
+
+fl=/Users/skaes/src/ruby-prof/test/printers_test.rb
+fn=PrintersTest#setup
+16 5
+cfl=/Users/skaes/src/ruby-prof/test/prime.rb
+cfn=Object#run_primes
+calls=1 16
+16 702856
+cfl=/Users/skaes/src/ruby-prof/test/printers_test.rb
+cfn=PrintersTest#go
+calls=1 17
+17 709509
+
+fl=/Users/skaes/src/ruby-prof/ruby_runtime
+fn=Array#initialize
+0 98
+
+fl=/Users/skaes/src/ruby-prof/ruby_runtime
+fn=Array#each_index
+0 8789
+cfl=/Users/skaes/src/ruby-prof/ruby_runtime
+cfn=Array#[]=
+calls=10000 10
+10 1364
+cfl=/Users/skaes/src/ruby-prof/ruby_runtime
+cfn=Kernel#rand
+calls=10000 10
+10 1602
+cfl=/Users/skaes/src/ruby-prof/ruby_runtime
+cfn=Array#[]=
+calls=10000 10
+10 1328
+cfl=/Users/skaes/src/ruby-prof/ruby_runtime
+cfn=Kernel#rand
+calls=10000 10
+10 1636
+
+fl=/Users/skaes/src/ruby-prof/test/prime.rb
+fn=Object#is_prime
+16 13805
+cfl=/Users/skaes/src/ruby-prof/ruby_runtime
+cfn=Integer#upto
+calls=10000 18
+18 683251
+cfl=/Users/skaes/src/ruby-prof/ruby_runtime
+cfn=Fixnum#-
+calls=10000 18
+18 1157
+cfl=/Users/skaes/src/ruby-prof/ruby_runtime
+cfn=Integer#upto
+calls=10000 18
+18 689970
+cfl=/Users/skaes/src/ruby-prof/ruby_runtime
+cfn=Fixnum#-
+calls=10000 18
+18 1204
+
+fl=/Users/skaes/src/ruby-prof/test/printers_test.rb
+fn=PrintersTest#go
+9 5
+cfl=/Users/skaes/src/ruby-prof/test/prime.rb
+cfn=Object#run_primes
+calls=1 10
+10 709504
+
+fl=/Users/skaes/src/ruby-prof/test/prime.rb
+fn=Object#find_primes
+24 3
+cfl=/Users/skaes/src/ruby-prof/ruby_runtime
+cfn=Array#select
+calls=1 25
+25 695331
+cfl=/Users/skaes/src/ruby-prof/ruby_runtime
+cfn=Array#select
+calls=1 25
+25 702187
+
+fl=/Users/skaes/src/ruby-prof/ruby_runtime
+fn=Array#select
+0 8131
+cfl=/Users/skaes/src/ruby-prof/test/prime.rb
+cfn=Object#is_prime
+calls=10000 26
+26 691245
+cfl=/Users/skaes/src/ruby-prof/test/prime.rb
+cfn=Object#is_prime
+calls=10000 26
+26 698142
+
+fl=/Users/skaes/src/ruby-prof/ruby_runtime
+fn=Integer#upto
+0 1004845
+cfl=/Users/skaes/src/ruby-prof/ruby_runtime
+cfn=Fixnum#==
+calls=766408 19
+19 83149
+cfl=/Users/skaes/src/ruby-prof/ruby_runtime
+cfn=Fixnum#%
+calls=766408 19
+19 99302
+cfl=/Users/skaes/src/ruby-prof/ruby_runtime
+cfn=Fixnum#==
+calls=778318 19
+19 85282
+cfl=/Users/skaes/src/ruby-prof/ruby_runtime
+cfn=Fixnum#%
+calls=778318 19
+19 100643
+
+fl=/Users/skaes/src/ruby-prof/ruby_runtime
+fn=<Class::Array>#allocate
+0 2
+
+fl=/Users/skaes/src/ruby-prof/ruby_runtime
+fn=Fixnum#==
+0 168431
+
+fl=/Users/skaes/src/ruby-prof/test/prime.rb
+fn=Object#run_primes
+46 7
+cfl=/Users/skaes/src/ruby-prof/test/prime.rb
+cfn=Object#find_primes
+calls=1 51
+51 695333
+cfl=/Users/skaes/src/ruby-prof/test/prime.rb
+cfn=Object#make_random_array
+calls=1 48
+48 7519
+cfl=/Users/skaes/src/ruby-prof/test/prime.rb
+cfn=Object#find_primes
+calls=1 51
+51 702188
+cfl=/Users/skaes/src/ruby-prof/test/prime.rb
+cfn=Object#make_random_array
+calls=1 48
+48 7313
+
+fl=/Users/skaes/src/ruby-prof/ruby_runtime
+fn=Array#[]=
+0 2692
+
diff --git a/examples/multi.stack.html b/examples/multi.stack.html
new file mode 100644
index 0000000..09dadad
--- /dev/null
+++ b/examples/multi.stack.html
@@ -0,0 +1,573 @@
+<html><head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+<title>ruby-prof call tree</title>
+<style type="text/css">
+<!--
+body {
+    font-size:70%;
+    padding:0px;
+    margin:5px;
+    margin-right:0px;
+    margin-left:0px;
+    background: #ffffff;
+}
+ul {
+    margin-left:0px;
+    margin-top:0px;
+    margin-bottom:0px;
+    padding-left:0px;
+    list-style-type:none;
+}
+li {
+    margin-left:11px;
+    padding:0px;
+    white-space:nowrap;
+    border-top:1px solid #cccccc;
+    border-left:1px solid #cccccc;
+    border-bottom:none;
+}
+.thread {
+    margin-left:11px;
+    background:#708090;
+    padding-top:3px;
+    padding-left:12px;
+    padding-bottom:2px;
+    border-left:1px solid #CCCCCC;
+    border-top:1px solid #CCCCCC;
+    font-weight:bold;
+}
+.hidden {
+    display:none;
+    width:0px;
+    height:0px;
+    margin:0px;
+    padding:0px;
+    border-style:none;
+}
+.color01 { background:#adbdeb }
+.color05 { background:#9daddb }
+.color0 { background:#8d9dcb }
+.color1 { background:#89bccb }
+.color2 { background:#56e3e7 }
+.color3 { background:#32cd70 }
+.color4 { background:#a3d53c }
+.color5 { background:#c4cb34 }
+.color6 { background:#dcb66d }
+.color7 { background:#cda59e }
+.color8 { background:#be9d9c }
+.color9 { background:#cf947a }
+#commands {
+    font-size:10pt;
+    padding:10px;
+    margin-left:11px;
+    margin-bottom:0px;
+    margin-top:0px;
+    background:#708090;
+    border-top:1px solid #cccccc;
+    border-left:1px solid #cccccc;
+    border-bottom:none;
+}
+#titlebar {
+    font-size:10pt;
+    padding:10px;
+    margin-left:11px;
+    margin-bottom:0px;
+    margin-top:10px;
+    background:#8090a0;
+    border-top:1px solid #cccccc;
+    border-left:1px solid #cccccc;
+    border-bottom:none;
+}
+#help {
+    font-size:10pt;
+    padding:10px;
+    margin-left:11px;
+    margin-bottom:0px;
+    margin-top:0px;
+    background:#8090a0;
+    display:none;
+    border-top:1px solid #cccccc;
+    border-left:1px solid #cccccc;
+    border-bottom:none;
+}
+#sentinel {
+    height: 400px;
+    margin-left:11px;
+    background:#8090a0;
+    border-top:1px solid #cccccc;
+    border-left:1px solid #cccccc;
+    border-bottom:none;
+ }
+input { margin-left:10px; }
+-->
+</style>
+<script type="text/javascript">
+/*
+   Copyright (C) 2005,2009  Stefan Kaes
+   skaes at railsexpress.de
+*/
+
+function rootNode() {
+  return currentThread;
+}
+
+function hideUL(node) {
+  var lis = node.childNodes
+  var l = lis.length;
+  for (var i=0; i < l ; i++ ) {
+    hideLI(lis[i]);
+  }
+}
+
+function showUL(node) {
+  var lis = node.childNodes;
+  var l = lis.length;
+  for (var i=0; i < l ; i++ ) {
+    showLI(lis[i]);
+  }
+}
+
+function findUlChild(li){
+  var ul = li.childNodes[2];
+  while (ul && ul.nodeName != "UL") {
+    ul = ul.nextSibling;
+  }
+  return ul;
+}
+
+function isLeafNode(li) {
+  var img = li.firstChild;
+  return (img.src.indexOf('empty.png') > -1);
+}
+
+function hideLI(li) {
+  if (isLeafNode(li))
+    return;
+
+  var img = li.firstChild;
+  img.src = 'plus.png';
+
+  var ul = findUlChild(li);
+  if (ul) {
+    ul.style.display = 'none';
+    hideUL(ul);
+  }
+}
+
+function showLI(li) {
+  if (isLeafNode(li))
+    return;
+
+  var img = li.firstChild;
+  img.src = 'minus.png';
+
+  var ul = findUlChild(li);
+  if (ul) {
+    ul.style.display = 'block';
+    showUL(ul);
+  }
+}
+
+function toggleLI(li) {
+  var img = li.firstChild;
+  if (img.src.indexOf("minus.png")>-1)
+    hideLI(li);
+  else {
+    if (img.src.indexOf("plus.png")>-1)
+      showLI(li);
+  }
+}
+
+function aboveThreshold(text, threshold) {
+  var match = text.match(/\d+[.,]\d+/);
+  return (match && parseFloat(match[0].replace(/,/, '.'))>=threshold);
+}
+
+function setThresholdLI(li, threshold) {
+  var img = li.firstChild;
+  var text = img.nextSibling;
+  var ul = findUlChild(li);
+
+  var visible = aboveThreshold(text.nodeValue, threshold) ? 1 : 0;
+
+  var count = 0;
+  if (ul) {
+    count = setThresholdUL(ul, threshold);
+  }
+  if (count>0) {
+    img.src = 'minus.png';
+  }
+  else {
+    img.src = 'empty.png';
+  }
+  if (visible) {
+    li.style.display = 'block'
+  }
+  else {
+    li.style.display = 'none'
+  }
+  return visible;
+}
+
+function setThresholdUL(node, threshold) {
+  var lis = node.childNodes;
+  var l = lis.length;
+
+  var count = 0;
+  for ( var i = 0; i < l ; i++ ) {
+    count = count + setThresholdLI(lis[i], threshold);
+  }
+
+  var visible = (count > 0) ? 1 : 0;
+  if (visible) {
+    node.style.display = 'block';
+  }
+  else {
+    node.style.display = 'none';
+  }
+  return visible;
+}
+
+function toggleChildren(img, event) {
+  event.cancelBubble=true;
+
+  if (img.src.indexOf('empty.png') > -1)
+    return;
+
+  var minus = (img.src.indexOf('minus.png') > -1);
+
+  if (minus) {
+    img.src = 'plus.png';
+  }
+  else
+    img.src = 'minus.png';
+
+  var li = img.parentNode;
+  var ul = findUlChild(li);
+  if (ul) {
+    if (minus)
+      ul.style.display = 'none';
+    else
+      ul.style.display = 'block';
+  }
+  if (minus)
+    moveSelectionIfNecessary(li);
+}
+
+function showChildren(li) {
+  var img = li.firstChild;
+  if (img.src.indexOf('empty.png') > -1)
+    return;
+  img.src = 'minus.png';
+
+  var ul = findUlChild(li);
+  if (ul) {
+    ul.style.display = 'block';
+  }
+}
+
+function setThreshold() {
+ var tv = document.getElementById("threshold").value;
+ if (tv.match(/[0-9]+([.,][0-9]+)?/)) {
+   var f = parseFloat(tv.replace(/,/, '.'));
+   var threads = document.getElementsByName("thread");
+   var l = threads.length;
+   for ( var i = 0; i < l ; i++ ) {
+     setThresholdUL(threads[i], f);
+   }
+   var p = selectedNode;
+   while (p && p.style.display=='none')
+     p=p.parentNode.parentNode;
+   if (p && p.nodeName=="LI")
+    selectNode(p);
+ }
+ else {
+   alert("Please specify a decimal number as threshold value!");
+ }
+}
+
+function collapseAll(event) {
+  event.cancelBubble=true;
+  var threads = document.getElementsByName("thread");
+  var l = threads.length;
+  for ( var i = 0; i < l ; i++ ) {
+    hideUL(threads[i]);
+  }
+  selectNode(rootNode(), null);
+}
+
+function expandAll(event) {
+  event.cancelBubble=true;
+  var threads = document.getElementsByName("thread");
+  var l = threads.length;
+  for ( var i = 0; i < l ; i++ ) {
+    showUL(threads[i]);
+  }
+}
+
+function toggleHelp(node) {
+  var help = document.getElementById("help");
+  if (node.value == "Show Help") {
+    node.value = "Hide Help";
+    help.style.display = 'block';
+  }
+  else {
+    node.value = "Show Help";
+    help.style.display = 'none';
+  }
+}
+
+var selectedNode = null;
+var selectedColor = null;
+var selectedThread = null;
+
+function descendentOf(a,b){
+  while (a!=b && b!=null)
+    b=b.parentNode;
+  return (a==b);
+}
+
+function moveSelectionIfNecessary(node){
+  if (descendentOf(node, selectedNode))
+    selectNode(node, null);
+}
+
+function selectNode(node, event) {
+  if (event) {
+    event.cancelBubble = true;
+    thread = findThread(node);
+    selectThread(thread);
+  }
+  if (selectedNode) {
+    selectedNode.style.background = selectedColor;
+  }
+  selectedNode = node;
+  selectedColor = node.style.background;
+  selectedNode.style.background = "red";
+  selectedNode.scrollIntoView();
+  window.scrollBy(0,-400);
+}
+
+function moveUp(){
+  var p = selectedNode.previousSibling;
+  while (p && p.style.display == 'none')
+    p = p.previousSibling;
+  if (p && p.nodeName == "LI") {
+    selectNode(p, null);
+  }
+}
+
+function moveDown(){
+  var p = selectedNode.nextSibling;
+  while (p && p.style.display == 'none')
+    p = p.nextSibling;
+  if (p && p.nodeName == "LI") {
+    selectNode(p, null);
+  }
+}
+
+function moveLeft(){
+  var p = selectedNode.parentNode.parentNode;
+  if (p && p.nodeName=="LI") {
+    selectNode(p, null);
+  }
+}
+
+function moveRight(){
+  if (!isLeafNode(selectedNode)) {
+    showChildren(selectedNode);
+    var ul = findUlChild(selectedNode);
+    if (ul) {
+      selectNode(ul.firstChild, null);
+    }
+  }
+}
+
+function moveForward(){
+  if (isLeafNode(selectedNode)) {
+    var p = selectedNode;
+    while ((p.nextSibling == null || p.nextSibling.style.display=='none') && p.nodeName=="LI") {
+      p = p.parentNode.parentNode;
+    }
+    if (p.nodeName=="LI")
+      selectNode(p.nextSibling, null);
+  }
+  else {
+    moveRight();
+  }
+}
+
+function isExpandedNode(li){
+  var img = li.firstChild;
+  return(img.src.indexOf('minus.png')>-1);
+}
+
+function moveBackward(){
+  var p = selectedNode;
+  var q = p.previousSibling;
+  while (q != null && q.style.display=='none')
+    q = q.previousSibling;
+  if (q == null) {
+    p = p.parentNode.parentNode;
+  } else {
+    while (!isLeafNode(q) && isExpandedNode(q)) {
+      q = findUlChild(q).lastChild;
+      while (q.style.display=='none')
+        q = q.previousSibling;
+    }
+    p = q;
+  }
+  if (p.nodeName=="LI")
+    selectNode(p, null);
+}
+
+function moveHome() {
+  selectNode(currentThread);
+}
+
+var currentThreadIndex = null;
+
+function findThread(node){
+  while (node && node.parentNode.nodeName!="BODY") {
+    node = node.parentNode;
+  }
+  return node.firstChild;
+}
+
+function selectThread(node){
+  var threads = document.getElementsByName("thread");
+  currentThread = node;
+  for (var i=0; i<threads.length; i++) {
+    if (threads[i]==currentThread.parentNode)
+      currentThreadIndex = i;
+  }
+}
+
+function nextThread(){
+  var threads = document.getElementsByName("thread");
+  if (currentThreadIndex==threads.length-1)
+    currentThreadIndex = 0;
+  else
+    currentThreadIndex += 1
+  currentThread = threads[currentThreadIndex].firstChild;
+  selectNode(currentThread, null);
+}
+
+function previousThread(){
+  var threads = document.getElementsByName("thread");
+  if (currentThreadIndex==0)
+    currentThreadIndex = threads.length-1;
+  else
+    currentThreadIndex -= 1
+  currentThread = threads[currentThreadIndex].firstChild;
+  selectNode(currentThread, null);
+}
+
+function switchThread(node, event){
+  event.cancelBubble = true;
+  selectThread(node.nextSibling.firstChild);
+  selectNode(currentThread, null);
+}
+
+function handleKeyEvent(event){
+  var code = event.charCode ? event.charCode : event.keyCode;
+  var str = String.fromCharCode(code);
+  switch (str) {
+    case "a": moveLeft();  break;
+    case "s": moveDown();  break;
+    case "d": moveRight(); break;
+    case "w": moveUp();    break;
+    case "f": moveForward(); break;
+    case "b": moveBackward(); break;
+    case "x": toggleChildren(selectedNode.firstChild, event); break;
+    case "*": toggleLI(selectedNode); break;
+    case "n": nextThread(); break;
+    case "h": moveHome(); break;
+    case "p": previousThread(); break;
+  }
+}
+document.onkeypress=function(event){ handleKeyEvent(event) };
+
+window.onload=function(){
+  var images = document.getElementsByTagName("img");
+  for (var i=0; i<images.length; i++) {
+    var img = images[i];
+    if (img.className == "toggle") {
+      img.onclick = function(event){ toggleChildren(this, event); };
+    }
+  }
+  var divs = document.getElementsByTagName("div");
+  for (i=0; i<divs.length; i++) {
+    var div = divs[i];
+    if (div.className == "thread")
+      div.onclick = function(event){ switchThread(this, event) };
+  }
+  var lis = document.getElementsByTagName("li");
+  for (var i=0; i<lis.length; i++) {
+    lis[i].onclick = function(event){ selectNode(this, event); };
+  }
+  var threads = document.getElementsByName("thread");
+  currentThreadIndex = 0;
+  currentThread = threads[0].firstChild;
+  selectNode(currentThread, null);
+}
+</script>
+</head><body>
+<div id="titlebar">
+Call tree for application <b>primes </b><br/>
+Generated on Sat Jul 24 08:05:17 +0200 2010 with options {:application=>"primes"}<br/>
+</div>
+<div id="commands">
+<span style="font-size: 11pt; font-weight: bold;">Threshold:</span>
+<input value="1.0" size="3" id="threshold" type="text">
+<input value="Apply" onclick="setThreshold();" type="submit">
+<input value="Expand All" onclick="expandAll(event);" type="submit">
+<input value="Collapse All" onclick="collapseAll(event);" type="submit">
+<input value="Show Help" onclick="toggleHelp(this);" type="submit">
+</div>
+<div style="display: none;" id="help">
+<img src="empty.png"> Enter a decimal value <i>d</i> into the threshold field and click "Apply"
+to hide all nodes marked with time values lower than <i>d</i>.<br>
+<img src="empty.png"> Click on "Expand All" for full tree expansion.<br>
+<img src="empty.png"> Click on "Collapse All" to show only top level nodes.<br>
+<img src="empty.png"> Use a, s, d, w as in Quake or Urban Terror to navigate the tree.<br>
+<img src="empty.png"> Use f and b to navigate the tree in preorder forward and backwards.<br>
+<img src="empty.png"> Use x to toggle visibility of a subtree.<br>
+<img src="empty.png"> Use * to expand/collapse a whole subtree.<br>
+<img src="empty.png"> Use h to navigate to thread root.<br>
+<img src="empty.png"> Use n and p to navigate between threads.<br>
+<img src="empty.png"> Click on background to move focus to a subtree.<br>
+</div>
+<div class="thread">Thread: 2148387240 (100.00% ~ 1.41237)</div><ul name="thread"><li class="color9" style="display:block"><img class="toggle" src="minus.png"> 100.00% (100.00%) <a href="txmt://open?url=file:///Users/skaes/src/ruby-prof/test/printers_test.rb&line=16">PrintersTest#setup</a> [1 calls, <a href='multi.graph.html#PrintersTest_setup_2148387240'>1</a> total]
+<ul><li class="color5" style="display:block"><img class="toggle" src="minus.png"> 50.24% (50.24%) <a href="txmt://open?url=file:///Users/skaes/src/ruby-prof/test/printers_test.rb&line=9">PrintersTest#go</a> [1 calls, <a href='multi.graph.html#PrintersTest_go_2148387240'>1</a> total]
+<ul><li class="color5" style="display:block"><img class="toggle" src="minus.png"> 50.23% (100.00%) <a href="txmt://open?url=file:///Users/skaes/src/ruby-prof/test/prime.rb&line=46">Object#run_primes</a> [1 calls, <a href='multi.graph.html#Object_run_primes_2148387240'>2</a> total]
+<ul><li class="color4" style="display:block"><img class="toggle" src="minus.png"> 49.72% (98.97%) <a href="txmt://open?url=file:///Users/skaes/src/ruby-prof/test/prime.rb&line=24">Object#find_primes</a> [1 calls, <a href='multi.graph.html#Object_find_primes_2148387240'>2</a> total]
+<ul><li class="color4" style="display:block"><img class="toggle" src="minus.png"> 49.72% (100.00%) Array#select [1 calls, <a href='multi.graph.html#Array_select_2148387240'>2</a> total]
+<ul><li class="color4" style="display:block"><img class="toggle" src="minus.png"> 49.43% (99.42%) <a href="txmt://open?url=file:///Users/skaes/src/ruby-prof/test/prime.rb&line=16">Object#is_prime</a> [10000 calls, <a href='multi.graph.html#Object_is_prime_2148387240'>20000</a> total]
+<ul><li class="color4" style="display:block"><img class="toggle" src="minus.png"> 48.85% (98.83%) Integer#upto [10000 calls, <a href='multi.graph.html#Integer_upto_2148387240'>20000</a> total]
+<ul><li class="color05" style="display:block"><img src="empty.png"> 7.13% (14.59%) Fixnum#% [778318 calls, <a href='multi.graph.html#Fixnum_%_2148387240'>1544726</a> total]
+</li><li class="color05" style="display:block"><img src="empty.png"> 6.04% (12.36%) Fixnum#== [778318 calls, <a href='multi.graph.html#Fixnum____2148387240'>1544726</a> total]
+</li></ul></li><li class="color01" style="display:none"><img src="empty.png"> 0.09% (0.17%) Fixnum#- [10000 calls, <a href='multi.graph.html#Fixnum_-_2148387240'>20000</a> total]
+</li></ul></li></ul></li></ul></li><li class="color01" style="display:none"><img class="toggle" src="empty.png"> 0.52% (1.03%) <a href="txmt://open?url=file:///Users/skaes/src/ruby-prof/test/prime.rb&line=7">Object#make_random_array</a> [1 calls, <a href='multi.graph.html#Object_make_random_array_2148387240'>2</a> total]
+<ul style="display:none"><li class="color01" style="display:none"><img class="toggle" src="empty.png"> 0.51% (99.22%) Array#each_index [1 calls, <a href='multi.graph.html#Array_each_index_2148387240'>2</a> total]
+<ul style="display:none"><li class="color01" style="display:none"><img src="empty.png"> 0.12% (22.55%) Kernel#rand [10000 calls, <a href='multi.graph.html#Kernel_rand_2148387240'>20000</a> total]
+</li><li class="color01" style="display:none"><img src="empty.png"> 0.09% (18.30%) Array#[]= [10000 calls, <a href='multi.graph.html#Array_[]__2148387240'>20000</a> total]
+</li></ul></li><li class="color01" style="display:none"><img class="toggle" src="empty.png"> 0.00% (0.71%) Class#new [1 calls, <a href='multi.graph.html#Class_new_2148387240'>2</a> total]
+<ul style="display:none"><li class="color01" style="display:none"><img src="empty.png"> 0.00% (96.15%) Array#initialize [1 calls, <a href='multi.graph.html#Array_initialize_2148387240'>2</a> total]
+</li><li class="color01" style="display:none"><img src="empty.png"> 0.00% (1.92%) <Class::Array>#allocate [1 calls, <a href='multi.graph.html#_Class__Array__allocate_2148387240'>2</a> total]
+</li></ul></li></ul></li></ul></li></ul></li><li class="color4" style="display:block"><img class="toggle" src="minus.png"> 49.76% (49.76%) <a href="txmt://open?url=file:///Users/skaes/src/ruby-prof/test/prime.rb&line=46">Object#run_primes</a> [1 calls, <a href='multi.graph.html#Object_run_primes_2148387240'>2</a> total]
+<ul><li class="color4" style="display:block"><img class="toggle" src="minus.png"> 49.23% (98.93%) <a href="txmt://open?url=file:///Users/skaes/src/ruby-prof/test/prime.rb&line=24">Object#find_primes</a> [1 calls, <a href='multi.graph.html#Object_find_primes_2148387240'>2</a> total]
+<ul><li class="color4" style="display:block"><img class="toggle" src="minus.png"> 49.23% (100.00%) Array#select [1 calls, <a href='multi.graph.html#Array_select_2148387240'>2</a> total]
+<ul><li class="color4" style="display:block"><img class="toggle" src="minus.png"> 48.94% (99.41%) <a href="txmt://open?url=file:///Users/skaes/src/ruby-prof/test/prime.rb&line=16">Object#is_prime</a> [10000 calls, <a href='multi.graph.html#Object_is_prime_2148387240'>20000</a> total]
+<ul><li class="color4" style="display:block"><img class="toggle" src="minus.png"> 48.38% (98.84%) Integer#upto [10000 calls, <a href='multi.graph.html#Integer_upto_2148387240'>20000</a> total]
+<ul><li class="color05" style="display:block"><img src="empty.png"> 7.03% (14.53%) Fixnum#% [766408 calls, <a href='multi.graph.html#Fixnum_%_2148387240'>1544726</a> total]
+</li><li class="color01" style="display:block"><img src="empty.png"> 5.89% (12.17%) Fixnum#== [766408 calls, <a href='multi.graph.html#Fixnum____2148387240'>1544726</a> total]
+</li></ul></li><li class="color01" style="display:none"><img src="empty.png"> 0.08% (0.17%) Fixnum#- [10000 calls, <a href='multi.graph.html#Fixnum_-_2148387240'>20000</a> total]
+</li></ul></li></ul></li></ul></li><li class="color01" style="display:none"><img class="toggle" src="empty.png"> 0.53% (1.07%) <a href="txmt://open?url=file:///Users/skaes/src/ruby-prof/test/prime.rb&line=7">Object#make_random_array</a> [1 calls, <a href='multi.graph.html#Object_make_random_array_2148387240'>2</a> total]
+<ul style="display:none"><li class="color01" style="display:none"><img class="toggle" src="empty.png"> 0.53% (99.26%) Array#each_index [1 calls, <a href='multi.graph.html#Array_each_index_2148387240'>2</a> total]
+<ul style="display:none"><li class="color01" style="display:none"><img src="empty.png"> 0.11% (21.47%) Kernel#rand [10000 calls, <a href='multi.graph.html#Kernel_rand_2148387240'>20000</a> total]
+</li><li class="color01" style="display:none"><img src="empty.png"> 0.10% (18.28%) Array#[]= [10000 calls, <a href='multi.graph.html#Array_[]__2148387240'>20000</a> total]
+</li></ul></li><li class="color01" style="display:none"><img class="toggle" src="empty.png"> 0.00% (0.72%) Class#new [1 calls, <a href='multi.graph.html#Class_new_2148387240'>2</a> total]
+<ul style="display:none"><li class="color01" style="display:none"><img src="empty.png"> 0.00% (88.89%) Array#initialize [1 calls, <a href='multi.graph.html#Array_initialize_2148387240'>2</a> total]
+</li><li class="color01" style="display:none"><img src="empty.png"> 0.00% (1.85%) <Class::Array>#allocate [1 calls, <a href='multi.graph.html#_Class__Array__allocate_2148387240'>2</a> total]
+</li></ul></li></ul></li></ul></li></ul></li></ul><div id="sentinel"></div></body></html>
diff --git a/examples/plus.png b/examples/plus.png
new file mode 100755
index 0000000..2f0bbe0
Binary files /dev/null and b/examples/plus.png differ
diff --git a/examples/stack.html b/examples/stack.html
new file mode 100644
index 0000000..c015d03
--- /dev/null
+++ b/examples/stack.html
@@ -0,0 +1,573 @@
+<html><head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+<title>ruby-prof call tree</title>
+<style type="text/css">
+<!--
+body {
+    font-size:70%;
+    padding:0px;
+    margin:5px;
+    margin-right:0px;
+    margin-left:0px;
+    background: #ffffff;
+}
+ul {
+    margin-left:0px;
+    margin-top:0px;
+    margin-bottom:0px;
+    padding-left:0px;
+    list-style-type:none;
+}
+li {
+    margin-left:11px;
+    padding:0px;
+    white-space:nowrap;
+    border-top:1px solid #cccccc;
+    border-left:1px solid #cccccc;
+    border-bottom:none;
+}
+.thread {
+    margin-left:11px;
+    background:#708090;
+    padding-top:3px;
+    padding-left:12px;
+    padding-bottom:2px;
+    border-left:1px solid #CCCCCC;
+    border-top:1px solid #CCCCCC;
+    font-weight:bold;
+}
+.hidden {
+    display:none;
+    width:0px;
+    height:0px;
+    margin:0px;
+    padding:0px;
+    border-style:none;
+}
+.color01 { background:#adbdeb }
+.color05 { background:#9daddb }
+.color0 { background:#8d9dcb }
+.color1 { background:#89bccb }
+.color2 { background:#56e3e7 }
+.color3 { background:#32cd70 }
+.color4 { background:#a3d53c }
+.color5 { background:#c4cb34 }
+.color6 { background:#dcb66d }
+.color7 { background:#cda59e }
+.color8 { background:#be9d9c }
+.color9 { background:#cf947a }
+#commands {
+    font-size:10pt;
+    padding:10px;
+    margin-left:11px;
+    margin-bottom:0px;
+    margin-top:0px;
+    background:#708090;
+    border-top:1px solid #cccccc;
+    border-left:1px solid #cccccc;
+    border-bottom:none;
+}
+#titlebar {
+    font-size:10pt;
+    padding:10px;
+    margin-left:11px;
+    margin-bottom:0px;
+    margin-top:10px;
+    background:#8090a0;
+    border-top:1px solid #cccccc;
+    border-left:1px solid #cccccc;
+    border-bottom:none;
+}
+#help {
+    font-size:10pt;
+    padding:10px;
+    margin-left:11px;
+    margin-bottom:0px;
+    margin-top:0px;
+    background:#8090a0;
+    display:none;
+    border-top:1px solid #cccccc;
+    border-left:1px solid #cccccc;
+    border-bottom:none;
+}
+#sentinel {
+    height: 400px;
+    margin-left:11px;
+    background:#8090a0;
+    border-top:1px solid #cccccc;
+    border-left:1px solid #cccccc;
+    border-bottom:none;
+ }
+input { margin-left:10px; }
+-->
+</style>
+<script type="text/javascript">
+/*
+   Copyright (C) 2005,2009  Stefan Kaes
+   skaes at railsexpress.de
+*/
+
+function rootNode() {
+  return currentThread;
+}
+
+function hideUL(node) {
+  var lis = node.childNodes
+  var l = lis.length;
+  for (var i=0; i < l ; i++ ) {
+    hideLI(lis[i]);
+  }
+}
+
+function showUL(node) {
+  var lis = node.childNodes;
+  var l = lis.length;
+  for (var i=0; i < l ; i++ ) {
+    showLI(lis[i]);
+  }
+}
+
+function findUlChild(li){
+  var ul = li.childNodes[2];
+  while (ul && ul.nodeName != "UL") {
+    ul = ul.nextSibling;
+  }
+  return ul;
+}
+
+function isLeafNode(li) {
+  var img = li.firstChild;
+  return (img.src.indexOf('empty.png') > -1);
+}
+
+function hideLI(li) {
+  if (isLeafNode(li))
+    return;
+
+  var img = li.firstChild;
+  img.src = 'plus.png';
+
+  var ul = findUlChild(li);
+  if (ul) {
+    ul.style.display = 'none';
+    hideUL(ul);
+  }
+}
+
+function showLI(li) {
+  if (isLeafNode(li))
+    return;
+
+  var img = li.firstChild;
+  img.src = 'minus.png';
+
+  var ul = findUlChild(li);
+  if (ul) {
+    ul.style.display = 'block';
+    showUL(ul);
+  }
+}
+
+function toggleLI(li) {
+  var img = li.firstChild;
+  if (img.src.indexOf("minus.png")>-1)
+    hideLI(li);
+  else {
+    if (img.src.indexOf("plus.png")>-1)
+      showLI(li);
+  }
+}
+
+function aboveThreshold(text, threshold) {
+  var match = text.match(/\d+[.,]\d+/);
+  return (match && parseFloat(match[0].replace(/,/, '.'))>=threshold);
+}
+
+function setThresholdLI(li, threshold) {
+  var img = li.firstChild;
+  var text = img.nextSibling;
+  var ul = findUlChild(li);
+
+  var visible = aboveThreshold(text.nodeValue, threshold) ? 1 : 0;
+
+  var count = 0;
+  if (ul) {
+    count = setThresholdUL(ul, threshold);
+  }
+  if (count>0) {
+    img.src = 'minus.png';
+  }
+  else {
+    img.src = 'empty.png';
+  }
+  if (visible) {
+    li.style.display = 'block'
+  }
+  else {
+    li.style.display = 'none'
+  }
+  return visible;
+}
+
+function setThresholdUL(node, threshold) {
+  var lis = node.childNodes;
+  var l = lis.length;
+
+  var count = 0;
+  for ( var i = 0; i < l ; i++ ) {
+    count = count + setThresholdLI(lis[i], threshold);
+  }
+
+  var visible = (count > 0) ? 1 : 0;
+  if (visible) {
+    node.style.display = 'block';
+  }
+  else {
+    node.style.display = 'none';
+  }
+  return visible;
+}
+
+function toggleChildren(img, event) {
+  event.cancelBubble=true;
+
+  if (img.src.indexOf('empty.png') > -1)
+    return;
+
+  var minus = (img.src.indexOf('minus.png') > -1);
+
+  if (minus) {
+    img.src = 'plus.png';
+  }
+  else
+    img.src = 'minus.png';
+
+  var li = img.parentNode;
+  var ul = findUlChild(li);
+  if (ul) {
+    if (minus)
+      ul.style.display = 'none';
+    else
+      ul.style.display = 'block';
+  }
+  if (minus)
+    moveSelectionIfNecessary(li);
+}
+
+function showChildren(li) {
+  var img = li.firstChild;
+  if (img.src.indexOf('empty.png') > -1)
+    return;
+  img.src = 'minus.png';
+
+  var ul = findUlChild(li);
+  if (ul) {
+    ul.style.display = 'block';
+  }
+}
+
+function setThreshold() {
+ var tv = document.getElementById("threshold").value;
+ if (tv.match(/[0-9]+([.,][0-9]+)?/)) {
+   var f = parseFloat(tv.replace(/,/, '.'));
+   var threads = document.getElementsByName("thread");
+   var l = threads.length;
+   for ( var i = 0; i < l ; i++ ) {
+     setThresholdUL(threads[i], f);
+   }
+   var p = selectedNode;
+   while (p && p.style.display=='none')
+     p=p.parentNode.parentNode;
+   if (p && p.nodeName=="LI")
+    selectNode(p);
+ }
+ else {
+   alert("Please specify a decimal number as threshold value!");
+ }
+}
+
+function collapseAll(event) {
+  event.cancelBubble=true;
+  var threads = document.getElementsByName("thread");
+  var l = threads.length;
+  for ( var i = 0; i < l ; i++ ) {
+    hideUL(threads[i]);
+  }
+  selectNode(rootNode(), null);
+}
+
+function expandAll(event) {
+  event.cancelBubble=true;
+  var threads = document.getElementsByName("thread");
+  var l = threads.length;
+  for ( var i = 0; i < l ; i++ ) {
+    showUL(threads[i]);
+  }
+}
+
+function toggleHelp(node) {
+  var help = document.getElementById("help");
+  if (node.value == "Show Help") {
+    node.value = "Hide Help";
+    help.style.display = 'block';
+  }
+  else {
+    node.value = "Show Help";
+    help.style.display = 'none';
+  }
+}
+
+var selectedNode = null;
+var selectedColor = null;
+var selectedThread = null;
+
+function descendentOf(a,b){
+  while (a!=b && b!=null)
+    b=b.parentNode;
+  return (a==b);
+}
+
+function moveSelectionIfNecessary(node){
+  if (descendentOf(node, selectedNode))
+    selectNode(node, null);
+}
+
+function selectNode(node, event) {
+  if (event) {
+    event.cancelBubble = true;
+    thread = findThread(node);
+    selectThread(thread);
+  }
+  if (selectedNode) {
+    selectedNode.style.background = selectedColor;
+  }
+  selectedNode = node;
+  selectedColor = node.style.background;
+  selectedNode.style.background = "red";
+  selectedNode.scrollIntoView();
+  window.scrollBy(0,-400);
+}
+
+function moveUp(){
+  var p = selectedNode.previousSibling;
+  while (p && p.style.display == 'none')
+    p = p.previousSibling;
+  if (p && p.nodeName == "LI") {
+    selectNode(p, null);
+  }
+}
+
+function moveDown(){
+  var p = selectedNode.nextSibling;
+  while (p && p.style.display == 'none')
+    p = p.nextSibling;
+  if (p && p.nodeName == "LI") {
+    selectNode(p, null);
+  }
+}
+
+function moveLeft(){
+  var p = selectedNode.parentNode.parentNode;
+  if (p && p.nodeName=="LI") {
+    selectNode(p, null);
+  }
+}
+
+function moveRight(){
+  if (!isLeafNode(selectedNode)) {
+    showChildren(selectedNode);
+    var ul = findUlChild(selectedNode);
+    if (ul) {
+      selectNode(ul.firstChild, null);
+    }
+  }
+}
+
+function moveForward(){
+  if (isLeafNode(selectedNode)) {
+    var p = selectedNode;
+    while ((p.nextSibling == null || p.nextSibling.style.display=='none') && p.nodeName=="LI") {
+      p = p.parentNode.parentNode;
+    }
+    if (p.nodeName=="LI")
+      selectNode(p.nextSibling, null);
+  }
+  else {
+    moveRight();
+  }
+}
+
+function isExpandedNode(li){
+  var img = li.firstChild;
+  return(img.src.indexOf('minus.png')>-1);
+}
+
+function moveBackward(){
+  var p = selectedNode;
+  var q = p.previousSibling;
+  while (q != null && q.style.display=='none')
+    q = q.previousSibling;
+  if (q == null) {
+    p = p.parentNode.parentNode;
+  } else {
+    while (!isLeafNode(q) && isExpandedNode(q)) {
+      q = findUlChild(q).lastChild;
+      while (q.style.display=='none')
+        q = q.previousSibling;
+    }
+    p = q;
+  }
+  if (p.nodeName=="LI")
+    selectNode(p, null);
+}
+
+function moveHome() {
+  selectNode(currentThread);
+}
+
+var currentThreadIndex = null;
+
+function findThread(node){
+  while (node && node.parentNode.nodeName!="BODY") {
+    node = node.parentNode;
+  }
+  return node.firstChild;
+}
+
+function selectThread(node){
+  var threads = document.getElementsByName("thread");
+  currentThread = node;
+  for (var i=0; i<threads.length; i++) {
+    if (threads[i]==currentThread.parentNode)
+      currentThreadIndex = i;
+  }
+}
+
+function nextThread(){
+  var threads = document.getElementsByName("thread");
+  if (currentThreadIndex==threads.length-1)
+    currentThreadIndex = 0;
+  else
+    currentThreadIndex += 1
+  currentThread = threads[currentThreadIndex].firstChild;
+  selectNode(currentThread, null);
+}
+
+function previousThread(){
+  var threads = document.getElementsByName("thread");
+  if (currentThreadIndex==0)
+    currentThreadIndex = threads.length-1;
+  else
+    currentThreadIndex -= 1
+  currentThread = threads[currentThreadIndex].firstChild;
+  selectNode(currentThread, null);
+}
+
+function switchThread(node, event){
+  event.cancelBubble = true;
+  selectThread(node.nextSibling.firstChild);
+  selectNode(currentThread, null);
+}
+
+function handleKeyEvent(event){
+  var code = event.charCode ? event.charCode : event.keyCode;
+  var str = String.fromCharCode(code);
+  switch (str) {
+    case "a": moveLeft();  break;
+    case "s": moveDown();  break;
+    case "d": moveRight(); break;
+    case "w": moveUp();    break;
+    case "f": moveForward(); break;
+    case "b": moveBackward(); break;
+    case "x": toggleChildren(selectedNode.firstChild, event); break;
+    case "*": toggleLI(selectedNode); break;
+    case "n": nextThread(); break;
+    case "h": moveHome(); break;
+    case "p": previousThread(); break;
+  }
+}
+document.onkeypress=function(event){ handleKeyEvent(event) };
+
+window.onload=function(){
+  var images = document.getElementsByTagName("img");
+  for (var i=0; i<images.length; i++) {
+    var img = images[i];
+    if (img.className == "toggle") {
+      img.onclick = function(event){ toggleChildren(this, event); };
+    }
+  }
+  var divs = document.getElementsByTagName("div");
+  for (i=0; i<divs.length; i++) {
+    var div = divs[i];
+    if (div.className == "thread")
+      div.onclick = function(event){ switchThread(this, event) };
+  }
+  var lis = document.getElementsByTagName("li");
+  for (var i=0; i<lis.length; i++) {
+    lis[i].onclick = function(event){ selectNode(this, event); };
+  }
+  var threads = document.getElementsByName("thread");
+  currentThreadIndex = 0;
+  currentThread = threads[0].firstChild;
+  selectNode(currentThread, null);
+}
+</script>
+</head><body>
+<div id="titlebar">
+Call tree for application <b>primes </b><br/>
+Generated on Sat Jul 24 08:05:17 +0200 2010 with options {:application=>"primes"}<br/>
+</div>
+<div id="commands">
+<span style="font-size: 11pt; font-weight: bold;">Threshold:</span>
+<input value="1.0" size="3" id="threshold" type="text">
+<input value="Apply" onclick="setThreshold();" type="submit">
+<input value="Expand All" onclick="expandAll(event);" type="submit">
+<input value="Collapse All" onclick="collapseAll(event);" type="submit">
+<input value="Show Help" onclick="toggleHelp(this);" type="submit">
+</div>
+<div style="display: none;" id="help">
+<img src="empty.png"> Enter a decimal value <i>d</i> into the threshold field and click "Apply"
+to hide all nodes marked with time values lower than <i>d</i>.<br>
+<img src="empty.png"> Click on "Expand All" for full tree expansion.<br>
+<img src="empty.png"> Click on "Collapse All" to show only top level nodes.<br>
+<img src="empty.png"> Use a, s, d, w as in Quake or Urban Terror to navigate the tree.<br>
+<img src="empty.png"> Use f and b to navigate the tree in preorder forward and backwards.<br>
+<img src="empty.png"> Use x to toggle visibility of a subtree.<br>
+<img src="empty.png"> Use * to expand/collapse a whole subtree.<br>
+<img src="empty.png"> Use h to navigate to thread root.<br>
+<img src="empty.png"> Use n and p to navigate between threads.<br>
+<img src="empty.png"> Click on background to move focus to a subtree.<br>
+</div>
+<div class="thread">Thread: 2148387240 (100.00% ~ 1.41237)</div><ul name="thread"><li class="color9" style="display:block"><img class="toggle" src="minus.png"> 100.00% (100.00%) <a href="txmt://open?url=file:///Users/skaes/src/ruby-prof/test/printers_test.rb&line=16">PrintersTest#setup</a> [1 calls, 1 total]
+<ul><li class="color5" style="display:block"><img class="toggle" src="minus.png"> 50.24% (50.24%) <a href="txmt://open?url=file:///Users/skaes/src/ruby-prof/test/printers_test.rb&line=9">PrintersTest#go</a> [1 calls, 1 total]
+<ul><li class="color5" style="display:block"><img class="toggle" src="minus.png"> 50.23% (100.00%) <a href="txmt://open?url=file:///Users/skaes/src/ruby-prof/test/prime.rb&line=46">Object#run_primes</a> [1 calls, 2 total]
+<ul><li class="color4" style="display:block"><img class="toggle" src="minus.png"> 49.72% (98.97%) <a href="txmt://open?url=file:///Users/skaes/src/ruby-prof/test/prime.rb&line=24">Object#find_primes</a> [1 calls, 2 total]
+<ul><li class="color4" style="display:block"><img class="toggle" src="minus.png"> 49.72% (100.00%) Array#select [1 calls, 2 total]
+<ul><li class="color4" style="display:block"><img class="toggle" src="minus.png"> 49.43% (99.42%) <a href="txmt://open?url=file:///Users/skaes/src/ruby-prof/test/prime.rb&line=16">Object#is_prime</a> [10000 calls, 20000 total]
+<ul><li class="color4" style="display:block"><img class="toggle" src="minus.png"> 48.85% (98.83%) Integer#upto [10000 calls, 20000 total]
+<ul><li class="color05" style="display:block"><img src="empty.png"> 7.13% (14.59%) Fixnum#% [778318 calls, 1544726 total]
+</li><li class="color05" style="display:block"><img src="empty.png"> 6.04% (12.36%) Fixnum#== [778318 calls, 1544726 total]
+</li></ul></li><li class="color01" style="display:none"><img src="empty.png"> 0.09% (0.17%) Fixnum#- [10000 calls, 20000 total]
+</li></ul></li></ul></li></ul></li><li class="color01" style="display:none"><img class="toggle" src="empty.png"> 0.52% (1.03%) <a href="txmt://open?url=file:///Users/skaes/src/ruby-prof/test/prime.rb&line=7">Object#make_random_array</a> [1 calls, 2 total]
+<ul style="display:none"><li class="color01" style="display:none"><img class="toggle" src="empty.png"> 0.51% (99.22%) Array#each_index [1 calls, 2 total]
+<ul style="display:none"><li class="color01" style="display:none"><img src="empty.png"> 0.12% (22.55%) Kernel#rand [10000 calls, 20000 total]
+</li><li class="color01" style="display:none"><img src="empty.png"> 0.09% (18.30%) Array#[]= [10000 calls, 20000 total]
+</li></ul></li><li class="color01" style="display:none"><img class="toggle" src="empty.png"> 0.00% (0.71%) Class#new [1 calls, 2 total]
+<ul style="display:none"><li class="color01" style="display:none"><img src="empty.png"> 0.00% (96.15%) Array#initialize [1 calls, 2 total]
+</li><li class="color01" style="display:none"><img src="empty.png"> 0.00% (1.92%) <Class::Array>#allocate [1 calls, 2 total]
+</li></ul></li></ul></li></ul></li></ul></li><li class="color4" style="display:block"><img class="toggle" src="minus.png"> 49.76% (49.76%) <a href="txmt://open?url=file:///Users/skaes/src/ruby-prof/test/prime.rb&line=46">Object#run_primes</a> [1 calls, 2 total]
+<ul><li class="color4" style="display:block"><img class="toggle" src="minus.png"> 49.23% (98.93%) <a href="txmt://open?url=file:///Users/skaes/src/ruby-prof/test/prime.rb&line=24">Object#find_primes</a> [1 calls, 2 total]
+<ul><li class="color4" style="display:block"><img class="toggle" src="minus.png"> 49.23% (100.00%) Array#select [1 calls, 2 total]
+<ul><li class="color4" style="display:block"><img class="toggle" src="minus.png"> 48.94% (99.41%) <a href="txmt://open?url=file:///Users/skaes/src/ruby-prof/test/prime.rb&line=16">Object#is_prime</a> [10000 calls, 20000 total]
+<ul><li class="color4" style="display:block"><img class="toggle" src="minus.png"> 48.38% (98.84%) Integer#upto [10000 calls, 20000 total]
+<ul><li class="color05" style="display:block"><img src="empty.png"> 7.03% (14.53%) Fixnum#% [766408 calls, 1544726 total]
+</li><li class="color01" style="display:block"><img src="empty.png"> 5.89% (12.17%) Fixnum#== [766408 calls, 1544726 total]
+</li></ul></li><li class="color01" style="display:none"><img src="empty.png"> 0.08% (0.17%) Fixnum#- [10000 calls, 20000 total]
+</li></ul></li></ul></li></ul></li><li class="color01" style="display:none"><img class="toggle" src="empty.png"> 0.53% (1.07%) <a href="txmt://open?url=file:///Users/skaes/src/ruby-prof/test/prime.rb&line=7">Object#make_random_array</a> [1 calls, 2 total]
+<ul style="display:none"><li class="color01" style="display:none"><img class="toggle" src="empty.png"> 0.53% (99.26%) Array#each_index [1 calls, 2 total]
+<ul style="display:none"><li class="color01" style="display:none"><img src="empty.png"> 0.11% (21.47%) Kernel#rand [10000 calls, 20000 total]
+</li><li class="color01" style="display:none"><img src="empty.png"> 0.10% (18.28%) Array#[]= [10000 calls, 20000 total]
+</li></ul></li><li class="color01" style="display:none"><img class="toggle" src="empty.png"> 0.00% (0.72%) Class#new [1 calls, 2 total]
+<ul style="display:none"><li class="color01" style="display:none"><img src="empty.png"> 0.00% (88.89%) Array#initialize [1 calls, 2 total]
+</li><li class="color01" style="display:none"><img src="empty.png"> 0.00% (1.85%) <Class::Array>#allocate [1 calls, 2 total]
+</li></ul></li></ul></li></ul></li></ul></li></ul><div id="sentinel"></div></body></html>
diff --git a/ext/extconf.rb b/ext/extconf.rb
deleted file mode 100644
index 363ae3c..0000000
--- a/ext/extconf.rb
+++ /dev/null
@@ -1,34 +0,0 @@
-require "mkmf"
-
-if RUBY_VERSION >= "1.9"
-  if RUBY_RELEASE_DATE < "2005-03-17"
-    STDERR.print("Ruby version is too old\n")
-    exit(1)
-  end
-elsif RUBY_VERSION >= "1.8"
-  if RUBY_RELEASE_DATE < "2005-03-22"
-    STDERR.print("Ruby version is too old\n")
-    exit(1)
-  end
-else
-  STDERR.print("Ruby version is too old\n")
-  exit(1)
-end
-
-have_header("sys/times.h")
-
-# Stefan Kaes / Alexander Dymo GC patch
-have_func("rb_os_allocated_objects")
-have_func("rb_gc_allocated_size")
-have_func("rb_gc_collections")
-have_func("rb_gc_time")
-
-# Lloyd Hilaiel's heap info patch
-have_func("rb_heap_total_mem")
-have_func("rb_gc_heap_info")
-
-# Ruby 1.9 unexposed methods
-have_func("rb_gc_malloc_allocations")
-have_func("rb_gc_malloc_allocated_size")
-
-create_makefile("ruby_prof")
diff --git a/ext/measure_allocations.h b/ext/measure_allocations.h
deleted file mode 100644
index a7e09f7..0000000
--- a/ext/measure_allocations.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* :nodoc: 
- * Copyright (C) 2008  Shugo Maeda <shugo at ruby-lang.org>
- *                     Charlie Savage <cfis at savagexi.com>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE. */
-
-#include <ruby.h>
-
-#if defined(HAVE_RB_OS_ALLOCATED_OBJECTS)
-#define MEASURE_ALLOCATIONS 3
- 
-static prof_measure_t
-measure_allocations()
-{ 
-    return rb_os_allocated_objects(); 
-}
-
-static double
-convert_allocations(prof_measure_t c)
-{ 
-    return  c; 
-}
-
-/* Document-method: prof_measure_allocations
-   call-seq:
-     measure_allocations -> int
-
-Returns the total number of object allocations since Ruby started.*/
-static VALUE
-prof_measure_allocations(VALUE self)
-{
-#if defined(HAVE_LONG_LONG)
-    return ULL2NUM(rb_os_allocated_objects());
-#else
-    return ULONG2NUM(rb_os_allocated_objects());
-#endif
-}
-#endif
diff --git a/ext/measure_cpu_time.h b/ext/measure_cpu_time.h
deleted file mode 100644
index df382e1..0000000
--- a/ext/measure_cpu_time.h
+++ /dev/null
@@ -1,152 +0,0 @@
-/* :nodoc: 
- * Copyright (C) 2008  Shugo Maeda <shugo at ruby-lang.org>
- *                     Charlie Savage <cfis at savagexi.com>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE. */
-
-#include <ruby.h>
-
-#if defined(_WIN32) || (defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__) || defined(__powerpc__) || defined(__ppc__)))
-#define MEASURE_CPU_TIME 2
-
-static unsigned long long cpu_frequency;
-
-#if defined(__GNUC__)
-
-#include <stdint.h>
-
-static prof_measure_t
-measure_cpu_time()
-{
-#if defined(__i386__) || defined(__x86_64__) 
-    uint32_t a, d;
-    __asm__ volatile("rdtsc" : "=a" (a), "=d" (d));
-    return ((uint64_t)d << 32) + a;
-#elif defined(__powerpc__) || defined(__ppc__)
-    unsigned long long x, y;
-
-    __asm__ __volatile__ ("\n\
-1:	mftbu   %1\n\
-  mftb    %L0\n\
-  mftbu   %0\n\
-  cmpw    %0,%1\n\
-  bne-    1b"
-  : "=r" (x), "=r" (y));
-    return x;
-#endif
-}
-
-#elif defined(_WIN32)
-
-static prof_measure_t
-measure_cpu_time()
-{
-    prof_measure_t cycles = 0;
-
-    __asm
-    {
-        rdtsc
-        mov DWORD PTR cycles, eax
-        mov DWORD PTR [cycles + 4], edx
-    }
-    return cycles;
-}
-
-#endif
-
-
-/* The _WIN32 check is needed for msys (and maybe cygwin?) */
-#if defined(__GNUC__) && !defined(_WIN32)
-
-unsigned long long get_cpu_frequency()
-{
-    unsigned long long x, y;
-
-    struct timespec ts;
-    ts.tv_sec = 0;
-    ts.tv_nsec = 500000000;
-    x = measure_cpu_time();
-    nanosleep(&ts, NULL);
-    y = measure_cpu_time();
-    return (y - x) * 2;
-}
-
-#elif defined(_WIN32)
-
-unsigned long long get_cpu_frequency()
-{
-    unsigned long long x, y;
-    unsigned long long frequency;
-    x = measure_cpu_time();
-
-    /* Use the windows sleep function, not Ruby's */
-    Sleep(500);
-    y = measure_cpu_time();
-    frequency = 2*(y-x);
-    return frequency;
-}
-#endif
-
-static double
-convert_cpu_time(prof_measure_t c)
-{
-    return (double) c / cpu_frequency;
-}
-
-/* Document-method: prof_measure_cpu_time
-   call-seq:
-     measure_cpu_time -> float
-
-Returns the cpu time.*/
-static VALUE
-prof_measure_cpu_time(VALUE self)
-{
-    return rb_float_new(convert_cpu_time(measure_cpu_time()));
-}
-
-/* Document-method: prof_get_cpu_frequency
-   call-seq:
-     cpu_frequency -> int
-
-Returns the cpu's frequency.  This value is needed when 
-RubyProf::measure_mode is set to CPU_TIME. */
-static VALUE
-prof_get_cpu_frequency(VALUE self)
-{
-    return ULL2NUM(cpu_frequency);
-}
-
-/* Document-method: prof_set_cpu_frequency
-   call-seq:
-     cpu_frequency=value -> void
-
-Sets the cpu's frequency.   This value is needed when 
-RubyProf::measure_mode is set to CPU_TIME. */
-static VALUE
-prof_set_cpu_frequency(VALUE self, VALUE val)
-{
-    cpu_frequency = NUM2LL(val);
-    return val;
-}
-
-#endif
diff --git a/ext/measure_gc_runs.h b/ext/measure_gc_runs.h
deleted file mode 100644
index e98e325..0000000
--- a/ext/measure_gc_runs.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/* :nodoc: 
- * Copyright (C) 2008  Shugo Maeda <shugo at ruby-lang.org>
- *                     Charlie Savage <cfis at savagexi.com>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE. */
-
-#if defined(HAVE_RB_GC_COLLECTIONS)
-#define MEASURE_GC_RUNS 5
-
-static prof_measure_t
-measure_gc_runs()
-{
-    return NUM2INT(rb_gc_collections());
-}
-
-static double
-convert_gc_runs(prof_measure_t c)
-{
-    return c;
-}
-
-/* Document-method: prof_measure_gc_runs
-   call-seq:
-     gc_runs -> Integer
-
-Returns the total number of garbage collections.*/
-static VALUE
-prof_measure_gc_runs(VALUE self)
-{
-    return rb_gc_collections();
-}
-
-#elif defined(HAVE_RB_GC_HEAP_INFO)
-#define MEASURE_GC_RUNS 5
-
-static prof_measure_t
-measure_gc_runs()
-{
-  VALUE h = rb_gc_heap_info();
-  return NUM2UINT(rb_hash_aref(h, rb_str_new2("num_gc_passes")));
-}
-
-static double
-convert_gc_runs(prof_measure_t c)
-{
-    return c;
-}
-
-static VALUE
-prof_measure_gc_runs(VALUE self)
-{
-  VALUE h = rb_gc_heap_info();
-  return rb_hash_aref(h, rb_str_new2("num_gc_passes"));
-}
-
-#endif
diff --git a/ext/measure_gc_time.h b/ext/measure_gc_time.h
deleted file mode 100644
index ee0057b..0000000
--- a/ext/measure_gc_time.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* :nodoc: 
- * Copyright (C) 2008  Shugo Maeda <shugo at ruby-lang.org>
- *                     Charlie Savage <cfis at savagexi.com>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE. */
-
-#if defined(HAVE_RB_GC_TIME)
-#define MEASURE_GC_TIME 6
-
-static prof_measure_t
-measure_gc_time()
-{
-#if HAVE_LONG_LONG
-    return NUM2LL(rb_gc_time());
-#else
-    return NUM2LONG(rb_gc_time());
-#endif
-}
-
-static double
-convert_gc_time(prof_measure_t c)
-{
-    return (double) c / 1000000;
-}
-
-/* Document-method: prof_measure_gc_time
-   call-seq:
-     gc_time -> Integer
-
-Returns the time spent doing garbage collections in microseconds.*/
-static VALUE
-prof_measure_gc_time(VALUE self)
-{
-    return rb_gc_time();
-}
-
-#endif
diff --git a/ext/measure_memory.h b/ext/measure_memory.h
deleted file mode 100644
index c613db7..0000000
--- a/ext/measure_memory.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/* :nodoc: 
- * Copyright (C) 2008  Alexander Dymo <adymo at pluron.com>
- *
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE. */
-
-
-#if defined(HAVE_RB_GC_ALLOCATED_SIZE)
-#define MEASURE_MEMORY 4
-#define TOGGLE_GC_STATS 1
- 
-static prof_measure_t
-measure_memory()
-{
-#if defined(HAVE_LONG_LONG)
-    return NUM2LL(rb_gc_allocated_size());
-#else
-    return NUM2ULONG(rb_gc_allocated_size());
-#endif
-}
-
-static double
-convert_memory(prof_measure_t c)
-{ 
-    return (double) c / 1024; 
-}
-
-/* Document-method: prof_measure_memory
-   call-seq:
-     measure_memory -> int
-
-Returns total allocated memory in bytes.*/
-static VALUE
-prof_measure_memory(VALUE self)
-{
-    return rb_gc_allocated_size();
-}
-
-#elif defined(HAVE_RB_GC_MALLOC_ALLOCATED_SIZE)
-#define MEASURE_MEMORY 4
-
-static prof_measure_t
-measure_memory()
-{
-    return rb_gc_malloc_allocated_size();
-}
-
-static double
-convert_memory(prof_measure_t c)
-{
-    return (double) c / 1024;
-}
-
-static VALUE
-prof_measure_memory(VALUE self)
-{
-    return UINT2NUM(rb_gc_malloc_allocated_size());
-}
-
-#elif defined(HAVE_RB_HEAP_TOTAL_MEM)
-#define MEASURE_MEMORY 4
-
-static prof_measure_t
-measure_memory()
-{
-    return rb_heap_total_mem();
-}
-
-static double
-convert_memory(prof_measure_t c)
-{
-    return (double) c / 1024;
-}
-
-static VALUE
-prof_measure_memory(VALUE self)
-{
-    return ULONG2NUM(rb_heap_total_mem());
-}
-
-#endif
diff --git a/ext/measure_process_time.h b/ext/measure_process_time.h
deleted file mode 100644
index b104967..0000000
--- a/ext/measure_process_time.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2008  Shugo Maeda <shugo at ruby-lang.org>
- *                     Charlie Savage <cfis at savagexi.com>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE. */
-
-#include <time.h>
-
-#define MEASURE_PROCESS_TIME 0
-
-static prof_measure_t
-measure_process_time()
-{
-    return clock();
-}
-
-static double
-convert_process_time(prof_measure_t c)
-{
-    return (double) c / CLOCKS_PER_SEC;
-}
-
-/* Document-method: measure_process_time
-   call-seq:
-     measure_process_time -> float
-
-Returns the process time.*/
-static VALUE
-prof_measure_process_time(VALUE self)
-{
-    return rb_float_new(convert_process_time(measure_process_time()));
-}
diff --git a/ext/measure_wall_time.h b/ext/measure_wall_time.h
deleted file mode 100644
index faa550a..0000000
--- a/ext/measure_wall_time.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* :nodoc: 
- * Copyright (C) 2008  Shugo Maeda <shugo at ruby-lang.org>
- *                     Charlie Savage <cfis at savagexi.com>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE. */
-
-
-#define MEASURE_WALL_TIME 1
-
-static prof_measure_t
-measure_wall_time()
-{
-    struct timeval tv;
-    gettimeofday(&tv, NULL);
-    return tv.tv_sec * 1000000 + tv.tv_usec;
-}
-
-static double
-convert_wall_time(prof_measure_t c)
-{
-    return (double) c / 1000000;
-}
-
-/* Document-method: prof_measure_wall_time
-   call-seq:
-     measure_wall_time -> float
-
-Returns the wall time.*/
-static VALUE
-prof_measure_wall_time(VALUE self)
-{
-    return rb_float_new(convert_wall_time(measure_wall_time()));
-}
diff --git a/ext/mingw/Rakefile b/ext/mingw/Rakefile
deleted file mode 100644
index add032d..0000000
--- a/ext/mingw/Rakefile
+++ /dev/null
@@ -1,23 +0,0 @@
-# We can't use Ruby's standard build procedures
-# on Windows because the Ruby executable is
-# built with VC++ while here we want to build
-# with MingW.  So just roll our own...
-
-require 'fileutils'
-require 'rbconfig'
-
-EXTENSION_NAME = "ruby_prof.#{Config::CONFIG["DLEXT"]}"
-
-# This is called when the Windows GEM is installed!
-task :install do
-  # Gems will pass these two environment variables:
-  # RUBYARCHDIR=#{dest_path}
-  # RUBYLIBDIR=#{dest_path}
-  
-  dest_path = ENV['RUBYLIBDIR']
-
-  # Copy the extension
-  cp(EXTENSION_NAME, dest_path)
-end
-
-task :default => :install
diff --git a/ext/mingw/build.rake b/ext/mingw/build.rake
deleted file mode 100644
index edd66a2..0000000
--- a/ext/mingw/build.rake
+++ /dev/null
@@ -1,38 +0,0 @@
-# We can't use Ruby's standard build procedures
-# on Windows because the Ruby executable is
-# built with VC++ while here we want to build
-# with MingW.  So just roll our own...
-
-require 'rake/clean'
-require 'rbconfig'
-
-RUBY_INCLUDE_DIR = Config::CONFIG["archdir"]
-RUBY_BIN_DIR = Config::CONFIG["bindir"]
-RUBY_LIB_DIR = Config::CONFIG["libdir"]
-RUBY_SHARED_LIB = Config::CONFIG["LIBRUBY"]
-RUBY_SHARED_DLL = RUBY_SHARED_LIB.gsub(/lib$/, 'dll')
-    
-EXTENSION_NAME = "ruby_prof.#{Config::CONFIG["DLEXT"]}"
-
-CLEAN.include('*.o')
-CLOBBER.include(EXTENSION_NAME)
-
-task :default => "ruby_prof"
-
-SRC = FileList['../*.c']
-OBJ = SRC.collect do |file_name|
-  File.basename(file_name).ext('o')
-end
-
-SRC.each do |srcfile|
-  objfile = File.basename(srcfile).ext('o')
-  file objfile => srcfile do
-    command = "gcc -c -fPIC -O2 -Wall -o #{objfile} -I/usr/local/include #{srcfile} -I#{RUBY_INCLUDE_DIR}"
-    sh "sh -c '#{command}'" 
-  end
-end
-
-file "ruby_prof" => OBJ do
-  command = "gcc -shared -o #{EXTENSION_NAME} -L/usr/local/lib #{OBJ} #{RUBY_BIN_DIR}/#{RUBY_SHARED_DLL}" 
-  sh "sh -c '#{command}'" 
-end
\ No newline at end of file
diff --git a/ext/mingw/ruby_prof.so b/ext/mingw/ruby_prof.so
deleted file mode 100755
index 70adf02..0000000
Binary files a/ext/mingw/ruby_prof.so and /dev/null differ
diff --git a/ext/ruby_prof.c b/ext/ruby_prof.c
deleted file mode 100644
index 34ee12a..0000000
--- a/ext/ruby_prof.c
+++ /dev/null
@@ -1,1680 +0,0 @@
-/*
- * Copyright (C) 2008  Shugo Maeda <shugo at ruby-lang.org>
- *                     Charlie Savage <cfis at savagexi.com>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/* ruby-prof tracks the time spent executing every method in ruby programming.
-   The main players are:
-
-     prof_result_t     - Its one field, values,  contains the overall results
-     thread_data_t     - Stores data about a single thread.  
-     prof_stack_t      - The method call stack in a particular thread
-     prof_method_t     - Profiling information for each method
-     prof_call_info_t  - Keeps track a method's callers and callees. 
-
-  The final resulut is a hash table of thread_data_t, keyed on the thread
-  id.  Each thread has an hash a table of prof_method_t, keyed on the
-  method id.  A hash table is used for quick look up when doing a profile.
-  However, it is exposed to Ruby as an array.
-  
-  Each prof_method_t has two hash tables, parent and children, of prof_call_info_t.
-  These objects keep track of a method's callers (who called the method) and its
-  callees (who the method called).  These are keyed the method id, but once again,
-  are exposed to Ruby as arrays.  Each prof_call_into_t maintains a pointer to the
-  caller or callee method, thereby making it easy to navigate through the call 
-  hierarchy in ruby - which is very helpful for creating call graphs.      
-*/
-
-#include "ruby_prof.h"
-
-
-/* ================  Helper Functions  =================*/
-static VALUE
-figure_singleton_name(VALUE klass)
-{
-    VALUE result = Qnil;
-
-    /* We have come across a singleton object. First
-       figure out what it is attached to.*/
-    VALUE attached = rb_iv_get(klass, "__attached__");
-
-    /* Is this a singleton class acting as a metaclass? */
-    if (BUILTIN_TYPE(attached) == T_CLASS)
-    {
-        result = rb_str_new2("<Class::");
-        rb_str_append(result, rb_inspect(attached));
-        rb_str_cat2(result, ">");
-    }
-
-    /* Is this for singleton methods on a module? */
-    else if (BUILTIN_TYPE(attached) == T_MODULE)
-    {
-        result = rb_str_new2("<Module::");
-        rb_str_append(result, rb_inspect(attached));
-        rb_str_cat2(result, ">");
-    }
-
-    /* Is this for singleton methods on an object? */
-    else if (BUILTIN_TYPE(attached) == T_OBJECT)
-    {
-        /* Make sure to get the super class so that we don't
-           mistakenly grab a T_ICLASS which would lead to
-           unknown method errors. */
-#ifdef RCLASS_SUPER
-        VALUE super = rb_class_real(RCLASS_SUPER(klass));
-#else
-        VALUE super = rb_class_real(RCLASS(klass)->super);
-#endif
-        result = rb_str_new2("<Object::");
-        rb_str_append(result, rb_inspect(super));
-        rb_str_cat2(result, ">");
-    }
-    
-    /* Ok, this could be other things like an array made put onto
-       a singleton object (yeah, it happens, see the singleton
-       objects test case). */
-    else
-    {
-        result = rb_inspect(klass);
-    }
-
-    return result;
-}
-
-static VALUE
-klass_name(VALUE klass)
-{
-    VALUE result = Qnil;
-    
-    if (klass == 0 || klass == Qnil)
-    {
-        result = rb_str_new2("Global");
-    }
-    else if (BUILTIN_TYPE(klass) == T_MODULE)
-    {
-        result = rb_inspect(klass);
-    }
-    else if (BUILTIN_TYPE(klass) == T_CLASS && FL_TEST(klass, FL_SINGLETON))
-    {
-        result = figure_singleton_name(klass);
-    }
-    else if (BUILTIN_TYPE(klass) == T_CLASS)
-    {
-        result = rb_inspect(klass);
-    }
-    else
-    {
-        /* Should never happen. */
-        result = rb_str_new2("Unknown");
-    }
-
-    return result;
-}
-
-static VALUE
-method_name(ID mid, int depth)
-{
-    VALUE result;
-
-    if (mid == ID_ALLOCATOR) 
-        result = rb_str_new2("allocate");
-    else if (mid == 0)
-        result = rb_str_new2("[No method]");
-    else
-        result = rb_String(ID2SYM(mid));
-    
-    if (depth > 0)
-    {
-      char buffer[65];
-      sprintf(buffer, "%i", depth);
-      rb_str_cat2(result, "-");
-      rb_str_cat2(result, buffer);
-    }
-
-    return result;
-}
-
-static VALUE
-full_name(VALUE klass, ID mid, int depth)
-{
-  VALUE result = klass_name(klass);
-  rb_str_cat2(result, "#");
-  rb_str_append(result, method_name(mid, depth));
-  
-  return result;
-}
-
-/* ================  Stack Handling   =================*/
-/* Creates a stack of prof_frame_t to keep track
-   of timings for active methods. */
-static prof_stack_t *
-stack_create()
-{
-    prof_stack_t *stack = ALLOC(prof_stack_t);
-    stack->start = ALLOC_N(prof_frame_t, INITIAL_STACK_SIZE);
-    stack->ptr = stack->start;
-    stack->end = stack->start + INITIAL_STACK_SIZE;
-    return stack;
-}
-
-static void
-stack_free(prof_stack_t *stack)
-{
-    xfree(stack->start);
-    xfree(stack);
-}
-
-static prof_frame_t *
-stack_push(prof_stack_t *stack)
-{
-  /* Is there space on the stack?  If not, double
-     its size. */
-  if (stack->ptr == stack->end)
-  {
-    size_t len = stack->ptr - stack->start;
-    size_t new_capacity = (stack->end - stack->start) * 2;
-    REALLOC_N(stack->start, prof_frame_t, new_capacity);
-    stack->ptr = stack->start + len;
-    stack->end = stack->start + new_capacity;
-  }
-  return stack->ptr++;
-}
-
-static prof_frame_t *
-stack_pop(prof_stack_t *stack)
-{
-    if (stack->ptr == stack->start)
-      return NULL;
-    else
-      return --stack->ptr;
-}
-
-static prof_frame_t *
-stack_peek(prof_stack_t *stack)
-{
-    if (stack->ptr == stack->start)
-      return NULL;
-    else
-      return stack->ptr - 1;
-}
-
-/* ================  Method Key   =================*/
-static int 
-method_table_cmp(prof_method_key_t *key1, prof_method_key_t *key2) 
-{
-    return (key1->klass != key2->klass) || 
-           (key1->mid != key2->mid) || 
-           (key1->depth != key2->depth);
-}
-
-static int 
-method_table_hash(prof_method_key_t *key) 
-{
-   return key->key;
-}
-
-static struct st_hash_type type_method_hash = {
-    method_table_cmp,
-    method_table_hash
-};
-
-static void
-method_key(prof_method_key_t* key, VALUE klass, ID mid, int depth)
-{
-    key->klass = klass;
-    key->mid = mid;
-    key->depth = depth;
-    key->key = (klass << 4) + (mid << 2) + depth;
-}
-
-
-/* ================  Call Info   =================*/
-static st_table *
-call_info_table_create()
-{
-  return st_init_table(&type_method_hash);
-}
-
-static size_t
-call_info_table_insert(st_table *table, const prof_method_key_t *key, prof_call_info_t *val)
-{
-  return st_insert(table, (st_data_t) key, (st_data_t) val);
-}
-
-static prof_call_info_t *
-call_info_table_lookup(st_table *table, const prof_method_key_t *key)
-{
-    st_data_t val;
-    if (st_lookup(table, (st_data_t) key, &val))
-    {
-      return (prof_call_info_t *) val;
-    }
-    else
-    {
-      return NULL;
-    }
-}
-
-static void
-call_info_table_free(st_table *table)
-{
-    st_free_table(table);
-}
-
-/* Document-class: RubyProf::CallInfo
-RubyProf::CallInfo is a helper class used by RubyProf::MethodInfo
-to keep track of which child methods were called and how long
-they took to execute. */
-
-/* :nodoc: */
-static prof_call_info_t *
-prof_call_info_create(prof_method_t* method, prof_call_info_t* parent)
-{
-    prof_call_info_t *result = ALLOC(prof_call_info_t);
-    result->object = Qnil;
-    result->target = method;
-    result->parent = parent;
-    result->call_infos = call_info_table_create();
-    result->children = Qnil;
-
-    result->called = 0;
-    result->total_time = 0;
-    result->self_time = 0;
-    result->wait_time = 0;
-    result->line = 0;
-    return result;
-}
-
-static void
-prof_call_info_mark(prof_call_info_t *call_info)
-{
-  rb_gc_mark(prof_method_wrap(call_info->target));
-  rb_gc_mark(call_info->children);
-  if (call_info->parent)
-    rb_gc_mark(prof_call_info_wrap(call_info->parent));
-}
-
-static void
-prof_call_info_free(prof_call_info_t *call_info)
-{
-  call_info_table_free(call_info->call_infos); 
-  xfree(call_info);
-}
-
-static VALUE
-prof_call_info_wrap(prof_call_info_t *call_info)
-{
-  if (call_info->object == Qnil)
-  {
-    call_info->object = Data_Wrap_Struct(cCallInfo, prof_call_info_mark, prof_call_info_free, call_info);
-  }
-  return call_info->object;
-}
-
-static prof_call_info_t *
-prof_get_call_info_result(VALUE obj)
-{
-    if (BUILTIN_TYPE(obj) != T_DATA)
-    {
-        /* Should never happen */
-      rb_raise(rb_eTypeError, "Not a call info object");
-    }
-    return (prof_call_info_t *) DATA_PTR(obj);
-}
-
-
-/* call-seq:
-   called -> MethodInfo
-
-Returns the target method. */
-static VALUE
-prof_call_info_target(VALUE self)
-{
-    /* Target is a pointer to a method_info - so we have to be careful
-       about the GC.  We will wrap the method_info but provide no
-       free method so the underlying object is not freed twice! */
-    
-    prof_call_info_t *result = prof_get_call_info_result(self);
-    return prof_method_wrap(result->target);
-}
-
-/* call-seq:
-   called -> int
-
-Returns the total amount of time this method was called. */
-static VALUE
-prof_call_info_called(VALUE self)
-{
-    prof_call_info_t *result = prof_get_call_info_result(self);
-    return INT2NUM(result->called);
-}
-
-/* call-seq:
-   line_no -> int
-
-   returns the line number of the method */
-static VALUE
-prof_call_info_line(VALUE self)
-{
-  prof_call_info_t *result = prof_get_call_info_result(self);
-  return rb_int_new(result->line);
-}
-
-/* call-seq:
-   total_time -> float
-
-Returns the total amount of time spent in this method and its children. */
-static VALUE
-prof_call_info_total_time(VALUE self)
-{
-    prof_call_info_t *result = prof_get_call_info_result(self);
-    return rb_float_new(convert_measurement(result->total_time));
-}
-
-/* call-seq:
-   self_time -> float
-
-Returns the total amount of time spent in this method. */
-static VALUE
-prof_call_info_self_time(VALUE self)
-{
-    prof_call_info_t *result = prof_get_call_info_result(self);
-
-    return rb_float_new(convert_measurement(result->self_time));
-}
-
-/* call-seq:
-   wait_time -> float
-
-Returns the total amount of time this method waited for other threads. */
-static VALUE
-prof_call_info_wait_time(VALUE self)
-{
-    prof_call_info_t *result = prof_get_call_info_result(self);
-
-    return rb_float_new(convert_measurement(result->wait_time));
-}
-
-/* call-seq:
-   parent -> call_info
-
-Returns the call_infos parent call_info object (the method that called this method).*/
-static VALUE
-prof_call_info_parent(VALUE self)
-{
-    prof_call_info_t *result = prof_get_call_info_result(self);
-    if (result->parent)
-      return prof_call_info_wrap(result->parent);
-    else
-      return Qnil;
-}
-
-static int
-prof_call_info_collect_children(st_data_t key, st_data_t value, st_data_t result)
-{
-    prof_call_info_t *call_info = (prof_call_info_t *) value;
-    VALUE arr = (VALUE) result;
-    rb_ary_push(arr, prof_call_info_wrap(call_info));
-    return ST_CONTINUE;
-}
-
-/* call-seq:
-   children -> hash
-
-Returns an array of call info objects of methods that this method 
-called (ie, children).*/
-static VALUE
-prof_call_info_children(VALUE self)
-{
-    prof_call_info_t *call_info = prof_get_call_info_result(self);
-    if (call_info->children == Qnil)
-    {
-      call_info->children = rb_ary_new();
-      st_foreach(call_info->call_infos, prof_call_info_collect_children, call_info->children);
-    }
-    return call_info->children;
-}
-
-/* ================  Call Infos   =================*/
-static prof_call_infos_t*
-prof_call_infos_create()
-{
-   prof_call_infos_t *result = ALLOC(prof_call_infos_t);
-   result->start = ALLOC_N(prof_call_info_t*, INITIAL_CALL_INFOS_SIZE);
-   result->end = result->start + INITIAL_CALL_INFOS_SIZE;
-   result->ptr = result->start;
-   result->object = Qnil;
-   return result;
-}
-
-static void
-prof_call_infos_free(prof_call_infos_t *call_infos)
-{
-  xfree(call_infos->start);
-  xfree(call_infos);
-}
-
-static void
-prof_add_call_info(prof_call_infos_t *call_infos, prof_call_info_t *call_info)
-{
-  if (call_infos->ptr == call_infos->end)
-  {
-    size_t len = call_infos->ptr - call_infos->start;
-    size_t new_capacity = (call_infos->end - call_infos->start) * 2;
-    REALLOC_N(call_infos->start, prof_call_info_t*, new_capacity);
-    call_infos->ptr = call_infos->start + len;
-    call_infos->end = call_infos->start + new_capacity;
-  }
-  *call_infos->ptr = call_info;
-  call_infos->ptr++;
-}
-
-static VALUE
-prof_call_infos_wrap(prof_call_infos_t *call_infos)
-{
-  if (call_infos->object == Qnil)
-  {
-    prof_call_info_t **i;
-    call_infos->object = rb_ary_new();
-    for(i=call_infos->start; i<call_infos->ptr; i++)
-    {
-      VALUE call_info = prof_call_info_wrap(*i);
-      rb_ary_push(call_infos->object, call_info);
-    }
-  }
-  return call_infos->object;
-}
-
-
-/* ================  Method Info   =================*/
-/* Document-class: RubyProf::MethodInfo
-The RubyProf::MethodInfo class stores profiling data for a method.
-One instance of the RubyProf::MethodInfo class is created per method
-called per thread.  Thus, if a method is called in two different
-thread then there will be two RubyProf::MethodInfo objects
-created.  RubyProf::MethodInfo objects can be accessed via
-the RubyProf::Result object.
-*/
-
-static prof_method_t*
-prof_method_create(prof_method_key_t *key, const char* source_file, int line)
-{
-    prof_method_t *result = ALLOC(prof_method_t);
-    result->object = Qnil;
-    result->key = ALLOC(prof_method_key_t);
-    method_key(result->key, key->klass, key->mid, key->depth);   
-
-    result->call_infos = prof_call_infos_create();
-
-    result->active = 0;
-
-    if (source_file != NULL) 
-    {
-      int len = strlen(source_file) + 1;    
-      char *buffer = ALLOC_N(char, len);
-
-      MEMCPY(buffer, source_file, char, len);
-      result->source_file = buffer;
-    }
-    else 
-    {    
-      result->source_file = source_file;
-    }      
-    result->line = line;
-
-    return result;
-}
-
-static void
-prof_method_mark(prof_method_t *method)
-{
-  rb_gc_mark(method->call_infos->object);
-  rb_gc_mark(method->key->klass);
-}
-
-static void
-prof_method_free(prof_method_t *method)
-{
-  if (method->source_file)
-  {
-    xfree((char*)method->source_file);    
-  }
-
-  prof_call_infos_free(method->call_infos);
-  xfree(method->key);
-  xfree(method);
-}
-
-static VALUE
-prof_method_wrap(prof_method_t *result)
-{
-  if (result->object == Qnil)
-  {
-    result->object = Data_Wrap_Struct(cMethodInfo, prof_method_mark, prof_method_free, result);
-  }
-  return result->object;
-}
-
-static prof_method_t *
-get_prof_method(VALUE obj)
-{
-    return (prof_method_t *) DATA_PTR(obj);
-}
-
-/* call-seq:
-   line_no -> int
-
-   returns the line number of the method */
-static VALUE
-prof_method_line(VALUE self)
-{
-    return rb_int_new(get_prof_method(self)->line);
-}
-
-/* call-seq:
-   source_file => string
-
-return the source file of the method 
-*/
-static VALUE prof_method_source_file(VALUE self)
-{
-    const char* sf = get_prof_method(self)->source_file;
-    if(!sf)
-    {
-      return rb_str_new2("ruby_runtime");
-    }
-    else
-    {
-      return rb_str_new2(sf);
-    }
-}
-
-
-/* call-seq:
-   method_class -> klass
-
-Returns the Ruby klass that owns this method. */
-static VALUE
-prof_method_klass(VALUE self)
-{
-    prof_method_t *result = get_prof_method(self);
-    return result->key->klass;
-}
-
-/* call-seq:
-   method_id -> ID
-
-Returns the id of this method. */
-static VALUE
-prof_method_id(VALUE self)
-{
-    prof_method_t *result = get_prof_method(self);
-    return ID2SYM(result->key->mid);
-}
-
-/* call-seq:
-   klass_name -> string
-
-Returns the name of this method's class.  Singleton classes
-will have the form <Object::Object>. */
-
-static VALUE
-prof_klass_name(VALUE self)
-{
-    prof_method_t *method = get_prof_method(self);
-    return klass_name(method->key->klass);
-}
-
-/* call-seq:
-   method_name -> string
-
-Returns the name of this method in the format Object#method.  Singletons
-methods will be returned in the format <Object::Object>#method.*/
-
-static VALUE
-prof_method_name(VALUE self, int depth)
-{
-    prof_method_t *method = get_prof_method(self);
-    return method_name(method->key->mid, depth);
-}
-
-/* call-seq:
-   full_name -> string
-
-Returns the full name of this method in the format Object#method.*/
-
-static VALUE
-prof_full_name(VALUE self)
-{
-    prof_method_t *method = get_prof_method(self);
-    return full_name(method->key->klass, method->key->mid, method->key->depth);
-}
-
-/* call-seq:
-   call_infos -> Array of call_info
-
-Returns an array of call info objects that contain profiling information 
-about the current method.*/
-static VALUE
-prof_method_call_infos(VALUE self)
-{
-    prof_method_t *method = get_prof_method(self);
-    return prof_call_infos_wrap(method->call_infos);
-}
-
-static int
-collect_methods(st_data_t key, st_data_t value, st_data_t result)
-{
-    /* Called for each method stored in a thread's method table. 
-       We want to store the method info information into an array.*/
-    VALUE methods = (VALUE) result;
-    prof_method_t *method = (prof_method_t *) value;
-    rb_ary_push(methods, prof_method_wrap(method));
-
-    /* Wrap call info objects */
-    prof_call_infos_wrap(method->call_infos);
-
-    return ST_CONTINUE;
-}
-
-/* ================  Method Table   =================*/
-static st_table *
-method_table_create()
-{
-  return st_init_table(&type_method_hash);
-}
-
-static size_t
-method_table_insert(st_table *table, const prof_method_key_t *key, prof_method_t *val)
-{
-  return st_insert(table, (st_data_t) key, (st_data_t) val);
-}
-
-static prof_method_t *
-method_table_lookup(st_table *table, const prof_method_key_t* key)
-{
-    st_data_t val;
-    if (st_lookup(table, (st_data_t)key, &val))
-    {
-      return (prof_method_t *) val;
-    }
-    else 
-    {
-      return NULL;
-    }
-}
-
-
-static void
-method_table_free(st_table *table)
-{
-    /* Don't free the contents since they are wrapped by
-       Ruby objects! */
-    st_free_table(table);
-}
-
-
-/* ================  Thread Handling   =================*/
-
-/* ---- Keeps track of thread's stack and methods ---- */
-static thread_data_t*
-thread_data_create()
-{
-    thread_data_t* result = ALLOC(thread_data_t);
-    result->stack = stack_create();
-    result->method_table = method_table_create();
-    result->last_switch = get_measurement();
-    return result;
-}
-
-static void
-thread_data_free(thread_data_t* thread_data)
-{
-    method_table_free(thread_data->method_table);
-    stack_free(thread_data->stack);
-    xfree(thread_data);
-}
-
-/* ---- Hash, keyed on thread, that stores thread's stack
-        and methods---- */
-
-static st_table *
-threads_table_create()
-{
-    return st_init_numtable();
-}
-
-static size_t
-threads_table_insert(st_table *table, VALUE thread, thread_data_t *thread_data)
-{
-    /* Its too slow to key on the real thread id so just typecast thread instead. */
-    return st_insert(table, (st_data_t) thread, (st_data_t) thread_data);
-}
-
-static thread_data_t *
-threads_table_lookup(st_table *table, VALUE thread_id)
-{
-    thread_data_t* result;
-    st_data_t val;
-
-    /* Its too slow to key on the real thread id so just typecast thread instead. */
-    if (st_lookup(table, (st_data_t) thread_id, &val))
-    {
-      result = (thread_data_t *) val;
-    }
-    else
-    {
-        result = thread_data_create();
-        result->thread_id = thread_id;
-
-        /* Insert the table */
-        threads_table_insert(threads_tbl, thread_id, result);
-    }
-    return result;
-}
-
-static int
-free_thread_data(st_data_t key, st_data_t value, st_data_t dummy)
-{
-    thread_data_free((thread_data_t*)value);
-    return ST_CONTINUE;
-}
-
-
-static void
-threads_table_free(st_table *table)
-{
-    st_foreach(table, free_thread_data, 0);
-    st_free_table(table);
-}
-
-
-static int
-collect_threads(st_data_t key, st_data_t value, st_data_t result)
-{
-    /* Although threads are keyed on an id, that is actually a 
-       pointer to the VALUE object of the thread.  So its bogus.
-       However, in thread_data is the real thread id stored
-       as an int. */
-    thread_data_t* thread_data = (thread_data_t*) value;
-    VALUE threads_hash = (VALUE) result;
-
-    VALUE methods = rb_ary_new();
-
-    /* Now collect an array of all the called methods */
-    st_table* method_table = thread_data->method_table;
-    st_foreach(method_table, collect_methods, methods);
- 
-    /* Store the results in the threads hash keyed on the thread id. */
-    rb_hash_aset(threads_hash, thread_data->thread_id, methods);
-
-    return ST_CONTINUE;
-}
-
-
-/* ================  Profiling    =================*/
-/* Copied from eval.c */
-#ifdef DEBUG
-static char *
-get_event_name(rb_event_flag_t event)
-{
-  switch (event) {
-    case RUBY_EVENT_LINE:
-  return "line";
-    case RUBY_EVENT_CLASS:
-  return "class";
-    case RUBY_EVENT_END:
-  return "end";
-    case RUBY_EVENT_CALL:
-  return "call";
-    case RUBY_EVENT_RETURN:
-  return "return";
-    case RUBY_EVENT_C_CALL:
-  return "c-call";
-    case RUBY_EVENT_C_RETURN:
-  return "c-return";
-    case RUBY_EVENT_RAISE:
-  return "raise";
-    default:
-  return "unknown";
-  }
-}
-#endif
-
-static prof_method_t* 
-get_method(rb_event_flag_t event, NODE *node, VALUE klass, ID mid, int depth, st_table* method_table)
-{
-    prof_method_key_t key;
-    prof_method_t *method = NULL;
-    
-    method_key(&key, klass, mid, depth);
-    method = method_table_lookup(method_table, &key);
-
-    if (!method)
-    {
-      const char* source_file = rb_sourcefile();
-      int line = rb_sourceline();
-      
-      /* Line numbers are not accurate for c method calls */
-      if (event == RUBY_EVENT_C_CALL)
-      {
-        line = 0;
-        source_file = NULL;
-      }
-        
-      method = prof_method_create(&key, source_file, line);
-      method_table_insert(method_table, method->key, method);
-    }
-    return method;
-}
-
-static void
-update_result(prof_measure_t total_time,
-              prof_frame_t *parent_frame, 
-              prof_frame_t *frame)
-{
-    prof_measure_t self_time = total_time - frame->child_time - frame->wait_time;
-
-    prof_call_info_t *call_info = frame->call_info;
-    
-    /* Update information about the current method */
-    call_info->called++;
-    call_info->total_time += total_time;
-    call_info->self_time += self_time;
-    call_info->wait_time += frame->wait_time;
-
-    /* Note where the current method was called from */
-    if (parent_frame)
-      call_info->line = parent_frame->line;
-}
-
-static thread_data_t *
-switch_thread(VALUE thread_id, prof_measure_t now)
-{
-    prof_frame_t *frame = NULL;
-    prof_measure_t wait_time = 0;
-    
-    /* Get new thread information. */
-    thread_data_t *thread_data = threads_table_lookup(threads_tbl, thread_id);
-
-    /* How long has this thread been waiting? */
-    wait_time = now - thread_data->last_switch;
-    thread_data->last_switch = 0;
-
-    /* Get the frame at the top of the stack.  This may represent
-       the current method (EVENT_LINE, EVENT_RETURN)  or the
-       previous method (EVENT_CALL).*/
-    frame = stack_peek(thread_data->stack);
-  
-    if (frame)
-      frame->wait_time += wait_time;
-      
-    /* Save on the last thread the time of the context switch
-       and reset this thread's last context switch to 0.*/
-    if (last_thread_data)
-      last_thread_data->last_switch = now;
-      
-    last_thread_data = thread_data;
-    return thread_data;
-}
-
-static prof_frame_t*
-pop_frame(thread_data_t *thread_data, prof_measure_t now)
-{
-  prof_frame_t *frame = NULL;
-  prof_frame_t* parent_frame = NULL;
-  prof_measure_t total_time;
-
-  frame = stack_pop(thread_data->stack);
-    
-  /* Frame can be null.  This can happen if RubProf.start is called from
-     a method that exits.  And it can happen if an exception is raised
-     in code that is being profiled and the stack unwinds (RubProf is
-     not notified of that by the ruby runtime. */
-  if (frame == NULL) return NULL;
-
-  /* Calculate the total time this method took */
-  total_time = now - frame->start_time;
-
-  /* Now deactivate the method */
-  frame->call_info->target->active = 0;
-
-  parent_frame = stack_peek(thread_data->stack);
-  if (parent_frame)
-  {
-    parent_frame->child_time += total_time;
-  }
-    
-  update_result(total_time, parent_frame, frame);
-  return frame;
-}
-
-static int 
-pop_frames(st_data_t key, st_data_t value, st_data_t now_arg)
-{
-    VALUE thread_id = (VALUE)key;
-    thread_data_t* thread_data = (thread_data_t *) value;
-    prof_measure_t now = *(prof_measure_t *) now_arg;
-
-    if (!last_thread_data || last_thread_data->thread_id != thread_id)
-      thread_data = switch_thread(thread_id, now);
-    else
-      thread_data = last_thread_data;
-
-    while (pop_frame(thread_data, now))
-    {
-    }
-    
-    return ST_CONTINUE;
-}
-
-static void 
-prof_pop_threads()
-{
-    /* Get current measurement*/
-    prof_measure_t now = get_measurement();
-    st_foreach(threads_tbl, pop_frames, (st_data_t) &now);
-}
-
-
-#ifdef RUBY_VM
-static void
-prof_event_hook(rb_event_flag_t event, VALUE data, VALUE self, ID mid, VALUE klass)
-#else
-static void
-prof_event_hook(rb_event_flag_t event, NODE *node, VALUE self, ID mid, VALUE klass)
-#endif
-{
-    
-    VALUE thread = Qnil;
-    VALUE thread_id = Qnil;
-    prof_measure_t now = 0;
-    thread_data_t* thread_data = NULL;
-    prof_frame_t *frame = NULL;
-
-
-#ifdef RUBY_VM
-
-    if (event != RUBY_EVENT_C_CALL && event != RUBY_EVENT_C_RETURN) {
-        rb_frame_method_id_and_class(&mid, &klass);
-    }
-#endif
-
-#ifdef DEBUG
-    /*  This code is here for debug purposes - uncomment it out
-        when debugging to see a print out of exactly what the
-        profiler is tracing. */
-    {
-        char* key = 0;
-        static VALUE last_thread_id = Qnil;
-
-        VALUE thread = rb_thread_current();
-        VALUE thread_id = rb_obj_id(thread);
-        char* class_name = NULL;
-        char* method_name = rb_id2name(mid);
-        char* source_file = rb_sourcefile();
-        unsigned int source_line = rb_sourceline();
-
-        char* event_name = get_event_name(event);
-
-        if (klass != 0)
-          klass = (BUILTIN_TYPE(klass) == T_ICLASS ? RBASIC(klass)->klass : klass);
-
-        class_name = rb_class2name(klass);
-
-        if (last_thread_id != thread_id)
-          printf("\n");
-
-        printf("%2u: %-8s :%2d  %s#%s\n",
-               thread_id, event_name, source_line, class_name, method_name);
-        fflush(stdout);
-        last_thread_id = thread_id;               
-    }
-#endif
-    
-    /* Special case - skip any methods from the mProf 
-       module, such as Prof.stop, since they clutter
-       the results but aren't important to them results. */
-    if (self == mProf) return;
-
-    /* Get current measurement*/
-    now = get_measurement();
-    
-    /* Get the current thread information. */
-    thread = rb_thread_current();
-    thread_id = rb_obj_id(thread);
-
-    if (exclude_threads_tbl &&
-        st_lookup(exclude_threads_tbl, (st_data_t) thread_id, 0)) 
-    {
-      return;
-    }    
-    
-    /* Was there a context switch? */
-    if (!last_thread_data || last_thread_data->thread_id != thread_id)
-      thread_data = switch_thread(thread_id, now);
-    else
-      thread_data = last_thread_data;
-    
-    /* Get the current frame for the current thread. */
-    frame = stack_peek(thread_data->stack);
-
-    switch (event) {
-    case RUBY_EVENT_LINE:
-    {
-      /* Keep track of the current line number in this method.  When
-         a new method is called, we know what line number it was 
-         called from. */
-      if (frame)
-      {
-        frame->line = rb_sourceline();
-        break;
-      }
-
-      /* If we get here there was no frame, which means this is 
-         the first method seen for this thread, so fall through
-         to below to create it. */
-    }
-    case RUBY_EVENT_CALL:
-    case RUBY_EVENT_C_CALL:
-    {
-        prof_call_info_t *call_info = NULL;
-        prof_method_t *method = NULL;
-
-        /* Is this an include for a module?  If so get the actual
-           module class since we want to combine all profiling
-           results for that module. */
-        
-        if (klass != 0)
-          klass = (BUILTIN_TYPE(klass) == T_ICLASS ? RBASIC(klass)->klass : klass);
-          
-        /* Assume this is the first time we have called this method. */
-        method = get_method(event, node, klass, mid, 0, thread_data->method_table);
-
-        /* Check for a recursive call */
-        if (method->active)
-        {
-          /* Yes, this method is already active */
-          method = get_method(event, node, klass, mid, method->key->depth + 1, thread_data->method_table);
-        }
-        else
-        {
-          /* No, so make it active */
-          method->active = 1;
-        }
-
-        if (!frame)
-        {
-          call_info = prof_call_info_create(method, NULL);
-          prof_add_call_info(method->call_infos, call_info);
-        }
-        else
-        {
-          call_info = call_info_table_lookup(frame->call_info->call_infos, method->key);
-
-          if (!call_info)
-          {
-            call_info = prof_call_info_create(method, frame->call_info);
-            call_info_table_insert(frame->call_info->call_infos, method->key, call_info);
-            prof_add_call_info(method->call_infos, call_info);
-          }
-        }
-
-        /* Push a new frame onto the stack */
-        frame = stack_push(thread_data->stack);
-        frame->call_info = call_info;
-        frame->start_time = now;
-        frame->wait_time = 0;
-        frame->child_time = 0;
-        frame->line = rb_sourceline();
-
-        break;
-    }
-    case RUBY_EVENT_RETURN:
-    case RUBY_EVENT_C_RETURN:
-    {
-        pop_frame(thread_data, now);
-        break;
-      }
-    }
-}
-
-
-/* ========  ProfResult ============== */
-
-/* Document-class: RubyProf::Result
-The RubyProf::Result class is used to store the results of a 
-profiling run.  And instace of the class is returned from
-the methods RubyProf#stop and RubyProf#profile.
-
-RubyProf::Result has one field, called threads, which is a hash
-table keyed on thread ID.  For each thread id, the hash table
-stores another hash table that contains profiling information
-for each method called during the threads execution.  That
-hash table is keyed on method name and contains
-RubyProf::MethodInfo objects. */
-
-
-static void
-prof_result_mark(prof_result_t *prof_result)
-{
-    VALUE threads = prof_result->threads;
-    rb_gc_mark(threads);
-}
-
-static void
-prof_result_free(prof_result_t *prof_result)
-{
-    prof_result->threads = Qnil;
-    xfree(prof_result);
-}
-
-static VALUE
-prof_result_new()
-{
-    prof_result_t *prof_result = ALLOC(prof_result_t);
-
-    /* Wrap threads in Ruby regular Ruby hash table. */
-    prof_result->threads = rb_hash_new();
-    st_foreach(threads_tbl, collect_threads, prof_result->threads);
-
-    return Data_Wrap_Struct(cResult, prof_result_mark, prof_result_free, prof_result);
-}
-
-
-static prof_result_t *
-get_prof_result(VALUE obj)
-{
-    if (BUILTIN_TYPE(obj) != T_DATA ||
-      RDATA(obj)->dfree != (RUBY_DATA_FUNC) prof_result_free)
-    {
-        /* Should never happen */
-      rb_raise(rb_eTypeError, "wrong result object");
-    }
-    return (prof_result_t *) DATA_PTR(obj);
-}
-
-/* call-seq:
-   threads -> Hash
-
-Returns a hash table keyed on thread ID.  For each thread id,
-the hash table stores another hash table that contains profiling
-information for each method called during the threads execution.
-That hash table is keyed on method name and contains 
-RubyProf::MethodInfo objects. */
-static VALUE
-prof_result_threads(VALUE self)
-{
-    prof_result_t *prof_result = get_prof_result(self);
-    return prof_result->threads;
-}
-
-
-
-/* call-seq:
-   measure_mode -> measure_mode
-   
-   Returns what ruby-prof is measuring.  Valid values include:
-   
-   *RubyProf::PROCESS_TIME - Measure process time.  This is default.  It is implemented using the clock functions in the C Runtime library.
-   *RubyProf::WALL_TIME - Measure wall time using gettimeofday on Linx and GetLocalTime on Windows
-   *RubyProf::CPU_TIME - Measure time using the CPU clock counter.  This mode is only supported on Pentium or PowerPC platforms. 
-   *RubyProf::ALLOCATIONS - Measure object allocations.  This requires a patched Ruby interpreter.
-   *RubyProf::MEMORY - Measure memory size.  This requires a patched Ruby interpreter.
-   *RubyProf::GC_RUNS - Measure number of garbage collections.  This requires a patched Ruby interpreter.
-   *RubyProf::GC_TIME - Measure time spent doing garbage collection.  This requires a patched Ruby interpreter.*/
-static VALUE
-prof_get_measure_mode(VALUE self)
-{
-    return INT2NUM(measure_mode);
-}
-
-/* call-seq:
-   measure_mode=value -> void
-   
-   Specifies what ruby-prof should measure.  Valid values include:
-   
-   *RubyProf::PROCESS_TIME - Measure process time.  This is default.  It is implemented using the clock functions in the C Runtime library.
-   *RubyProf::WALL_TIME - Measure wall time using gettimeofday on Linx and GetLocalTime on Windows
-   *RubyProf::CPU_TIME - Measure time using the CPU clock counter.  This mode is only supported on Pentium or PowerPC platforms. 
-   *RubyProf::ALLOCATIONS - Measure object allocations.  This requires a patched Ruby interpreter.
-   *RubyProf::MEMORY - Measure memory size.  This requires a patched Ruby interpreter.
-   *RubyProf::GC_RUNS - Measure number of garbage collections.  This requires a patched Ruby interpreter.
-   *RubyProf::GC_TIME - Measure time spent doing garbage collection.  This requires a patched Ruby interpreter.*/
-static VALUE
-prof_set_measure_mode(VALUE self, VALUE val)
-{
-    long mode = NUM2LONG(val);
-
-    if (threads_tbl)
-    {
-      rb_raise(rb_eRuntimeError, "can't set measure_mode while profiling");
-    }
-
-    switch (mode) {
-      case MEASURE_PROCESS_TIME:
-        get_measurement = measure_process_time;
-        convert_measurement = convert_process_time;
-        break;
-        
-      case MEASURE_WALL_TIME:
-        get_measurement = measure_wall_time;
-        convert_measurement = convert_wall_time;
-        break;
-        
-      #if defined(MEASURE_CPU_TIME)
-      case MEASURE_CPU_TIME:
-        if (cpu_frequency == 0)
-            cpu_frequency = get_cpu_frequency();
-        get_measurement = measure_cpu_time;
-        convert_measurement = convert_cpu_time;
-        break;
-      #endif
-              
-      #if defined(MEASURE_ALLOCATIONS)
-      case MEASURE_ALLOCATIONS:
-        get_measurement = measure_allocations;
-        convert_measurement = convert_allocations;
-        break;
-      #endif
-        
-      #if defined(MEASURE_MEMORY)
-      case MEASURE_MEMORY:
-        get_measurement = measure_memory;
-        convert_measurement = convert_memory;
-        break;
-      #endif
-
-      #if defined(MEASURE_GC_RUNS)
-      case MEASURE_GC_RUNS:
-        get_measurement = measure_gc_runs;
-        convert_measurement = convert_gc_runs;
-        break;
-      #endif
-
-      #if defined(MEASURE_GC_TIME)
-      case MEASURE_GC_TIME:
-        get_measurement = measure_gc_time;
-        convert_measurement = convert_gc_time;
-        break;
-      #endif
-
-      default:
-        rb_raise(rb_eArgError, "invalid mode: %ld", mode);
-        break;
-    }
-    
-    measure_mode = mode;
-    return val;
-}
-
-/* call-seq:
-   exclude_threads= -> void
-
-   Specifies what threads ruby-prof should exclude from profiling */
-static VALUE
-prof_set_exclude_threads(VALUE self, VALUE threads)
-{
-    int i;
-
-    if (threads_tbl != NULL)
-    {
-      rb_raise(rb_eRuntimeError, "can't set exclude_threads while profiling");
-    }
-
-    /* Stay simple, first free the old hash table */
-    if (exclude_threads_tbl)
-    {
-      st_free_table(exclude_threads_tbl);
-      exclude_threads_tbl = NULL;
-    }
-
-    /* Now create a new one if the user passed in any threads */
-    if (threads != Qnil)
-    {
-      Check_Type(threads, T_ARRAY);
-      exclude_threads_tbl = st_init_numtable();
-
-      for (i=0; i < RARRAY_LEN(threads); ++i) 
-      {
-        VALUE thread = rb_ary_entry(threads, i);
-        st_insert(exclude_threads_tbl, (st_data_t) rb_obj_id(thread), 0);
-      }
-    }    
-    return threads;
-}
-
-
-/* =========  Profiling ============= */
-void
-prof_install_hook()
-{
-#ifdef RUBY_VM
-    rb_add_event_hook(prof_event_hook,
-          RUBY_EVENT_CALL | RUBY_EVENT_RETURN |
-          RUBY_EVENT_C_CALL | RUBY_EVENT_C_RETURN 
-          | RUBY_EVENT_LINE, Qnil);
-#else
-    rb_add_event_hook(prof_event_hook,
-          RUBY_EVENT_CALL | RUBY_EVENT_RETURN |
-          RUBY_EVENT_C_CALL | RUBY_EVENT_C_RETURN 
-          | RUBY_EVENT_LINE);
-#endif
-
-#if defined(TOGGLE_GC_STATS)
-    rb_gc_enable_stats();
-#endif
-}
-
-void
-prof_remove_hook()
-{
-#if defined(TOGGLE_GC_STATS)
-    rb_gc_disable_stats();
-#endif
-
-    /* Now unregister from event   */
-    rb_remove_event_hook(prof_event_hook);
-}
-
-
-
-/* call-seq:
-   running? -> boolean
-   
-   Returns whether a profile is currently running.*/
-static VALUE
-prof_running(VALUE self)
-{
-    if (threads_tbl != NULL)
-        return Qtrue;
-    else
-        return Qfalse;
-}
-
-/* call-seq:
-   start -> RubyProf
-   
-   Starts recording profile data.*/
-static VALUE
-prof_start(VALUE self)
-{
-    if (threads_tbl != NULL)
-    {
-        rb_raise(rb_eRuntimeError, "RubyProf.start was already called");
-    }
-
-    /* Setup globals */
-    last_thread_data = NULL;
-    threads_tbl = threads_table_create();
-
-    prof_install_hook();              
-    return self;
-}    
-
-/* call-seq:
-   pause -> RubyProf
-
-   Pauses collecting profile data. */
-static VALUE
-prof_pause(VALUE self)
-{
-    if (threads_tbl == NULL)
-    {
-        rb_raise(rb_eRuntimeError, "RubyProf is not running.");
-    }
-
-    prof_remove_hook();
-    return self;
-}
-
-/* call-seq:
-   resume {block} -> RubyProf
-   
-   Resumes recording profile data.*/
-static VALUE
-prof_resume(VALUE self)
-{
-    if (threads_tbl == NULL)
-    { 
-        prof_start(self);
-    }
-    else
-    { 
-        prof_install_hook();
-    }
-    
-    if (rb_block_given_p())
-    {
-      rb_ensure(rb_yield, self, prof_pause, self);
-    }
-
-    return self;
-}
-
-/* call-seq:
-   stop -> RubyProf::Result
-
-   Stops collecting profile data and returns a RubyProf::Result object. */
-static VALUE
-prof_stop(VALUE self)
-{
-    VALUE result = Qnil;
-    
-    prof_remove_hook();
-
-    prof_pop_threads();
-
-    /* Create the result */
-    result = prof_result_new();
-
-    /* Unset the last_thread_data (very important!) 
-       and the threads table */
-    last_thread_data = NULL;
-    threads_table_free(threads_tbl);
-    threads_tbl = NULL;
-
-    return result;
-}
-
-/* call-seq:
-   profile {block} -> RubyProf::Result
-
-Profiles the specified block and returns a RubyProf::Result object. */
-static VALUE
-prof_profile(VALUE self)
-{
-    int result;
-    
-    if (!rb_block_given_p())
-    {
-        rb_raise(rb_eArgError, "A block must be provided to the profile method.");
-    }
-
-    prof_start(self);
-    rb_protect(rb_yield, self, &result);
-    return prof_stop(self);
-}
-
-/* Get arround annoying limitations in RDOC */
-
-/* Document-method: measure_process_time
-   call-seq:
-     measure_process_time -> float
-
-Returns the process time.*/
-
-/* Document-method: measure_wall_time
-   call-seq:
-     measure_wall_time -> float
-
-Returns the wall time.*/
-
-/* Document-method: measure_cpu_time
-   call-seq:
-     measure_cpu_time -> float
-
-Returns the cpu time.*/
-
-/* Document-method: get_cpu_frequency
-   call-seq:
-     cpu_frequency -> int
-
-Returns the cpu's frequency.  This value is needed when 
-RubyProf::measure_mode is set to CPU_TIME. */
-
-/* Document-method: cpu_frequency
-   call-seq:
-     cpu_frequency -> int
-
-Returns the cpu's frequency.  This value is needed when 
-RubyProf::measure_mode is set to CPU_TIME. */
-
-/* Document-method: cpu_frequency=
-   call-seq:
-     cpu_frequency = frequency
-
-Sets the cpu's frequency.  This value is needed when 
-RubyProf::measure_mode is set to CPU_TIME. */
-
-/* Document-method: measure_allocations
-   call-seq:
-     measure_allocations -> int
-
-Returns the total number of object allocations since Ruby started.*/
-
-/* Document-method: measure_memory
-   call-seq:
-     measure_memory -> int
-
-Returns total allocated memory in bytes.*/
-
-/* Document-method: measure_gc_runs
-   call-seq:
-     gc_runs -> Integer
-
-Returns the total number of garbage collections.*/
-
-/* Document-method: measure_gc_time
-   call-seq:
-     gc_time -> Integer
-
-Returns the time spent doing garbage collections in microseconds.*/
-
-
-#if defined(_WIN32)
-__declspec(dllexport) 
-#endif
-void
-
-Init_ruby_prof()
-{
-    mProf = rb_define_module("RubyProf");
-    rb_define_const(mProf, "VERSION", rb_str_new2(RUBY_PROF_VERSION));
-    rb_define_module_function(mProf, "start", prof_start, 0);
-    rb_define_module_function(mProf, "stop", prof_stop, 0);
-    rb_define_module_function(mProf, "resume", prof_resume, 0);
-    rb_define_module_function(mProf, "pause", prof_pause, 0);
-    rb_define_module_function(mProf, "running?", prof_running, 0);
-    rb_define_module_function(mProf, "profile", prof_profile, 0);
-    
-    rb_define_singleton_method(mProf, "exclude_threads=", prof_set_exclude_threads, 1);
-    rb_define_singleton_method(mProf, "measure_mode", prof_get_measure_mode, 0);
-    rb_define_singleton_method(mProf, "measure_mode=", prof_set_measure_mode, 1);
-
-    rb_define_const(mProf, "CLOCKS_PER_SEC", INT2NUM(CLOCKS_PER_SEC));
-    rb_define_const(mProf, "PROCESS_TIME", INT2NUM(MEASURE_PROCESS_TIME));
-    rb_define_singleton_method(mProf, "measure_process_time", prof_measure_process_time, 0); /* in measure_process_time.h */
-    rb_define_const(mProf, "WALL_TIME", INT2NUM(MEASURE_WALL_TIME));
-    rb_define_singleton_method(mProf, "measure_wall_time", prof_measure_wall_time, 0); /* in measure_wall_time.h */
-
-    #ifndef MEASURE_CPU_TIME
-    rb_define_const(mProf, "CPU_TIME", Qnil);
-    #else
-    rb_define_const(mProf, "CPU_TIME", INT2NUM(MEASURE_CPU_TIME));
-    rb_define_singleton_method(mProf, "measure_cpu_time", prof_measure_cpu_time, 0); /* in measure_cpu_time.h */
-    rb_define_singleton_method(mProf, "cpu_frequency", prof_get_cpu_frequency, 0); /* in measure_cpu_time.h */
-    rb_define_singleton_method(mProf, "cpu_frequency=", prof_set_cpu_frequency, 1); /* in measure_cpu_time.h */
-    #endif
-        
-    #ifndef MEASURE_ALLOCATIONS
-    rb_define_const(mProf, "ALLOCATIONS", Qnil);
-    #else
-    rb_define_const(mProf, "ALLOCATIONS", INT2NUM(MEASURE_ALLOCATIONS));
-    rb_define_singleton_method(mProf, "measure_allocations", prof_measure_allocations, 0); /* in measure_allocations.h */
-    #endif
-    
-    #ifndef MEASURE_MEMORY
-    rb_define_const(mProf, "MEMORY", Qnil);
-    #else
-    rb_define_const(mProf, "MEMORY", INT2NUM(MEASURE_MEMORY));
-    rb_define_singleton_method(mProf, "measure_memory", prof_measure_memory, 0); /* in measure_memory.h */
-    #endif
-
-    #ifndef MEASURE_GC_RUNS
-    rb_define_const(mProf, "GC_RUNS", Qnil);
-    #else
-    rb_define_const(mProf, "GC_RUNS", INT2NUM(MEASURE_GC_RUNS));
-    rb_define_singleton_method(mProf, "measure_gc_runs", prof_measure_gc_runs, 0); /* in measure_gc_runs.h */
-    #endif
-
-    #ifndef MEASURE_GC_TIME
-    rb_define_const(mProf, "GC_TIME", Qnil);
-    #else
-    rb_define_const(mProf, "GC_TIME", INT2NUM(MEASURE_GC_TIME));
-    rb_define_singleton_method(mProf, "measure_gc_time", prof_measure_gc_time, 0); /* in measure_gc_time.h */
-    #endif
-
-    cResult = rb_define_class_under(mProf, "Result", rb_cObject);
-    rb_undef_method(CLASS_OF(cMethodInfo), "new");
-    rb_define_method(cResult, "threads", prof_result_threads, 0);
-
-    /* MethodInfo */
-    cMethodInfo = rb_define_class_under(mProf, "MethodInfo", rb_cObject);
-    rb_undef_method(CLASS_OF(cMethodInfo), "new");
-    
-    rb_define_method(cMethodInfo, "klass", prof_method_klass, 0);
-    rb_define_method(cMethodInfo, "klass_name", prof_klass_name, 0);
-    rb_define_method(cMethodInfo, "method_name", prof_method_name, 0);
-    rb_define_method(cMethodInfo, "full_name", prof_full_name, 0);
-    rb_define_method(cMethodInfo, "method_id", prof_method_id, 0);
-    
-    rb_define_method(cMethodInfo, "source_file", prof_method_source_file,0);
-    rb_define_method(cMethodInfo, "line", prof_method_line, 0);
-
-    rb_define_method(cMethodInfo, "call_infos", prof_method_call_infos, 0);
-
-    /* CallInfo */
-    cCallInfo = rb_define_class_under(mProf, "CallInfo", rb_cObject);
-    rb_undef_method(CLASS_OF(cCallInfo), "new");
-    rb_define_method(cCallInfo, "parent", prof_call_info_parent, 0);
-    rb_define_method(cCallInfo, "children", prof_call_info_children, 0);
-    rb_define_method(cCallInfo, "target", prof_call_info_target, 0);
-    rb_define_method(cCallInfo, "called", prof_call_info_called, 0);
-    rb_define_method(cCallInfo, "total_time", prof_call_info_total_time, 0);
-    rb_define_method(cCallInfo, "self_time", prof_call_info_self_time, 0);
-    rb_define_method(cCallInfo, "wait_time", prof_call_info_wait_time, 0);
-    rb_define_method(cCallInfo, "line", prof_call_info_line, 0);
-}
diff --git a/ext/ruby_prof.h b/ext/ruby_prof.h
deleted file mode 100644
index cd6a1eb..0000000
--- a/ext/ruby_prof.h
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * Copyright (C) 2008  Shugo Maeda <shugo at ruby-lang.org>
- *                     Charlie Savage <cfis at savagexi.com>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/* ruby-prof tracks the time spent executing every method in ruby programming.
-   The main players are:
-
-     prof_result_t     - Its one field, values,  contains the overall results
-     thread_data_t     - Stores data about a single thread.  
-     prof_stack_t      - The method call stack in a particular thread
-     prof_method_t     - Profiling information for each method
-     prof_call_info_t  - Keeps track a method's callers and callees. 
-
-  The final resulut is a hash table of thread_data_t, keyed on the thread
-  id.  Each thread has an hash a table of prof_method_t, keyed on the
-  method id.  A hash table is used for quick look up when doing a profile.
-  However, it is exposed to Ruby as an array.
-  
-  Each prof_method_t has two hash tables, parent and children, of prof_call_info_t.
-  These objects keep track of a method's callers (who called the method) and its
-  callees (who the method called).  These are keyed the method id, but once again,
-  are exposed to Ruby as arrays.  Each prof_call_into_t maintains a pointer to the
-  caller or callee method, thereby making it easy to navigate through the call 
-  hierarchy in ruby - which is very helpful for creating call graphs.      
-*/
-
-/* #define DEBUG */
-
-#ifndef RUBY_PROF_H
-#define RUBY_PROF_H
-
-#include <stdio.h>
-
-#include <ruby.h>
-
-#ifndef RUBY_VM
-#include <node.h>
-#include <st.h>
-typedef rb_event_t rb_event_flag_t;
-#define rb_sourcefile() (node ? node->nd_file : 0)
-#define rb_sourceline() (node ? nd_line(node) : 0)
-#endif
-
-#include "version.h"
-
-/* ================  Constants  =================*/
-#define INITIAL_STACK_SIZE 8
-#define INITIAL_CALL_INFOS_SIZE 2
-
-
-/* ================  Measurement  =================*/
-#ifdef HAVE_LONG_LONG
-typedef unsigned LONG_LONG prof_measure_t;
-#else
-typedef unsigned long prof_measure_t;
-#endif
-
-#include "measure_process_time.h"
-#include "measure_wall_time.h"
-#include "measure_cpu_time.h"
-#include "measure_allocations.h"
-#include "measure_memory.h"
-#include "measure_gc_runs.h"
-#include "measure_gc_time.h"
-
-static prof_measure_t (*get_measurement)() = measure_process_time;
-static double (*convert_measurement)(prof_measure_t) = convert_process_time;
-
-/* ================  DataTypes  =================*/
-static VALUE mProf;
-static VALUE cResult;
-static VALUE cMethodInfo;
-static VALUE cCallInfo;
-
-/* Profiling information for each method. */
-typedef struct {
-    VALUE klass;                            /* The method's class. */
-    ID mid;                                 /* The method id. */
-    int depth;                              /* The recursion depth. */
-    int key;                                /* Cache calculated key */
-} prof_method_key_t;
-
-struct prof_call_infos_t;
-
-/* Profiling information for each method. */
-typedef struct {
-    prof_method_key_t *key;                 /* Method key */
-    const char *source_file;                /* The method's source file */
-    int line;                               /* The method's line number. */
-    int active;                             /* Is this  recursion depth. */
-    struct prof_call_infos_t *call_infos;   /* Call info objects for this method */
-    VALUE object;                           /* Cahced ruby object */
-} prof_method_t;
-
-/* Callers and callee information for a method. */
-typedef struct prof_call_info_t {
-    prof_method_t *target; /* Use target instead of method to avoid conflict with Ruby method */
-    struct prof_call_info_t *parent;
-    st_table *call_infos;
-    int called;
-    prof_measure_t total_time;
-    prof_measure_t self_time;
-    prof_measure_t wait_time;
-    int line;  
-    VALUE object;
-    VALUE children;
-} prof_call_info_t;
-
-/* Array of call_info objects */
-typedef struct prof_call_infos_t {
-    prof_call_info_t **start;
-    prof_call_info_t **end;
-    prof_call_info_t **ptr;
-    VALUE object;
-} prof_call_infos_t;
-
-
-/* Temporary object that maintains profiling information
-   for active methods - there is one per method.*/
-typedef struct {
-    /* Caching prof_method_t values significantly
-       increases performance. */
-    prof_call_info_t *call_info;
-    prof_measure_t start_time;
-    prof_measure_t wait_time;
-    prof_measure_t child_time;
-    unsigned int line;
-} prof_frame_t;
-
-/* Current stack of active methods.*/
-typedef struct {
-    prof_frame_t *start;
-    prof_frame_t *end;
-    prof_frame_t *ptr;
-} prof_stack_t;
-
-/* Profiling information for a thread. */
-typedef struct {
-    VALUE thread_id;                  /* Thread id */
-    st_table* method_table;           /* Methods called in the thread */
-    prof_stack_t* stack;              /* Active methods */
-    prof_measure_t last_switch;       /* Point of last context switch */
-} thread_data_t;
-
-typedef struct {
-    VALUE threads;
-} prof_result_t;
-
-
-/* ================  Variables  =================*/
-static int measure_mode;
-static st_table *threads_tbl = NULL;
-static st_table *exclude_threads_tbl = NULL;
-
-/* TODO - If Ruby become multi-threaded this has to turn into
-   a separate stack since this isn't thread safe! */
-static thread_data_t* last_thread_data = NULL;
-
-
-/* Forward declarations */
-static VALUE prof_call_infos_wrap(prof_call_infos_t *call_infos);
-static VALUE prof_call_info_wrap(prof_call_info_t *call_info);
-static VALUE prof_method_wrap(prof_method_t *result);
-
-#endif
diff --git a/ext/ruby_prof/extconf.rb b/ext/ruby_prof/extconf.rb
new file mode 100644
index 0000000..d1609e8
--- /dev/null
+++ b/ext/ruby_prof/extconf.rb
@@ -0,0 +1,59 @@
+require "mkmf"
+
+if RUBY_VERSION == "1.8.6"
+  STDERR.print("Ruby #{RUBY_VERSION} is no longer supported.  Please upgrade to 1.8.7 or 1.9.2 or higher\n")
+  exit(1)
+end
+
+if RUBY_VERSION == "1.9.0" or RUBY_VERSION == "1.9.1"
+  STDERR.print("Ruby #{RUBY_VERSION} is no longer supported.  Please upgrade to 1.9.2 or higher\n")
+  exit(1)
+end
+
+have_header("sys/times.h")
+
+# Stefan Kaes / Alexander Dymo GC patch
+have_func("rb_os_allocated_objects")
+have_func("rb_gc_allocated_size")
+have_func("rb_gc_collections")
+have_func("rb_gc_time")
+
+# 1.9.3 superclass
+have_func("rb_class_superclass")
+
+# Lloyd Hilaiel's heap info patch
+have_func("rb_heap_total_mem")
+have_func("rb_gc_heap_info")
+
+# whether our ruby has fibers
+have_func("rb_fiber_current")
+
+def add_define(name, value = nil)
+  if value
+    $defs.push("-D#{name}=#{value}")
+  else
+    $defs.push("-D#{name}")
+  end
+end
+
+# if have_func("rb_gc_enable_stats")
+#   add_define("TOGGLE_GC_STATS", 1)
+# end
+
+require 'rubygems'
+unless Gem.win_platform? || RUBY_PLATFORM =~ /(darwin|openbsd)/
+  $LDFLAGS += " -lrt" # for clock_gettime
+end
+add_define("RUBY_VERSION", RUBY_VERSION.gsub('.', ''))
+
+# for ruby 1.9, determine whether threads inherit trace flags (latest 1.9.2 works correctly)
+if RUBY_VERSION > "1.9"
+  require 'set'
+  threads = Set.new
+  set_trace_func lambda { |*args| threads << Thread.current.object_id }
+  Thread.new{1}.join
+  set_trace_func nil
+  add_define("THREADS_INHERIT_EVENT_FLAGS", (threads.size == 2) ? "1" : "0")
+end
+
+create_makefile("ruby_prof")
diff --git a/ext/ruby_prof/rp_call_info.c b/ext/ruby_prof/rp_call_info.c
new file mode 100644
index 0000000..e032039
--- /dev/null
+++ b/ext/ruby_prof/rp_call_info.c
@@ -0,0 +1,407 @@
+/* Copyright (C) 2005-2013 Shugo Maeda <shugo at ruby-lang.org> and Charlie Savage <cfis at savagexi.com>
+   Please see the LICENSE file for copyright and distribution information */
+
+#include "ruby_prof.h"
+
+#define INITIAL_CALL_INFOS_SIZE 2
+
+VALUE cCallInfo;
+
+
+// Forward declarations
+st_table * call_info_table_create();
+
+
+/* =======  prof_call_info_t   ========*/
+prof_call_info_t *
+prof_call_info_create(prof_method_t* method, prof_call_info_t* parent)
+{
+    prof_call_info_t *result = ALLOC(prof_call_info_t);
+    result->object = Qnil;
+    result->target = method;
+    result->parent = parent;
+    result->call_infos = call_info_table_create();
+    result->children = Qnil;
+
+    result->called = 0;
+    result->total_time = 0;
+    result->self_time = 0;
+    result->wait_time = 0;
+    result->line = 0;
+    return result;
+}
+static void
+prof_call_info_ruby_gc_free(prof_call_info_t *call_info)
+{
+	/* Has this thread object been accessed by Ruby?  If
+	   yes clean it up so to avoid a segmentation fault. */
+	if (call_info->object != Qnil)
+	{
+		RDATA(call_info->object)->data = NULL;
+		RDATA(call_info->object)->dfree = NULL;
+		RDATA(call_info->object)->dmark = NULL;
+    }
+	call_info->object = Qnil;
+}
+
+static void
+prof_call_info_free(prof_call_info_t *call_info)
+{
+	prof_call_info_ruby_gc_free(call_info);
+	st_free_table(call_info->call_infos);
+	xfree(call_info);
+}
+
+static void
+prof_call_info_mark(prof_call_info_t *call_info)
+{
+	if (call_info->object)
+		rb_gc_mark(call_info->object);
+
+	if (call_info->children)
+		rb_gc_mark(call_info->children);
+
+	/* We don't mark the call info child table since that will be done
+	   via the appropriate method */
+}
+
+VALUE
+prof_call_info_wrap(prof_call_info_t *call_info)
+{
+  if (call_info->object == Qnil)
+  {
+    call_info->object = Data_Wrap_Struct(cCallInfo, prof_call_info_mark, prof_call_info_ruby_gc_free, call_info);
+  }
+  return call_info->object;
+}
+
+static prof_call_info_t *
+prof_get_call_info(VALUE self)
+{
+    /* Can't use Data_Get_Struct because that triggers the event hook
+       ending up in endless recursion. */
+	prof_call_info_t* result = DATA_PTR(self);
+
+	if (!result)
+	    rb_raise(rb_eRuntimeError, "This RubyProf::CallInfo instance has already been freed, likely because its profile has been freed.");
+
+   return result;
+}
+
+/* =======  Call Info Table   ========*/
+st_table *
+call_info_table_create()
+{
+  return st_init_table(&type_method_hash);
+}
+
+size_t
+call_info_table_insert(st_table *table, const prof_method_key_t *key, prof_call_info_t *val)
+{
+  return st_insert(table, (st_data_t) key, (st_data_t) val);
+}
+
+prof_call_info_t *
+call_info_table_lookup(st_table *table, const prof_method_key_t *key)
+{
+    st_data_t val;
+    if (st_lookup(table, (st_data_t) key, &val))
+    {
+      return (prof_call_info_t *) val;
+    }
+    else
+    {
+      return NULL;
+    }
+}
+
+
+/* =======  RubyProf::CallInfo   ========*/
+
+/* Document-class: RubyProf::CallInfo
+RubyProf::CallInfo is a helper class used by RubyProf::MethodInfo
+to keep track of which child methods were called and how long
+they took to execute. */
+
+
+/* call-seq:
+   called -> MethodInfo
+
+Returns the target method. */
+static VALUE
+prof_call_info_target(VALUE self)
+{
+    /* Target is a pointer to a method_info - so we have to be careful
+       about the GC.  We will wrap the method_info but provide no
+       free method so the underlying object is not freed twice! */
+
+    prof_call_info_t *result = prof_get_call_info(self);
+    return prof_method_wrap(result->target);
+}
+
+/* call-seq:
+   called -> int
+
+Returns the total amount of times this method was called. */
+static VALUE
+prof_call_info_called(VALUE self)
+{
+    prof_call_info_t *result = prof_get_call_info(self);
+    return INT2NUM(result->called);
+}
+
+/* call-seq:
+   called=n -> n
+
+Sets the call count to n. */
+static VALUE
+prof_call_info_set_called(VALUE self, VALUE called)
+{
+    prof_call_info_t *result = prof_get_call_info(self);
+    result->called = NUM2INT(called);
+    return called;
+}
+
+/* call-seq:
+   depth -> int
+
+   returns the depth of this call info in the call graph */
+static VALUE
+prof_call_info_depth(VALUE self)
+{
+  prof_call_info_t *result = prof_get_call_info(self);
+  return rb_int_new(result->depth);
+}
+
+/* call-seq:
+   line_no -> int
+
+   returns the line number of the method */
+static VALUE
+prof_call_info_line(VALUE self)
+{
+  prof_call_info_t *result = prof_get_call_info(self);
+  return rb_int_new(result->line);
+}
+
+/* call-seq:
+   total_time -> float
+
+Returns the total amount of time spent in this method and its children. */
+static VALUE
+prof_call_info_total_time(VALUE self)
+{
+    prof_call_info_t *result = prof_get_call_info(self);
+    return rb_float_new(result->total_time);
+}
+
+/* call-seq:
+   add_total_time(call_info) -> nil
+
+adds total time time from call_info to self. */
+static VALUE
+prof_call_info_add_total_time(VALUE self, VALUE other)
+{
+    prof_call_info_t *result = prof_get_call_info(self);
+    prof_call_info_t *other_info = prof_get_call_info(other);
+
+    result->total_time += other_info->total_time;
+    return Qnil;
+}
+
+/* call-seq:
+   self_time -> float
+
+Returns the total amount of time spent in this method. */
+static VALUE
+prof_call_info_self_time(VALUE self)
+{
+    prof_call_info_t *result = prof_get_call_info(self);
+
+    return rb_float_new(result->self_time);
+}
+
+/* call-seq:
+   add_self_time(call_info) -> nil
+
+adds self time from call_info to self. */
+static VALUE
+prof_call_info_add_self_time(VALUE self, VALUE other)
+{
+    prof_call_info_t *result = prof_get_call_info(self);
+    prof_call_info_t *other_info = prof_get_call_info(other);
+
+    result->self_time += other_info->self_time;
+    return Qnil;
+}
+
+/* call-seq:
+   wait_time -> float
+
+Returns the total amount of time this method waited for other threads. */
+static VALUE
+prof_call_info_wait_time(VALUE self)
+{
+    prof_call_info_t *result = prof_get_call_info(self);
+
+    return rb_float_new(result->wait_time);
+}
+
+/* call-seq:
+   add_wait_time(call_info) -> nil
+
+adds wait time from call_info to self. */
+
+static VALUE
+prof_call_info_add_wait_time(VALUE self, VALUE other)
+{
+    prof_call_info_t *result = prof_get_call_info(self);
+    prof_call_info_t *other_info = prof_get_call_info(other);
+
+    result->wait_time += other_info->wait_time;
+    return Qnil;
+}
+
+/* call-seq:
+   parent -> call_info
+
+Returns the call_infos parent call_info object (the method that called this method).*/
+static VALUE
+prof_call_info_parent(VALUE self)
+{
+    prof_call_info_t *result = prof_get_call_info(self);
+    if (result->parent)
+      return prof_call_info_wrap(result->parent);
+    else
+      return Qnil;
+}
+
+/* call-seq:
+   parent=new_parent -> new_parent
+
+Changes the parent of self to new_parent and returns it.*/
+static VALUE
+prof_call_info_set_parent(VALUE self, VALUE new_parent)
+{
+    prof_call_info_t *result = prof_get_call_info(self);
+    if (new_parent == Qnil)
+      result->parent = NULL;
+    else
+      result->parent = prof_get_call_info(new_parent);
+    return prof_call_info_parent(self);
+}
+
+static int
+prof_call_info_collect_children(st_data_t key, st_data_t value, st_data_t result)
+{
+    prof_call_info_t *call_info = (prof_call_info_t *) value;
+    VALUE arr = (VALUE) result;
+    rb_ary_push(arr, prof_call_info_wrap(call_info));
+    return ST_CONTINUE;
+}
+
+/* call-seq:
+   children -> hash
+
+Returns an array of call info objects of methods that this method
+called (ie, children).*/
+static VALUE
+prof_call_info_children(VALUE self)
+{
+    prof_call_info_t *call_info = prof_get_call_info(self);
+    if (call_info->children == Qnil)
+    {
+      call_info->children = rb_ary_new();
+      st_foreach(call_info->call_infos, prof_call_info_collect_children, call_info->children);
+    }
+    return call_info->children;
+}
+
+/* =======  Call Infos   ========*/
+prof_call_infos_t*
+prof_call_infos_create()
+{
+   prof_call_infos_t *result = ALLOC(prof_call_infos_t);
+   result->start = ALLOC_N(prof_call_info_t*, INITIAL_CALL_INFOS_SIZE);
+   result->end = result->start + INITIAL_CALL_INFOS_SIZE;
+   result->ptr = result->start;
+   result->object = Qnil;
+   return result;
+}
+
+void
+prof_call_infos_mark(prof_call_infos_t *call_infos)
+{
+    prof_call_info_t **call_info;
+
+	if (call_infos->object)
+		rb_gc_mark(call_infos->object);
+
+    for(call_info=call_infos->start; call_info<call_infos->ptr; call_info++)
+    {
+		prof_call_info_mark(*call_info);
+    }
+}
+
+void
+prof_call_infos_free(prof_call_infos_t *call_infos)
+{
+    prof_call_info_t **call_info;
+
+    for(call_info=call_infos->start; call_info<call_infos->ptr; call_info++)
+    {
+		prof_call_info_free(*call_info);
+    }
+}
+
+void
+prof_add_call_info(prof_call_infos_t *call_infos, prof_call_info_t *call_info)
+{
+  if (call_infos->ptr == call_infos->end)
+  {
+    size_t len = call_infos->ptr - call_infos->start;
+    size_t new_capacity = (call_infos->end - call_infos->start) * 2;
+    REALLOC_N(call_infos->start, prof_call_info_t*, new_capacity);
+    call_infos->ptr = call_infos->start + len;
+    call_infos->end = call_infos->start + new_capacity;
+  }
+  *call_infos->ptr = call_info;
+  call_infos->ptr++;
+}
+
+VALUE
+prof_call_infos_wrap(prof_call_infos_t *call_infos)
+{
+  if (call_infos->object == Qnil)
+  {
+    prof_call_info_t **i;
+    call_infos->object = rb_ary_new();
+    for(i=call_infos->start; i<call_infos->ptr; i++)
+    {
+      VALUE call_info = prof_call_info_wrap(*i);
+      rb_ary_push(call_infos->object, call_info);
+    }
+  }
+  return call_infos->object;
+}
+
+void rp_init_call_info()
+{
+    /* CallInfo */
+    cCallInfo = rb_define_class_under(mProf, "CallInfo", rb_cObject);
+    rb_undef_method(CLASS_OF(cCallInfo), "new");
+    rb_define_method(cCallInfo, "parent", prof_call_info_parent, 0);
+    rb_define_method(cCallInfo, "parent=", prof_call_info_set_parent, 1);
+    rb_define_method(cCallInfo, "children", prof_call_info_children, 0);
+    rb_define_method(cCallInfo, "target", prof_call_info_target, 0);
+    rb_define_method(cCallInfo, "called", prof_call_info_called, 0);
+    rb_define_method(cCallInfo, "called=", prof_call_info_set_called, 1);
+    rb_define_method(cCallInfo, "total_time", prof_call_info_total_time, 0);
+    rb_define_method(cCallInfo, "add_total_time", prof_call_info_add_total_time, 1);
+    rb_define_method(cCallInfo, "self_time", prof_call_info_self_time, 0);
+    rb_define_method(cCallInfo, "add_self_time", prof_call_info_add_self_time, 1);
+    rb_define_method(cCallInfo, "wait_time", prof_call_info_wait_time, 0);
+    rb_define_method(cCallInfo, "add_wait_time", prof_call_info_add_wait_time, 1);
+    rb_define_method(cCallInfo, "depth", prof_call_info_depth, 0);
+    rb_define_method(cCallInfo, "line", prof_call_info_line, 0);
+}
diff --git a/ext/ruby_prof/rp_call_info.h b/ext/ruby_prof/rp_call_info.h
new file mode 100644
index 0000000..1a98c75
--- /dev/null
+++ b/ext/ruby_prof/rp_call_info.h
@@ -0,0 +1,48 @@
+/* Copyright (C) 2005-2013 Shugo Maeda <shugo at ruby-lang.org> and Charlie Savage <cfis at savagexi.com>
+   Please see the LICENSE file for copyright and distribution information */
+
+#ifndef __RP_CALL_INFO_H__
+#define __RP_CALL_INFO_H__
+
+#include "rp_measure.h"
+#include "rp_method.h"
+
+extern VALUE cCallInfo;
+
+/* Callers and callee information for a method. */
+typedef struct prof_call_info_t
+{
+    prof_method_t *target; /* Use target instead of method to avoid conflict with Ruby method */
+    struct prof_call_info_t *parent;
+    st_table *call_infos;
+    int called;
+	int depth;
+    double total_time;
+    double self_time;
+    double wait_time;
+    int line;
+    VALUE object;
+    VALUE children;
+} prof_call_info_t;
+
+/* Array of call_info objects */
+typedef struct prof_call_infos_t 
+{
+    prof_call_info_t **start;
+    prof_call_info_t **end;
+    prof_call_info_t **ptr;
+    VALUE object;
+} prof_call_infos_t;
+
+
+void rp_init_call_info(void);
+prof_call_infos_t* prof_call_infos_create();
+void prof_call_infos_mark(prof_call_infos_t *call_infos);
+void prof_call_infos_free(prof_call_infos_t *call_infos);
+void prof_add_call_info(prof_call_infos_t *call_infos, prof_call_info_t *call_info);
+VALUE prof_call_infos_wrap(prof_call_infos_t *call_infos);
+prof_call_info_t * prof_call_info_create(prof_method_t* method, prof_call_info_t* parent);
+prof_call_info_t * call_info_table_lookup(st_table *table, const prof_method_key_t *key);
+size_t call_info_table_insert(st_table *table, const prof_method_key_t *key, prof_call_info_t *val);
+
+#endif //__RP_CALL_INFO_H__
diff --git a/ext/ruby_prof/rp_measure.c b/ext/ruby_prof/rp_measure.c
new file mode 100644
index 0000000..bf3bd17
--- /dev/null
+++ b/ext/ruby_prof/rp_measure.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 2005-2013 Shugo Maeda <shugo at ruby-lang.org> and Charlie Savage <cfis at savagexi.com>
+   Please see the LICENSE file for copyright and distribution information */
+
+#include "ruby_prof.h"
+
+VALUE mMeasure;
+
+prof_measurer_t* prof_get_measurer(prof_measure_mode_t measure)
+{
+    switch (measure)
+    {
+    case MEASURE_ALLOCATIONS:
+      return prof_measurer_allocations();
+      break;
+    case MEASURE_CPU_TIME:
+      return prof_measurer_cpu_time();
+      break;
+    case MEASURE_GC_RUNS:
+      return prof_measurer_gc_runs();
+      break;
+    case MEASURE_GC_TIME:
+      return prof_measurer_gc_time();
+      break;
+    case MEASURE_MEMORY:
+      return prof_measurer_memory();
+      break;
+    case MEASURE_PROCESS_TIME:
+      return prof_measurer_process_time();
+      break;
+    case MEASURE_WALL_TIME:
+      return prof_measurer_wall_time();
+      break;
+	default:
+	  rb_raise(rb_eArgError, "Unknown measure mode: %d", measure);
+    }
+};
+
+void rp_init_measure()
+{
+    mMeasure = rb_define_module_under(mProf, "Measure");
+    rp_init_measure_allocations();
+    rp_init_measure_cpu_time();
+    rp_init_measure_gc_runs();
+    rp_init_measure_gc_time();
+    rp_init_measure_memory();
+    rp_init_measure_process_time();
+    rp_init_measure_wall_time();
+}
diff --git a/ext/ruby_prof/rp_measure.h b/ext/ruby_prof/rp_measure.h
new file mode 100644
index 0000000..68d52be
--- /dev/null
+++ b/ext/ruby_prof/rp_measure.h
@@ -0,0 +1,45 @@
+/* Copyright (C) 2005-2013 Shugo Maeda <shugo at ruby-lang.org> and Charlie Savage <cfis at savagexi.com>
+   Please see the LICENSE file for copyright and distribution information */
+
+#ifndef __RP_MEASUREMENT_H__
+#define __RP_MEASUREMENT_H__
+
+extern VALUE mMeasure;
+
+typedef double (*get_measurement)();
+
+typedef struct
+{
+    get_measurement measure;
+} prof_measurer_t;
+
+typedef enum 
+{
+    MEASURE_ALLOCATIONS,
+    MEASURE_CPU_TIME,
+    MEASURE_GC_RUNS,
+    MEASURE_GC_TIME,
+    MEASURE_MEMORY,
+    MEASURE_PROCESS_TIME,
+    MEASURE_WALL_TIME,
+} prof_measure_mode_t;
+
+prof_measurer_t* prof_get_measurer(prof_measure_mode_t measure);
+prof_measurer_t* prof_measurer_allocations();
+prof_measurer_t* prof_measurer_cpu_time();
+prof_measurer_t* prof_measurer_gc_runs();
+prof_measurer_t* prof_measurer_gc_time();
+prof_measurer_t* prof_measurer_memory();
+prof_measurer_t* prof_measurer_process_time();
+prof_measurer_t* prof_measurer_wall_time();
+
+void rp_init_measure();
+void rp_init_measure_allocations();
+void rp_init_measure_cpu_time();
+void rp_init_measure_gc_runs();
+void rp_init_measure_gc_time();
+void rp_init_measure_memory();
+void rp_init_measure_process_time();
+void rp_init_measure_wall_time();
+
+#endif //__RP_MEASUREMENT_H__
diff --git a/ext/ruby_prof/rp_measure_allocations.c b/ext/ruby_prof/rp_measure_allocations.c
new file mode 100644
index 0000000..1162aca
--- /dev/null
+++ b/ext/ruby_prof/rp_measure_allocations.c
@@ -0,0 +1,65 @@
+/* Copyright (C) 2005-2013 Shugo Maeda <shugo at ruby-lang.org> and Charlie Savage <cfis at savagexi.com>
+   Please see the LICENSE file for copyright and distribution information */
+
+/* :nodoc: */
+
+#include "ruby_prof.h"
+
+static VALUE cMeasureAllocations;
+
+#if defined(HAVE_RB_OS_ALLOCATED_OBJECTS)
+  unsigned LONG_LONG rb_os_allocated_objects();
+#endif
+
+#if defined(HAVE_RB_GC_MALLOC_ALLOCATIONS)
+  unsigned LONG_LONG rb_gc_malloc_allocations();
+#endif
+
+static double
+measure_allocations()
+{
+#if defined(HAVE_RB_OS_ALLOCATED_OBJECTS)
+#define MEASURE_ALLOCATIONS_ENABLED Qtrue
+    return rb_os_allocated_objects();
+
+#elif defined(HAVE_RB_GC_MALLOC_ALLOCATIONS)
+#define MEASURE_ALLOCATIONS_ENABLED Qtrue
+    return rb_gc_malloc_allocations();
+
+#else
+#define MEASURE_ALLOCATIONS_ENABLED Qfalse
+    return 0;
+#endif
+}
+
+
+prof_measurer_t* prof_measurer_allocations()
+{
+  prof_measurer_t* measure = ALLOC(prof_measurer_t);
+  measure->measure = measure_allocations;
+  return measure;
+}
+
+/* call-seq:
+     measure -> int
+
+Returns the number of Ruby object allocations. */
+
+static VALUE
+prof_measure_allocations(VALUE self)
+{
+#if defined(HAVE_LONG_LONG)
+    return ULL2NUM(measure_allocations());
+#else
+    return ULONG2NUM(measure_allocations());
+#endif
+}
+
+void rp_init_measure_allocations()
+{
+    rb_define_const(mProf, "ALLOCATIONS", INT2NUM(MEASURE_ALLOCATIONS));
+    rb_define_const(mProf, "ALLOCATIONS_ENABLED", MEASURE_ALLOCATIONS_ENABLED);
+
+    cMeasureAllocations = rb_define_class_under(mMeasure, "Allocations", rb_cObject);
+    rb_define_singleton_method(cMeasureAllocations, "measure", prof_measure_allocations, 0);    
+}
diff --git a/ext/ruby_prof/rp_measure_cpu_time.c b/ext/ruby_prof/rp_measure_cpu_time.c
new file mode 100644
index 0000000..4abd72b
--- /dev/null
+++ b/ext/ruby_prof/rp_measure_cpu_time.c
@@ -0,0 +1,112 @@
+/* Copyright (C) 2005-2013 Shugo Maeda <shugo at ruby-lang.org> and Charlie Savage <cfis at savagexi.com>
+   Please see the LICENSE file for copyright and distribution information */
+
+#include "ruby_prof.h"
+
+static VALUE cMeasureCpuTime;
+
+static unsigned long long cpu_frequency = 0;
+
+/* The _WIN32 check is needed for msys (and maybe cygwin?) */
+#if defined(__GNUC__) && !defined(_WIN32)
+
+#include <stdint.h>
+#include <time.h>
+
+static unsigned long long get_cpu_time()
+{
+#if defined(__i386__) || defined(__x86_64__)
+    uint32_t a, d;
+    __asm__ volatile("rdtsc" : "=a" (a), "=d" (d));
+   return ((uint64_t)d << 32) + a;
+#elif defined(__powerpc__) || defined(__ppc__)
+    unsigned long long x, y;
+
+    __asm__ __volatile__ ("\n\
+1:      mftbu   %1\n\
+  mftb    %L0\n\
+  mftbu   %0\n\
+  cmpw    %0,%1\n\
+  bne-    1b"
+  : "=r" (x), "=r" (y));
+   return x;
+#endif
+}
+
+static unsigned long long get_cpu_frequency()
+{
+    unsigned long long x, y;
+
+    struct timespec ts;
+    ts.tv_sec = 0;
+    ts.tv_nsec = 500000000;
+    x = get_cpu_time();
+    nanosleep(&ts, NULL);
+    y = get_cpu_time();
+    return (y - x) * 2;
+}
+
+#elif defined(_WIN32)
+
+static unsigned long long get_cpu_time()
+{
+	LARGE_INTEGER time;
+	QueryPerformanceCounter(&time);
+	return time.QuadPart;
+};
+
+static unsigned long long get_cpu_frequency()
+{
+	LARGE_INTEGER cpu_frequency;
+	QueryPerformanceFrequency(&cpu_frequency);
+	return cpu_frequency.QuadPart;
+};
+#endif
+
+static double
+measure_cpu_time()
+{
+    return ((double)get_cpu_time()) / cpu_frequency;
+}
+
+
+prof_measurer_t* prof_measurer_cpu_time()
+{
+  prof_measurer_t* measure = ALLOC(prof_measurer_t);
+  measure->measure = measure_cpu_time;
+  return measure;
+}
+
+/* call-seq:
+   measure -> float
+
+Returns the cpu time.*/
+static VALUE
+prof_measure_cpu_time(VALUE self)
+{
+    return rb_float_new(measure_cpu_time());
+}
+
+/* call-seq:
+   cpu_frequency -> int
+
+Returns the cpu's frequency.  This value is needed when
+RubyProf::measure_mode is set to CPU_TIME. */
+static VALUE
+prof_get_cpu_frequency(VALUE self)
+{
+	return ULL2NUM(cpu_frequency);
+}
+
+void rp_init_measure_cpu_time()
+{
+    rb_define_const(mProf, "CPU_TIME", INT2NUM(MEASURE_CPU_TIME));
+	rb_define_const(mProf, "CPU_TIME_ENABLED", Qtrue);
+
+    cMeasureCpuTime = rb_define_class_under(mMeasure, "CpuTime", rb_cObject);
+    rb_define_singleton_method(cMeasureCpuTime, "measure", prof_measure_cpu_time, 0);
+    rb_define_singleton_method(cMeasureCpuTime, "frequency", prof_get_cpu_frequency, 0);
+
+    /* Get cpu_frequency */
+    cpu_frequency = get_cpu_frequency();
+}
diff --git a/ext/ruby_prof/rp_measure_gc_runs.c b/ext/ruby_prof/rp_measure_gc_runs.c
new file mode 100644
index 0000000..d1b8fe8
--- /dev/null
+++ b/ext/ruby_prof/rp_measure_gc_runs.c
@@ -0,0 +1,65 @@
+/* Copyright (C) 2005-2013 Shugo Maeda <shugo at ruby-lang.org> and Charlie Savage <cfis at savagexi.com>
+   Please see the LICENSE file for copyright and distribution information */
+
+/* :nodoc: */
+
+#include "ruby_prof.h"
+
+static VALUE cMeasureGcRuns;
+
+#if defined(HAVE_RB_GC_COLLECTIONS)
+  VALUE rb_gc_collections(void);
+#endif
+
+#if defined(HAVE_RB_GC_HEAP_INFO)
+  VALUE rb_gc_heap_info(void);
+#endif
+
+
+static double
+measure_gc_runs()
+{
+#if defined(HAVE_RB_GC_COLLECTIONS)
+#define MEASURE_GC_RUNS_ENABLED Qtrue
+  return NUM2INT(rb_gc_collections());
+
+#elif defined(HAVE_RB_GC_HEAP_INFO)
+#define MEASURE_GC_RUNS_ENABLED Qtrue
+  VALUE h = rb_gc_heap_info();
+  return NUM2UINT(rb_hash_aref(h, rb_str_new2("num_gc_passes")));
+
+#else
+#define MEASURE_GC_RUNS_ENABLED Qfalse
+  return 0;
+#endif
+}
+
+prof_measurer_t* prof_measurer_gc_runs()
+{
+  prof_measurer_t* measure = ALLOC(prof_measurer_t);
+  measure->measure = measure_gc_runs;
+  return measure;
+}
+
+/* call-seq:
+   measure -> int
+
+Returns the number of GC runs.*/
+static VALUE
+prof_measure_gc_runs(VALUE self)
+{
+#if defined(HAVE_LONG_LONG)
+    return ULL2NUM(measure_gc_runs());
+#else
+    return ULONG2NUM(measure_gc_runs());
+#endif
+}
+
+void rp_init_measure_gc_runs()
+{
+    rb_define_const(mProf, "GC_RUNS", INT2NUM(MEASURE_GC_RUNS));
+    rb_define_const(mProf, "GC_RUNS_ENABLED", MEASURE_GC_RUNS_ENABLED);
+    
+    cMeasureGcRuns = rb_define_class_under(mMeasure, "GcRuns", rb_cObject);
+    rb_define_singleton_method(cMeasureGcRuns, "measure", prof_measure_gc_runs, 0);
+}
diff --git a/ext/ruby_prof/rp_measure_gc_time.c b/ext/ruby_prof/rp_measure_gc_time.c
new file mode 100644
index 0000000..9bf0570
--- /dev/null
+++ b/ext/ruby_prof/rp_measure_gc_time.c
@@ -0,0 +1,57 @@
+/* Copyright (C) 2005-2013 Shugo Maeda <shugo at ruby-lang.org> and Charlie Savage <cfis at savagexi.com>
+   Please see the LICENSE file for copyright and distribution information */
+
+/* :nodoc: */
+
+#include "ruby_prof.h"
+
+static VALUE cMeasureGcTimes;
+
+#if defined(HAVE_RB_GC_TIME)
+  VALUE rb_gc_time();
+#endif
+
+
+static double
+measure_gc_time()
+{
+#if defined(HAVE_RB_GC_TIME)
+#define MEASURE_GC_TIME_ENABLED Qtrue
+    const double conversion = 1000000.0;
+#if HAVE_LONG_LONG
+    return NUM2LL(rb_gc_time()) / conversion;
+#else
+    return NUM2LONG(rb_gc_time()) / conversion;
+#endif
+
+#else
+#define MEASURE_GC_TIME_ENABLED Qfalse
+    return 0.0;
+#endif
+}
+
+prof_measurer_t* prof_measurer_gc_time()
+{
+  prof_measurer_t* measure = ALLOC(prof_measurer_t);
+  measure->measure = measure_gc_time;
+  return measure;
+}
+
+/* call-seq:
+   measure -> float
+
+Returns the time spent performing GC.*/
+static VALUE
+prof_measure_gc_time(VALUE self)
+{
+    return rb_float_new(measure_gc_time());
+}
+
+void rp_init_measure_gc_time()
+{
+    rb_define_const(mProf, "GC_TIME", INT2NUM(MEASURE_GC_TIME));
+    rb_define_const(mProf, "GC_TIME_ENABLED", MEASURE_GC_TIME_ENABLED);
+
+    cMeasureGcTimes = rb_define_class_under(mMeasure, "GcTime", rb_cObject);
+    rb_define_singleton_method(cMeasureGcTimes, "measure", prof_measure_gc_time, 0);
+}
diff --git a/ext/ruby_prof/rp_measure_memory.c b/ext/ruby_prof/rp_measure_memory.c
new file mode 100644
index 0000000..a8f8706
--- /dev/null
+++ b/ext/ruby_prof/rp_measure_memory.c
@@ -0,0 +1,73 @@
+/* Copyright (C) 2005-2013 Shugo Maeda <shugo at ruby-lang.org> and Charlie Savage <cfis at savagexi.com>
+   Please see the LICENSE file for copyright and distribution information */
+
+/* :nodoc: */
+
+#include "ruby_prof.h"
+
+static VALUE cMeasureMemory;
+
+
+#if defined(HAVE_RB_GC_ALLOCATED_SIZE)
+  VALUE rb_gc_allocated_size();
+#endif
+
+#if defined(HAVE_RB_GC_MALLOC_ALLOCATED_SIZE)
+  size_t rb_gc_malloc_allocated_size();
+#endif
+
+#if defined(HAVE_RB_HEAP_TOTAL_MEM)
+  //FIXME: did not find the patch to check prototype, assuming it to return size_t
+  size_t rb_heap_total_mem();
+#endif
+
+static double
+measure_memory()
+{
+#if defined(HAVE_RB_GC_ALLOCATED_SIZE)
+#define MEASURE_MEMORY_ENABLED Qtrue
+#if defined(HAVE_LONG_LONG)
+    return NUM2LL(rb_gc_allocated_size()) / 1024.0;
+#else
+    return NUM2ULONG(rb_gc_allocated_size()) / 1024.0;
+#endif
+
+#elif defined(HAVE_RB_GC_MALLOC_ALLOCATED_SIZE)
+#define MEASURE_MEMORY_ENABLED Qtrue
+    return rb_gc_malloc_allocated_size() / 1024.0;
+
+#elif defined(HAVE_RB_HEAP_TOTAL_MEM)
+#define MEASURE_MEMORY_ENABLED Qtrue
+    return rb_heap_total_mem() / 1024.0;
+
+#else
+#define MEASURE_MEMORY_ENABLED Qfalse
+    return 0;
+#endif
+}
+
+prof_measurer_t* prof_measurer_memory()
+{
+  prof_measurer_t* measure = ALLOC(prof_measurer_t);
+  measure->measure = measure_memory;
+  return measure;
+}
+
+/* call-seq:
+   measure_process_time -> float
+
+Returns the process time.*/
+static VALUE
+prof_measure_memory(VALUE self)
+{
+    return rb_float_new(measure_memory());
+}
+
+void rp_init_measure_memory()
+{
+    rb_define_const(mProf, "MEMORY", INT2NUM(MEASURE_MEMORY));
+    rb_define_const(mProf, "MEMORY_ENABLED", MEASURE_MEMORY_ENABLED);
+
+    cMeasureMemory = rb_define_class_under(mMeasure, "Memory", rb_cObject);
+    rb_define_singleton_method(cMeasureMemory, "measure", prof_measure_memory, 0);
+}
diff --git a/ext/ruby_prof/rp_measure_process_time.c b/ext/ruby_prof/rp_measure_process_time.c
new file mode 100644
index 0000000..c3a1c3f
--- /dev/null
+++ b/ext/ruby_prof/rp_measure_process_time.c
@@ -0,0 +1,71 @@
+/* Copyright (C) 2005-2013 Shugo Maeda <shugo at ruby-lang.org> and Charlie Savage <cfis at savagexi.com>
+   Please see the LICENSE file for copyright and distribution information */
+
+#include "ruby_prof.h"
+#include <time.h>
+
+static VALUE cMeasureProcessTime;
+
+static double
+measure_process_time()
+{
+#if defined(__linux__)
+    struct timespec clock;
+    clock_gettime(CLOCK_PROCESS_CPUTIME_ID , &clock);
+    return clock.tv_sec + (clock.tv_nsec/1000000000.0);
+#elif defined(_win32)
+	FILETIME createTime;
+	FILETIME exitTime;
+	FILETIME sysTime;
+	FILETIME cpuTime;
+
+	ULARGE_INTEGER sysTimeInt;
+	ULARGE_INTEGER cpuTimeInt;
+	ULONGLONG totalTime;
+
+	GetProcessTimes(GetCurrentProcess(), &createTime, &exitTime, &sysTime, &cpuTime); 
+
+	/* Doing this based on MSFT's recommendation in the FILETIME structure documentation at
+	  http://msdn.microsoft.com/en-us/library/ms724284%28VS.85%29.aspx*/
+
+	sysTimeInt.LowPart = sysTime.dwLowDateTime;
+	sysTimeInt.HighPart = sysTime.dwHighDateTime;
+	cpuTimeInt.LowPart = cpuTime.dwLowDateTime;
+	cpuTimeInt.HighPart = cpuTime.dwHighDateTime;
+
+	totalTime = sysTimeInt.QuadPart + cpuTimeInt.QuadPart;
+
+	// Times are in 100-nanosecond time units.  So instead of 10-9 use 10-7
+	return totalTime / 10000000.0;
+#else
+    return ((double)clock()) / CLOCKS_PER_SEC;
+#endif
+}
+
+/* call-seq:
+   measure_process_time -> float
+
+Returns the process time.*/
+static VALUE
+prof_measure_process_time(VALUE self)
+{
+    return rb_float_new(measure_process_time());
+}
+
+prof_measurer_t* prof_measurer_process_time()
+{
+  prof_measurer_t* measure = ALLOC(prof_measurer_t);
+  measure->measure = measure_process_time;
+  return measure;
+}
+
+
+void rp_init_measure_process_time()
+{
+    rb_define_const(mProf, "CLOCKS_PER_SEC", INT2NUM(CLOCKS_PER_SEC));
+    rb_define_const(mProf, "PROCESS_TIME", INT2NUM(MEASURE_PROCESS_TIME));
+	rb_define_const(mProf, "PROCESS_TIME_ENABLED", Qtrue);
+
+    cMeasureProcessTime = rb_define_class_under(mMeasure, "ProcessTime", rb_cObject);
+    rb_define_singleton_method(cMeasureProcessTime, "measure", prof_measure_process_time, 0);
+}
diff --git a/ext/ruby_prof/rp_measure_wall_time.c b/ext/ruby_prof/rp_measure_wall_time.c
new file mode 100644
index 0000000..1b4fa62
--- /dev/null
+++ b/ext/ruby_prof/rp_measure_wall_time.c
@@ -0,0 +1,42 @@
+/* Copyright (C) 2005-2013 Shugo Maeda <shugo at ruby-lang.org> and Charlie Savage <cfis at savagexi.com>
+   Please see the LICENSE file for copyright and distribution information */
+
+/* :nodoc: */
+#include "ruby_prof.h"
+
+static VALUE cMeasureWallTime;
+
+static double
+measure_wall_time()
+{
+    struct timeval tv;
+    gettimeofday(&tv, NULL);
+    return tv.tv_sec + (tv.tv_usec/1000000.0);
+}
+
+prof_measurer_t* prof_measurer_wall_time()
+{
+  prof_measurer_t* measure = ALLOC(prof_measurer_t);
+  measure->measure = measure_wall_time;
+  return measure;
+}
+
+/* Document-method: prof_measure_wall_time
+   call-seq:
+     measure_wall_time -> float
+
+Returns the wall time.*/
+static VALUE
+prof_measure_wall_time(VALUE self)
+{
+    return rb_float_new(measure_wall_time());
+}
+
+void rp_init_measure_wall_time()
+{
+    rb_define_const(mProf, "WALL_TIME", INT2NUM(MEASURE_WALL_TIME));
+    rb_define_const(mProf, "WALL_TIME_ENABLED", Qtrue);
+
+    cMeasureWallTime = rb_define_class_under(mMeasure, "WallTime", rb_cObject);
+    rb_define_singleton_method(cMeasureWallTime, "measure", prof_measure_wall_time, 0);
+}
diff --git a/ext/ruby_prof/rp_method.c b/ext/ruby_prof/rp_method.c
new file mode 100644
index 0000000..80bf583
--- /dev/null
+++ b/ext/ruby_prof/rp_method.c
@@ -0,0 +1,420 @@
+/* Copyright (C) 2005-2013 Shugo Maeda <shugo at ruby-lang.org> and Charlie Savage <cfis at savagexi.com>
+   Please see the LICENSE file for copyright and distribution information */
+
+#include "ruby_prof.h"
+
+VALUE cMethodInfo;
+
+/* ================  Helper Functions  =================*/
+static VALUE
+figure_singleton_name(VALUE klass)
+{
+    VALUE result = Qnil;
+
+    /* We have come across a singleton object. First
+       figure out what it is attached to.*/
+    VALUE attached = rb_iv_get(klass, "__attached__");
+
+    /* Is this a singleton class acting as a metaclass? */
+    if (BUILTIN_TYPE(attached) == T_CLASS)
+    {
+        result = rb_str_new2("<Class::");
+        rb_str_append(result, rb_inspect(attached));
+        rb_str_cat2(result, ">");
+    }
+
+    /* Is this for singleton methods on a module? */
+    else if (BUILTIN_TYPE(attached) == T_MODULE)
+    {
+        result = rb_str_new2("<Module::");
+        rb_str_append(result, rb_inspect(attached));
+        rb_str_cat2(result, ">");
+    }
+
+    /* Is this for singleton methods on an object? */
+    else if (BUILTIN_TYPE(attached) == T_OBJECT)
+    {
+        /* Make sure to get the super class so that we don't
+           mistakenly grab a T_ICLASS which would lead to
+           unknown method errors. */
+#ifdef HAVE_RB_CLASS_SUPERCLASS
+        // 1.9.3
+        VALUE super = rb_class_superclass(klass);
+#else
+# ifdef RCLASS_SUPER
+        VALUE super = rb_class_real(RCLASS_SUPER(klass));
+# else
+        VALUE super = rb_class_real(RCLASS(klass)->super);
+# endif
+#endif
+        result = rb_str_new2("<Object::");
+        rb_str_append(result, rb_inspect(super));
+        rb_str_cat2(result, ">");
+    }
+
+    /* Ok, this could be other things like an array made put onto
+       a singleton object (yeah, it happens, see the singleton
+       objects test case). */
+    else
+    {
+        result = rb_inspect(klass);
+    }
+
+    return result;
+}
+
+static VALUE
+klass_name(VALUE klass)
+{
+    VALUE result = Qnil;
+
+    if (klass == 0 || klass == Qnil)
+    {
+        result = rb_str_new2("Global");
+    }
+    else if (BUILTIN_TYPE(klass) == T_MODULE)
+    {
+        result = rb_inspect(klass);
+    }
+    else if (BUILTIN_TYPE(klass) == T_CLASS && FL_TEST(klass, FL_SINGLETON))
+    {
+        result = figure_singleton_name(klass);
+    }
+    else if (BUILTIN_TYPE(klass) == T_CLASS)
+    {
+        result = rb_inspect(klass);
+    }
+    else
+    {
+        /* Should never happen. */
+        result = rb_str_new2("Unknown");
+    }
+
+    return result;
+}
+
+static VALUE
+method_name(ID mid)
+{
+    VALUE result;
+
+    if (mid == 0)
+        result = rb_str_new2("[No method]");
+#ifdef ID_ALLOCATOR
+    else if (mid == ID_ALLOCATOR)
+        result = rb_str_new2("allocate");
+#endif
+    else
+        result = rb_String(ID2SYM(mid));
+
+    return result;
+}
+
+static VALUE
+full_name(VALUE klass, ID mid)
+{
+  VALUE result = klass_name(klass);
+  rb_str_cat2(result, "#");
+  rb_str_append(result, method_name(mid));
+
+  return result;
+}
+
+void
+method_key(prof_method_key_t* key, VALUE klass, ID mid)
+{
+    /* Is this an include for a module?  If so get the actual
+        module class since we want to combine all profiling
+        results for that module. */
+    if (klass != 0)
+        klass = (BUILTIN_TYPE(klass) == T_ICLASS ? RBASIC(klass)->klass : klass);
+
+    key->klass = klass;
+    key->mid = mid;
+    key->key = (klass << 4) + (mid << 2);
+}
+
+/* ================  prof_method_t   =================*/
+prof_method_t*
+prof_method_create(VALUE klass, ID mid, const char* source_file, int line)
+{
+    prof_method_t *result = ALLOC(prof_method_t);
+    result->object = Qnil;
+    result->call_infos = prof_call_infos_create();
+
+    result->key = ALLOC(prof_method_key_t);
+    method_key(result->key, klass, mid);
+
+    //result->call_info_table = call_info_table_create();
+
+    if (source_file != NULL)
+    {
+      size_t len = strlen(source_file) + 1;
+      char *buffer = ALLOC_N(char, len);
+
+      MEMCPY(buffer, source_file, char, len);
+      result->source_file = buffer;
+    }
+    else
+    {
+      result->source_file = source_file;
+    }
+    result->line = line;
+
+    return result;
+}
+
+/* The underlying c structures are freed when the parent profile is freed.  
+   However, on shutdown the Ruby GC frees objects in any will-nilly order.
+   That means the ruby thread object wrapping the c thread struct may
+   be freed before the parent profile.  Thus we add in a free function
+   for the garbage collector so that if it does get called will nil 
+   out our Ruby object reference.*/
+static void
+prof_method_ruby_gc_free(prof_method_t* method)
+{
+	/* Has this thread object been accessed by Ruby?  If
+	   yes clean it up so to avoid a segmentation fault. */
+	if (method->object != Qnil)
+	{
+		RDATA(method->object)->data = NULL;
+		RDATA(method->object)->dfree = NULL;
+		RDATA(method->object)->dmark = NULL;
+    }
+	method->object = Qnil;
+}
+
+static void
+prof_method_free(prof_method_t* method)
+{
+	prof_method_ruby_gc_free(method);
+	prof_call_infos_free(method->call_infos);
+	xfree(method->call_infos);
+
+	xfree(method->key);
+	method->key = NULL;
+
+	xfree(method);
+}
+
+void
+prof_method_mark(prof_method_t *method)
+{
+	if (method->object)
+		rb_gc_mark(method->object);
+
+	prof_call_infos_mark(method->call_infos);
+}
+
+VALUE
+prof_method_wrap(prof_method_t *result)
+{
+  if (result->object == Qnil)
+  {
+    result->object = Data_Wrap_Struct(cMethodInfo, prof_method_mark, prof_method_ruby_gc_free, result);
+  }
+  return result->object;
+}
+
+static prof_method_t *
+get_prof_method(VALUE self)
+{
+    /* Can't use Data_Get_Struct because that triggers the event hook
+       ending up in endless recursion. */
+	prof_method_t* result = DATA_PTR(self);
+
+	if (!result)
+	    rb_raise(rb_eRuntimeError, "This RubyProf::MethodInfo instance has already been freed, likely because its profile has been freed.");
+
+   return result;
+}
+
+/* ================  Method Table   =================*/
+int
+method_table_cmp(prof_method_key_t *key1, prof_method_key_t *key2)
+{
+    return (key1->klass != key2->klass) || (key1->mid != key2->mid);
+}
+
+st_index_t
+method_table_hash(prof_method_key_t *key)
+{
+    return key->key;
+}
+
+struct st_hash_type type_method_hash = {
+    method_table_cmp,
+    method_table_hash
+};
+
+st_table *
+method_table_create()
+{
+  return st_init_table(&type_method_hash);
+}
+
+static int
+method_table_free_iterator(st_data_t key, st_data_t value, st_data_t dummy)
+{
+    prof_method_free((prof_method_t*)value);
+    return ST_CONTINUE;
+}
+
+void
+method_table_free(st_table *table)
+{
+    st_foreach(table, method_table_free_iterator, 0);
+    st_free_table(table);
+}
+
+
+size_t
+method_table_insert(st_table *table, const prof_method_key_t *key, prof_method_t *val)
+{
+  return st_insert(table, (st_data_t) key, (st_data_t) val);
+}
+
+prof_method_t *
+method_table_lookup(st_table *table, const prof_method_key_t* key)
+{
+    st_data_t val;
+    if (st_lookup(table, (st_data_t)key, &val))
+    {
+      return (prof_method_t *) val;
+    }
+    else
+    {
+      return NULL;
+    }
+}
+
+/* ================  Method Info   =================*/
+/* Document-class: RubyProf::MethodInfo
+The RubyProf::MethodInfo class stores profiling data for a method.
+One instance of the RubyProf::MethodInfo class is created per method
+called per thread.  Thus, if a method is called in two different
+thread then there will be two RubyProf::MethodInfo objects
+created.  RubyProf::MethodInfo objects can be accessed via
+the RubyProf::Result object.
+*/
+
+/* call-seq:
+   line_no -> int
+
+   returns the line number of the method */
+static VALUE
+prof_method_line(VALUE self)
+{
+    return rb_int_new(get_prof_method(self)->line);
+}
+
+/* call-seq:
+   source_file => string
+
+return the source file of the method
+*/
+static VALUE prof_method_source_file(VALUE self)
+{
+    const char* sf = get_prof_method(self)->source_file;
+    if(!sf)
+    {
+      return rb_str_new2("ruby_runtime");
+    }
+    else
+    {
+      return rb_str_new2(sf);
+    }
+}
+
+
+/* call-seq:
+   method_class -> klass
+
+Returns the Ruby klass that owns this method. */
+static VALUE
+prof_method_klass(VALUE self)
+{
+    prof_method_t *result = get_prof_method(self);
+    return result->key->klass;
+}
+
+/* call-seq:
+   method_id -> ID
+
+Returns the id of this method. */
+static VALUE
+prof_method_id(VALUE self)
+{
+    prof_method_t *result = get_prof_method(self);
+    return ID2SYM(result->key->mid);
+}
+
+/* call-seq:
+   klass_name -> string
+
+Returns the name of this method's class.  Singleton classes
+will have the form <Object::Object>. */
+
+static VALUE
+prof_klass_name(VALUE self)
+{
+    prof_method_t *method = get_prof_method(self);
+    return klass_name(method->key->klass);
+}
+
+/* call-seq:
+   method_name -> string
+
+Returns the name of this method in the format Object#method.  Singletons
+methods will be returned in the format <Object::Object>#method.*/
+
+static VALUE
+prof_method_name(VALUE self)
+{
+    prof_method_t *method = get_prof_method(self);
+    return method_name(method->key->mid);
+}
+
+/* call-seq:
+   full_name -> string
+
+Returns the full name of this method in the format Object#method.*/
+
+static VALUE
+prof_full_name(VALUE self)
+{
+    prof_method_t *method = get_prof_method(self);
+    return full_name(method->key->klass, method->key->mid);
+}
+
+/* call-seq:
+   call_infos -> Array of call_info
+
+Returns an array of call info objects that contain profiling information
+about the current method.*/
+static VALUE
+prof_method_call_infos(VALUE self)
+{
+    prof_method_t *method = get_prof_method(self);
+	if (method->call_infos->object == Qnil)
+	{
+		method->call_infos->object = prof_call_infos_wrap(method->call_infos);
+	}
+	return method->call_infos->object;
+}
+
+void rp_init_method_info()
+{
+    /* MethodInfo */
+    cMethodInfo = rb_define_class_under(mProf, "MethodInfo", rb_cObject);
+    rb_undef_method(CLASS_OF(cMethodInfo), "new");
+
+    rb_define_method(cMethodInfo, "klass", prof_method_klass, 0);
+    rb_define_method(cMethodInfo, "klass_name", prof_klass_name, 0);
+    rb_define_method(cMethodInfo, "method_name", prof_method_name, 0);
+    rb_define_method(cMethodInfo, "full_name", prof_full_name, 0);
+    rb_define_method(cMethodInfo, "method_id", prof_method_id, 0);
+    rb_define_method(cMethodInfo, "source_file", prof_method_source_file,0);
+    rb_define_method(cMethodInfo, "line", prof_method_line, 0);
+    rb_define_method(cMethodInfo, "call_infos", prof_method_call_infos, 0);
+}
diff --git a/ext/ruby_prof/rp_method.h b/ext/ruby_prof/rp_method.h
new file mode 100644
index 0000000..e8c39aa
--- /dev/null
+++ b/ext/ruby_prof/rp_method.h
@@ -0,0 +1,57 @@
+/* Copyright (C) 2005-2013 Shugo Maeda <shugo at ruby-lang.org> and Charlie Savage <cfis at savagexi.com>
+   Please see the LICENSE file for copyright and distribution information */
+
+#ifndef __RP_METHOD_INFO__
+#define __RP_METHOD_INFO__
+
+#include <ruby.h>
+
+#ifndef RUBY_VM
+#include <st.h>
+typedef st_data_t st_index_t;
+#endif
+
+extern VALUE cMethodInfo;
+
+/* A key used to identify each method */
+typedef struct 
+{
+    VALUE klass;                            /* The method's class. */
+    ID mid;                                 /* The method id. */
+    st_index_t key;                         /* Cache calculated key */
+} prof_method_key_t;
+
+
+/* Forward declaration, see rp_call_info.h */
+struct prof_call_infos_t;
+
+/* Profiling information for each method. */
+typedef struct 
+{
+    prof_method_key_t *key;                 /* Method key */
+    const char *source_file;                /* The method's source file */
+    int line;                               /* The method's line number. */
+    struct prof_call_infos_t *call_infos;   /* Call info objects for this method */
+    VALUE object;                           /* Cached ruby object */
+} prof_method_t;
+
+void rp_init_method_info(void);
+
+void method_key(prof_method_key_t* key, VALUE klass, ID mid);
+
+st_table * method_table_create();
+prof_method_t * method_table_lookup(st_table *table, const prof_method_key_t* key);
+size_t method_table_insert(st_table *table, const prof_method_key_t *key, prof_method_t *val);
+void method_table_free(st_table *table);
+
+prof_method_t* prof_method_create(VALUE klass, ID mid, const char* source_file, int line);
+VALUE prof_method_wrap(prof_method_t *result);
+void prof_method_mark(prof_method_t *method);
+
+/* Setup infrastructure to use method keys as hash comparisons */
+int method_table_cmp(prof_method_key_t *key1, prof_method_key_t *key2);
+st_index_t method_table_hash(prof_method_key_t *key);
+
+extern struct st_hash_type type_method_hash;
+
+#endif
diff --git a/ext/ruby_prof/rp_stack.c b/ext/ruby_prof/rp_stack.c
new file mode 100644
index 0000000..777b4c5
--- /dev/null
+++ b/ext/ruby_prof/rp_stack.c
@@ -0,0 +1,128 @@
+/* Copyright (C) 2005-2013 Shugo Maeda <shugo at ruby-lang.org> and Charlie Savage <cfis at savagexi.com>
+   Please see the LICENSE file for copyright and distribution information */
+
+#include "rp_stack.h"
+
+#define INITIAL_STACK_SIZE 8
+
+void
+prof_frame_pause(prof_frame_t *frame, double current_measurement)
+{
+    if (frame && prof_frame_is_unpaused(frame))
+        frame->pause_time = current_measurement;
+}
+
+void
+prof_frame_unpause(prof_frame_t *frame, double current_measurement)
+{
+    if (frame && prof_frame_is_paused(frame)) {
+        frame->dead_time += (current_measurement - frame->pause_time);
+        frame->pause_time = -1;
+    }
+}
+
+
+/* Creates a stack of prof_frame_t to keep track
+   of timings for active methods. */
+prof_stack_t *
+prof_stack_create()
+{
+    prof_stack_t *stack = ALLOC(prof_stack_t);
+    stack->start = ALLOC_N(prof_frame_t, INITIAL_STACK_SIZE);
+    stack->ptr = stack->start;
+    stack->end = stack->start + INITIAL_STACK_SIZE;
+
+    return stack;
+}
+
+void
+prof_stack_free(prof_stack_t *stack)
+{
+    xfree(stack->start);
+    xfree(stack);
+}
+
+prof_frame_t *
+prof_stack_push(prof_stack_t *stack, double measurement)
+{
+  prof_frame_t* result = NULL;
+
+  /* Is there space on the stack?  If not, double
+     its size. */
+  if (stack->ptr == stack->end  )   
+  {
+    size_t len = stack->ptr - stack->start;
+    size_t new_capacity = (stack->end - stack->start) * 2;
+    REALLOC_N(stack->start, prof_frame_t, new_capacity);
+    /* Memory just got moved, reset pointers */
+    stack->ptr = stack->start + len;
+    stack->end = stack->start + new_capacity;
+  }
+
+  // Setup returned stack pointer to be valid
+  result = stack->ptr;
+  result->child_time = 0;
+  result->switch_time = 0;
+  result->wait_time = 0;
+  result->dead_time = 0;
+  result->depth = (int)(stack->ptr - stack->start); // shortening of 64 bit into 32
+  result->start_time = measurement;
+
+  // Increment the stack ptr for next time
+  stack->ptr++;
+
+  // Return the result
+  return result;
+}
+
+prof_frame_t *
+prof_stack_pop(prof_stack_t *stack, double measurement)
+{
+  prof_frame_t *frame = NULL;
+  prof_frame_t* parent_frame = NULL;
+  prof_call_info_t *call_info;
+
+  double total_time;
+  double self_time;
+
+  /* Frame can be null.  This can happen if RubProf.start is called from
+     a method that exits.  And it can happen if an exception is raised
+     in code that is being profiled and the stack unwinds (RubyProf is
+     not notified of that by the ruby runtime. */
+  if (stack->ptr == stack->start)
+    return NULL;
+  
+  frame = --stack->ptr;
+
+  /* Calculate the total time this method took */
+  prof_frame_unpause(frame, measurement);
+  total_time = measurement - frame->start_time - frame->dead_time;
+  self_time = total_time - frame->child_time - frame->wait_time;
+
+  /* Update information about the current method */
+  call_info = frame->call_info;
+  call_info->called++;
+  call_info->total_time += total_time;
+  call_info->self_time += self_time;
+  call_info->wait_time += frame->wait_time;
+
+  parent_frame = prof_stack_peek(stack);
+  if (parent_frame)
+  {
+      parent_frame->child_time += total_time;
+      parent_frame->dead_time += frame->dead_time;
+
+      call_info->line = parent_frame->line;
+  }
+
+  return frame;
+}
+
+prof_frame_t *
+prof_stack_peek(prof_stack_t *stack)
+{
+    if (stack->ptr == stack->start)
+      return NULL;
+    else
+      return stack->ptr - 1;
+}
diff --git a/ext/ruby_prof/rp_stack.h b/ext/ruby_prof/rp_stack.h
new file mode 100644
index 0000000..b18c3eb
--- /dev/null
+++ b/ext/ruby_prof/rp_stack.h
@@ -0,0 +1,51 @@
+/* Copyright (C) 2005-2013 Shugo Maeda <shugo at ruby-lang.org> and Charlie Savage <cfis at savagexi.com>
+   Please see the LICENSE file for copyright and distribution information */
+
+#ifndef __RP_STACK__
+#define __RP_STACK__
+
+#include <ruby.h>
+
+#include "rp_measure.h"
+#include "rp_call_info.h"
+
+
+/* Temporary object that maintains profiling information
+   for active methods.  They are created and destroyed
+   as the program moves up and down its stack. */
+typedef struct 
+{
+    /* Caching prof_method_t values significantly
+       increases performance. */
+    prof_call_info_t *call_info;
+    double start_time;
+    double switch_time;  /* Time at switch to different thread */
+    double wait_time;
+    double child_time;
+    double pause_time; // Time pause() was initiated
+    double dead_time; // Time to ignore (i.e. total amount of time between pause/resume blocks)
+    int depth;
+    unsigned int line;
+} prof_frame_t;
+
+#define prof_frame_is_paused(f) (f->pause_time >= 0)
+#define prof_frame_is_unpaused(f) (f->pause_time < 0)
+void prof_frame_pause(prof_frame_t*, double current_measurement);
+void prof_frame_unpause(prof_frame_t*, double current_measurement);
+
+
+/* Current stack of active methods.*/
+typedef struct 
+{
+    prof_frame_t *start;
+    prof_frame_t *end;
+    prof_frame_t *ptr;
+} prof_stack_t;
+
+prof_stack_t * prof_stack_create();
+void prof_stack_free(prof_stack_t *stack);
+prof_frame_t * prof_stack_push(prof_stack_t *stack, double measurement);
+prof_frame_t * prof_stack_pop(prof_stack_t *stack, double measurement);
+prof_frame_t * prof_stack_peek(prof_stack_t *stack);
+
+#endif //__RP_STACK__
diff --git a/ext/ruby_prof/rp_thread.c b/ext/ruby_prof/rp_thread.c
new file mode 100644
index 0000000..f742d39
--- /dev/null
+++ b/ext/ruby_prof/rp_thread.c
@@ -0,0 +1,268 @@
+/* Copyright (C) 2005-2013 Shugo Maeda <shugo at ruby-lang.org> and Charlie Savage <cfis at savagexi.com>
+   Please see the LICENSE file for copyright and distribution information */
+
+#include "ruby_prof.h"
+
+VALUE cRpThread;
+
+/* ======   thread_data_t  ====== */
+thread_data_t*
+thread_data_create()
+{
+    thread_data_t* result = ALLOC(thread_data_t);
+    result->stack = prof_stack_create();
+    result->method_table = method_table_create();
+	result->object = Qnil;
+	result->methods = Qnil;
+    return result;
+}
+
+/* The underlying c structures are freed when the parent profile is freed.  
+   However, on shutdown the Ruby GC frees objects in any will-nilly order.
+   That means the ruby thread object wrapping the c thread struct may
+   be freed before the parent profile.  Thus we add in a free function
+   for the garbage collector so that if it does get called will nil 
+   out our Ruby object reference.*/
+static void
+thread_data_ruby_gc_free(thread_data_t* thread_data)
+{
+	/* Has this thread object been accessed by Ruby?  If
+	  yes clean it up so to avoid a segmentation fault. */
+	if (thread_data->object != Qnil)
+	{
+		RDATA(thread_data->object)->data = NULL;
+		RDATA(thread_data->object)->dfree = NULL;
+		RDATA(thread_data->object)->dmark = NULL;
+    }
+	thread_data->object = Qnil;
+}
+
+static void
+thread_data_free(thread_data_t* thread_data)
+{
+	thread_data_ruby_gc_free(thread_data);
+    method_table_free(thread_data->method_table);
+    prof_stack_free(thread_data->stack);
+
+    thread_data->thread_id = Qnil;
+
+	xfree(thread_data);
+}
+
+static int
+mark_methods(st_data_t key, st_data_t value, st_data_t result)
+{
+    prof_method_t *method = (prof_method_t *) value;
+    prof_method_mark(method);
+    return ST_CONTINUE;
+}
+
+void
+prof_thread_mark(thread_data_t *thread)
+{
+	if (thread->object != Qnil)
+		rb_gc_mark(thread->object);
+	
+	if (thread->methods != Qnil)
+		rb_gc_mark(thread->methods);
+
+	if (thread->thread_id != Qnil)
+		rb_gc_mark(thread->thread_id);
+
+	if (thread->fiber_id != Qnil)
+		rb_gc_mark(thread->fiber_id);
+
+	st_foreach(thread->method_table, mark_methods, 0);
+}
+
+VALUE
+prof_thread_wrap(thread_data_t *thread)
+{
+  if (thread->object == Qnil)
+  {
+    thread->object = Data_Wrap_Struct(cRpThread, prof_thread_mark, thread_data_ruby_gc_free, thread);
+  }
+  return thread->object;
+}
+
+static thread_data_t*
+prof_get_thread(VALUE self)
+{
+    /* Can't use Data_Get_Struct because that triggers the event hook
+       ending up in endless recursion. */
+	thread_data_t* result = DATA_PTR(self);
+	if (!result)
+	    rb_raise(rb_eRuntimeError, "This RubyProf::Thread instance has already been freed, likely because its profile has been freed.");
+
+   return result;
+}
+
+/* ======   Thread Table  ====== */
+/* The thread table is hash keyed on ruby thread_id that stores instances
+   of thread_data_t. */
+
+st_table *
+threads_table_create()
+{
+    return st_init_numtable();
+}
+
+static int
+thread_table_free_iterator(st_data_t key, st_data_t value, st_data_t dummy)
+{
+    thread_data_free((thread_data_t*)value);
+    return ST_CONTINUE;
+}
+
+void
+threads_table_free(st_table *table)
+{
+    st_foreach(table, thread_table_free_iterator, 0);
+    st_free_table(table);
+}
+
+size_t
+threads_table_insert(prof_profile_t* profile, VALUE fiber, thread_data_t *thread_data)
+{
+    /* Its too slow to key on the real thread id so just typecast thread instead. */
+    return st_insert(profile->threads_tbl, (st_data_t) fiber, (st_data_t) thread_data);
+}
+
+thread_data_t *
+threads_table_lookup(prof_profile_t* profile, VALUE thread_id, VALUE fiber_id)
+{
+    thread_data_t* result;
+    st_data_t val;
+
+    /* Its too slow to key on the real thread id so just typecast thread instead. */
+    if (st_lookup(profile->threads_tbl, (st_data_t) fiber_id, &val))
+    {
+      result = (thread_data_t *) val;
+    }
+    else
+    {
+        result = thread_data_create();
+        result->thread_id = thread_id;
+        result->fiber_id = fiber_id;
+
+        /* Insert the table */
+        threads_table_insert(profile, fiber_id, result);
+    }
+    return result;
+}
+
+thread_data_t *
+switch_thread(void* prof, VALUE thread_id, VALUE fiber_id)
+{
+    prof_profile_t* profile = (prof_profile_t*)prof;
+    double measurement = profile->measurer->measure();
+
+    /* Get new thread information. */
+    thread_data_t *thread_data = threads_table_lookup(profile, thread_id, fiber_id);
+
+    /* Get current frame for this thread */
+    prof_frame_t *frame = prof_stack_peek(thread_data->stack);
+
+    /* Update the time this thread waited for another thread */
+    if (frame)
+    {
+        frame->wait_time += measurement - frame->switch_time;
+        frame->switch_time = measurement;
+    }
+
+    /* Save on the last thread the time of the context switch
+       and reset this thread's last context switch to 0.*/
+    if (profile->last_thread_data)
+    {
+       prof_frame_t *last_frame = prof_stack_peek(profile->last_thread_data->stack);
+       if (last_frame)
+         last_frame->switch_time = measurement;
+    }
+
+    profile->last_thread_data = thread_data;
+    return thread_data;
+}
+
+int pause_thread(st_data_t key, st_data_t value, st_data_t data) 
+{
+    thread_data_t* thread_data = (thread_data_t *) value;
+	prof_profile_t* profile = (prof_profile_t*)data;
+
+    prof_frame_t* frame = prof_stack_peek(thread_data->stack);
+	prof_frame_pause(frame, profile->measurement_at_pause_resume);
+
+    return ST_CONTINUE;
+}
+
+int unpause_thread(st_data_t key, st_data_t value, st_data_t data) 
+{
+    thread_data_t* thread_data = (thread_data_t *) value;
+	prof_profile_t* profile = (prof_profile_t*)data;
+
+    prof_frame_t* frame = prof_stack_peek(thread_data->stack);
+	prof_frame_unpause(frame, profile->measurement_at_pause_resume);
+
+    return ST_CONTINUE;
+}
+
+static int
+collect_methods(st_data_t key, st_data_t value, st_data_t result)
+{
+    /* Called for each method stored in a thread's method table.
+       We want to store the method info information into an array.*/
+    VALUE methods = (VALUE) result;
+    prof_method_t *method = (prof_method_t *) value;
+    rb_ary_push(methods, prof_method_wrap(method));
+
+    return ST_CONTINUE;
+}
+
+
+/* call-seq:
+   id -> number
+
+Returns the id of this thread. */
+static VALUE
+prof_thread_id(VALUE self)
+{
+    thread_data_t* thread = prof_get_thread(self);
+	return thread->thread_id;
+}
+
+/* call-seq:
+   fiber_id -> number
+
+Returns the fiber id of this thread. */
+static VALUE
+prof_fiber_id(VALUE self)
+{
+    thread_data_t* thread = prof_get_thread(self);
+	return thread->fiber_id;
+}
+
+/* call-seq:
+   methods -> Array of MethodInfo
+
+Returns an array of methods that were called from this
+thread during program execution. */
+static VALUE
+prof_thread_methods(VALUE self)
+{
+    thread_data_t* thread = prof_get_thread(self);
+	if (thread->methods == Qnil)
+	{
+		thread->methods = rb_ary_new();
+	    st_foreach(thread->method_table, collect_methods, thread->methods);
+	}
+	return thread->methods;
+}
+
+void rp_init_thread()
+{
+    cRpThread = rb_define_class_under(mProf, "Thread", rb_cObject);
+    rb_undef_method(CLASS_OF(cRpThread), "new");
+
+    rb_define_method(cRpThread, "id", prof_thread_id, 0);
+    rb_define_method(cRpThread, "fiber_id", prof_fiber_id, 0);
+    rb_define_method(cRpThread, "methods", prof_thread_methods, 0);
+}
diff --git a/ext/ruby_prof/rp_thread.h b/ext/ruby_prof/rp_thread.h
new file mode 100644
index 0000000..11a8a75
--- /dev/null
+++ b/ext/ruby_prof/rp_thread.h
@@ -0,0 +1,27 @@
+/* Copyright (C) 2005-2013 Shugo Maeda <shugo at ruby-lang.org> and Charlie Savage <cfis at savagexi.com>
+   Please see the LICENSE file for copyright and distribution information */
+
+#ifndef __RP_THREAD__
+#define __RP_THREAD__
+
+/* Profiling information for a thread. */
+typedef struct
+{
+    VALUE object;                     /* Cache to wrapped object */
+    VALUE methods;                    /* Array of RubyProf::MethodInfo */
+    VALUE thread_id;                  /* Thread id */
+    VALUE fiber_id;                   /* Fiber id */
+    st_table* method_table;           /* Methods called in the thread */
+    prof_stack_t* stack;              /* Stack of frames */
+} thread_data_t;
+
+void rp_init_thread();
+st_table * threads_table_create();
+thread_data_t* switch_thread(void* prof, VALUE thread_id, VALUE fiber_id);
+void threads_table_free(st_table *table);
+VALUE prof_thread_wrap(thread_data_t *thread);
+void prof_thread_mark(thread_data_t *thread);
+int pause_thread(st_data_t key, st_data_t value, st_data_t data);
+int unpause_thread(st_data_t key, st_data_t value, st_data_t data);
+
+#endif //__RP_THREAD__
diff --git a/ext/ruby_prof/ruby_prof.c b/ext/ruby_prof/ruby_prof.c
new file mode 100644
index 0000000..1e9ea8e
--- /dev/null
+++ b/ext/ruby_prof/ruby_prof.c
@@ -0,0 +1,695 @@
+/* Copyright (C) 2005-2013 Shugo Maeda <shugo at ruby-lang.org> and Charlie Savage <cfis at savagexi.com>
+   Please see the LICENSE file for copyright and distribution information */
+
+/* ruby-prof tracks the time spent executing every method in ruby programming.
+   The main players are:
+
+     profile_t         - This represents 1 profile.
+     thread_data_t     - Stores data about a single thread.
+     prof_stack_t      - The method call stack in a particular thread
+     prof_method_t     - Profiling information about each method
+     prof_call_info_t  - Keeps track a method's callers and callees.
+
+  The final result is an instance of a profile object which has a hash table of
+  thread_data_t, keyed on the thread id.  Each thread in turn has a hash table
+  of prof_method_t, keyed on the method id.  A hash table is used for quick 
+  look up when doing a profile.  However, it is exposed to Ruby as an array.
+
+  Each prof_method_t has two hash tables, parent and children, of prof_call_info_t.
+  These objects keep track of a method's callers (who called the method) and its
+  callees (who the method called).  These are keyed the method id, but once again,
+  are exposed to Ruby as arrays.  Each prof_call_into_t maintains a pointer to the
+  caller or callee method, thereby making it easy to navigate through the call
+  hierarchy in ruby - which is very helpful for creating call graphs.
+*/
+
+#include "ruby_prof.h"
+#include <assert.h>
+
+VALUE mProf;
+VALUE cProfile;
+
+#ifndef RUBY_VM
+/* Global variable to hold current profile - needed 
+   prior to Ruby 1.9 */
+static prof_profile_t* pCurrentProfile;
+#endif
+
+static prof_profile_t*
+prof_get_profile(VALUE self)
+{
+    /* Can't use Data_Get_Struct because that triggers the event hook
+       ending up in endless recursion. */
+    return (prof_profile_t*)RDATA(self)->data;
+}
+
+/* support tracing ruby events from ruby-prof. useful for getting at
+   what actually happens inside the ruby interpreter (and ruby-prof).
+   set environment variable RUBY_PROF_TRACE to filename you want to
+   find the trace in.
+ */
+static FILE* trace_file = NULL;
+
+/* Copied from eval.c (1.8.x) / thread.c (1.9.2) */
+static const char *
+get_event_name(rb_event_flag_t event)
+{
+  switch (event) {
+    case RUBY_EVENT_LINE:
+  return "line";
+    case RUBY_EVENT_CLASS:
+  return "class";
+    case RUBY_EVENT_END:
+  return "end";
+    case RUBY_EVENT_CALL:
+  return "call";
+    case RUBY_EVENT_RETURN:
+  return "return";
+    case RUBY_EVENT_C_CALL:
+  return "c-call";
+    case RUBY_EVENT_C_RETURN:
+  return "c-return";
+    case RUBY_EVENT_RAISE:
+  return "raise";
+
+#ifdef RUBY_VM
+    case RUBY_EVENT_SWITCH:
+  return "thread-interrupt";
+#endif
+
+    default:
+  return "unknown";
+  }
+}
+
+static prof_method_t*
+create_method(rb_event_flag_t event, VALUE klass, ID mid, const char* source_file, int line)
+{
+    /* Line numbers are not accurate for c method calls */
+    if (event == RUBY_EVENT_C_CALL)
+    {
+		line = 0;
+		source_file = NULL;
+    }
+
+    return prof_method_create(klass, mid, source_file, line);
+}
+
+
+static prof_method_t*
+#ifdef RUBY_VM
+ get_method(rb_event_flag_t event, VALUE klass, ID mid, thread_data_t* thread_data)
+# else
+ get_method(rb_event_flag_t event, NODE *node, VALUE klass, ID mid, thread_data_t* thread_data)
+#endif
+{
+    prof_method_key_t key;
+    prof_method_t *method = NULL;
+
+    method_key(&key, klass, mid);
+    method = method_table_lookup(thread_data->method_table, &key);
+
+    if (!method)
+    {
+ 	  const char* source_file = rb_sourcefile();
+      int line = rb_sourceline();
+
+	  method = create_method(event, klass, mid, source_file, line);
+      method_table_insert(thread_data->method_table, method->key, method);
+    }
+    return method;
+}
+
+static int
+pop_frames(st_data_t key, st_data_t value, st_data_t data)
+{
+    VALUE fiber_id = (VALUE)key;
+    thread_data_t* thread_data = (thread_data_t *) value;
+    prof_profile_t* profile = (prof_profile_t*) data;
+	double measurement = profile->measurer->measure();
+
+    if (!profile->last_thread_data || profile->last_thread_data->fiber_id != fiber_id)
+      thread_data = switch_thread(profile, Qnil, fiber_id);
+    else
+      thread_data = profile->last_thread_data;
+
+    while (prof_stack_pop(thread_data->stack, measurement))
+    {
+    }
+
+    return ST_CONTINUE;
+}
+
+static void
+prof_pop_threads(prof_profile_t* profile)
+{
+    st_foreach(profile->threads_tbl, pop_frames, (st_data_t) profile);
+}
+
+/* ===========  Profiling ================= */
+#ifdef RUBY_VM
+static void
+prof_trace(prof_profile_t* profile, rb_event_flag_t event, ID mid, VALUE klass, double measurement)
+#else
+static void
+prof_trace(prof_profile_t* profile, rb_event_flag_t event, NODE *node, ID mid, VALUE klass, double measurement)
+#endif
+{
+    static VALUE last_fiber_id = Qnil;
+
+    VALUE thread = rb_thread_current();
+    VALUE thread_id = rb_obj_id(thread);
+#if defined(HAVE_RB_FIBER_CURRENT)
+    VALUE fiber = rb_fiber_current();
+    VALUE fiber_id = rb_obj_id(fiber);
+#else
+    VALUE fiber_id = thread_id;
+#endif
+    const char* class_name = NULL;
+    const char* method_name = rb_id2name(mid);
+    const char* source_file = rb_sourcefile();
+    unsigned int source_line = rb_sourceline();
+
+    const char* event_name = get_event_name(event);
+
+    if (klass != 0)
+        klass = (BUILTIN_TYPE(klass) == T_ICLASS ? RBASIC(klass)->klass : klass);
+
+    class_name = rb_class2name(klass);
+
+    if (last_fiber_id != fiber_id)
+    {
+        fprintf(trace_file, "\n");
+    }
+
+    fprintf(trace_file, "%2lu:%2lu:%2ums %-8s %s:%2d  %s#%s\n",
+            (unsigned long) thread_id, (unsigned long) fiber_id, (unsigned int) measurement*1000,
+            event_name, source_file, source_line, class_name, method_name);
+    fflush(trace_file);
+    last_fiber_id = fiber_id;
+}
+
+#ifdef RUBY_VM
+static void
+prof_event_hook(rb_event_flag_t event, VALUE data, VALUE self, ID mid, VALUE klass)
+#else
+static void
+prof_event_hook(rb_event_flag_t event, NODE *node, VALUE self, ID mid, VALUE klass)
+#endif
+{
+#ifndef RUBY_VM
+    prof_profile_t* profile = pCurrentProfile;
+#else
+    prof_profile_t* profile = prof_get_profile(data);
+#endif	
+    
+    VALUE thread = Qnil;
+    VALUE thread_id = Qnil;
+    VALUE fiber = Qnil;
+    VALUE fiber_id = Qnil;
+    thread_data_t* thread_data = NULL;
+    prof_frame_t *frame = NULL;
+    double measurement;
+
+    #ifdef RUBY_VM
+      if (event != RUBY_EVENT_C_CALL && event != RUBY_EVENT_C_RETURN) {
+        // guess these are already set for C calls in 1.9, then?
+        rb_frame_method_id_and_class(&mid, &klass);
+      }
+    #endif
+
+    /* Get current measurement */
+    measurement = profile->measurer->measure();
+
+    if (trace_file != NULL)
+    {
+#ifdef RUBY_VM
+        prof_trace(profile, event, mid, klass, measurement);
+#else
+        prof_trace(profile, event, node, mid, klass, measurement);
+#endif
+    }
+
+    /* Special case - skip any methods from the mProf
+       module or cProfile class since they clutter
+       the results but aren't important to them results. */
+    if (self == mProf || klass == cProfile)
+		return;
+
+    /* Get the current thread information. */
+    thread = rb_thread_current();
+    thread_id = rb_obj_id(thread);
+#if defined(HAVE_RB_FIBER_CURRENT)
+    fiber = rb_fiber_current();
+    fiber_id = rb_obj_id(fiber);
+#else
+    fiber = thread;
+    fiber_id = thread_id;
+#endif
+
+    if (st_lookup(profile->exclude_threads_tbl, (st_data_t) thread_id, 0))
+    {
+      return;
+    }
+
+    /* Was there a context switch? */
+    if (!profile->last_thread_data || profile->last_thread_data->fiber_id != fiber_id)
+      thread_data = switch_thread(profile, thread_id, fiber_id);
+    else
+      thread_data = profile->last_thread_data;
+
+    /* Get the current frame for the current thread. */
+    frame = prof_stack_peek(thread_data->stack);
+
+    switch (event) {
+    case RUBY_EVENT_LINE:
+    {
+      /* Keep track of the current line number in this method.  When
+         a new method is called, we know what line number it was
+         called from. */
+
+      if (frame)
+      {
+        frame->line = rb_sourceline();
+        break;
+      }
+
+      /* If we get here there was no frame, which means this is
+         the first method seen for this thread, so fall through
+         to below to create it. */
+    }
+    case RUBY_EVENT_CALL:
+    case RUBY_EVENT_C_CALL:
+    {
+        prof_call_info_t *call_info = NULL;
+        prof_method_t *method = NULL;
+
+        #ifdef RUBY_VM
+        method = get_method(event, klass, mid, thread_data);
+        #else
+        method = get_method(event, node, klass, mid, thread_data);
+        #endif
+
+        if (!frame)
+        {
+          call_info = prof_call_info_create(method, NULL);
+          prof_add_call_info(method->call_infos, call_info);
+        }
+        else
+        {
+          call_info = call_info_table_lookup(frame->call_info->call_infos, method->key);
+
+          if (!call_info)
+          {
+            /* This call info does not yet exist.  So create it, then add
+               it to previous callinfo's children and to the current method .*/
+            call_info = prof_call_info_create(method, frame->call_info);
+            call_info_table_insert(frame->call_info->call_infos, method->key, call_info);
+            prof_add_call_info(method->call_infos, call_info);
+          }
+
+          // Unpause the parent frame. If currently paused then:
+          // 1) The child frame will begin paused.
+          // 2) The parent will inherit the child's dead time.
+          prof_frame_unpause(frame, measurement);
+        }
+
+        /* Push a new frame onto the stack for a new c-call or ruby call (into a method) */
+        frame = prof_stack_push(thread_data->stack, measurement);
+        frame->call_info = call_info;
+		frame->call_info->depth = frame->depth;
+        frame->pause_time = profile->paused == Qtrue ? measurement : -1;
+        frame->line = rb_sourceline();
+        break;
+    }
+    case RUBY_EVENT_RETURN:
+    case RUBY_EVENT_C_RETURN:
+    {
+	  prof_stack_pop(thread_data->stack, measurement);
+      break;
+    }
+  }
+}
+
+void
+prof_install_hook(VALUE self)
+{
+#ifdef RUBY_VM
+    rb_add_event_hook(prof_event_hook,
+          RUBY_EVENT_CALL | RUBY_EVENT_RETURN |
+          RUBY_EVENT_C_CALL | RUBY_EVENT_C_RETURN
+            | RUBY_EVENT_LINE, self); // RUBY_EVENT_SWITCH
+#else
+    rb_add_event_hook(prof_event_hook,
+          RUBY_EVENT_CALL | RUBY_EVENT_RETURN |
+          RUBY_EVENT_C_CALL | RUBY_EVENT_C_RETURN
+          | RUBY_EVENT_LINE);
+
+    pCurrentProfile = prof_get_profile(self);
+#endif	
+
+#if defined(TOGGLE_GC_STATS)
+    rb_gc_enable_stats();
+#endif
+}
+
+void
+prof_remove_hook()
+{
+#if defined(TOGGLE_GC_STATS)
+    rb_gc_disable_stats();
+#endif
+
+#ifndef RUBY_VM
+    pCurrentProfile = NULL;
+#endif
+
+    /* Now unregister from event   */
+    rb_remove_event_hook(prof_event_hook);
+}
+
+static int
+collect_threads(st_data_t key, st_data_t value, st_data_t result)
+{
+    thread_data_t* thread_data = (thread_data_t*) value;
+    VALUE threads_array = (VALUE) result;
+	rb_ary_push(threads_array, prof_thread_wrap(thread_data));
+    return ST_CONTINUE;
+}
+
+/* ========  Profile Class ====== */
+static int
+mark_threads(st_data_t key, st_data_t value, st_data_t result)
+{
+    thread_data_t *thread = (thread_data_t *) value;
+    prof_thread_mark(thread);
+    return ST_CONTINUE;
+}
+
+static void
+prof_mark(prof_profile_t *profile)
+{
+	st_foreach(profile->threads_tbl, mark_threads, 0);
+}
+
+/* Freeing the profile creates a cascade of freeing.
+   It fress the thread table, which frees its methods,
+   which frees its call infos. */
+static void
+prof_free(prof_profile_t *profile)
+{
+	profile->last_thread_data = NULL;
+
+	threads_table_free(profile->threads_tbl);
+    profile->threads_tbl = NULL;
+
+    st_free_table(profile->exclude_threads_tbl);
+    profile->exclude_threads_tbl = NULL;
+
+	xfree(profile->measurer);
+	profile->measurer = NULL;
+
+    xfree(profile);
+}
+
+static VALUE
+prof_allocate(VALUE klass)
+{
+    VALUE result;
+    prof_profile_t* profile;
+    result = Data_Make_Struct(klass, prof_profile_t, prof_mark, prof_free, profile);
+    profile->threads_tbl = threads_table_create();
+	profile->exclude_threads_tbl = threads_table_create();
+    profile->running = Qfalse;
+    return result;
+}
+
+/* call-seq:
+   RubyProf::Profile.new(mode, exclude_threads) -> instance
+
+   Returns a new profiler.
+   
+   == Parameters
+   mode::  Measure mode (optional). Specifies the profile measure mode.  If not specified, defaults
+           to RubyProf::WALL_TIME.
+   exclude_threads:: Threads to exclude from the profiling results (optional). */
+static VALUE
+prof_initialize(int argc,  VALUE *argv, VALUE self)
+{
+    prof_profile_t* profile = prof_get_profile(self);
+    VALUE mode;
+    prof_measure_mode_t measurer = MEASURE_WALL_TIME;
+    VALUE exclude_threads;
+    int i;
+    
+    switch (rb_scan_args(argc, argv, "02", &mode, &exclude_threads))
+    {
+      case 0:
+      {
+        measurer = MEASURE_WALL_TIME;
+        exclude_threads = rb_ary_new();
+        break;
+      }
+      case 1:
+      {
+        measurer = (prof_measure_mode_t)NUM2INT(mode);
+        exclude_threads = rb_ary_new();
+        break;
+      }
+      case 2:
+      {
+        Check_Type(exclude_threads, T_ARRAY);
+        measurer = (prof_measure_mode_t)NUM2INT(mode);
+        break;
+      }
+    }
+
+    profile->measurer = prof_get_measurer(measurer);
+
+    for (i = 0; i < RARRAY_LEN(exclude_threads); i++)
+    {
+        VALUE thread = rb_ary_entry(exclude_threads, i);
+        VALUE thread_id = rb_obj_id(thread);
+        st_insert(profile->exclude_threads_tbl, thread_id, Qtrue);
+    }
+
+    return self;
+}
+
+/* call-seq:
+   paused? -> boolean
+
+   Returns whether a profile is currently paused.*/
+static VALUE
+prof_paused(VALUE self)
+{
+    prof_profile_t* profile = prof_get_profile(self);
+    return profile->paused;
+}
+
+/* call-seq:
+   running? -> boolean
+
+   Returns whether a profile is currently running.*/
+static VALUE
+prof_running(VALUE self)
+{
+    prof_profile_t* profile = prof_get_profile(self);
+    return profile->running;
+}
+
+/* call-seq:
+   start -> RubyProf
+
+   Starts recording profile data.*/
+static VALUE
+prof_start(VALUE self)
+{
+    char* trace_file_name;
+
+    prof_profile_t* profile = prof_get_profile(self);
+        
+    if (profile->running == Qtrue)
+    {
+        rb_raise(rb_eRuntimeError, "RubyProf.start was already called");
+    }
+
+#ifndef RUBY_VM
+	if (pCurrentProfile != NULL)
+    {
+        rb_raise(rb_eRuntimeError, "Only one profile can run at a time on Ruby 1.8.*");
+    }
+#endif
+
+    profile->running = Qtrue;
+    profile->paused = Qfalse;
+    profile->last_thread_data = NULL;
+
+
+    /* open trace file if environment wants it */
+    trace_file_name = getenv("RUBY_PROF_TRACE");
+    if (trace_file_name != NULL) 
+    {
+      if (strcmp(trace_file_name, "stdout") == 0) 
+      {
+        trace_file = stdout;
+      } 
+      else if (strcmp(trace_file_name, "stderr") == 0)
+      {
+        trace_file = stderr;
+      }
+      else 
+      {
+        trace_file = fopen(trace_file_name, "w");
+      }
+    }
+
+    prof_install_hook(self);
+    return self;
+}
+
+/* call-seq:
+   pause -> RubyProf
+
+   Pauses collecting profile data. */
+static VALUE
+prof_pause(VALUE self)
+{
+    prof_profile_t* profile = prof_get_profile(self);
+    if (profile->running == Qfalse)
+    {
+        rb_raise(rb_eRuntimeError, "RubyProf is not running.");
+    }
+
+    if (profile->paused == Qfalse)
+    {
+        profile->paused = Qtrue;
+        profile->measurement_at_pause_resume = profile->measurer->measure();
+        st_foreach(profile->threads_tbl, pause_thread, (st_data_t) profile);
+    }
+
+    return self;
+}
+
+/* call-seq:
+   resume {block} -> RubyProf
+
+   Resumes recording profile data.*/
+static VALUE
+prof_resume(VALUE self)
+{
+    prof_profile_t* profile = prof_get_profile(self);
+    if (profile->running == Qfalse)
+    {
+        rb_raise(rb_eRuntimeError, "RubyProf is not running.");
+    }
+
+    if (profile->paused == Qtrue)
+    {
+        profile->paused = Qfalse;
+        profile->measurement_at_pause_resume = profile->measurer->measure();
+        st_foreach(profile->threads_tbl, unpause_thread, (st_data_t) profile);
+    }
+
+    return rb_block_given_p() ? rb_ensure(rb_yield, self, prof_pause, self) : self;
+}
+
+/* call-seq:
+   stop -> self
+
+   Stops collecting profile data.*/
+static VALUE
+prof_stop(VALUE self)
+{
+    prof_profile_t* profile = prof_get_profile(self);
+
+    if (profile->running == Qfalse)
+    {
+        rb_raise(rb_eRuntimeError, "RubyProf.start was not yet called");
+    }
+  
+    prof_remove_hook();
+
+    /* close trace file if open */
+    if (trace_file != NULL) 
+    {
+      if (trace_file !=stderr && trace_file != stdout)
+      {
+#ifdef _MSC_VER
+          _fcloseall();
+#else
+        fclose(trace_file);
+#endif
+      }
+      trace_file = NULL;
+    }
+    
+    prof_pop_threads(profile);
+
+    /* Unset the last_thread_data (very important!)
+       and the threads table */
+    profile->running = profile->paused = Qfalse;
+    profile->last_thread_data = NULL;
+
+    /* Post process result */
+    rb_funcall(self, rb_intern("post_process") , 0);
+
+    return self;
+}
+
+/* call-seq:
+   profile {block} -> RubyProf::Result
+
+Profiles the specified block and returns a RubyProf::Result object. */
+static VALUE
+prof_profile(int argc,  VALUE *argv, VALUE klass)
+{
+    int result;
+    VALUE profile = rb_class_new_instance(argc, argv, cProfile);
+
+    if (!rb_block_given_p())
+    {
+        rb_raise(rb_eArgError, "A block must be provided to the profile method.");
+    }
+
+    prof_start(profile);
+    rb_protect(rb_yield, profile, &result);
+    return prof_stop(profile);
+}
+
+/* call-seq:
+   threads -> Array of RubyProf::Thread
+
+Returns an array of RubyProf::Thread instances that were executed
+while the the program was being run. */
+static VALUE
+prof_threads(VALUE self)
+{
+	VALUE result = rb_ary_new();
+    prof_profile_t* profile = prof_get_profile(self);
+    st_foreach(profile->threads_tbl, collect_threads, result);
+    return result;
+}
+
+void Init_ruby_prof()
+{
+    mProf = rb_define_module("RubyProf");
+    rb_define_const(mProf, "VERSION", rb_str_new2(RUBY_PROF_VERSION));
+    
+    rp_init_measure();
+    rp_init_method_info();
+    rp_init_call_info();
+    rp_init_thread();
+
+    cProfile = rb_define_class_under(mProf, "Profile", rb_cObject);
+    rb_define_singleton_method(cProfile, "profile", prof_profile, -1);
+    rb_define_alloc_func (cProfile, prof_allocate);
+    rb_define_method(cProfile, "initialize", prof_initialize, -1);
+    rb_define_method(cProfile, "start", prof_start, 0);
+    rb_define_method(cProfile, "stop", prof_stop, 0);
+    rb_define_method(cProfile, "resume", prof_resume, 0);
+    rb_define_method(cProfile, "pause", prof_pause, 0);
+    rb_define_method(cProfile, "running?", prof_running, 0);
+    rb_define_method(cProfile, "paused?", prof_paused, 0);
+    rb_define_method(cProfile, "threads", prof_threads, 0);
+}
diff --git a/ext/ruby_prof/ruby_prof.h b/ext/ruby_prof/ruby_prof.h
new file mode 100644
index 0000000..29e513c
--- /dev/null
+++ b/ext/ruby_prof/ruby_prof.h
@@ -0,0 +1,55 @@
+/* Copyright (C) 2005-2013 Shugo Maeda <shugo at ruby-lang.org> and Charlie Savage <cfis at savagexi.com>
+   Please see the LICENSE file for copyright and distribution information */
+
+#ifndef __RUBY_PROF_H__
+#define __RUBY_PROF_H__
+
+#include <ruby.h>
+#include <stdio.h>
+
+#if RUBY_VERSION == 186
+# error 1.8.6 is not supported.  Please upgrade to 1.8.7 or 1.9.2 or higher.
+#endif
+
+#if RUBY_VERSION == 190
+# error 1.9.0 is not supported.  Please upgrade to 1.9.2 or higher.
+#endif
+
+#if RUBY_VERSION == 191
+# error 1.9.1 is not supported.  Please upgrade to 1.9.2 or higher.
+#endif
+
+#ifndef RUBY_VM
+#include <node.h>
+typedef rb_event_t rb_event_flag_t;
+#define rb_sourcefile() (node ? node->nd_file : 0)
+#define rb_sourceline() (node ? nd_line(node) : 0)
+#endif
+
+#include "version.h"
+
+#include "rp_measure.h"
+#include "rp_method.h"
+#include "rp_call_info.h"
+#include "rp_stack.h"
+#include "rp_thread.h"
+
+extern VALUE mProf;
+extern VALUE cProfile;
+
+void method_key(prof_method_key_t* key, VALUE klass, ID mid);
+
+typedef struct
+{
+    VALUE running;
+    VALUE paused;
+    prof_measurer_t* measurer;
+    VALUE threads;
+    st_table* threads_tbl;
+    st_table* exclude_threads_tbl;
+    thread_data_t* last_thread_data;
+    double measurement_at_pause_resume;
+} prof_profile_t;
+
+
+#endif //__RUBY_PROF_H__
diff --git a/ext/ruby_prof/vc/ruby_prof.sln b/ext/ruby_prof/vc/ruby_prof.sln
new file mode 100644
index 0000000..ba39463
--- /dev/null
+++ b/ext/ruby_prof/vc/ruby_prof.sln
@@ -0,0 +1,32 @@
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ruby_prof_18", "ruby_prof_18.vcxproj", "{7789FC23-D053-4733-9ED1-D6CE099E1237}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ruby_prof_19", "ruby_prof_19.vcxproj", "{5AF7F29A-B100-4D61-95DA-DB21D7C8C1B8}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ruby_prof_20", "ruby_prof_20.vcxproj", "{6B4978F4-3B5F-4D38-81A8-069EC28CC069}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Win32 = Debug|Win32
+		Release|Win32 = Release|Win32
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{7789FC23-D053-4733-9ED1-D6CE099E1237}.Debug|Win32.ActiveCfg = Debug|Win32
+		{7789FC23-D053-4733-9ED1-D6CE099E1237}.Debug|Win32.Build.0 = Debug|Win32
+		{7789FC23-D053-4733-9ED1-D6CE099E1237}.Release|Win32.ActiveCfg = Release|Win32
+		{7789FC23-D053-4733-9ED1-D6CE099E1237}.Release|Win32.Build.0 = Release|Win32
+		{5AF7F29A-B100-4D61-95DA-DB21D7C8C1B8}.Debug|Win32.ActiveCfg = Debug|Win32
+		{5AF7F29A-B100-4D61-95DA-DB21D7C8C1B8}.Debug|Win32.Build.0 = Debug|Win32
+		{5AF7F29A-B100-4D61-95DA-DB21D7C8C1B8}.Release|Win32.ActiveCfg = Release|Win32
+		{5AF7F29A-B100-4D61-95DA-DB21D7C8C1B8}.Release|Win32.Build.0 = Release|Win32
+		{6B4978F4-3B5F-4D38-81A8-069EC28CC069}.Debug|Win32.ActiveCfg = Debug|Win32
+		{6B4978F4-3B5F-4D38-81A8-069EC28CC069}.Debug|Win32.Build.0 = Debug|Win32
+		{6B4978F4-3B5F-4D38-81A8-069EC28CC069}.Release|Win32.ActiveCfg = Release|Win32
+		{6B4978F4-3B5F-4D38-81A8-069EC28CC069}.Release|Win32.Build.0 = Release|Win32
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal
diff --git a/ext/ruby_prof/vc/ruby_prof_18.vcxproj b/ext/ruby_prof/vc/ruby_prof_18.vcxproj
new file mode 100644
index 0000000..8edf619
--- /dev/null
+++ b/ext/ruby_prof/vc/ruby_prof_18.vcxproj
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="..\rp_call_info.h" />
+    <ClInclude Include="..\rp_measure.h" />
+    <ClInclude Include="..\rp_method.h" />
+    <ClInclude Include="..\rp_stack.h" />
+    <ClInclude Include="..\rp_thread.h" />
+    <ClInclude Include="..\ruby_prof.h" />
+    <ClInclude Include="..\version.h" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="..\rp_call_info.c" />
+    <ClCompile Include="..\rp_measure.c" />
+    <ClCompile Include="..\rp_measure_allocations.c" />
+    <ClCompile Include="..\rp_measure_cpu_time.c" />
+    <ClCompile Include="..\rp_measure_gc_runs.c" />
+    <ClCompile Include="..\rp_measure_gc_time.c" />
+    <ClCompile Include="..\rp_measure_memory.c" />
+    <ClCompile Include="..\rp_measure_process_time.c" />
+    <ClCompile Include="..\rp_measure_wall_time.c" />
+    <ClCompile Include="..\rp_method.c" />
+    <ClCompile Include="..\rp_stack.c" />
+    <ClCompile Include="..\rp_thread.c" />
+    <ClCompile Include="..\ruby_prof.c" />
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{7789FC23-D053-4733-9ED1-D6CE099E1237}</ProjectGuid>
+    <Keyword>Win32Proj</Keyword>
+    <RootNamespace>ruby_prof_18</RootNamespace>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <LinkIncremental>true</LinkIncremental>
+    <OutDir>C:\MinGW\local\src\ruby-prof\lib\1.8</OutDir>
+    <TargetExt>.so</TargetExt>
+    <TargetName>ruby_prof</TargetName>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <LinkIncremental>false</LinkIncremental>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <PrecompiledHeader>NotUsing</PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;RUBY_PROF_18_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>C:\MinGW\local\ruby187vc\lib\ruby\1.8\i386-mswin32_100</AdditionalIncludeDirectories>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <AdditionalLibraryDirectories>C:\MinGW\local\ruby187vc\lib</AdditionalLibraryDirectories>
+      <AdditionalDependencies>msvcr100-ruby18.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <ModuleDefinitionFile>ruby_prof.def</ModuleDefinitionFile>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;RUBY_PROF_18_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+    </Link>
+  </ItemDefinitionGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>
\ No newline at end of file
diff --git a/ext/ruby_prof/vc/ruby_prof_19.vcxproj b/ext/ruby_prof/vc/ruby_prof_19.vcxproj
new file mode 100644
index 0000000..bb58988
--- /dev/null
+++ b/ext/ruby_prof/vc/ruby_prof_19.vcxproj
@@ -0,0 +1,110 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{5AF7F29A-B100-4D61-95DA-DB21D7C8C1B8}</ProjectGuid>
+    <Keyword>Win32Proj</Keyword>
+    <RootNamespace>ruby_prof</RootNamespace>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <LinkIncremental>true</LinkIncremental>
+    <OutDir>..\..\..\lib\1.9</OutDir>
+    <TargetExt>.so</TargetExt>
+    <TargetName>ruby_prof</TargetName>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <LinkIncremental>false</LinkIncremental>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;RUBY_PROF_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>C:\MinGW\local\ruby193vc\include\ruby-1.9.1;C:\MinGW\local\ruby193vc\include\ruby-1.9.1\i386-mswin32_100;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <AdditionalLibraryDirectories>C:\MinGW\local\ruby193vc\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <AdditionalDependencies>msvcr100-ruby191.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <ModuleDefinitionFile>ruby_prof.def</ModuleDefinitionFile>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;RUBY_PROF_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClInclude Include="..\rp_call_info.h" />
+    <ClInclude Include="..\rp_measure.h" />
+    <ClInclude Include="..\rp_method.h" />
+    <ClInclude Include="..\rp_stack.h" />
+    <ClInclude Include="..\rp_thread.h" />
+    <ClInclude Include="..\ruby_prof.h" />
+    <ClInclude Include="..\version.h" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="..\rp_call_info.c" />
+    <ClCompile Include="..\rp_measure.c" />
+    <ClCompile Include="..\rp_measure_allocations.c" />
+    <ClCompile Include="..\rp_measure_cpu_time.c" />
+    <ClCompile Include="..\rp_measure_gc_runs.c" />
+    <ClCompile Include="..\rp_measure_gc_time.c" />
+    <ClCompile Include="..\rp_measure_memory.c" />
+    <ClCompile Include="..\rp_measure_process_time.c" />
+    <ClCompile Include="..\rp_measure_wall_time.c" />
+    <ClCompile Include="..\rp_method.c" />
+    <ClCompile Include="..\rp_stack.c" />
+    <ClCompile Include="..\rp_thread.c" />
+    <ClCompile Include="..\ruby_prof.c" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>
\ No newline at end of file
diff --git a/ext/ruby_prof/vc/ruby_prof_20.vcxproj b/ext/ruby_prof/vc/ruby_prof_20.vcxproj
new file mode 100644
index 0000000..d620c4e
--- /dev/null
+++ b/ext/ruby_prof/vc/ruby_prof_20.vcxproj
@@ -0,0 +1,110 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{6B4978F4-3B5F-4D38-81A8-069EC28CC069}</ProjectGuid>
+    <Keyword>Win32Proj</Keyword>
+    <RootNamespace>ruby_prof</RootNamespace>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <LinkIncremental>true</LinkIncremental>
+    <OutDir>..\..\..\lib\2.0</OutDir>
+    <TargetExt>.so</TargetExt>
+    <TargetName>ruby_prof</TargetName>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <LinkIncremental>false</LinkIncremental>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;RUBY_PROF_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>C:\MinGW\local\ruby200vc\include\ruby-2.0.0;C:\MinGW\local\ruby200vc\include\ruby-2.0.0\i386-mswin32_100;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <AdditionalLibraryDirectories>C:\MinGW\local\ruby200vc\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <AdditionalDependencies>msvcr100-ruby200.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <ModuleDefinitionFile>ruby_prof.def</ModuleDefinitionFile>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;RUBY_PROF_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClInclude Include="..\rp_call_info.h" />
+    <ClInclude Include="..\rp_measure.h" />
+    <ClInclude Include="..\rp_method.h" />
+    <ClInclude Include="..\rp_stack.h" />
+    <ClInclude Include="..\rp_thread.h" />
+    <ClInclude Include="..\ruby_prof.h" />
+    <ClInclude Include="..\version.h" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="..\rp_call_info.c" />
+    <ClCompile Include="..\rp_measure.c" />
+    <ClCompile Include="..\rp_measure_allocations.c" />
+    <ClCompile Include="..\rp_measure_cpu_time.c" />
+    <ClCompile Include="..\rp_measure_gc_runs.c" />
+    <ClCompile Include="..\rp_measure_gc_time.c" />
+    <ClCompile Include="..\rp_measure_memory.c" />
+    <ClCompile Include="..\rp_measure_process_time.c" />
+    <ClCompile Include="..\rp_measure_wall_time.c" />
+    <ClCompile Include="..\rp_method.c" />
+    <ClCompile Include="..\rp_stack.c" />
+    <ClCompile Include="..\rp_thread.c" />
+    <ClCompile Include="..\ruby_prof.c" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>
\ No newline at end of file
diff --git a/ext/ruby_prof/version.h b/ext/ruby_prof/version.h
new file mode 100644
index 0000000..9d34617
--- /dev/null
+++ b/ext/ruby_prof/version.h
@@ -0,0 +1,7 @@
+/* Copyright (C) 2005-2013 Shugo Maeda <shugo at ruby-lang.org> and Charlie Savage <cfis at savagexi.com>
+   Please see the LICENSE file for copyright and distribution information */
+
+#define RUBY_PROF_VERSION  "0.13.1" // as a string, for easy parsing from rake files
+#define RUBY_PROF_VERSION_MAJ   0
+#define RUBY_PROF_VERSION_MIN   13
+#define RUBY_PROF_VERSION_MIC   1
diff --git a/ext/vc/ruby_prof.sln b/ext/vc/ruby_prof.sln
deleted file mode 100644
index 2f123b1..0000000
--- a/ext/vc/ruby_prof.sln
+++ /dev/null
@@ -1,20 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 10.00
-# Visual Studio 2008
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ruby_prof", "ruby_prof.vcproj", "{DDB3E992-BF4B-4413-B061-288E40AECAD3}"
-EndProject
-Global
-	GlobalSection(SolutionConfigurationPlatforms) = preSolution
-		Debug|Win32 = Debug|Win32
-		Release|Win32 = Release|Win32
-	EndGlobalSection
-	GlobalSection(ProjectConfigurationPlatforms) = postSolution
-		{DDB3E992-BF4B-4413-B061-288E40AECAD3}.Debug|Win32.ActiveCfg = Debug|Win32
-		{DDB3E992-BF4B-4413-B061-288E40AECAD3}.Debug|Win32.Build.0 = Debug|Win32
-		{DDB3E992-BF4B-4413-B061-288E40AECAD3}.Release|Win32.ActiveCfg = Release|Win32
-		{DDB3E992-BF4B-4413-B061-288E40AECAD3}.Release|Win32.Build.0 = Release|Win32
-	EndGlobalSection
-	GlobalSection(SolutionProperties) = preSolution
-		HideSolutionNode = FALSE
-	EndGlobalSection
-EndGlobal
diff --git a/ext/vc/ruby_prof.vcproj b/ext/vc/ruby_prof.vcproj
deleted file mode 100644
index d5041e3..0000000
--- a/ext/vc/ruby_prof.vcproj
+++ /dev/null
@@ -1,241 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="9.00"
-	Name="ruby_prof"
-	ProjectGUID="{DDB3E992-BF4B-4413-B061-288E40AECAD3}"
-	RootNamespace="rubyprof"
-	Keyword="Win32Proj"
-	TargetFrameworkVersion="131072"
-	>
-	<Platforms>
-		<Platform
-			Name="Win32"
-		/>
-	</Platforms>
-	<ToolFiles>
-	</ToolFiles>
-	<Configurations>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
-			IntermediateDirectory="$(ConfigurationName)"
-			ConfigurationType="2"
-			CharacterSet="1"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				AdditionalIncludeDirectories=""C:\Development\ruby\lib\ruby\1.8\i386-mswin32""
-				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;RUBYPROF_EXPORTS"
-				MinimalRebuild="true"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="3"
-				UsePrecompiledHeader="0"
-				BrowseInformation="0"
-				WarningLevel="3"
-				Detect64BitPortabilityProblems="true"
-				DebugInformationFormat="4"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="msvcrt-ruby18.lib"
-				OutputFile="C:\Development\ruby\lib\ruby\gems\1.8\gems\ruby-prof-0.7.0-x86-mswin32-60\lib\$(ProjectName).so"
-				LinkIncremental="2"
-				AdditionalLibraryDirectories="C:\Development\ruby\lib"
-				GenerateDebugInformation="true"
-				SubSystem="2"
-				RandomizedBaseAddress="1"
-				DataExecutionPrevention="0"
-				TargetMachine="1"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
-			IntermediateDirectory="$(ConfigurationName)"
-			ConfigurationType="2"
-			CharacterSet="1"
-			WholeProgramOptimization="1"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="C:\Development\ruby\lib\ruby\1.8\i386-mswin32"
-				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;RUBYPROF_EXPORTS"
-				RuntimeLibrary="2"
-				UsePrecompiledHeader="0"
-				WarningLevel="3"
-				Detect64BitPortabilityProblems="true"
-				DebugInformationFormat="3"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="msvcrt-ruby18.lib"
-				OutputFile="$(OutDir)\$(ProjectName).so"
-				LinkIncremental="1"
-				AdditionalLibraryDirectories="C:\Development\ruby\lib"
-				GenerateDebugInformation="true"
-				SubSystem="2"
-				OptimizeReferences="2"
-				EnableCOMDATFolding="2"
-				RandomizedBaseAddress="1"
-				DataExecutionPrevention="0"
-				TargetMachine="1"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Name="Source Files"
-			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
-			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
-			>
-			<File
-				RelativePath="..\ruby_prof.c"
-				>
-			</File>
-		</Filter>
-		<Filter
-			Name="Header Files"
-			Filter="h;hpp;hxx;hm;inl;inc;xsd"
-			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
-			>
-			<File
-				RelativePath="..\measure_allocations.h"
-				>
-			</File>
-			<File
-				RelativePath="..\measure_cpu_time.h"
-				>
-			</File>
-			<File
-				RelativePath="..\measure_gc_runs.h"
-				>
-			</File>
-			<File
-				RelativePath="..\measure_gc_time.h"
-				>
-			</File>
-			<File
-				RelativePath="..\measure_memory.h"
-				>
-			</File>
-			<File
-				RelativePath="..\measure_process_time.h"
-				>
-			</File>
-			<File
-				RelativePath="..\measure_wall_time.h"
-				>
-			</File>
-			<File
-				RelativePath="..\ruby_prof.h"
-				>
-			</File>
-			<File
-				RelativePath="..\version.h"
-				>
-			</File>
-		</Filter>
-		<Filter
-			Name="Resource Files"
-			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
-			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
-			>
-		</Filter>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>
diff --git a/ext/version.h b/ext/version.h
deleted file mode 100644
index 3ceb126..0000000
--- a/ext/version.h
+++ /dev/null
@@ -1,4 +0,0 @@
-#define RUBY_PROF_VERSION  "0.7.3"
-#define RUBY_PROF_VERSION_MAJ   0
-#define RUBY_PROF_VERSION_MIN   7
-#define RUBY_PROF_VERSION_MIC   3
diff --git a/lib/ruby-prof.rb b/lib/ruby-prof.rb
index 8b24a7e..57423ac 100644
--- a/lib/ruby-prof.rb
+++ b/lib/ruby-prof.rb
@@ -1,17 +1,35 @@
-require "ruby_prof.so"
+# encoding: utf-8
 
-require "ruby-prof/method_info"
-require "ruby-prof/call_info"
-require "ruby-prof/aggregate_call_info"
-require "ruby-prof/flat_printer"
-require "ruby-prof/graph_printer"
-require "ruby-prof/graph_html_printer"
-require "ruby-prof/call_tree_printer"
+# Load the C-based binding.
+begin
+  RUBY_VERSION =~ /(\d+.\d+)/
+  require "#{$1}/ruby_prof"
+rescue LoadError
+  require "ruby_prof"
+end
+
+require 'ruby-prof/aggregate_call_info'
+require 'ruby-prof/call_info'
+require 'ruby-prof/call_info_visitor'
+require 'ruby-prof/compatibility'
+require 'ruby-prof/method_info'
+require 'ruby-prof/profile'
+require 'ruby-prof/rack'
+require 'ruby-prof/thread'
 
-require "ruby-prof/test"
+require 'ruby-prof/printers/abstract_printer'
+require 'ruby-prof/printers/call_info_printer'
+require 'ruby-prof/printers/call_stack_printer'
+require 'ruby-prof/printers/call_tree_printer'
+require 'ruby-prof/printers/dot_printer'
+require 'ruby-prof/printers/flat_printer'
+require 'ruby-prof/printers/flat_printer_with_line_numbers'
+require 'ruby-prof/printers/graph_html_printer'
+require 'ruby-prof/printers/graph_printer'
+require 'ruby-prof/printers/multi_printer'
 
 module RubyProf
-  # See if the user specified the clock mode via 
+  # Checks if the user specified the clock mode via
   # the RUBY_PROF_MEASURE_MODE environment variable
   def self.figure_measure_mode
     case ENV["RUBY_PROF_MEASURE_MODE"]
@@ -40,9 +58,10 @@ module RubyProf
     when "memory"
       RubyProf.measure_mode = RubyProf::MEMORY
     else
+      # the default...
       RubyProf.measure_mode = RubyProf::PROCESS_TIME
     end
   end
 end
 
-RubyProf::figure_measure_mode
+RubyProf::figure_measure_mode
\ No newline at end of file
diff --git a/lib/ruby-prof/abstract_printer.rb b/lib/ruby-prof/abstract_printer.rb
deleted file mode 100644
index 63cd60d..0000000
--- a/lib/ruby-prof/abstract_printer.rb
+++ /dev/null
@@ -1,41 +0,0 @@
-module RubyProf
-  class AbstractPrinter
-    def initialize(result)
-      @result = result
-      @output = nil
-      @options = {}
-    end
-
-    # Specify print options.
-    # 
-    # options - Hash table
-    #   :min_percent - Number 0 to 100 that specifes the minimum
-    #                  %self (the methods self time divided by the
-    #                  overall total time) that a method must take
-    #                  for it to be printed out in the report.
-    #                  Default value is 0.
-    #
-    #   :print_file  - True or false. Specifies if a method's source
-    #                  file should be printed.  Default value if false.
-    #
-    def setup_options(options = {})
-      @options = options
-    end      
-
-    def min_percent
-      @options[:min_percent] || 0
-    end
-    
-    def print_file
-      @options[:print_file] || false
-    end
-    
-    def method_name(method)
-      name = method.full_name
-      if print_file
-        name += " (#{method.source_file}:#{method.line}}"
-      end
-      name
-    end
-  end
-end 
\ No newline at end of file
diff --git a/lib/ruby-prof/aggregate_call_info.rb b/lib/ruby-prof/aggregate_call_info.rb
index c86d2c4..7e9952c 100644
--- a/lib/ruby-prof/aggregate_call_info.rb
+++ b/lib/ruby-prof/aggregate_call_info.rb
@@ -1,6 +1,9 @@
+# encoding: utf-8
+
 module RubyProf
   class AggregateCallInfo
     attr_reader :call_infos
+
     def initialize(call_infos)
       if call_infos.length == 0
         raise(ArgumentError, "Must specify at least one call info.")
@@ -27,19 +30,19 @@ module RubyProf
     end
 
     def total_time
-      aggregate(:total_time)
+      aggregate_without_recursion(:total_time)
     end
 
     def self_time
-      aggregate(:self_time)
+      aggregate_without_recursion(:self_time)
     end
 
     def wait_time
-      aggregate(:wait_time)
+      aggregate_without_recursion(:wait_time)
     end
 
     def children_time
-      aggregate(:children_time)
+      aggregate_without_recursion(:children_time)
     end
 
     def called
@@ -47,7 +50,7 @@ module RubyProf
     end
 
     def to_s
-      "#{call_infos.first.full_name}"
+      "#{call_infos.first.target.full_name}"
     end
 
     private
@@ -58,5 +61,12 @@ module RubyProf
         sum
       end
     end
+
+    def aggregate_without_recursion(method_name)
+      self.call_infos.inject(0) do |sum, call_info|
+        sum += call_info.send(method_name) unless call_info.recursive
+        sum
+      end
+    end
   end
-end
\ No newline at end of file
+end
diff --git a/lib/ruby-prof/call_info.rb b/lib/ruby-prof/call_info.rb
index 0f08d90..b306b60 100644
--- a/lib/ruby-prof/call_info.rb
+++ b/lib/ruby-prof/call_info.rb
@@ -1,15 +1,8 @@
+# encoding: utf-8
+
 module RubyProf
   class CallInfo
-    def depth
-      result = 0
-      call_info = self.parent
-
-      while call_info
-        result += 1
-        call_info = call_info.parent
-      end
-      result
-    end
+    attr_accessor :recursive
 
     def children_time
       children.inject(0) do |sum, call_info|
@@ -41,7 +34,56 @@ module RubyProf
     end
 
     def to_s
-      "#{call_sequence}"
+      "#{self.target.full_name} (c: #{self.called}, tt: #{self.total_time}, st: #{self.self_time}, ct: #{self.children_time})"
+    end
+
+    # eliminate call info from the call tree.
+    # adds self and wait time to parent and attaches called methods to parent.
+    # merges call trees for methods called from both praent end self.
+    def eliminate!
+      # puts "eliminating #{self}"
+      return unless parent
+      parent.add_self_time(self)
+      parent.add_wait_time(self)
+      children.each do |kid|
+        if call = parent.find_call(kid)
+          call.merge_call_tree(kid)
+        else
+          parent.children << kid
+          # $stderr.puts "setting parent of #{kid}\nto #{parent}"
+          kid.parent = parent
+        end
+      end
+      parent.children.delete(self)
+    end
+
+    # find a specific call in list of children. returns nil if not found.
+    # note: there can't be more than one child with a given target method. in other words:
+    # x.children.grep{|y|y.target==m}.size <= 1 for all method infos m and call infos x
+    def find_call(other)
+      matching = children.select { |kid| kid.target == other.target }
+      raise "inconsistent call tree" unless matching.size <= 1
+      matching.first
+    end
+
+    # merge two call trees. adds self, wait, and total time of other to self and merges children of other into children of self.
+    def merge_call_tree(other)
+      # $stderr.puts "merging #{self}\nand #{other}"
+      self.called += other.called
+      add_self_time(other)
+      add_wait_time(other)
+      add_total_time(other)
+      other.children.each do |other_kid|
+        if kid = find_call(other_kid)
+          # $stderr.puts "merging kids"
+          kid.merge_call_tree(other_kid)
+        else
+          other_kid.parent = self
+          children << other_kid
+        end
+      end
+      other.children.clear
+      other.target.call_infos.delete(other)
     end
   end
-end
\ No newline at end of file
+end
diff --git a/lib/ruby-prof/call_info_visitor.rb b/lib/ruby-prof/call_info_visitor.rb
new file mode 100644
index 0000000..8a83752
--- /dev/null
+++ b/lib/ruby-prof/call_info_visitor.rb
@@ -0,0 +1,44 @@
+# The call info visitor class does a depth-first traversal
+# across a thread's call stack.  At each call_info node,
+# the visitor executes the block provided in the
+# #visit method.  The block is passed two parameters, the
+# event and the call_info instance.  Event will be
+# either :enter or :exit.
+#
+#   visitor = RubyProf::CallInfoVisitor.new(result.threads.first)
+#
+#   method_names = Array.new
+#
+#   visitor.visit do |call_info, event|
+#     method_names << call_info.target.full_name if event == :enter
+#   end
+#
+#   puts method_names
+
+module RubyProf
+  class CallInfoVisitor
+    attr_reader :block, :thread
+
+    def initialize(thread)
+      @thread = thread
+    end
+
+    def visit(&block)
+      @block = block
+
+      self.thread.top_methods.each do |method_info|
+        method_info.call_infos.each do |call_info|
+          self.visit_call_info(call_info)
+        end
+      end
+    end
+
+    def visit_call_info(call_info)
+      self.block.call(call_info, :enter)
+      call_info.children.each do |child|
+        visit_call_info(child)
+      end
+      self.block.call(call_info, :exit)
+    end
+  end
+end
\ No newline at end of file
diff --git a/lib/ruby-prof/compatibility.rb b/lib/ruby-prof/compatibility.rb
new file mode 100644
index 0000000..c9e6d0a
--- /dev/null
+++ b/lib/ruby-prof/compatibility.rb
@@ -0,0 +1,169 @@
+# encoding: utf-8
+
+# These methods are here for backwards compatability with previous RubyProf releases
+module RubyProf
+  # Measurements
+  def self.cpu_frequency
+    Measure::CpuTime.frequency
+  end
+
+  def self.cpu_frequency=(value)
+    Measure::CpuTime.frequency = value
+  end
+
+  def self.measure_allocations
+    Measure::Allocations.measure
+  end
+
+  def self.measure_cpu_time
+    Measure::CpuTime.measure
+  end
+
+  def self.measure_gc_runs
+    Measure::GcRuns.measure
+  end
+
+  def self.measure_gc_time
+    Measure::GcTime.measure
+  end
+
+  def self.measure_memory
+    Measure::Memory.measure
+  end
+
+  def self.measure_process_time
+    Measure::ProcessTime.measure
+  end
+
+  def self.measure_wall_time
+    Measure::WallTime.measure
+  end
+
+  # call-seq:
+  # measure_mode -> measure_mode
+  #
+  # Returns what ruby-prof is measuring.  Valid values include:
+  #
+  # *RubyProf::PROCESS_TIME - Measure process time.  This is default.  It is implemented using the clock functions in the C Runtime library.
+  # *RubyProf::WALL_TIME - Measure wall time using gettimeofday on Linx and GetLocalTime on Windows
+  # *RubyProf::CPU_TIME - Measure time using the CPU clock counter.  This mode is only supported on Pentium or PowerPC platforms.
+  # *RubyProf::ALLOCATIONS - Measure object allocations.  This requires a patched Ruby interpreter.
+  # *RubyProf::MEMORY - Measure memory size.  This requires a patched Ruby interpreter.
+  # *RubyProf::GC_RUNS - Measure number of garbage collections.  This requires a patched Ruby interpreter.
+  # *RubyProf::GC_TIME - Measure time spent doing garbage collection.  This requires a patched Ruby interpreter.*/
+
+  def self.measure_mode
+    @measure_mode ||= RubyProf::WALL_TIME
+  end
+
+  # call-seq:
+  # measure_mode=value -> void
+  #
+  # Specifies what ruby-prof should measure.  Valid values include:
+  #
+  # *RubyProf::PROCESS_TIME - Measure process time.  This is default.  It is implemented using the clock functions in the C Runtime library.
+  # *RubyProf::WALL_TIME - Measure wall time using gettimeofday on Linx and GetLocalTime on Windows
+  # *RubyProf::CPU_TIME - Measure time using the CPU clock counter.  This mode is only supported on Pentium or PowerPC platforms.
+  # *RubyProf::ALLOCATIONS - Measure object allocations.  This requires a patched Ruby interpreter.
+  # *RubyProf::MEMORY - Measure memory size.  This requires a patched Ruby interpreter.
+  # *RubyProf::GC_RUNS - Measure number of garbage collections.  This requires a patched Ruby interpreter.
+  # *RubyProf::GC_TIME - Measure time spent doing garbage collection.  This requires a patched Ruby interpreter.*/
+  def self.measure_mode=(value)
+    @measure_mode = value
+  end
+
+  # call-seq:
+  # exclude_threads -> exclude_threads
+  #
+  # Returns threads ruby-prof should exclude from profiling
+
+  def self.exclude_threads
+    @exclude_threads ||= Array.new
+  end
+
+  # call-seq:
+  # exclude_threads= -> void
+  #
+  # Specifies what threads ruby-prof should exclude from profiling
+
+  def self.exclude_threads=(value)
+    @exclude_threads = value
+  end
+
+  # Profiling
+  def self.start_script(script)
+    start
+    load script
+  end
+
+  def self.start
+    ensure_not_running!
+    @profile = Profile.new(self.measure_mode, self.exclude_threads)
+    enable_gc_stats_if_needed
+    @profile.start
+  end
+
+  def self.pause
+    ensure_running!
+    disable_gc_stats_if_needed
+    @profile.pause
+  end
+
+  def self.running?
+    if defined?(@profile) and @profile
+      @profile.running?
+    else
+      false
+    end
+  end
+
+  def self.resume
+    ensure_running!
+    enable_gc_stats_if_needed
+    @profile.resume
+  end
+
+  def self.stop
+    ensure_running!
+    result = @profile.stop
+    disable_gc_stats_if_needed
+    @profile = nil
+    result
+  end
+
+  # Profile a block
+  def self.profile(&block)
+    ensure_not_running!
+    gc_stat_was_enabled = enable_gc_stats_if_needed
+    res = Profile.profile(self.measure_mode, self.exclude_threads, &block)
+    disable_gc_stats_if_needed(gc_stat_was_enabled)
+    res
+  end
+
+
+private
+  def self.ensure_running!
+    raise(RuntimeError, "RubyProf.start was not yet called") unless running?
+  end
+
+  def self.ensure_not_running!
+    raise(RuntimeError, "RubyProf is already running") if running?
+  end
+
+  # for GC.allocated_size to work GC statistics should be enabled
+  def self.enable_gc_stats_if_needed
+    if measure_mode_requires_gc_stats_enabled?
+      @gc_stat_was_enabled = GC.enable_stats
+    end
+  end
+
+  def self.disable_gc_stats_if_needed(was_enabled=nil)
+    was_enabled ||= defined?(@gc_stat_was_enabled) && @gc_stat_was_enabled
+    GC.disable_stats if measure_mode_requires_gc_stats_enabled? && !was_enabled
+  end
+
+  def self.measure_mode_requires_gc_stats_enabled?
+    GC.respond_to?(:enable_stats) &&
+      [RubyProf::MEMORY, RubyProf::GC_TIME, RubyProf::GC_RUNS].include?(measure_mode)
+  end
+end
diff --git a/lib/ruby-prof/flat_printer.rb b/lib/ruby-prof/flat_printer.rb
deleted file mode 100644
index 6c8259d..0000000
--- a/lib/ruby-prof/flat_printer.rb
+++ /dev/null
@@ -1,79 +0,0 @@
-require 'ruby-prof/abstract_printer'
-
-module RubyProf
-  # Generates flat[link:files/examples/flat_txt.html] profile reports as text. 
-  # To use the flat printer:
-  #
-  #   result = RubyProf.profile do
-  #     [code to profile]
-  #   end
-  #
-  #   printer = RubyProf::FlatPrinter.new(result)
-  #   printer.print(STDOUT, 0)
-  #
-  class FlatPrinter < AbstractPrinter
-    # Print a flat profile report to the provided output.
-    # 
-    # output - Any IO oject, including STDOUT or a file. 
-    # The default value is STDOUT.
-    # 
-    # options - Hash of print options.  See #setup_options 
-    #           for more information.
-    #
-    def print(output = STDOUT, options = {})
-      @output = output
-      setup_options(options)
-      print_threads
-    end      
-    
-    private 
-    
-    def print_threads
-      @result.threads.each do |thread_id, methods|
-        print_methods(thread_id, methods)
-        @output << "\n" * 2
-      end
-    end
-    
-    def print_methods(thread_id, methods)
-      # Get total time
-      toplevel = methods.sort.last
-      total_time = toplevel.total_time
-      if total_time == 0
-        total_time = 0.01
-      end
-      
-      # Now sort methods by largest self time,
-      # not total time like in other printouts
-      methods = methods.sort do |m1, m2|
-        m1.self_time <=> m2.self_time
-      end.reverse
-      
-      @output << "Thread ID: %d\n" % thread_id
-      @output << "Total: %0.6f\n" % total_time
-      @output << "\n"
-      @output << " %self     total     self     wait    child    calls  name\n"
-
-      sum = 0    
-      methods.each do |method|
-        self_percent = (method.self_time / total_time) * 100
-        next if self_percent < min_percent
-        
-        sum += method.self_time
-        #self_time_called = method.called > 0 ? method.self_time/method.called : 0
-        #total_time_called = method.called > 0? method.total_time/method.called : 0
-        
-        @output << "%6.2f  %8.2f %8.2f %8.2f %8.2f %8d  %s\n" % [
-                      method.self_time / total_time * 100, # %self
-                      method.total_time,                   # total
-                      method.self_time,                    # self
-                      method.wait_time,                    # wait
-                      method.children_time,                # children
-                      method.called,                       # calls
-                    method_name(method)                  # name
-                  ]
-      end
-    end
-  end
-end 
-
diff --git a/lib/ruby-prof/graph_html_printer.rb b/lib/ruby-prof/graph_html_printer.rb
deleted file mode 100644
index 7b04d4b..0000000
--- a/lib/ruby-prof/graph_html_printer.rb
+++ /dev/null
@@ -1,256 +0,0 @@
-require 'ruby-prof/abstract_printer'
-require 'erb'
-
-module RubyProf
-  # Generates graph[link:files/examples/graph_html.html] profile reports as html. 
-  # To use the grap html printer:
-  #
-  #   result = RubyProf.profile do
-  #     [code to profile]
-  #   end
-  #
-  #   printer = RubyProf::GraphHtmlPrinter.new(result)
-  #   printer.print(STDOUT, :min_percent=>0)
-  #
-  # The constructor takes two arguments.  The first is
-  # a RubyProf::Result object generated from a profiling
-  # run.  The second is the minimum %total (the methods 
-  # total time divided by the overall total time) that
-  # a method must take for it to be printed out in 
-  # the report.  Use this parameter to eliminate methods
-  # that are not important to the overall profiling results.
-  
-  class GraphHtmlPrinter < AbstractPrinter
-    include ERB::Util
-    
-    PERCENTAGE_WIDTH = 8
-    TIME_WIDTH = 10
-    CALL_WIDTH = 20
-  
-    # Create a GraphPrinter.  Result is a RubyProf::Result  
-    # object generated from a profiling run.
-    def initialize(result)
-      super(result)
-      @thread_times = Hash.new
-      calculate_thread_times
-    end
-
-    # Print a graph html report to the provided output.
-    # 
-    # output - Any IO oject, including STDOUT or a file. 
-    # The default value is STDOUT.
-    # 
-    # options - Hash of print options.  See #setup_options 
-    #           for more information.
-    #
-    def print(output = STDOUT, options = {})
-      @output = output
-      setup_options(options)
-      
-      filename = options[:filename]
-      template = filename ? File.read(filename).untaint : (options[:template] || self.template)
-      _erbout = @output
-      erb = ERB.new(template, nil, nil)
-      erb.filename = filename
-      @output << erb.result(binding)
-    end
-
-    # These methods should be private but then ERB doesn't
-    # work.  Turn off RDOC though 
-    #--
-    def calculate_thread_times
-      # Cache thread times since this is an expensive
-      # operation with the required sorting      
-      @result.threads.each do |thread_id, methods|
-        top = methods.sort.last
-        
-        thread_time = 0.01
-        thread_time = top.total_time if top.total_time > 0
-
-        @thread_times[thread_id] = thread_time 
-      end
-    end
-    
-    def thread_time(thread_id)
-      @thread_times[thread_id]
-    end
-   
-    def total_percent(thread_id, method)
-      overall_time = self.thread_time(thread_id)
-      (method.total_time/overall_time) * 100
-    end
-    
-    def self_percent(method)
-      overall_time = self.thread_time(method.thread_id)
-      (method.self_time/overall_time) * 100
-    end
-
-    # Creates a link to a method.  Note that we do not create
-    # links to methods which are under the min_perecent 
-    # specified by the user, since they will not be
-    # printed out.
-    def create_link(thread_id, method)
-      if self.total_percent(thread_id, method) < min_percent
-        # Just return name
-        h method.full_name
-      else
-        href = '#' + method_href(thread_id, method)
-        "<a href=\"#{href}\">#{h method.full_name}</a>" 
-      end
-    end
-    
-    def method_href(thread_id, method)
-      h(method.full_name.gsub(/[><#\.\?=:]/,"_") + "_" + thread_id.to_s)
-    end
-    
-    def template
-'
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-  <style media="all" type="text/css">
-    table {
-      border-collapse: collapse;
-      border: 1px solid #CCC;
-      font-family: Verdana, Arial, Helvetica, sans-serif;
-      font-size: 9pt;
-      line-height: normal;
-      width: 100%;
-    }
-
-    th {
-      text-align: center;
-      border-top: 1px solid #FB7A31;
-      border-bottom: 1px solid #FB7A31;
-      background: #FFC;
-      padding: 0.3em;
-      border-left: 1px solid silver;
-    }
-
-    tr.break td {
-      border: 0;
-      border-top: 1px solid #FB7A31;
-      padding: 0;
-      margin: 0;
-    }
-
-    tr.method td {
-      font-weight: bold;
-    }
-
-    td {
-      padding: 0.3em;
-    }
-
-    td:first-child {
-      width: 190px;
-      }
-
-    td {
-      border-left: 1px solid #CCC;
-      text-align: center;
-    } 
-
-    .method_name {
-      text-align: left;
-    }
-  </style>
-  </head>
-  <body>
-    <h1>Profile Report</h1>
-    <!-- Threads Table -->
-    <table>
-      <tr>
-        <th>Thread ID</th>
-        <th>Total Time</th>
-      </tr>
-      <% for thread_id, methods in @result.threads %>
-      <tr>
-        <td><a href="#<%= thread_id %>"><%= thread_id %></a></td>
-        <td><%= thread_time(thread_id) %></td>
-      </tr>
-      <% end %>
-    </table>
-
-    <!-- Methods Tables -->
-    <% for thread_id, methods in @result.threads
-         total_time = thread_time(thread_id) %>
-      <h2><a name="<%= thread_id %>">Thread <%= thread_id %></a></h2>
-
-      <table>
-        <tr>
-          <th><%= sprintf("%#{PERCENTAGE_WIDTH}s", "%Total") %></th>
-          <th><%= sprintf("%#{PERCENTAGE_WIDTH}s", "%Self") %></th>
-          <th><%= sprintf("%#{TIME_WIDTH}s", "Total") %></th>
-          <th><%= sprintf("%#{TIME_WIDTH}s", "Self") %></th>
-          <th><%= sprintf("%#{TIME_WIDTH}s", "Wait") %></th>
-          <th><%= sprintf("%#{TIME_WIDTH+2}s", "Child") %></th>
-          <th><%= sprintf("%#{CALL_WIDTH}s", "Calls") %></th>
-          <th class="method_name">Name</th>
-          <th>Line</th>
-        </tr>
-
-        <% min_time = @options[:min_time] || (@options[:nonzero] ? 0.005 : nil)
-           methods.sort.reverse_each do |method|
-            total_percentage = (method.total_time/total_time) * 100
-            next if total_percentage < min_percent
-            next if min_time && method.total_time < min_time
-            self_percentage = (method.self_time/total_time) * 100 %>
-          
-            <!-- Parents -->
-            <% for caller in method.aggregate_parents
-                 next unless caller.parent
-                 next if min_time && caller.total_time < min_time  %>
-              <tr>
-                <td> </td>
-                <td> </td>
-                <td><%= sprintf("%#{TIME_WIDTH}.2f", caller.total_time) %></td>
-                <td><%= sprintf("%#{TIME_WIDTH}.2f", caller.self_time) %></td>
-                <td><%= sprintf("%#{TIME_WIDTH}.2f", caller.wait_time) %></td>
-                <td><%= sprintf("%#{TIME_WIDTH}.2f", caller.children_time) %></td>
-                <% called = "#{caller.called}/#{method.called}" %>
-                <td><%= sprintf("%#{CALL_WIDTH}s", called) %></td>
-                <td class="method_name"><%= create_link(thread_id, caller.parent.target) %></td>
-                <td><a href="file://<%=h srcfile=File.expand_path(caller.parent.target.source_file) %>#line=<%= linenum=caller.line %>" title="<%=h srcfile %>:<%= linenum %>"><%= caller.line %></a></td>
-              </tr>
-            <% end %>
-
-            <tr class="method">
-              <td><%= sprintf("%#{PERCENTAGE_WIDTH-1}.2f\%", total_percentage) %></td>
-              <td><%= sprintf("%#{PERCENTAGE_WIDTH-1}.2f\%", self_percentage) %></td>
-              <td><%= sprintf("%#{TIME_WIDTH}.2f", method.total_time) %></td>
-              <td><%= sprintf("%#{TIME_WIDTH}.2f", method.self_time) %></td>
-              <td><%= sprintf("%#{TIME_WIDTH}.2f", method.wait_time) %></td>
-              <td><%= sprintf("%#{TIME_WIDTH}.2f", method.children_time) %></td>
-              <td><%= sprintf("%#{CALL_WIDTH}i", method.called) %></td>
-              <td class="method_name"><a name="<%= method_href(thread_id, method) %>"><%= h method.full_name %></a></td>
-              <td><a href="file://<%=h srcfile=File.expand_path(method.source_file) %>#line=<%= linenum=method.line %>" title="<%=h srcfile %>:<%= linenum %>"><%= method.line %></a></td>
-            </tr>
-
-            <!-- Children -->
-            <% for callee in method.aggregate_children %>
-            <%   next if min_time && callee.total_time < min_time  %>
-              <tr>
-                <td> </td>
-                <td> </td>
-                <td><%= sprintf("%#{TIME_WIDTH}.2f", callee.total_time) %></td>
-                <td><%= sprintf("%#{TIME_WIDTH}.2f", callee.self_time) %></td>
-                <td><%= sprintf("%#{TIME_WIDTH}.2f", callee.wait_time) %></td>
-                <td><%= sprintf("%#{TIME_WIDTH}.2f", callee.children_time) %></td>
-                <% called = "#{callee.called}/#{callee.target.called}" %>
-                <td><%= sprintf("%#{CALL_WIDTH}s", called) %></td>
-                <td class="method_name"><%= create_link(thread_id, callee.target) %></td>
-                <td><a href="file://<%=h srcfile=File.expand_path(method.source_file) %>#line=<%= linenum=callee.line %>" title="<%=h srcfile %>:<%= linenum %>"><%= callee.line %></a></td>
-              </tr>
-            <% end %>
-            <!-- Create divider row -->
-            <tr class="break"><td colspan="9"></td></tr>
-        <% end %>
-      </table>
-    <% end %>
-  </body>
-</html>'
-    end
-  end
-end 
-
diff --git a/lib/ruby-prof/graph_printer.rb b/lib/ruby-prof/graph_printer.rb
deleted file mode 100644
index a03eebc..0000000
--- a/lib/ruby-prof/graph_printer.rb
+++ /dev/null
@@ -1,164 +0,0 @@
-require 'ruby-prof/abstract_printer'
-
-module RubyProf
-  # Generates graph[link:files/examples/graph_txt.html] profile reports as text. 
-  # To use the graph printer:
-  #
-  #   result = RubyProf.profile do
-  #     [code to profile]
-  #   end
-  #
-  #   printer = RubyProf::GraphPrinter.new(result, 5)
-  #   printer.print(STDOUT, 0)
-  #
-  # The constructor takes two arguments.  The first is
-  # a RubyProf::Result object generated from a profiling
-  # run.  The second is the minimum %total (the methods 
-  # total time divided by the overall total time) that
-  # a method must take for it to be printed out in 
-  # the report.  Use this parameter to eliminate methods
-  # that are not important to the overall profiling results.
-
-  class GraphPrinter < AbstractPrinter
-    PERCENTAGE_WIDTH = 8
-    TIME_WIDTH = 10
-    CALL_WIDTH = 17
-  
-    # Create a GraphPrinter.  Result is a RubyProf::Result  
-    # object generated from a profiling run.
-    def initialize(result)
-      super(result)
-      @thread_times = Hash.new
-      calculate_thread_times
-    end
-
-    def calculate_thread_times
-      # Cache thread times since this is an expensive
-      # operation with the required sorting      
-      @result.threads.each do |thread_id, methods|
-        top = methods.sort.last
-        
-        thread_time = 0.01
-        thread_time = top.total_time if top.total_time > 0
-
-        @thread_times[thread_id] = thread_time 
-      end
-    end
-    
-    # Print a graph report to the provided output.
-    # 
-    # output - Any IO oject, including STDOUT or a file. 
-    # The default value is STDOUT.
-    # 
-    # options - Hash of print options.  See #setup_options 
-    #           for more information.
-    #
-    def print(output = STDOUT, options = {})
-      @output = output
-      setup_options(options)
-      print_threads
-    end
-
-    private 
-    def print_threads
-      # sort assumes that spawned threads have higher object_ids
-      @result.threads.sort.each do |thread_id, methods|
-        print_methods(thread_id, methods)
-        @output << "\n" * 2
-      end
-    end
-    
-    def print_methods(thread_id, methods)
-      # Sort methods from longest to shortest total time
-      methods = methods.sort
-      
-      toplevel = methods.last
-      total_time = toplevel.total_time
-      if total_time == 0
-        total_time = 0.01
-      end
-      
-      print_heading(thread_id)
-    
-      # Print each method in total time order
-      methods.reverse_each do |method|
-        total_percentage = (method.total_time/total_time) * 100
-        self_percentage = (method.self_time/total_time) * 100
-        
-        next if total_percentage < min_percent
-        
-        @output << "-" * 80 << "\n"
-
-        print_parents(thread_id, method)
-    
-        # 1 is for % sign
-        @output << sprintf("%#{PERCENTAGE_WIDTH-1}.2f\%", total_percentage)
-        @output << sprintf("%#{PERCENTAGE_WIDTH-1}.2f\%", self_percentage)
-        @output << sprintf("%#{TIME_WIDTH}.2f", method.total_time)
-        @output << sprintf("%#{TIME_WIDTH}.2f", method.self_time)
-        @output << sprintf("%#{TIME_WIDTH}.2f", method.wait_time)
-        @output << sprintf("%#{TIME_WIDTH}.2f", method.children_time)
-        @output << sprintf("%#{CALL_WIDTH}i", method.called)
-        @output << sprintf("     %s", method_name(method))
-        if print_file
-          @output << sprintf("  %s:%s", method.source_file, method.line)
-        end          
-        @output << "\n"
-    
-        print_children(method)
-      end
-    end
-  
-    def print_heading(thread_id)
-      @output << "Thread ID: #{thread_id}\n"
-      @output << "Total Time: #{@thread_times[thread_id]}\n"
-      @output << "\n"
-      
-      # 1 is for % sign
-      @output << sprintf("%#{PERCENTAGE_WIDTH}s", "%total")
-      @output << sprintf("%#{PERCENTAGE_WIDTH}s", "%self")
-      @output << sprintf("%#{TIME_WIDTH}s", "total")
-      @output << sprintf("%#{TIME_WIDTH}s", "self")
-      @output << sprintf("%#{TIME_WIDTH}s", "wait")
-      @output << sprintf("%#{TIME_WIDTH}s", "child")
-      @output << sprintf("%#{CALL_WIDTH}s", "calls")
-      @output << "   Name"
-      @output << "\n"
-    end
-    
-    def print_parents(thread_id, method)
-      method.aggregate_parents.each do |caller|
-        next unless caller.parent
-        @output << " " * 2 * PERCENTAGE_WIDTH
-        @output << sprintf("%#{TIME_WIDTH}.2f", caller.total_time)
-        @output << sprintf("%#{TIME_WIDTH}.2f", caller.self_time)
-        @output << sprintf("%#{TIME_WIDTH}.2f", caller.wait_time)
-        @output << sprintf("%#{TIME_WIDTH}.2f", caller.children_time)
-    
-        call_called = "#{caller.called}/#{method.called}"
-        @output << sprintf("%#{CALL_WIDTH}s", call_called)
-        @output << sprintf("     %s", caller.parent.target.full_name)
-        @output << "\n"
-      end
-    end
-  
-    def print_children(method)
-      method.aggregate_children.each do |child|
-        # Get children method
-        
-        @output << " " * 2 * PERCENTAGE_WIDTH
-        
-        @output << sprintf("%#{TIME_WIDTH}.2f", child.total_time)
-        @output << sprintf("%#{TIME_WIDTH}.2f", child.self_time)
-        @output << sprintf("%#{TIME_WIDTH}.2f", child.wait_time)
-        @output << sprintf("%#{TIME_WIDTH}.2f", child.children_time)
-
-        call_called = "#{child.called}/#{child.target.called}"
-        @output << sprintf("%#{CALL_WIDTH}s", call_called)
-        @output << sprintf("     %s", child.target.full_name)
-        @output << "\n"
-      end
-    end
-  end
-end 
-
diff --git a/lib/ruby-prof/images/empty.png b/lib/ruby-prof/images/empty.png
new file mode 100755
index 0000000..5ac4d09
Binary files /dev/null and b/lib/ruby-prof/images/empty.png differ
diff --git a/lib/ruby-prof/images/minus.png b/lib/ruby-prof/images/minus.png
new file mode 100755
index 0000000..7075f1c
Binary files /dev/null and b/lib/ruby-prof/images/minus.png differ
diff --git a/lib/ruby-prof/images/plus.png b/lib/ruby-prof/images/plus.png
new file mode 100755
index 0000000..2f0bbe0
Binary files /dev/null and b/lib/ruby-prof/images/plus.png differ
diff --git a/lib/ruby-prof/method_info.rb b/lib/ruby-prof/method_info.rb
index 9f5ec2e..2f1c6e4 100644
--- a/lib/ruby-prof/method_info.rb
+++ b/lib/ruby-prof/method_info.rb
@@ -1,3 +1,5 @@
+# encoding: utf-8
+
 module RubyProf
   class MethodInfo
     include Comparable
@@ -12,7 +14,7 @@ module RubyProf
       elsif self.min_depth > other.min_depth
         -1
       else
-        -1 * (self.full_name <=> other.full_name)
+        self.full_name <=> other.full_name
       end
     end
 
@@ -27,15 +29,17 @@ module RubyProf
     def total_time
       @total_time ||= begin
         call_infos.inject(0) do |sum, call_info|
-          sum += call_info.total_time
+          sum += call_info.total_time unless call_info.recursive
+          sum
         end
       end
     end
-    
+
     def self_time
       @self_time ||= begin
         call_infos.inject(0) do |sum, call_info|
-          sum += call_info.self_time
+          sum += call_info.self_time  unless call_info.recursive
+          sum
         end
       end
     end
@@ -43,7 +47,8 @@ module RubyProf
     def wait_time
       @wait_time ||= begin
         call_infos.inject(0) do |sum, call_info|
-          sum += call_info.wait_time
+          sum += call_info.wait_time unless call_info.recursive
+          sum
         end
       end
     end
@@ -51,13 +56,14 @@ module RubyProf
     def children_time
       @children_time ||= begin
         call_infos.inject(0) do |sum, call_info|
-          sum += call_info.children_time
+          sum += call_info.children_time  unless call_info.recursive
+          sum
         end
       end
     end
 
     def min_depth
-      call_infos.map do |call_info|
+      @min_depth ||= call_infos.map do |call_info|
         call_info.depth
       end.min
     end
@@ -70,6 +76,12 @@ module RubyProf
       end
     end
 
+    def recursive?
+      call_infos.detect do |call_info|
+        call_info.recursive
+      end
+    end
+
     def children
       @children ||= begin
         call_infos.map do |call_info|
@@ -105,7 +117,15 @@ module RubyProf
     end
 
     def to_s
-      full_name
+      "#{self.full_name} (c: #{self.called}, tt: #{self.total_time}, st: #{self.self_time}, ct: #{self.children_time})"
+    end
+
+    # remove method from the call graph. should not be called directly.
+    def eliminate!
+      # $stderr.puts "eliminating #{self}"
+      call_infos.each{ |call_info| call_info.eliminate! }
+      call_infos.clear
     end
+
   end
-end
\ No newline at end of file
+end
diff --git a/lib/ruby-prof/printers/abstract_printer.rb b/lib/ruby-prof/printers/abstract_printer.rb
new file mode 100644
index 0000000..d56e18a
--- /dev/null
+++ b/lib/ruby-prof/printers/abstract_printer.rb
@@ -0,0 +1,85 @@
+# encoding: utf-8
+
+module RubyProf
+  class AbstractPrinter
+    # Create a new printer.
+    #
+    # result should be the output generated from a profiling run
+    def initialize(result)
+      @result = result
+      @output = nil
+    end
+
+    # Specify print options.
+    #
+    # options - Hash table
+    #   :min_percent - Number 0 to 100 that specifes the minimum
+    #                  %self (the methods self time divided by the
+    #                  overall total time) that a method must take
+    #                  for it to be printed out in the report.
+    #                  Default value is 0.
+    #
+    #   :print_file  - True or false. Specifies if a method's source
+    #                  file should be printed.  Default value if false.
+    #
+    #   :sort_method - Specifies method used for sorting method infos.
+    #                  Available values are :total_time, :self_time,
+    #                  :wait_time, :children_time
+    #                  Default value is :total_time
+    def setup_options(options = {})
+      @options = options
+    end
+
+    def min_percent
+      @options[:min_percent] || 0
+    end
+
+    def print_file
+      @options[:print_file] || false
+    end
+
+    def sort_method
+      @options[:sort_method] || :total_time
+    end
+
+    def method_name(method)
+      name = method.full_name
+      if print_file
+        name += " (#{method.source_file}:#{method.line}}"
+      end
+      name
+    end
+
+    # Print a profiling report to the provided output.
+    #
+    # output - Any IO object, including STDOUT or a file.
+    # The default value is STDOUT.
+    #
+    # options - Hash of print options.  See #setup_options
+    # for more information.  Note that each printer can
+    # define its own set of options.
+    def print(output = STDOUT, options = {})
+      @output = output
+      setup_options(options)
+      print_threads
+    end
+
+    def print_threads
+      @result.threads.each do |thread|
+        print_thread(thread)
+      end
+    end
+
+    def print_thread(thread)
+      print_header(thread)
+      print_methods(thread)
+      print_footer(thread)
+    end
+
+    def print_header(thread)
+    end
+
+    def print_footer(thread)
+    end
+  end
+end
\ No newline at end of file
diff --git a/lib/ruby-prof/printers/call_info_printer.rb b/lib/ruby-prof/printers/call_info_printer.rb
new file mode 100644
index 0000000..079c33f
--- /dev/null
+++ b/lib/ruby-prof/printers/call_info_printer.rb
@@ -0,0 +1,41 @@
+# encoding: utf-8
+
+module RubyProf
+  # Prints out the call graph based on CallInfo instances.  This
+  # is mainly for debugging purposes as it provides access into
+  # into RubyProf's internals.
+
+  class CallInfoPrinter < AbstractPrinter
+    TIME_WIDTH = 0
+
+    private
+
+    def print_header(thread)
+      @output << "Thread ID: #{thread.id}\n"
+      @output << "Fiber ID: #{thread.fiber_id}\n"
+      @output << "Total Time: #{thread.total_time}\n"
+      @output << "Sort by: #{sort_method}\n"
+      @output << "\n"
+    end
+
+    def print_methods(thread)
+      visitor = CallInfoVisitor.new(thread)
+
+      visitor.visit do |call_info, event|
+        if event == :enter
+          @output << "  " * call_info.depth
+          @output << call_info.target.full_name
+          @output << " ("
+          @output << "tt:#{sprintf("%#{TIME_WIDTH}.2f", call_info.total_time)}, "
+          @output << "st:#{sprintf("%#{TIME_WIDTH}.2f", call_info.self_time)}, "
+          @output << "wt:#{sprintf("%#{TIME_WIDTH}.2f", call_info.wait_time)}, "
+          @output << "ct:#{sprintf("%#{TIME_WIDTH}.2f", call_info.children_time)}, "
+          @output << "call:#{call_info.called}, "
+          @output << "rec:#{call_info.recursive}"
+          @output << ")"
+          @output << "\n"
+        end
+      end
+    end
+  end
+end
diff --git a/lib/ruby-prof/printers/call_stack_printer.rb b/lib/ruby-prof/printers/call_stack_printer.rb
new file mode 100644
index 0000000..ca635eb
--- /dev/null
+++ b/lib/ruby-prof/printers/call_stack_printer.rb
@@ -0,0 +1,773 @@
+# encoding: utf-8
+
+require 'erb'
+require 'fileutils'
+
+module RubyProf
+  # prints a HTML visualization of the call tree
+  class CallStackPrinter < AbstractPrinter
+    include ERB::Util
+
+    # Specify print options.
+    #
+    # options - Hash table
+    #   :min_percent - Number 0 to 100 that specifes the minimum
+    #                  %self (the methods self time divided by the
+    #                  overall total time) that a method must take
+    #                  for it to be printed out in the report.
+    #                  Default value is 0.
+    #
+    #   :print_file  - True or false. Specifies if a method's source
+    #                  file should be printed.  Default value if false.
+    #
+    #   :threshold   - a float from 0 to 100 that sets the threshold of
+    #                  results displayed.
+    #                  Default value is 1.0
+    #
+    #   :title       - a String to overide the default "ruby-prof call tree"
+    #                  title of the report.
+    #
+    #   :expansion   - a float from 0 to 100 that sets the threshold of
+    #                  results that are expanded, if the percent_total
+    #                  exceeds it.
+    #                  Default value is 10.0
+    #
+    #   :application - a String to overide the name of the application,
+    #                  as it appears on the report.
+    #
+    def print(output = STDOUT, options = {})
+      @output = output
+      setup_options(options)
+      if @graph_html = options.delete(:graph)
+        @graph_html = "file://" + @graph_html if @graph_html[0]=="/"
+      end
+
+      print_header
+
+      @overall_threads_time = @result.threads.inject(0) do |val, thread|
+        val += thread.total_time
+      end
+
+      @result.threads.each do |thread|
+        @current_thread_id = thread.fiber_id
+        @overall_time = thread.total_time
+        thread_info = "Thread: #{thread.id}"
+        thread_info << ", Fiber: #{thread.fiber_id}" unless thread.id == thread.fiber_id
+        thread_info << " (#{"%4.2f%%" % ((@overall_time/@overall_threads_time)*100)} ~ #{@overall_time})"
+        @output.print "<div class=\"thread\">#{thread_info}</div>"
+        @output.print "<ul name=\"thread\">"
+        thread.methods.each do |m|
+          # $stderr.print m.dump
+          next unless m.root?
+          m.call_infos.each do |ci|
+            next unless ci.root?
+            print_stack ci, thread.total_time
+          end
+        end
+        @output.print "</ul>"
+      end
+
+      print_footer
+
+      copy_image_files
+    end
+
+    def print_stack(call_info, parent_time)
+      total_time = call_info.total_time
+      percent_parent = (total_time/parent_time)*100
+      percent_total = (total_time/@overall_time)*100
+      return unless percent_total > min_percent
+      color = self.color(percent_total)
+      kids = call_info.children
+      visible = percent_total >= threshold
+      expanded = percent_total >= expansion
+      display = visible ? "block" : "none"
+      @output.print "<li class=\"color#{color}\" style=\"display:#{display}\">"
+      if kids.empty?
+        @output.print "<img src=\"empty.png\">"
+      else
+        visible_children = kids.any?{|ci| (ci.total_time/@overall_time)*100 >= threshold}
+        image = visible_children ? (expanded ? "minus" : "plus") : "empty"
+        @output.print "<img class=\"toggle\" src=\"#{image}.png\">"
+      end
+      @output.printf " %4.2f%% (%4.2f%%) %s %s\n", percent_total, percent_parent, link(call_info), graph_link(call_info)
+      unless kids.empty?
+        if expanded
+          @output.print "<ul>"
+        else
+          @output.print '<ul style="display:none">'
+        end
+        kids.sort_by{|c| -c.total_time}.each do |callinfo|
+          print_stack callinfo, total_time
+        end
+        @output.print "</ul>"
+      end
+      @output.print "</li>"
+    end
+
+    def name(call_info)
+      method = call_info.target
+      method.full_name
+    end
+
+    def link(call_info)
+      method = call_info.target
+      file = File.expand_path(method.source_file)
+      if file =~ /\/ruby_runtime$/
+        h(name(call_info))
+      else
+        if RUBY_PLATFORM =~ /darwin/
+          "<a href=\"txmt://open?url=file://#{file}&line=#{method.line}\">#{h(name(call_info))}</a>"
+        else
+          "<a href=\"file://#{file}##{method.line}\">#{h(name(call_info))}</a>"
+        end
+      end
+    end
+
+    def graph_link(call_info)
+      total_calls = call_info.target.call_infos.inject(0){|t, ci| t += ci.called}
+      href = "#{@graph_html}##{method_href(call_info.target)}"
+      totals = @graph_html ? "<a href='#{href}'>#{total_calls}</a>" : total_calls.to_s
+      "[#{call_info.called} calls, #{totals} total]"
+    end
+
+    def method_href(method)
+      h(method.full_name.gsub(/[><#\.\?=:]/,"_") + "_" + @current_thread_id.to_s)
+    end
+
+    def total_time(call_infos)
+      sum(call_infos.map{|ci| ci.total_time})
+    end
+
+    def sum(a)
+      a.inject(0.0){|s,t| s+=t}
+    end
+
+    def dump(ci)
+      $stderr.printf "%s/%d t:%f s:%f w:%f  \n", ci, ci.object_id, ci.total_time, ci.self_time, ci.wait_time
+    end
+
+    def color(p)
+      case i = p.to_i
+      when 0..5
+        "01"
+      when 5..10
+        "05"
+      when 100
+        "9"
+      else
+        "#{i/10}"
+      end
+    end
+
+    def application
+      @options[:application] || $PROGRAM_NAME
+    end
+
+    def arguments
+      ARGV.join(' ')
+    end
+
+    def title
+      @title ||= @options.delete(:title) || "ruby-prof call tree"
+    end
+
+    def threshold
+      @options[:threshold] || 1.0
+    end
+
+    def expansion
+      @options[:expansion] || 10.0
+    end
+
+    def copy_image_files
+      if @output.is_a?(File)
+        target_dir = File.dirname(@output.path)
+        image_dir = File.join(File.dirname(__FILE__), '..', 'images')
+        %w(empty plus minus).each do |img|
+          source_file = "#{image_dir}/#{img}.png"
+          target_file = "#{target_dir}/#{img}.png"
+          FileUtils.cp(source_file, target_file) unless File.exist?(target_file)
+        end
+      end
+    end
+
+    def print_header
+      @output.puts "<html><head>"
+      @output.puts '<meta http-equiv="content-type" content="text/html; charset=utf-8">'
+      @output.puts "<title>#{h title}</title>"
+      print_css
+      print_java_script
+      @output.puts '</head><body><div style="display: inline-block;">'
+      print_title_bar
+      print_commands
+      print_help
+    end
+
+    def print_footer
+      @output.puts '<div id="sentinel"></div></div></body></html>'
+    end
+
+    def print_css
+      @output.puts <<-'end_css'
+<style type="text/css">
+<!--
+body {
+    font-size:70%;
+    padding:0px;
+    margin:5px;
+    margin-right:0px;
+    margin-left:0px;
+    background: #ffffff;
+}
+ul {
+    margin-left:0px;
+    margin-top:0px;
+    margin-bottom:0px;
+    padding-left:0px;
+    list-style-type:none;
+}
+li {
+    margin-left:11px;
+    padding:0px;
+    white-space:nowrap;
+    border-top:1px solid #cccccc;
+    border-left:1px solid #cccccc;
+    border-bottom:none;
+}
+.thread {
+    margin-left:11px;
+    background:#708090;
+    padding-top:3px;
+    padding-left:12px;
+    padding-bottom:2px;
+    border-left:1px solid #CCCCCC;
+    border-top:1px solid #CCCCCC;
+    font-weight:bold;
+}
+.hidden {
+    display:none;
+    width:0px;
+    height:0px;
+    margin:0px;
+    padding:0px;
+    border-style:none;
+}
+.color01 { background:#adbdeb }
+.color05 { background:#9daddb }
+.color0 { background:#8d9dcb }
+.color1 { background:#89bccb }
+.color2 { background:#56e3e7 }
+.color3 { background:#32cd70 }
+.color4 { background:#a3d53c }
+.color5 { background:#c4cb34 }
+.color6 { background:#dcb66d }
+.color7 { background:#cda59e }
+.color8 { background:#be9d9c }
+.color9 { background:#cf947a }
+#commands {
+    font-size:10pt;
+    padding:10px;
+    margin-left:11px;
+    margin-bottom:0px;
+    margin-top:0px;
+    background:#708090;
+    border-top:1px solid #cccccc;
+    border-left:1px solid #cccccc;
+    border-bottom:none;
+}
+#titlebar {
+    font-size:10pt;
+    padding:10px;
+    margin-left:11px;
+    margin-bottom:0px;
+    margin-top:10px;
+    background:#8090a0;
+    border-top:1px solid #cccccc;
+    border-left:1px solid #cccccc;
+    border-bottom:none;
+}
+#help {
+    font-size:10pt;
+    padding:10px;
+    margin-left:11px;
+    margin-bottom:0px;
+    margin-top:0px;
+    background:#8090a0;
+    display:none;
+    border-top:1px solid #cccccc;
+    border-left:1px solid #cccccc;
+    border-bottom:none;
+}
+#sentinel {
+    height: 400px;
+    margin-left:11px;
+    background:#8090a0;
+    border-top:1px solid #cccccc;
+    border-left:1px solid #cccccc;
+    border-bottom:none;
+ }
+input { margin-left:10px; }
+-->
+</style>
+end_css
+    end
+
+    def print_java_script
+      @output.puts <<-'end_java_script'
+<script type="text/javascript">
+/*
+   Copyright (C) 2005,2009  Stefan Kaes
+   skaes at railsexpress.de
+*/
+
+function rootNode() {
+  return currentThread;
+}
+
+function hideUL(node) {
+  var lis = node.childNodes
+  var l = lis.length;
+  for (var i=0; i < l ; i++ ) {
+    hideLI(lis[i]);
+  }
+}
+
+function showUL(node) {
+  var lis = node.childNodes;
+  var l = lis.length;
+  for (var i=0; i < l ; i++ ) {
+    showLI(lis[i]);
+  }
+}
+
+function findUlChild(li){
+  var ul = li.childNodes[2];
+  while (ul && ul.nodeName != "UL") {
+    ul = ul.nextSibling;
+  }
+  return ul;
+}
+
+function isLeafNode(li) {
+  var img = li.firstChild;
+  return (img.src.indexOf('empty.png') > -1);
+}
+
+function hideLI(li) {
+  if (isLeafNode(li))
+    return;
+
+  var img = li.firstChild;
+  img.src = 'plus.png';
+
+  var ul = findUlChild(li);
+  if (ul) {
+    ul.style.display = 'none';
+    hideUL(ul);
+  }
+}
+
+function showLI(li) {
+  if (isLeafNode(li))
+    return;
+
+  var img = li.firstChild;
+  img.src = 'minus.png';
+
+  var ul = findUlChild(li);
+  if (ul) {
+    ul.style.display = 'block';
+    showUL(ul);
+  }
+}
+
+function toggleLI(li) {
+  var img = li.firstChild;
+  if (img.src.indexOf("minus.png")>-1)
+    hideLI(li);
+  else {
+    if (img.src.indexOf("plus.png")>-1)
+      showLI(li);
+  }
+}
+
+function aboveThreshold(text, threshold) {
+  var match = text.match(/\d+[.,]\d+/);
+  return (match && parseFloat(match[0].replace(/,/, '.'))>=threshold);
+}
+
+function setThresholdLI(li, threshold) {
+  var img = li.firstChild;
+  var text = img.nextSibling;
+  var ul = findUlChild(li);
+
+  var visible = aboveThreshold(text.nodeValue, threshold) ? 1 : 0;
+
+  var count = 0;
+  if (ul) {
+    count = setThresholdUL(ul, threshold);
+  }
+  if (count>0) {
+    img.src = 'minus.png';
+  }
+  else {
+    img.src = 'empty.png';
+  }
+  if (visible) {
+    li.style.display = 'block'
+  }
+  else {
+    li.style.display = 'none'
+  }
+  return visible;
+}
+
+function setThresholdUL(node, threshold) {
+  var lis = node.childNodes;
+  var l = lis.length;
+
+  var count = 0;
+  for ( var i = 0; i < l ; i++ ) {
+    count = count + setThresholdLI(lis[i], threshold);
+  }
+
+  var visible = (count > 0) ? 1 : 0;
+  if (visible) {
+    node.style.display = 'block';
+  }
+  else {
+    node.style.display = 'none';
+  }
+  return visible;
+}
+
+function toggleChildren(img, event) {
+  event.cancelBubble=true;
+
+  if (img.src.indexOf('empty.png') > -1)
+    return;
+
+  var minus = (img.src.indexOf('minus.png') > -1);
+
+  if (minus) {
+    img.src = 'plus.png';
+  }
+  else
+    img.src = 'minus.png';
+
+  var li = img.parentNode;
+  var ul = findUlChild(li);
+  if (ul) {
+    if (minus)
+      ul.style.display = 'none';
+    else
+      ul.style.display = 'block';
+  }
+  if (minus)
+    moveSelectionIfNecessary(li);
+}
+
+function showChildren(li) {
+  var img = li.firstChild;
+  if (img.src.indexOf('empty.png') > -1)
+    return;
+  img.src = 'minus.png';
+
+  var ul = findUlChild(li);
+  if (ul) {
+    ul.style.display = 'block';
+  }
+}
+
+function setThreshold() {
+ var tv = document.getElementById("threshold").value;
+ if (tv.match(/[0-9]+([.,][0-9]+)?/)) {
+   var f = parseFloat(tv.replace(/,/, '.'));
+   var threads = document.getElementsByName("thread");
+   var l = threads.length;
+   for ( var i = 0; i < l ; i++ ) {
+     setThresholdUL(threads[i], f);
+   }
+   var p = selectedNode;
+   while (p && p.style.display=='none')
+     p=p.parentNode.parentNode;
+   if (p && p.nodeName=="LI")
+    selectNode(p);
+ }
+ else {
+   alert("Please specify a decimal number as threshold value!");
+ }
+}
+
+function collapseAll(event) {
+  event.cancelBubble=true;
+  var threads = document.getElementsByName("thread");
+  var l = threads.length;
+  for ( var i = 0; i < l ; i++ ) {
+    hideUL(threads[i]);
+  }
+  selectNode(rootNode(), null);
+}
+
+function expandAll(event) {
+  event.cancelBubble=true;
+  var threads = document.getElementsByName("thread");
+  var l = threads.length;
+  for ( var i = 0; i < l ; i++ ) {
+    showUL(threads[i]);
+  }
+}
+
+function toggleHelp(node) {
+  var help = document.getElementById("help");
+  if (node.value == "Show Help") {
+    node.value = "Hide Help";
+    help.style.display = 'block';
+  }
+  else {
+    node.value = "Show Help";
+    help.style.display = 'none';
+  }
+}
+
+var selectedNode = null;
+var selectedColor = null;
+var selectedThread = null;
+
+function descendentOf(a,b){
+  while (a!=b && b!=null)
+    b=b.parentNode;
+  return (a==b);
+}
+
+function moveSelectionIfNecessary(node){
+  if (descendentOf(node, selectedNode))
+    selectNode(node, null);
+}
+
+function selectNode(node, event) {
+  if (event) {
+    event.cancelBubble = true;
+    thread = findThread(node);
+    selectThread(thread);
+  }
+  if (selectedNode) {
+    selectedNode.style.background = selectedColor;
+  }
+  selectedNode = node;
+  selectedColor = node.style.background;
+  selectedNode.style.background = "red";
+  selectedNode.scrollIntoView();
+  window.scrollBy(0,-400);
+}
+
+function moveUp(){
+  var p = selectedNode.previousSibling;
+  while (p && p.style.display == 'none')
+    p = p.previousSibling;
+  if (p && p.nodeName == "LI") {
+    selectNode(p, null);
+  }
+}
+
+function moveDown(){
+  var p = selectedNode.nextSibling;
+  while (p && p.style.display == 'none')
+    p = p.nextSibling;
+  if (p && p.nodeName == "LI") {
+    selectNode(p, null);
+  }
+}
+
+function moveLeft(){
+  var p = selectedNode.parentNode.parentNode;
+  if (p && p.nodeName=="LI") {
+    selectNode(p, null);
+  }
+}
+
+function moveRight(){
+  if (!isLeafNode(selectedNode)) {
+    showChildren(selectedNode);
+    var ul = findUlChild(selectedNode);
+    if (ul) {
+      selectNode(ul.firstChild, null);
+    }
+  }
+}
+
+function moveForward(){
+  if (isLeafNode(selectedNode)) {
+    var p = selectedNode;
+    while ((p.nextSibling == null || p.nextSibling.style.display=='none') && p.nodeName=="LI") {
+      p = p.parentNode.parentNode;
+    }
+    if (p.nodeName=="LI")
+      selectNode(p.nextSibling, null);
+  }
+  else {
+    moveRight();
+  }
+}
+
+function isExpandedNode(li){
+  var img = li.firstChild;
+  return(img.src.indexOf('minus.png')>-1);
+}
+
+function moveBackward(){
+  var p = selectedNode;
+  var q = p.previousSibling;
+  while (q != null && q.style.display=='none')
+    q = q.previousSibling;
+  if (q == null) {
+    p = p.parentNode.parentNode;
+  } else {
+    while (!isLeafNode(q) && isExpandedNode(q)) {
+      q = findUlChild(q).lastChild;
+      while (q.style.display=='none')
+        q = q.previousSibling;
+    }
+    p = q;
+  }
+  if (p.nodeName=="LI")
+    selectNode(p, null);
+}
+
+function moveHome() {
+  selectNode(currentThread);
+}
+
+var currentThreadIndex = null;
+
+function findThread(node){
+  while (node && node.parentNode.nodeName!="BODY") {
+    node = node.parentNode;
+  }
+  return node.firstChild;
+}
+
+function selectThread(node){
+  var threads = document.getElementsByName("thread");
+  currentThread = node;
+  for (var i=0; i<threads.length; i++) {
+    if (threads[i]==currentThread.parentNode)
+      currentThreadIndex = i;
+  }
+}
+
+function nextThread(){
+  var threads = document.getElementsByName("thread");
+  if (currentThreadIndex==threads.length-1)
+    currentThreadIndex = 0;
+  else
+    currentThreadIndex += 1
+  currentThread = threads[currentThreadIndex].firstChild;
+  selectNode(currentThread, null);
+}
+
+function previousThread(){
+  var threads = document.getElementsByName("thread");
+  if (currentThreadIndex==0)
+    currentThreadIndex = threads.length-1;
+  else
+    currentThreadIndex -= 1
+  currentThread = threads[currentThreadIndex].firstChild;
+  selectNode(currentThread, null);
+}
+
+function switchThread(node, event){
+  event.cancelBubble = true;
+  selectThread(node.nextSibling.firstChild);
+  selectNode(currentThread, null);
+}
+
+function handleKeyEvent(event){
+  var code = event.charCode ? event.charCode : event.keyCode;
+  var str = String.fromCharCode(code);
+  switch (str) {
+    case "a": moveLeft();  break;
+    case "s": moveDown();  break;
+    case "d": moveRight(); break;
+    case "w": moveUp();    break;
+    case "f": moveForward(); break;
+    case "b": moveBackward(); break;
+    case "x": toggleChildren(selectedNode.firstChild, event); break;
+    case "*": toggleLI(selectedNode); break;
+    case "n": nextThread(); break;
+    case "h": moveHome(); break;
+    case "p": previousThread(); break;
+  }
+}
+document.onkeypress=function(event){ handleKeyEvent(event) };
+
+window.onload=function(){
+  var images = document.getElementsByTagName("img");
+  for (var i=0; i<images.length; i++) {
+    var img = images[i];
+    if (img.className == "toggle") {
+      img.onclick = function(event){ toggleChildren(this, event); };
+    }
+  }
+  var divs = document.getElementsByTagName("div");
+  for (i=0; i<divs.length; i++) {
+    var div = divs[i];
+    if (div.className == "thread")
+      div.onclick = function(event){ switchThread(this, event) };
+  }
+  var lis = document.getElementsByTagName("li");
+  for (var i=0; i<lis.length; i++) {
+    lis[i].onclick = function(event){ selectNode(this, event); };
+  }
+  var threads = document.getElementsByName("thread");
+  currentThreadIndex = 0;
+  currentThread = threads[0].firstChild;
+  selectNode(currentThread, null);
+}
+</script>
+end_java_script
+    end
+
+    def print_title_bar
+      @output.puts <<-"end_title_bar"
+<div id="titlebar">
+Call tree for application <b>#{h application} #{h arguments}</b><br/>
+Generated on #{Time.now} with options #{h @options.inspect}<br/>
+</div>
+end_title_bar
+    end
+
+    def print_commands
+      @output.puts <<-"end_commands"
+<div id=\"commands\">
+<span style=\"font-size: 11pt; font-weight: bold;\">Threshold:</span>
+<input value=\"#{h threshold}\" size=\"3\" id=\"threshold\" type=\"text\">
+<input value=\"Apply\" onclick=\"setThreshold();\" type=\"submit\">
+<input value=\"Expand All\" onclick=\"expandAll(event);\" type=\"submit\">
+<input value=\"Collapse All\" onclick=\"collapseAll(event);\" type=\"submit\">
+<input value=\"Show Help\" onclick=\"toggleHelp(this);\" type=\"submit\">
+</div>
+end_commands
+    end
+
+    def print_help
+      @output.puts <<-'end_help'
+<div style="display: none;" id="help">
+<img src="empty.png"> Enter a decimal value <i>d</i> into the threshold field and click "Apply"
+to hide all nodes marked with time values lower than <i>d</i>.<br>
+<img src="empty.png"> Click on "Expand All" for full tree expansion.<br>
+<img src="empty.png"> Click on "Collapse All" to show only top level nodes.<br>
+<img src="empty.png"> Use a, s, d, w as in Quake or Urban Terror to navigate the tree.<br>
+<img src="empty.png"> Use f and b to navigate the tree in preorder forward and backwards.<br>
+<img src="empty.png"> Use x to toggle visibility of a subtree.<br>
+<img src="empty.png"> Use * to expand/collapse a whole subtree.<br>
+<img src="empty.png"> Use h to navigate to thread root.<br>
+<img src="empty.png"> Use n and p to navigate between threads.<br>
+<img src="empty.png"> Click on background to move focus to a subtree.<br>
+</div>
+end_help
+    end
+  end
+end
+
diff --git a/lib/ruby-prof/call_tree_printer.rb b/lib/ruby-prof/printers/call_tree_printer.rb
similarity index 73%
rename from lib/ruby-prof/call_tree_printer.rb
rename to lib/ruby-prof/printers/call_tree_printer.rb
index a01648c..bd38af0 100644
--- a/lib/ruby-prof/call_tree_printer.rb
+++ b/lib/ruby-prof/printers/call_tree_printer.rb
@@ -1,14 +1,26 @@
-require 'ruby-prof/abstract_printer'
+# encoding: utf-8
 
 module RubyProf
   # Generate profiling information in calltree format
   # for use by kcachegrind and similar tools.
 
   class CallTreePrinter  < AbstractPrinter
+    # Specify print options.
+    #
+    # options - Hash table
+    #   :min_percent - Number 0 to 100 that specifes the minimum
+    #                  %self (the methods self time divided by the
+    #                  overall total time) that a method must take
+    #                  for it to be printed out in the report.
+    #                  Default value is 0.
+    #
+    #   :print_file  - True or false. Specifies if a method's source
+    #                  file should be printed.  Default value if false.
+    #
     def print(output = STDOUT, options = {})
       @output = output
       setup_options(options)
-        
+
       # add a header - this information is somewhat arbitrary
       @output << "events: "
       case RubyProf.measure_mode
@@ -42,8 +54,8 @@ module RubyProf
     end
 
     def print_threads
-      @result.threads.each do |thread_id, methods|
-        print_methods(thread_id, methods)
+      @result.threads.each do |thread|
+        print_thread(thread)
       end
     end
 
@@ -55,15 +67,11 @@ module RubyProf
       File.expand_path(method.source_file)
     end
 
-    def name(method)
-      "#{method.klass_name}::#{method.method_name}"
-    end
-
-    def print_methods(thread_id, methods)
-      methods.reverse_each do |method| 
+    def print_thread(thread)
+      thread.methods.reverse_each do |method|
         # Print out the file and method name
         @output << "fl=#{file(method)}\n"
-        @output << "fn=#{name(method)}\n"
+        @output << "fn=#{method_name(method)}\n"
 
         # Now print out the function line number and its self time
         @output << "#{method.line} #{convert(method.self_time)}\n"
@@ -71,7 +79,7 @@ module RubyProf
         # Now print out all the children methods
         method.children.each do |callee|
           @output << "cfl=#{file(callee.target)}\n"
-          @output << "cfn=#{name(callee.target)}\n"
+          @output << "cfn=#{method_name(callee.target)}\n"
           @output << "calls=#{callee.called} #{callee.line}\n"
 
           # Print out total times here!
diff --git a/lib/ruby-prof/printers/dot_printer.rb b/lib/ruby-prof/printers/dot_printer.rb
new file mode 100644
index 0000000..548f823
--- /dev/null
+++ b/lib/ruby-prof/printers/dot_printer.rb
@@ -0,0 +1,132 @@
+# encoding: utf-8
+
+require 'set'
+
+module RubyProf
+  # Generates a graphviz graph in dot format.
+  # To use the dot printer:
+  #
+  #   result = RubyProf.profile do
+  #     [code to profile]
+  #   end
+  #
+  #   printer = RubyProf::DotPrinter.new(result)
+  #   printer.print(STDOUT)
+  # 
+  # You can use either dot viewer such as GraphViz, or the dot command line tool
+  # to reformat the output into a wide variety of outputs:
+  # 
+  #   dot -Tpng graph.dot > graph.png
+  # 
+  class DotPrinter < RubyProf::AbstractPrinter  
+    CLASS_COLOR = '"#666666"'
+    EDGE_COLOR  = '"#666666"'
+    
+    # Creates the DotPrinter using a RubyProf::Result.
+    def initialize(result)
+      super(result)
+      @seen_methods = Set.new
+    end
+        
+    # Print a graph report to the provided output.
+    #  
+    # output - Any IO object, including STDOUT or a file. The default value is
+    # STDOUT.
+    #  
+    # options - Hash of print options.  See #setup_options 
+    # for more information.
+    #
+    # When profiling results that cover a large number of method calls it
+    # helps to use the :min_percent option, for example:
+    #  
+    #   DotPrinter.new(result).print(STDOUT, :min_percent=>5)
+    # 
+    def print(output = STDOUT, options = {})
+      @output = output
+      setup_options(options)
+      
+      puts 'digraph "Profile" {'
+      #puts "label=\"#{mode_name} >=#{min_percent}%\\nTotal: #{total_time}\";"
+      puts "labelloc=t;"
+      puts "labeljust=l;"
+      print_threads
+      puts '}'
+    end
+
+    private 
+    
+    # Something of a hack, figure out which constant went with the
+    # RubyProf.measure_mode so that we can display it.  Otherwise it's easy to
+    # forget what measurement was made.
+    def mode_name
+      RubyProf.constants.find{|c| RubyProf.const_get(c) == RubyProf.measure_mode}
+    end
+    
+    def print_threads
+      @result.threads.each do |thread|
+        puts "subgraph \"Thread #{thread.id}\" {"
+
+        print_thread(thread)
+        puts "}"
+        
+        print_classes(thread)
+      end
+    end
+    
+    # Determines an ID to use to represent the subject in the Dot file.
+    def dot_id(subject)
+      subject.object_id
+    end
+    
+    def print_thread(thread)
+      total_time = thread.total_time
+      thread.methods.sort_by(&sort_method).reverse_each do |method|
+        total_percentage = (method.total_time/total_time) * 100
+
+        next if total_percentage < min_percent
+        name = method_name(method).split("#").last
+        puts "#{dot_id(method)} [label=\"#{name}\\n(#{total_percentage.round}%)\"];"
+        @seen_methods << method
+        print_edges(total_time, method)
+      end
+    end
+      
+    def print_classes(thread)
+      grouped = {}
+      thread.methods.each{|m| grouped[m.klass_name] ||= []; grouped[m.klass_name] << m}
+      grouped.each do |cls, methods2|
+        # Filter down to just seen methods
+        big_methods = methods2.select{|m| @seen_methods.include? m}
+        
+        if !big_methods.empty?
+          puts "subgraph cluster_#{cls.object_id} {"
+          puts "label = \"#{cls}\";"
+          puts "fontcolor = #{CLASS_COLOR};"
+          puts "fontsize = 16;"
+          puts "color = #{CLASS_COLOR};"
+          big_methods.each do |m|
+            puts "#{m.object_id};"
+          end
+          puts "}"  
+        end        
+      end
+    end
+    
+    def print_edges(total_time, method)
+      method.aggregate_children.sort_by(&:total_time).reverse.each do |child|
+        
+        target_percentage = (child.target.total_time / total_time) * 100.0
+        next if target_percentage < min_percent
+        
+        # Get children method
+        puts "#{dot_id(method)} -> #{dot_id(child.target)} [label=\"#{child.called}/#{child.target.called}\" fontsize=10 fontcolor=#{EDGE_COLOR}];"
+      end
+    end
+    
+    # Silly little helper for printing to the @output
+    def puts(str)
+      @output.puts(str)
+    end
+    
+  end
+end
diff --git a/lib/ruby-prof/printers/flat_printer.rb b/lib/ruby-prof/printers/flat_printer.rb
new file mode 100644
index 0000000..f0e9bf7
--- /dev/null
+++ b/lib/ruby-prof/printers/flat_printer.rb
@@ -0,0 +1,69 @@
+# encoding: utf-8
+
+module RubyProf
+  # Generates flat[link:files/examples/flat_txt.html] profile reports as text.
+  # To use the flat printer:
+  #
+  #   result = RubyProf.profile do
+  #     [code to profile]
+  #   end
+  #
+  #   printer = RubyProf::FlatPrinter.new(result)
+  #   printer.print(STDOUT, {})
+  #
+  class FlatPrinter < AbstractPrinter
+    # Override for this printer to sort by self time by default
+    def sort_method
+      @options[:sort_method] || :self_time
+    end
+
+    private
+
+    #def print_threads
+    #  @result.threads.each do |thread|
+    #    print_thread(thread)
+    #    @output << "\n" * 2
+    #  end
+    #end
+
+    def print_header(thread)
+      @output << "Thread ID: %d\n" % thread.id
+      @output << "Fiber ID: %d\n" % thread.fiber_id unless thread.id == thread.fiber_id
+      @output << "Total: %0.6f\n" % thread.total_time
+      @output << "Sort by: #{sort_method}\n"
+      @output << "\n"
+      @output << " %self      total      self      wait     child     calls  name\n"
+    end
+
+    def print_methods(thread)
+      total_time = thread.total_time
+      methods = thread.methods.sort_by(&sort_method).reverse
+
+      sum = 0
+      methods.each do |method|
+        self_percent = (method.self_time / total_time) * 100
+        next if self_percent < min_percent
+
+        sum += method.self_time
+        #self_time_called = method.called > 0 ? method.self_time/method.called : 0
+        #total_time_called = method.called > 0? method.total_time/method.called : 0
+
+        @output << "%6.2f  %9.3f %9.3f %9.3f %9.3f %8d  %s%s \n" % [
+                      method.self_time / total_time * 100, # %self
+                      method.total_time,                   # total
+                      method.self_time,                    # self
+                      method.wait_time,                    # wait
+                      method.children_time,                # children
+                      method.called,                       # calls
+                      method.recursive? ? "*" : " ",       # cycle
+                      method_name(method)                  # name
+                  ]
+      end
+    end
+
+    def print_footer(thread)
+      @output << "\n"
+      @output << "* indicates recursively called methods\n"
+    end
+  end
+end
diff --git a/lib/ruby-prof/printers/flat_printer_with_line_numbers.rb b/lib/ruby-prof/printers/flat_printer_with_line_numbers.rb
new file mode 100644
index 0000000..682db31
--- /dev/null
+++ b/lib/ruby-prof/printers/flat_printer_with_line_numbers.rb
@@ -0,0 +1,57 @@
+# encoding: utf-8
+
+module RubyProf
+  # Generates flat[link:files/examples/flat_txt.html] profile reports as text.
+  # To use the flat printer with line numbers:
+  #
+  #   result = RubyProf.profile do
+  #     [code to profile]
+  #   end
+  #
+  #   printer = RubyProf::FlatPrinterWithLineNumbers.new(result)
+  #   printer.print(STDOUT, {})
+  #
+  class FlatPrinterWithLineNumbers < FlatPrinter
+    def print_methods(thread)
+      total_time = thread.total_time
+
+      methods = thread.methods.sort_by(&sort_method).reverse
+      sum = 0
+      methods.each do |method|
+        self_percent = (method.self_time / total_time) * 100
+        next if self_percent < min_percent
+
+        sum += method.self_time
+        #self_time_called = method.called > 0 ? method.self_time/method.called : 0
+        #total_time_called = method.called > 0? method.total_time/method.called : 0
+
+        @output << "%6.2f  %9.3f %9.3f %9.3f %9.3f %8d  %s%s \n" % [
+            method.self_time / total_time * 100, # %self
+            method.total_time,                   # total
+            method.self_time,                    # self
+            method.wait_time,                    # wait
+            method.children_time,                # children
+            method.called,                       # calls
+            method.recursive? ? "*" : " ",       # cycle
+            method_name(method)                  # name
+        ]
+         if method.source_file != 'ruby_runtime'
+           @output << "  %s:%s" % [File.expand_path(method.source_file), method.line]
+         end
+         @output << "\n\tcalled from: "
+
+         # make sure they're unique
+         method.call_infos.map{|ci|
+           if ci.parent && ci.parent.target.source_file != 'ruby_runtime'
+              [method_name(ci.parent.target), File.expand_path(ci.parent.target.source_file), ci.parent.target.line]
+           else
+              nil
+           end
+         }.compact.uniq.each{|args|
+             @output << " %s (%s:%s) " % args
+         }
+         @output << "\n\n"
+      end
+    end
+  end
+end
\ No newline at end of file
diff --git a/lib/ruby-prof/printers/graph_html_printer.rb b/lib/ruby-prof/printers/graph_html_printer.rb
new file mode 100644
index 0000000..e728747
--- /dev/null
+++ b/lib/ruby-prof/printers/graph_html_printer.rb
@@ -0,0 +1,255 @@
+# encoding: utf-8
+
+require 'erb'
+
+module RubyProf
+  # Generates graph[link:files/examples/graph_html.html] profile reports as html.
+  # To use the graph html printer:
+  #
+  #   result = RubyProf.profile do
+  #     [code to profile]
+  #   end
+  #
+  #   printer = RubyProf::GraphHtmlPrinter.new(result)
+  #   printer.print(STDOUT, :min_percent=>0)
+  #
+  # The Graph printer takes the following options in its print methods:
+  #   :filename    - specify a file to use that contains the ERB
+  #                  template to use, instead of the built-in self.template
+  #
+  #   :template    - specify an ERB template to use, instead of the
+  #                  built-in self.template
+  #
+
+  class GraphHtmlPrinter < AbstractPrinter
+    include ERB::Util
+
+    PERCENTAGE_WIDTH = 8
+    TIME_WIDTH = 10
+    CALL_WIDTH = 20
+
+    def setup_options(options)
+      super(options)
+
+      filename = options[:filename]
+      template = filename ? File.read(filename).untaint : (options[:template] || self.template)
+      @erb = ERB.new(template, nil, nil)
+      @erb.filename = filename
+    end
+
+    def print(output = STDOUT, options = {})
+      @output = output
+      setup_options(options)
+      @output << @erb.result(binding)
+    end
+
+    # Creates a link to a method.  Note that we do not create
+    # links to methods which are under the min_perecent
+    # specified by the user, since they will not be
+    # printed out.
+    def create_link(thread, overall_time, method)
+      total_percent = (method.total_time/overall_time) * 100
+      if total_percent < min_percent
+        # Just return name
+        h method.full_name
+      else
+        href = '#' + method_href(thread, method)
+        "<a href=\"#{href}\">#{h method.full_name}</a>"
+      end
+    end
+
+    def method_href(thread, method)
+      h(method.full_name.gsub(/[><#\.\?=:]/,"_") + "_" + thread.fiber_id.to_s)
+    end
+
+    def file_link(path, linenum)
+      srcfile = File.expand_path(path)
+      if srcfile =~ /\/ruby_runtime$/
+        ""
+      else
+        if RUBY_PLATFORM =~ /darwin/
+          "<a href=\"txmt://open?url=file://#{h srcfile}&line=#{linenum}\" title=\"#{h srcfile}:#{linenum}\">#{linenum}</a>"
+        else
+          "<a href=\"file://#{h srcfile}##{linenum}\" title=\"#{h srcfile}:#{linenum}\">#{linenum}</a>"
+        end
+      end
+    end
+
+    def template
+'
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+  <style media="all" type="text/css">
+    table {
+      border-collapse: collapse;
+      border: 1px solid #CCC;
+      font-family: Verdana, Arial, Helvetica, sans-serif;
+      font-size: 9pt;
+      line-height: normal;
+      width: 100%;
+    }
+
+    th {
+      text-align: center;
+      border-top: 1px solid #FB7A31;
+      border-bottom: 1px solid #FB7A31;
+      background: #FFC;
+      padding: 0.3em;
+      border-left: 1px solid silver;
+    }
+
+    tr.break td {
+      border: 0;
+      border-top: 1px solid #FB7A31;
+      padding: 0;
+      margin: 0;
+    }
+
+    tr.method td {
+      font-weight: bold;
+    }
+
+    td {
+      padding: 0.3em;
+    }
+
+    td:first-child {
+      width: 190px;
+      }
+
+    td {
+      border-left: 1px solid #CCC;
+      text-align: center;
+    }
+
+    .method_name {
+      text-align: left;
+    }
+
+    tfoot td {
+      text-align: left;
+    }
+  </style>
+  </head>
+  <body>
+    <h1>Profile Report</h1>
+    <!-- Threads Table -->
+    <table>
+      <tr>
+        <th>Thread ID</th>
+        <% if RUBY_VERSION >= "1.9" %>
+        <th>Fiber ID</th>
+        <% end %>
+        <th>Total Time</th>
+      </tr>
+      <% for thread in @result.threads %>
+      <tr>
+        <% if RUBY_VERSION >= "1.9" %>
+        <td><%= thread.id %></td>
+        <% end %>
+        <td><a href="#<%= thread.fiber_id %>"><%= thread.fiber_id %></a></td>
+        <td><%= thread.total_time %></td>
+      </tr>
+      <% end %>
+    </table>
+
+    <!-- Methods Tables -->
+    <% for thread in @result.threads
+         methods = thread.methods
+         total_time = thread.total_time %>
+      <% if RUBY_VERSION >= "1.9" %>
+      <h2><a name="<%= thread.fiber_id %>">Thread <%= thread.id %>, Fiber: <%= thread.fiber_id %></a></h2>
+      <% else %>
+      <h2><a name="<%= thread.fiber_id %>">Thread <%= thread.fiber_id %></a></h2>
+      <% end %>
+      <table>
+        <thead>
+          <tr>
+            <th><%= sprintf("%#{PERCENTAGE_WIDTH}s", "%Total") %></th>
+            <th><%= sprintf("%#{PERCENTAGE_WIDTH}s", "%Self") %></th>
+            <th><%= sprintf("%#{TIME_WIDTH}s", "Total") %></th>
+            <th><%= sprintf("%#{TIME_WIDTH}s", "Self") %></th>
+            <th><%= sprintf("%#{TIME_WIDTH}s", "Wait") %></th>
+            <th><%= sprintf("%#{TIME_WIDTH+2}s", "Child") %></th>
+            <th><%= sprintf("%#{CALL_WIDTH}s", "Calls") %></th>
+            <th class="method_name">Name</th>
+            <th>Line</th>
+          </tr>
+        </thead>
+
+        <tbody>
+          <% min_time = @options[:min_time] || (@options[:nonzero] ? 0.005 : nil)
+             methods.sort_by(&sort_method).reverse_each do |method|
+              total_percentage = (method.total_time/total_time) * 100
+              next if total_percentage < min_percent
+              next if min_time && method.total_time < min_time
+              self_percentage = (method.self_time/total_time) * 100 %>
+
+              <!-- Parents -->
+              <% for caller in method.aggregate_parents.sort_by(&:total_time)
+                   next unless caller.parent
+                   next if min_time && caller.total_time < min_time  %>
+                <tr>
+                  <td> </td>
+                  <td> </td>
+                  <td><%= sprintf("%#{TIME_WIDTH}.2f", caller.total_time) %></td>
+                  <td><%= sprintf("%#{TIME_WIDTH}.2f", caller.self_time) %></td>
+                  <td><%= sprintf("%#{TIME_WIDTH}.2f", caller.wait_time) %></td>
+                  <td><%= sprintf("%#{TIME_WIDTH}.2f", caller.children_time) %></td>
+                  <% called = "#{caller.called}/#{method.called}" %>
+                  <td><%= sprintf("%#{CALL_WIDTH}s", called) %></td>
+                  <td class="method_name"><%= create_link(thread, total_time, caller.parent.target) %></td>
+                  <td><%= file_link(caller.parent.target.source_file, caller.line) %></td>
+                </tr>
+              <% end %>
+
+              <tr class="method">
+                <td><%= sprintf("%#{PERCENTAGE_WIDTH-1}.2f\%", total_percentage) %></td>
+                <td><%= sprintf("%#{PERCENTAGE_WIDTH-1}.2f\%", self_percentage) %></td>
+                <td><%= sprintf("%#{TIME_WIDTH}.2f", method.total_time) %></td>
+                <td><%= sprintf("%#{TIME_WIDTH}.2f", method.self_time) %></td>
+                <td><%= sprintf("%#{TIME_WIDTH}.2f", method.wait_time) %></td>
+                <td><%= sprintf("%#{TIME_WIDTH}.2f", method.children_time) %></td>
+                <td><%= sprintf("%#{CALL_WIDTH}i", method.called) %></td>
+                <td class="method_name">
+                  <a name="<%= method_href(thread, method) %>">
+                    <%= method.recursive? ? "*" : " "%><%= h method.full_name %>
+                  </a>
+                </td>
+                <td><%= file_link(method.source_file, method.line) %></td>
+              </tr>
+
+              <!-- Children -->
+              <% for callee in method.aggregate_children.sort_by(&:total_time).reverse %>
+              <%   next if min_time && callee.total_time < min_time  %>
+                <tr>
+                  <td> </td>
+                  <td> </td>
+                  <td><%= sprintf("%#{TIME_WIDTH}.2f", callee.total_time) %></td>
+                  <td><%= sprintf("%#{TIME_WIDTH}.2f", callee.self_time) %></td>
+                  <td><%= sprintf("%#{TIME_WIDTH}.2f", callee.wait_time) %></td>
+                  <td><%= sprintf("%#{TIME_WIDTH}.2f", callee.children_time) %></td>
+                  <% called = "#{callee.called}/#{callee.target.called}" %>
+                  <td><%= sprintf("%#{CALL_WIDTH}s", called) %></td>
+                  <td class="method_name"><%= create_link(thread, total_time, callee.target) %></td>
+                  <td><%= file_link(method.source_file, callee.line) %></td>
+                </tr>
+              <% end %>
+              <!-- Create divider row -->
+              <tr class="break"><td colspan="9"></td></tr>
+          <% end %>
+        </tbody>
+        <tfoot>
+          <tr>
+            <td colspan="9">* indicates recursively called methods</td>
+          </tr>
+        </tfoot>
+      </table>
+    <% end %>
+  </body>
+</html>'
+    end
+  end
+end
+
diff --git a/lib/ruby-prof/printers/graph_printer.rb b/lib/ruby-prof/printers/graph_printer.rb
new file mode 100644
index 0000000..443a3d2
--- /dev/null
+++ b/lib/ruby-prof/printers/graph_printer.rb
@@ -0,0 +1,116 @@
+# encoding: utf-8
+
+module RubyProf
+  # Generates graph[link:files/examples/graph_txt.html] profile reports as text.
+  # To use the graph printer:
+  #
+  #   result = RubyProf.profile do
+  #     [code to profile]
+  #   end
+  #
+  #   printer = RubyProf::GraphPrinter.new(result)
+  #   printer.print(STDOUT, {})
+  #
+  # The constructor takes two arguments. See the README
+
+  class GraphPrinter < AbstractPrinter
+    PERCENTAGE_WIDTH = 8
+    TIME_WIDTH = 11
+    CALL_WIDTH = 17
+
+    private
+
+    def print_header(thread)
+      @output << "Thread ID: #{thread.id}\n"
+      @output << "Fiber ID: #{thread.fiber_id}\n" unless thread.id == thread.fiber_id
+      @output << "Total Time: #{thread.total_time}\n"
+      @output << "Sort by: #{sort_method}\n"
+      @output << "\n"
+
+      # 1 is for % sign
+      @output << sprintf("%#{PERCENTAGE_WIDTH}s", "%total")
+      @output << sprintf("%#{PERCENTAGE_WIDTH}s", "%self")
+      @output << sprintf("%#{TIME_WIDTH}s", "total")
+      @output << sprintf("%#{TIME_WIDTH}s", "self")
+      @output << sprintf("%#{TIME_WIDTH}s", "wait")
+      @output << sprintf("%#{TIME_WIDTH}s", "child")
+      @output << sprintf("%#{CALL_WIDTH}s", "calls")
+      @output << "    Name"
+      @output << "\n"
+    end
+
+    def print_methods(thread)
+      total_time = thread.total_time
+      # Sort methods from longest to shortest total time
+      methods = thread.methods.sort_by(&sort_method)
+
+      # Print each method in total time order
+      methods.reverse_each do |method|
+        total_percentage = (method.total_time/total_time) * 100
+        self_percentage = (method.self_time/total_time) * 100
+
+        next if total_percentage < min_percent
+
+        @output << "-" * 80 << "\n"
+
+        print_parents(thread, method)
+
+        # 1 is for % sign
+        @output << sprintf("%#{PERCENTAGE_WIDTH-1}.2f\%", total_percentage)
+        @output << sprintf("%#{PERCENTAGE_WIDTH-1}.2f\%", self_percentage)
+        @output << sprintf("%#{TIME_WIDTH}.3f", method.total_time)
+        @output << sprintf("%#{TIME_WIDTH}.3f", method.self_time)
+        @output << sprintf("%#{TIME_WIDTH}.3f", method.wait_time)
+        @output << sprintf("%#{TIME_WIDTH}.3f", method.children_time)
+        @output << sprintf("%#{CALL_WIDTH}i", method.called)
+        @output << sprintf("     %s",  method.recursive? ? "*" : " ")
+        @output << sprintf("%s", method_name(method))
+        if print_file
+          @output << sprintf("  %s:%s", method.source_file, method.line)
+        end
+        @output << "\n"
+
+        print_children(method)
+      end
+    end
+
+    def print_parents(thread, method)
+      method.aggregate_parents.sort_by(&:total_time).each do |caller|
+        next unless caller.parent
+        @output << " " * 2 * PERCENTAGE_WIDTH
+        @output << sprintf("%#{TIME_WIDTH}.3f", caller.total_time)
+        @output << sprintf("%#{TIME_WIDTH}.3f", caller.self_time)
+        @output << sprintf("%#{TIME_WIDTH}.3f", caller.wait_time)
+        @output << sprintf("%#{TIME_WIDTH}.3f", caller.children_time)
+
+        call_called = "#{caller.called}/#{method.called}"
+        @output << sprintf("%#{CALL_WIDTH}s", call_called)
+        @output << sprintf("      %s", caller.parent.target.full_name)
+        @output << "\n"
+      end
+    end
+
+    def print_children(method)
+      method.aggregate_children.sort_by(&:total_time).reverse.each do |child|
+        # Get children method
+
+        @output << " " * 2 * PERCENTAGE_WIDTH
+
+        @output << sprintf("%#{TIME_WIDTH}.3f", child.total_time)
+        @output << sprintf("%#{TIME_WIDTH}.3f", child.self_time)
+        @output << sprintf("%#{TIME_WIDTH}.3f", child.wait_time)
+        @output << sprintf("%#{TIME_WIDTH}.3f", child.children_time)
+
+        call_called = "#{child.called}/#{child.target.called}"
+        @output << sprintf("%#{CALL_WIDTH}s", call_called)
+        @output << sprintf("      %s", child.target.full_name)
+        @output << "\n"
+      end
+    end
+
+    def print_footer(thread)
+      @output << "\n"
+      @output << "* indicates recursively called methods\n"
+    end
+  end
+end
diff --git a/lib/ruby-prof/printers/multi_printer.rb b/lib/ruby-prof/printers/multi_printer.rb
new file mode 100644
index 0000000..beb5d0c
--- /dev/null
+++ b/lib/ruby-prof/printers/multi_printer.rb
@@ -0,0 +1,56 @@
+# encoding: utf-8
+
+module RubyProf
+  # Helper class to simplify printing profiles of several types from
+  # one profiling run. Currently prints a flat profile, a callgrind
+  # profile, a call stack profile and a graph profile.
+  class MultiPrinter
+    def initialize(result)
+      @stack_printer = CallStackPrinter.new(result)
+      @graph_printer = GraphHtmlPrinter.new(result)
+      @tree_printer = CallTreePrinter.new(result)
+      @flat_printer = FlatPrinter.new(result)
+    end
+
+    # create profile files under options[:path] or the current
+    # directory. options[:profile] is used as the base name for the
+    # pofile file, defaults to "profile".
+    def print(options)
+      @profile = options.delete(:profile) || "profile"
+      @directory = options.delete(:path) || File.expand_path(".")
+      File.open(stack_profile, "w") do |f|
+        @stack_printer.print(f, options.merge(:graph => "#{@profile}.graph.html"))
+      end
+      File.open(graph_profile, "w") do |f|
+        @graph_printer.print(f, options)
+      end
+      File.open(tree_profile, "w") do |f|
+        @tree_printer.print(f, options)
+      end
+      File.open(flat_profile, "w") do |f|
+        @flat_printer.print(f, options)
+      end
+    end
+
+    # the name of the call stack profile file
+    def stack_profile
+      "#{@directory}/#{@profile}.stack.html"
+    end
+
+    # the name of the graph profile file
+    def graph_profile
+      "#{@directory}/#{@profile}.graph.html"
+    end
+
+    # the name of the callgrind profile file
+    def tree_profile
+      "#{@directory}/#{@profile}.grind.dat"
+    end
+
+    # the name of the flat profile file
+    def flat_profile
+      "#{@directory}/#{@profile}.flat.txt"
+    end
+
+  end
+end
diff --git a/lib/ruby-prof/profile.rb b/lib/ruby-prof/profile.rb
new file mode 100644
index 0000000..0fa5a2a
--- /dev/null
+++ b/lib/ruby-prof/profile.rb
@@ -0,0 +1,77 @@
+# encoding: utf-8
+
+require 'set'
+module RubyProf
+  class Profile
+    # This method gets called once profiling has been completed
+    # but before results are returned to the user.  Thus it provides
+    # a hook to do any necessary post-processing on the call graph.
+    def post_process
+      self.threads.each do |thread|
+        detect_recursion(thread)
+      end
+    end
+
+    # This method detect recursive calls in the call graph.
+    def detect_recursion(thread)
+      visited_methods = Hash.new do |hash, key|
+        hash[key] = 0
+      end
+
+      visitor = CallInfoVisitor.new(thread)
+      visitor.visit do |call_info, event|
+        case event
+        when :enter
+          visited_methods[call_info.target] += 1
+          call_info.recursive = (visited_methods[call_info.target] > 1)
+        when :exit
+          visited_methods[call_info.target] -= 1
+          if visited_methods[call_info.target] == 0
+            visited_methods.delete(call_info.target)
+          end
+        end
+      end
+    end
+
+    # eliminate some calls from the graph by merging the information into callers.
+    # matchers can be a list of strings or regular expressions or the name of a file containing regexps.
+    def eliminate_methods!(matchers)
+      matchers = read_regexps_from_file(matchers) if matchers.is_a?(String)
+      eliminated = []
+      threads.each do |thread|
+        matchers.each{ |matcher| eliminated.concat(eliminate_methods(thread.methods, matcher)) }
+      end
+      eliminated
+    end
+
+    private
+
+    # read regexps from file
+    def read_regexps_from_file(file_name)
+      matchers = []
+      File.open(file_name).each_line do |l|
+        next if (l =~ /^(#.*|\s*)$/) # emtpy lines and lines starting with #
+        matchers << Regexp.new(l.strip)
+      end
+    end
+
+    # eliminate methods matching matcher
+    def eliminate_methods(methods, matcher)
+      eliminated = []
+      i = 0
+      while i < methods.size
+        method_info = methods[i]
+        method_name = method_info.full_name
+        if matcher === method_name
+          raise "can't eliminate root method" if method_info.root?
+          eliminated << methods.delete_at(i)
+          method_info.eliminate!
+        else
+          i += 1
+        end
+      end
+      eliminated
+    end
+
+  end
+end
diff --git a/lib/ruby-prof/rack.rb b/lib/ruby-prof/rack.rb
new file mode 100644
index 0000000..815270d
--- /dev/null
+++ b/lib/ruby-prof/rack.rb
@@ -0,0 +1,48 @@
+# encoding: utf-8
+require 'tmpdir'
+
+module Rack
+  class RubyProf
+    def initialize(app, options = {})
+      @app = app
+      @options = options
+      @options[:min_percent] ||= 1
+      @tmpdir = options[:path] || Dir.tmpdir
+      @printer_klasses = @options[:printers]  || {::RubyProf::FlatPrinter => 'flat.txt',
+                                                  ::RubyProf::GraphPrinter => 'graph.txt',
+                                                  ::RubyProf::GraphHtmlPrinter => 'graph.html',
+                                                  ::RubyProf::CallStackPrinter => 'call_stack.html'}
+
+      @skip_paths = options[:skip_paths] || [%r{^/assets}, %r{\.css$}, %r{\.js$}, %r{\.png$}, %r{\.jpeg$}, %r{\.jpg$}, %r{\.gif$}]
+    end
+
+    def call(env)
+      request = Rack::Request.new(env)
+
+      if @skip_paths.any? {|skip_path| skip_path =~ request.path}
+        @app.call(env)
+      else
+        result = nil
+        data = ::RubyProf::Profile.profile do
+          result = @app.call(env)
+        end
+
+        path = request.path.gsub('/', '-')
+        path.slice!(0)
+
+        print(data, path)
+        result
+      end
+    end
+
+    def print(data, path)
+      @printer_klasses.each do |printer_klass, base_name|
+        printer = printer_klass.new(data)
+        file_name = ::File.join(@tmpdir, "#{path}-#{base_name}")
+        ::File.open(file_name, 'wb') do |file|
+          printer.print(file, @options)
+        end
+      end
+    end
+  end
+end
\ No newline at end of file
diff --git a/lib/ruby-prof/task.rb b/lib/ruby-prof/task.rb
index a29fe9c..65b83ca 100755
--- a/lib/ruby-prof/task.rb
+++ b/lib/ruby-prof/task.rb
@@ -1,4 +1,5 @@
 #!/usr/bin/env ruby
+# encoding: utf-8
 
 require 'rake'
 require 'rake/testtask'
@@ -15,7 +16,7 @@ module RubyProf
   #
   # ruby-prof specific options include:
   #
-  #   output_dir - For each file specified an output 
+  #   output_dir - For each file specified an output
   #                file with profile information will be
   #                written to the output directory.
   #                By default, the output directory is
@@ -29,9 +30,9 @@ module RubyProf
   #                 will not be written out.
   #
   # Example:
-  #   
+  #
   #   require 'ruby-prof/task'
-  #   
+  #
   #   RubyProf::ProfileTask.new do |t|
   #     t.test_files = FileList['test/test*.rb']
   #     t.output_dir = "c:/temp"
@@ -55,37 +56,37 @@ module RubyProf
   #   rake profile TEST=just_one_file.rb     # run just one test file.
   #   rake profile TESTOPTS="-v"             # run in verbose mode
   #   rake profile TESTOPTS="--runner=fox"   # use the fox test runner
-  
+
   class ProfileTask < Rake::TestTask
-    attr_accessor :output_dir 
-    attr_accessor :min_percent 
+    attr_accessor :output_dir
+    attr_accessor :min_percent
     attr_accessor :printer
-    
+
     def initialize(name = :profile)
       super(name)
     end
-    
+
     # Create the tasks defined by this task lib.
     def define
       lib_path = @libs.join(File::PATH_SEPARATOR)
       desc "Profile" + (@name==:profile ? "" : " for #{@name}")
-      
+
       task @name do
         create_output_directory
-        
+
         @ruby_opts.unshift( "-I#{lib_path}" )
         @ruby_opts.unshift( "-w" ) if @warning
         @ruby_opts.push("-S ruby-prof")
         @ruby_opts.push("--printer #{@printer}")
         @ruby_opts.push("--min_percent #{@min_percent}")
 
-        file_list.each do |file_path|  
+        file_list.each do |file_path|
           run_script(file_path)
         end
       end
       self
     end
-    
+
     # Run script
     def run_script(script_path)
       run_code = ''
@@ -99,14 +100,14 @@ module RubyProf
           else
             file_name += ".txt"
         end
-          
+
         output_file_path = File.join(output_directory, file_name)
-          
-        command_line = @ruby_opts.join(" ") + 
+
+        command_line = @ruby_opts.join(" ") +
                       " --file=" + output_file_path +
                       " " + script_path
 
-        puts "ruby " + command_line 
+        puts "ruby " + command_line
         # We have to catch the exeption to continue on.  However,
         # the error message will have been output to STDERR
         # already by the time we get here so we don't have to
@@ -125,7 +126,7 @@ module RubyProf
     def output_directory
       File.expand_path(@output_dir)
     end
-    
+
     def create_output_directory
       if not File.exist?(output_directory)
         Dir.mkdir(output_directory)
@@ -138,9 +139,9 @@ module RubyProf
         FileUtils.rm(files)
       end
     end
-    
+
     def option_list # :nodoc:
       ENV['OPTIONS'] || @options.join(" ") || ""
     end
   end
-end
\ No newline at end of file
+end
diff --git a/lib/ruby-prof/test.rb b/lib/ruby-prof/test.rb
index a0691cc..8bf47bc 100644
--- a/lib/ruby-prof/test.rb
+++ b/lib/ruby-prof/test.rb
@@ -1,3 +1,5 @@
+# encoding: utf-8
+
 # Now load ruby-prof and away we go
 require 'fileutils'
 require 'ruby-prof'
@@ -15,7 +17,7 @@ module RubyProf
     def output_dir
       PROFILE_OPTIONS[:output_dir]
     end
-          
+
     def run(result)
       return if @method_name.to_s == "default_test"
 
@@ -82,7 +84,7 @@ module RubyProf
 
       data = RubyProf.stop
       bench = data.threads.values.inject(0) do |total, method_infos|
-        top = method_infos.sort.last
+        top = method_infos.max
         total += top.total_time
         total
       end
@@ -108,7 +110,7 @@ module RubyProf
     def report_profile(data, measure_mode)
       PROFILE_OPTIONS[:printers].each do |printer_klass|
         printer = printer_klass.new(data)
-        
+
         # Makes sure the output directory exits
         FileUtils.mkdir_p(output_dir)
 
@@ -145,4 +147,4 @@ module RubyProf
       end
     end
   end
-end
\ No newline at end of file
+end
diff --git a/lib/ruby-prof/thread.rb b/lib/ruby-prof/thread.rb
new file mode 100644
index 0000000..0452abe
--- /dev/null
+++ b/lib/ruby-prof/thread.rb
@@ -0,0 +1,22 @@
+module RubyProf
+  class Thread
+    def top_methods
+      self.methods.select do |method_info|
+        method_info.call_infos.detect do |call_info|
+          call_info.parent.nil?
+        end
+      end
+    end
+
+    def total_time
+      self.top_methods.inject(0) do |sum, method_info|
+        method_info.call_infos.each do |call_info|
+          if call_info.parent.nil?
+            sum += call_info.total_time
+          end
+        end
+        sum
+      end
+    end
+  end
+end
diff --git a/lib/unprof.rb b/lib/unprof.rb
index 0838096..c0683e3 100644
--- a/lib/unprof.rb
+++ b/lib/unprof.rb
@@ -1,3 +1,5 @@
+# encoding: utf-8
+
 require "ruby-prof"
 
 at_exit {
diff --git a/metadata.yml b/metadata.yml
new file mode 100644
index 0000000..51c9756
--- /dev/null
+++ b/metadata.yml
@@ -0,0 +1,258 @@
+--- !ruby/object:Gem::Specification
+name: ruby-prof
+version: !ruby/object:Gem::Version
+  version: 0.13.1
+platform: ruby
+authors:
+- Shugo Maeda, Charlie Savage, Roger Pack, Stefan Kaes
+autorequire: 
+bindir: bin
+cert_chain: []
+date: 2013-12-14 00:00:00.000000000 Z
+dependencies:
+- !ruby/object:Gem::Dependency
+  name: minitest
+  requirement: !ruby/object:Gem::Requirement
+    requirements:
+    - - ~>
+      - !ruby/object:Gem::Version
+        version: '4.0'
+  type: :development
+  prerelease: false
+  version_requirements: !ruby/object:Gem::Requirement
+    requirements:
+    - - ~>
+      - !ruby/object:Gem::Version
+        version: '4.0'
+- !ruby/object:Gem::Dependency
+  name: rake-compiler
+  requirement: !ruby/object:Gem::Requirement
+    requirements:
+    - - '>='
+      - !ruby/object:Gem::Version
+        version: '0'
+  type: :development
+  prerelease: false
+  version_requirements: !ruby/object:Gem::Requirement
+    requirements:
+    - - '>='
+      - !ruby/object:Gem::Version
+        version: '0'
+- !ruby/object:Gem::Dependency
+  name: rdoc
+  requirement: !ruby/object:Gem::Requirement
+    requirements:
+    - - '>='
+      - !ruby/object:Gem::Version
+        version: '0'
+  type: :development
+  prerelease: false
+  version_requirements: !ruby/object:Gem::Requirement
+    requirements:
+    - - '>='
+      - !ruby/object:Gem::Version
+        version: '0'
+description: |
+  ruby-prof is a fast code profiler for Ruby. It is a C extension and
+  therefore is many times faster than the standard Ruby profiler. It
+  supports both flat and graph profiles.  For each method, graph profiles
+  show how long the method ran, which methods called it and which
+  methods it called. RubyProf generate both text and html and can output
+  it to standard out or to a file.
+email: shugo at ruby-lang.org, cfis at savagexi.com, rogerdpack at gmail.com, skaes at railsexpress.de
+executables:
+- ruby-prof
+extensions:
+- ext/ruby_prof/extconf.rb
+extra_rdoc_files: []
+files:
+- CHANGES
+- LICENSE
+- Rakefile
+- README.rdoc
+- ruby-prof.gemspec
+- bin/ruby-prof
+- doc/created.rid
+- doc/examples/flat_txt.html
+- doc/examples/graph_txt.html
+- doc/images/add.png
+- doc/images/brick.png
+- doc/images/brick_link.png
+- doc/images/bug.png
+- doc/images/bullet_black.png
+- doc/images/bullet_toggle_minus.png
+- doc/images/bullet_toggle_plus.png
+- doc/images/date.png
+- doc/images/delete.png
+- doc/images/find.png
+- doc/images/loadingAnimation.gif
+- doc/images/macFFBgHack.png
+- doc/images/package.png
+- doc/images/page_green.png
+- doc/images/page_white_text.png
+- doc/images/page_white_width.png
+- doc/images/plugin.png
+- doc/images/ruby.png
+- doc/images/tag_blue.png
+- doc/images/tag_green.png
+- doc/images/transparent.png
+- doc/images/wrench.png
+- doc/images/wrench_orange.png
+- doc/images/zoom.png
+- doc/index.html
+- doc/js/darkfish.js
+- doc/js/jquery.js
+- doc/js/navigation.js
+- doc/js/search.js
+- doc/js/search_index.js
+- doc/js/searcher.js
+- doc/LICENSE.html
+- doc/Rack/RubyProf.html
+- doc/Rack.html
+- doc/rdoc.css
+- doc/README_rdoc.html
+- doc/RubyProf/AbstractPrinter.html
+- doc/RubyProf/AggregateCallInfo.html
+- doc/RubyProf/CallInfo.html
+- doc/RubyProf/CallInfoPrinter.html
+- doc/RubyProf/CallInfoVisitor.html
+- doc/RubyProf/CallStackPrinter.html
+- doc/RubyProf/CallTreePrinter.html
+- doc/RubyProf/Cmd.html
+- doc/RubyProf/DotPrinter.html
+- doc/RubyProf/FlatPrinter.html
+- doc/RubyProf/FlatPrinterWithLineNumbers.html
+- doc/RubyProf/GraphHtmlPrinter.html
+- doc/RubyProf/GraphPrinter.html
+- doc/RubyProf/MethodInfo.html
+- doc/RubyProf/MultiPrinter.html
+- doc/RubyProf/Profile.html
+- doc/RubyProf/ProfileTask.html
+- doc/RubyProf/Test.html
+- doc/RubyProf/Thread.html
+- doc/RubyProf.html
+- doc/table_of_contents.html
+- examples/empty.png
+- examples/flat.txt
+- examples/graph.dot
+- examples/graph.html
+- examples/graph.png
+- examples/graph.txt
+- examples/minus.png
+- examples/multi.flat.txt
+- examples/multi.graph.html
+- examples/multi.grind.dat
+- examples/multi.stack.html
+- examples/plus.png
+- examples/stack.html
+- ext/ruby_prof/extconf.rb
+- ext/ruby_prof/rp_call_info.c
+- ext/ruby_prof/rp_measure.c
+- ext/ruby_prof/rp_measure_allocations.c
+- ext/ruby_prof/rp_measure_cpu_time.c
+- ext/ruby_prof/rp_measure_gc_runs.c
+- ext/ruby_prof/rp_measure_gc_time.c
+- ext/ruby_prof/rp_measure_memory.c
+- ext/ruby_prof/rp_measure_process_time.c
+- ext/ruby_prof/rp_measure_wall_time.c
+- ext/ruby_prof/rp_method.c
+- ext/ruby_prof/rp_stack.c
+- ext/ruby_prof/rp_thread.c
+- ext/ruby_prof/ruby_prof.c
+- ext/ruby_prof/rp_call_info.h
+- ext/ruby_prof/rp_measure.h
+- ext/ruby_prof/rp_method.h
+- ext/ruby_prof/rp_stack.h
+- ext/ruby_prof/rp_thread.h
+- ext/ruby_prof/ruby_prof.h
+- ext/ruby_prof/version.h
+- ext/ruby_prof/vc/ruby_prof.sln
+- ext/ruby_prof/vc/ruby_prof_18.vcxproj
+- ext/ruby_prof/vc/ruby_prof_19.vcxproj
+- ext/ruby_prof/vc/ruby_prof_20.vcxproj
+- lib/ruby-prof.rb
+- lib/unprof.rb
+- lib/ruby-prof/aggregate_call_info.rb
+- lib/ruby-prof/call_info.rb
+- lib/ruby-prof/call_info_visitor.rb
+- lib/ruby-prof/compatibility.rb
+- lib/ruby-prof/method_info.rb
+- lib/ruby-prof/profile.rb
+- lib/ruby-prof/rack.rb
+- lib/ruby-prof/task.rb
+- lib/ruby-prof/test.rb
+- lib/ruby-prof/thread.rb
+- lib/ruby-prof/images/empty.png
+- lib/ruby-prof/images/minus.png
+- lib/ruby-prof/images/plus.png
+- lib/ruby-prof/printers/abstract_printer.rb
+- lib/ruby-prof/printers/call_info_printer.rb
+- lib/ruby-prof/printers/call_stack_printer.rb
+- lib/ruby-prof/printers/call_tree_printer.rb
+- lib/ruby-prof/printers/dot_printer.rb
+- lib/ruby-prof/printers/flat_printer.rb
+- lib/ruby-prof/printers/flat_printer_with_line_numbers.rb
+- lib/ruby-prof/printers/graph_html_printer.rb
+- lib/ruby-prof/printers/graph_printer.rb
+- lib/ruby-prof/printers/multi_printer.rb
+- test/aggregate_test.rb
+- test/basic_test.rb
+- test/call_info_test.rb
+- test/call_info_visitor_test.rb
+- test/duplicate_names_test.rb
+- test/dynamic_method_test.rb
+- test/enumerable_test.rb
+- test/exceptions_test.rb
+- test/exclude_threads_test.rb
+- test/exec_test.rb
+- test/fiber_test.rb
+- test/line_number_test.rb
+- test/measure_allocations_test.rb
+- test/measure_cpu_time_test.rb
+- test/measure_gc_runs_test.rb
+- test/measure_gc_time_test.rb
+- test/measure_memory_test.rb
+- test/measure_process_time_test.rb
+- test/measure_wall_time_test.rb
+- test/method_elimination_test.rb
+- test/module_test.rb
+- test/multi_printer_test.rb
+- test/no_method_class_test.rb
+- test/pause_resume_test.rb
+- test/prime.rb
+- test/printers_test.rb
+- test/recursive_test.rb
+- test/singleton_test.rb
+- test/stack_printer_test.rb
+- test/stack_test.rb
+- test/start_stop_test.rb
+- test/test_helper.rb
+- test/test_suite.rb
+- test/thread_test.rb
+- test/unique_call_path_test.rb
+homepage: https://github.com/rdp/ruby-prof
+licenses: []
+metadata: {}
+post_install_message: 
+rdoc_options: []
+require_paths:
+- lib
+required_ruby_version: !ruby/object:Gem::Requirement
+  requirements:
+  - - '>='
+    - !ruby/object:Gem::Version
+      version: 1.8.7
+required_rubygems_version: !ruby/object:Gem::Requirement
+  requirements:
+  - - '>='
+    - !ruby/object:Gem::Version
+      version: '0'
+requirements: []
+rubyforge_project: 
+rubygems_version: 2.1.11
+signing_key: 
+specification_version: 4
+summary: Fast Ruby profiler
+test_files:
+- test/test_helper.rb
+- test/test_suite.rb
diff --git a/rails/environment/profile.rb b/rails/environment/profile.rb
deleted file mode 100644
index 328100b..0000000
--- a/rails/environment/profile.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-# Settings specified here will take precedence over those in config/environment.rb
-# The profile environment should match the same settings
-# as the production environment to give a reasonalbe
-# approximation of performance.  However, it should
-# definitely not use the production databse!
-
-
-# Cache classes - otherwise your code 
-# will run approximately 5 times slower and the
-# profiling results will be overwhelmed by Rails
-# dependency loading mechanism
-config.cache_classes = true
-
-# Don't check template timestamps - once again this
-# is to avoid IO times overwhelming profile results
-config.action_view.cache_template_loading            = true
-
-# This is debatable, but turn off action controller
-# caching to see how long it really takes to run
-# queries and render templates
-config.action_controller.perform_caching             = false
-
-# Turn off most logging
-config.log_level = :info
\ No newline at end of file
diff --git a/rails/example/example_test.rb b/rails/example/example_test.rb
deleted file mode 100644
index 131f987..0000000
--- a/rails/example/example_test.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-require File.dirname(__FILE__) + '../profile_test_helper'
-
-class ExampleTest < Test::Unit::TestCase
-  include RubyProf::Test
-  
-  def test_stuff
-    puts "Test method"
-  end
-end   
diff --git a/rails/profile_test_helper.rb b/rails/profile_test_helper.rb
deleted file mode 100644
index 4692bd9..0000000
--- a/rails/profile_test_helper.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-# Load profile environment
-env = ENV["RAILS_ENV"] = "profile"
-require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
-
-# Load Rails testing infrastructure
-require 'test_help'
-
-# Now we can load test_helper since we've already loaded the
-# profile RAILS environment.
-require File.expand_path(File.join(RAILS_ROOT, 'test', 'test_helper'))
-
-# Reset the current environment back to profile
-# since test_helper reset it to test
-ENV["RAILS_ENV"] = env
-
-# Now load ruby-prof and away we go
-require 'ruby-prof'
-
-# Setup output directory to Rails tmp directory
-RubyProf::Test::PROFILE_OPTIONS[:output_dir] = 
-    File.expand_path(File.join(RAILS_ROOT, 'tmp', 'profile'))
diff --git a/ruby-prof.gemspec b/ruby-prof.gemspec
new file mode 100644
index 0000000..1298719
--- /dev/null
+++ b/ruby-prof.gemspec
@@ -0,0 +1,61 @@
+# -*- encoding: utf-8 -*-
+
+# Read version from header file
+version_header = File.read(File.expand_path('../ext/ruby_prof/version.h', __FILE__))
+#match = version_header.match(/RUBY_PROF_VERSION\s*"(\.+)"/)
+match = version_header.match(/RUBY_PROF_VERSION\s*"([^"]+)"/)
+raise(RuntimeError, "Could not determine RUBY_PROF_VERSION") if not match
+
+RUBY_PROF_VERSION = "#{match[1]}"
+
+Gem::Specification.new do |spec|
+  spec.name = "ruby-prof"
+
+  spec.homepage = "https://github.com/ruby-prof/ruby-prof/"
+  spec.summary = "Fast Ruby profiler"
+  spec.description = <<-EOF
+ruby-prof is a fast code profiler for Ruby. It is a C extension and
+therefore is many times faster than the standard Ruby profiler. It
+supports both flat and graph profiles.  For each method, graph profiles
+show how long the method ran, which methods called it and which
+methods it called. RubyProf generate both text and html and can output
+it to standard out or to a file.
+EOF
+
+  spec.version = RUBY_PROF_VERSION
+
+  spec.author = "Shugo Maeda, Charlie Savage, Roger Pack, Stefan Kaes"
+  spec.email = "shugo at ruby-lang.org, cfis at savagexi.com, rogerdpack at gmail.com, skaes at railsexpress.de"
+  spec.platform = Gem::Platform::RUBY
+  spec.require_path = "lib"
+  spec.bindir = "bin"
+  spec.executables = ["ruby-prof"]
+  spec.extensions = ["ext/ruby_prof/extconf.rb"]
+  spec.files = Dir['CHANGES',
+                   'LICENSE',
+                   'Rakefile',
+                   'README.rdoc',
+                   'ruby-prof.gemspec',
+                   'bin/ruby-prof',
+                   'doc/**/*',
+                   'examples/*',
+                   'ext/ruby_prof/extconf.rb',
+                   'ext/ruby_prof/*.c',
+                   'ext/ruby_prof/*.h',
+                   'ext/ruby_prof/vc/*.sln',
+                   'ext/ruby_prof/vc/*.vcxproj',
+                   'lib/ruby-prof.rb',
+                   'lib/unprof.rb',
+                   'lib/ruby-prof/*.rb',
+                   'lib/ruby-prof/images/*.png',
+                   'lib/ruby-prof/printers/*.rb',
+                   'test/*.rb']
+
+  spec.test_files = Dir["test/test_*.rb"]
+  spec.required_ruby_version = '>= 1.8.7'
+  spec.date = Time.now.strftime('%Y-%m-%d')
+  spec.homepage = 'https://github.com/rdp/ruby-prof'
+  spec.add_development_dependency('minitest', '~> 4.0')
+  spec.add_development_dependency('rake-compiler')
+  spec.add_development_dependency('rdoc')
+end
diff --git a/test/aggregate_test.rb b/test/aggregate_test.rb
index 87769e6..456d3a1 100755
--- a/test/aggregate_test.rb
+++ b/test/aggregate_test.rb
@@ -1,7 +1,7 @@
 #!/usr/bin/env ruby
+# encoding: UTF-8
 
-require 'test/unit'
-require 'ruby-prof'
+require File.expand_path('../test_helper', __FILE__)
 
 # Test data
 #   A   B   C
@@ -14,7 +14,7 @@ class AggClass
   def z
     sleep 1
   end
-  
+
   def a
     z
   end
@@ -24,7 +24,7 @@ class AggClass
   end
 
   def c
-   a
+    a
   end
 end
 
@@ -34,6 +34,21 @@ class AggregateTest < Test::Unit::TestCase
     RubyProf::measure_mode = RubyProf::WALL_TIME
   end
 
+  def test_all_call_infos_are_not_recursive
+    c1 = AggClass.new
+    result = RubyProf.profile do
+      c1.a
+      c1.b
+      c1.c
+    end
+    methods = result.threads.first.methods.sort.reverse
+    methods.each do |m|
+      m.call_infos.each do |ci|
+        assert(!ci.recursive)
+      end
+    end
+  end
+
   def test_call_infos
     c1 = AggClass.new
     result = RubyProf.profile do
@@ -42,16 +57,16 @@ class AggregateTest < Test::Unit::TestCase
       c1.c
     end
 
-    methods = result.threads.values.first.sort.reverse
-    method = methods.find {|method| method.full_name == 'AggClass#z'}
+    methods = result.threads.first.methods.sort.reverse
+    method = methods.find {|meth| meth.full_name == 'AggClass#z'}
 
     # Check AggClass#z
     assert_equal('AggClass#z', method.full_name)
     assert_equal(3, method.called)
-    assert_in_delta(3, method.total_time, 0.01)
-    assert_in_delta(0, method.wait_time, 0.01)
-    assert_in_delta(0, method.self_time, 0.01)
-    assert_in_delta(3, method.children_time, 0.01)
+    assert_in_delta(3, method.total_time, 0.05)
+    assert_in_delta(0, method.wait_time, 0.05)
+    assert_in_delta(0, method.self_time, 0.05)
+    assert_in_delta(3, method.children_time, 0.05)
     assert_equal(3, method.call_infos.length)
 
     call_info = method.call_infos[0]
@@ -75,8 +90,8 @@ class AggregateTest < Test::Unit::TestCase
       c1.c
     end
 
-    methods = result.threads.values.first.sort.reverse
-    method = methods.find {|method| method.full_name == 'AggClass#z'}
+    methods = result.threads.first.methods.sort.reverse
+    method = methods.find {|meth| meth.full_name == 'AggClass#z'}
 
     # Check AggClass#z
     assert_equal('AggClass#z', method.full_name)
@@ -86,10 +101,10 @@ class AggregateTest < Test::Unit::TestCase
 
     call_info = call_infos.first
     assert_equal('AggClass#a', call_info.parent.target.full_name)
-    assert_in_delta(3, call_info.total_time, 0.01)
-    assert_in_delta(0, call_info.wait_time, 0.01)
-    assert_in_delta(0, call_info.self_time, 0.01)
-    assert_in_delta(3, call_info.children_time, 0.01)
+    assert_in_delta(3, call_info.total_time, 0.05)
+    assert_in_delta(0, call_info.wait_time, 0.05)
+    assert_in_delta(0, call_info.self_time, 0.05)
+    assert_in_delta(3, call_info.children_time, 0.05)
     assert_equal(3, call_info.called)
   end
 
@@ -101,8 +116,8 @@ class AggregateTest < Test::Unit::TestCase
       c1.c
     end
 
-    methods = result.threads.values.first.sort.reverse
-    method = methods.find {|method| method.full_name == 'AggClass#a'}
+    methods = result.threads.first.methods.sort.reverse
+    method = methods.find {|meth| meth.full_name == 'AggClass#a'}
 
     # Check AggClass#a
     assert_equal('AggClass#a', method.full_name)
@@ -112,10 +127,10 @@ class AggregateTest < Test::Unit::TestCase
 
     call_info = call_infos.first
     assert_equal('AggClass#z', call_info.target.full_name)
-    assert_in_delta(3, call_info.total_time, 0.01)
-    assert_in_delta(0, call_info.wait_time, 0.01)
-    assert_in_delta(0, call_info.self_time, 0.01)
-    assert_in_delta(3, call_info.children_time, 0.01)
+    assert_in_delta(3, call_info.total_time, 0.05)
+    assert_in_delta(0, call_info.wait_time, 0.05)
+    assert_in_delta(0, call_info.self_time, 0.05)
+    assert_in_delta(3, call_info.children_time, 0.05)
     assert_equal(3, call_info.called)
   end
-end
\ No newline at end of file
+end
diff --git a/test/basic_test.rb b/test/basic_test.rb
index e3d19cf..e697c6d 100755
--- a/test/basic_test.rb
+++ b/test/basic_test.rb
@@ -1,54 +1,7 @@
 #!/usr/bin/env ruby
+# encoding: UTF-8
 
-require 'test/unit'
-require 'ruby-prof'
-
-class C1
-  def C1.hello
-    sleep(0.1)
-  end
-  
-  def hello
-    sleep(0.2)
-  end
-end
-
-module M1
-  def hello
-    sleep(0.3)
-  end
-end
-
-class C2
-  include M1
-  extend M1
-end
-
-class C3
-  def hello
-    sleep(0.4)
-  end
-end
-
-module M4
-  def hello
-    sleep(0.5)
-  end
-end
-
-module M5
-  include M4
-  def goodbye
-    hello
-  end
-end
-
-class C6
-  include M5
-  def test
-    goodbye
-  end
-end
+require File.expand_path('../test_helper', __FILE__)
 
 class BasicTest < Test::Unit::TestCase
   def setup
@@ -56,6 +9,11 @@ class BasicTest < Test::Unit::TestCase
     RubyProf::measure_mode = RubyProf::WALL_TIME
   end
 
+  def start
+    RubyProf.start
+    RubyProf::C1.hello
+  end
+
   def test_running
     assert(!RubyProf.running?)
     RubyProf.start
@@ -69,12 +27,6 @@ class BasicTest < Test::Unit::TestCase
     assert_raise(RuntimeError) do
       RubyProf.start
     end
-
-    assert_raise(RuntimeError) do
-      RubyProf.profile do
-        puts 1
-      end
-    end
     RubyProf.stop
   end
 
@@ -84,200 +36,93 @@ class BasicTest < Test::Unit::TestCase
     end
   end
 
-  def test_class_methods
-    result = RubyProf.profile do
-      C1.hello
+  def test_traceback
+    RubyProf.start
+    assert_raise(NoMethodError) do
+      RubyProf.xxx
     end
 
-    # Length should be 3:
-    #   BasicTest#test_class_methods
-    #   <Class::C1>#hello
-    #   Kernel#sleep
-
-    methods = result.threads.values.first.sort.reverse
-    assert_equal(3, methods.length)
-
-    # Check the names
-    assert_equal('BasicTest#test_class_methods', methods[0].full_name)
-    assert_equal('<Class::C1>#hello', methods[1].full_name)
-    assert_equal('Kernel#sleep', methods[2].full_name)
-
-    # Check times
-    assert_in_delta(0.1, methods[0].total_time, 0.01)
-    assert_in_delta(0, methods[0].wait_time, 0.01)
-    assert_in_delta(0, methods[0].self_time, 0.01)
-
-    assert_in_delta(0.1, methods[1].total_time, 0.01)
-    assert_in_delta(0, methods[1].wait_time, 0.01)
-    assert_in_delta(0, methods[1].self_time, 0.01)
-
-    assert_in_delta(0.1, methods[2].total_time, 0.01)
-    assert_in_delta(0, methods[2].wait_time, 0.01)
-    assert_in_delta(0.1, methods[2].self_time, 0.01)
+    RubyProf.stop
   end
 
-  def test_instance_methods
-    result = RubyProf.profile do
-      C1.new.hello
-    end
+  def test_leave_method
+    start
+    sleep 0.15
+    profile = RubyProf.stop
 
-    # Methods called
-    #   BasicTest#test_instance_methods
-    #   Class.new
-    #   Class:Object#allocate
-    #   for Object#initialize
-    #   C1#hello
-    #   Kernel#sleep
+    assert_equal(1, profile.threads.count)
 
-    methods = result.threads.values.first.sort.reverse
-    assert_equal(6, methods.length)
+    thread = profile.threads.first
+    assert_in_delta(0.25, thread.total_time, 0.01)
 
-    assert_equal('BasicTest#test_instance_methods', methods[0].full_name)
-    assert_equal('C1#hello', methods[1].full_name)
-    assert_equal('Kernel#sleep', methods[2].full_name)
-    assert_equal('Class#new', methods[3].full_name)
-    assert_equal('<Class::Object>#allocate', methods[4].full_name)
-    assert_equal('Object#initialize', methods[5].full_name)
+    top_methods = thread.top_methods.sort
+    assert_equal(2, top_methods.count)
+    assert_equal("BasicTest#start", top_methods[0].full_name)
+    assert_equal("BasicTest#test_leave_method", top_methods[1].full_name)
 
-    # Check times
-    assert_in_delta(0.2, methods[0].total_time, 0.01)
-    assert_in_delta(0, methods[0].wait_time, 0.01)
-    assert_in_delta(0, methods[0].self_time, 0.01)
-
-    assert_in_delta(0.2, methods[1].total_time, 0.01)
-    assert_in_delta(0, methods[1].wait_time, 0.01)
-    assert_in_delta(0, methods[1].self_time, 0.01)
+    assert_equal(4, thread.methods.length)
+    methods = profile.threads.first.methods.sort
 
-    assert_in_delta(0.2, methods[2].total_time, 0.01)
-    assert_in_delta(0, methods[2].wait_time, 0.01)
-    assert_in_delta(0.2, methods[2].self_time, 0.01)
+    # Check times
+    assert_equal("<Class::RubyProf::C1>#hello", methods[0].full_name)
+    assert_in_delta(0.1, methods[0].total_time, 0.01)
+    assert_in_delta(0.0,  methods[0].wait_time, 0.01)
+    assert_in_delta(0.0,  methods[0].self_time, 0.01)
 
-    assert_in_delta(0, methods[3].total_time, 0.01)
-    assert_in_delta(0, methods[3].wait_time, 0.01)
-    assert_in_delta(0, methods[3].self_time, 0.01)
+    assert_equal("BasicTest#start", methods[1].full_name)
+    assert_in_delta(0.1, methods[1].total_time, 0.01)
+    assert_in_delta(0.0, methods[1].wait_time, 0.01)
+    assert_in_delta(0.0, methods[1].self_time, 0.01)
 
-    assert_in_delta(0, methods[4].total_time, 0.01)
-    assert_in_delta(0, methods[4].wait_time, 0.01)
-    assert_in_delta(0, methods[4].self_time, 0.01)
+    assert_equal("BasicTest#test_leave_method", methods[2].full_name)
+    assert_in_delta(0.15, methods[2].total_time, 0.01)
+    assert_in_delta(0.0, methods[2].wait_time, 0.01)
+    assert_in_delta(0.0, methods[2].self_time, 0.01)
 
-    assert_in_delta(0, methods[5].total_time, 0.01)
-    assert_in_delta(0, methods[5].wait_time, 0.01)
-    assert_in_delta(0, methods[5].self_time, 0.01)
+    assert_equal("Kernel#sleep", methods[3].full_name)
+    assert_in_delta(0.25, methods[3].total_time, 0.01)
+    assert_in_delta(0.0, methods[3].wait_time, 0.01)
+    assert_in_delta(0.25, methods[3].self_time, 0.01)
   end
 
-  def test_module_methods
-    result = RubyProf.profile do
-      C2.hello
-    end
-
-    # Methods:
-    #   BasicTest#test_module_methods
-    #   M1#hello
-    #   Kernel#sleep
-
-    methods = result.threads.values.first.sort.reverse
-    assert_equal(3, methods.length)
+  def test_leave_method_2
+    start
+    RubyProf::C1.hello
+    RubyProf::C1.hello
+    profile = RubyProf.stop
 
-    assert_equal('BasicTest#test_module_methods', methods[0].full_name)
-    assert_equal('M1#hello', methods[1].full_name)
-    assert_equal('Kernel#sleep', methods[2].full_name)
+    assert_equal(1, profile.threads.count)
 
-    # Check times
-    assert_in_delta(0.3, methods[0].total_time, 0.01)
-    assert_in_delta(0, methods[0].wait_time, 0.01)
-    assert_in_delta(0, methods[0].self_time, 0.01)
+    thread = profile.threads.first
+    assert_in_delta(0.3, thread.total_time, 0.01)
 
-    assert_in_delta(0.3, methods[1].total_time, 0.01)
-    assert_in_delta(0, methods[1].wait_time, 0.01)
-    assert_in_delta(0, methods[1].self_time, 0.01)
+    top_methods = thread.top_methods.sort
+    assert_equal(2, top_methods.count)
+    assert_equal("BasicTest#start", top_methods[0].full_name)
+    assert_equal("BasicTest#test_leave_method_2", top_methods[1].full_name)
 
-    assert_in_delta(0.3, methods[2].total_time, 0.01)
-    assert_in_delta(0, methods[2].wait_time, 0.01)
-    assert_in_delta(0.3, methods[2].self_time, 0.01)
-  end
-
-  def test_module_instance_methods
-    result = RubyProf.profile do
-      C2.new.hello
-    end
-
-    # Methods:
-    #   BasicTest#test_module_instance_methods
-    #   Class#new
-    #   <Class::Object>#allocate
-    #   Object#initialize
-    #   M1#hello
-    #   Kernel#sleep
-
-    methods = result.threads.values.first.sort.reverse
-    assert_equal(6, methods.length)
-
-    assert_equal('BasicTest#test_module_instance_methods', methods[0].full_name)
-    assert_equal('M1#hello', methods[1].full_name)
-    assert_equal('Kernel#sleep', methods[2].full_name)
-    assert_equal('Class#new', methods[3].full_name)
-    assert_equal('<Class::Object>#allocate', methods[4].full_name)
-    assert_equal('Object#initialize', methods[5].full_name)
+    assert_equal(4, thread.methods.length)
+    methods = profile.threads.first.methods.sort
 
     # Check times
-    assert_in_delta(0.3, methods[0].total_time, 0.01)
-    assert_in_delta(0, methods[0].wait_time, 0.01)
-    assert_in_delta(0, methods[0].self_time, 0.01)
+    assert_equal("BasicTest#start", methods[0].full_name)
+    assert_in_delta(0.1, methods[0].total_time, 0.01)
+    assert_in_delta(0.0, methods[0].wait_time, 0.01)
+    assert_in_delta(0.0, methods[0].self_time, 0.01)
 
-    assert_in_delta(0.3, methods[1].total_time, 0.01)
-    assert_in_delta(0, methods[1].wait_time, 0.01)
-    assert_in_delta(0, methods[1].self_time, 0.01)
+    assert_equal("BasicTest#test_leave_method_2", methods[1].full_name)
+    assert_in_delta(0.2, methods[1].total_time, 0.01)
+    assert_in_delta(0.0, methods[1].wait_time, 0.01)
+    assert_in_delta(0.0, methods[1].self_time, 0.01)
 
+    assert_equal("Kernel#sleep", methods[2].full_name)
     assert_in_delta(0.3, methods[2].total_time, 0.01)
-    assert_in_delta(0, methods[2].wait_time, 0.01)
+    assert_in_delta(0.0, methods[2].wait_time, 0.01)
     assert_in_delta(0.3, methods[2].self_time, 0.01)
 
-    assert_in_delta(0, methods[3].total_time, 0.01)
-    assert_in_delta(0, methods[3].wait_time, 0.01)
-    assert_in_delta(0, methods[3].self_time, 0.01)
-
-    assert_in_delta(0, methods[4].total_time, 0.01)
-    assert_in_delta(0, methods[4].wait_time, 0.01)
-    assert_in_delta(0, methods[4].self_time, 0.01)
-
-    assert_in_delta(0, methods[5].total_time, 0.01)
-    assert_in_delta(0, methods[5].wait_time, 0.01)
-    assert_in_delta(0, methods[5].self_time, 0.01)
-  end
-
-  def test_singleton
-    c3 = C3.new
-
-    class << c3
-      def hello
-      end
-    end
-
-    result = RubyProf.profile do
-      c3.hello
-    end
-
-    methods = result.threads.values.first.sort.reverse
-    assert_equal(2, methods.length)
-
-    assert_equal('BasicTest#test_singleton', methods[0].full_name)
-    assert_equal('<Object::C3>#hello', methods[1].full_name)
-
-    assert_in_delta(0, methods[0].total_time, 0.01)
-    assert_in_delta(0, methods[0].wait_time, 0.01)
-    assert_in_delta(0, methods[0].self_time, 0.01)
-
-    assert_in_delta(0, methods[1].total_time, 0.01)
-    assert_in_delta(0, methods[1].wait_time, 0.01)
-    assert_in_delta(0, methods[1].self_time, 0.01)
-  end
-
-  def test_traceback
-    RubyProf.start
-    assert_raise(NoMethodError) do
-      RubyProf.xxx
-    end
-
-    RubyProf.stop
+    assert_equal("<Class::RubyProf::C1>#hello", methods[3].full_name)
+    assert_in_delta(0.3, methods[3].total_time, 0.01)
+    assert_in_delta(0.0, methods[3].wait_time, 0.01)
+    assert_in_delta(0.0, methods[3].self_time, 0.01)
   end
 end
\ No newline at end of file
diff --git a/test/call_info_test.rb b/test/call_info_test.rb
new file mode 100644
index 0000000..5914da4
--- /dev/null
+++ b/test/call_info_test.rb
@@ -0,0 +1,78 @@
+#!/usr/bin/env ruby
+# encoding: UTF-8
+
+require File.expand_path('../test_helper', __FILE__)
+
+class CallInfoTest < Test::Unit::TestCase
+  def setup
+    # Need to use wall time for this test due to the sleep calls
+    RubyProf::measure_mode = RubyProf::WALL_TIME
+  end
+
+#  def test_clone
+#    result = RubyProf.profile do
+#      RubyProf::C1.hello
+#    end
+#
+#    method = result.threads.first.top_methods.first
+#    call_info = method.call_infos.first
+#    call_info_clone = call_info.clone
+#
+##    assert_equal(call_info.target, call_info_clone.target)
+#    assert_equal(call_info.total_time, call_info_clone.total_time)
+#  end
+
+  def test_merge
+    result1 = RubyProf.profile do
+      RubyProf::C1.hello
+    end
+
+    methods = result1.threads.first.methods.sort.reverse
+    assert_equal(3, methods.length)
+
+    assert_equal('CallInfoTest#test_merge', methods[0].full_name)
+    assert_in_delta(0.1, methods[0].total_time, 0.01)
+    assert_in_delta(0, methods[0].wait_time, 0.01)
+    assert_in_delta(0, methods[0].self_time, 0.01)
+    assert_equal(1, methods[0].called)
+
+    assert_equal('<Class::RubyProf::C1>#hello', methods[1].full_name)
+    assert_in_delta(0.1, methods[1].total_time, 0.01)
+    assert_in_delta(0, methods[1].wait_time, 0.01)
+    assert_in_delta(0, methods[1].self_time, 0.01)
+    assert_equal(1, methods[1].called)
+
+    assert_equal('Kernel#sleep', methods[2].full_name)
+    assert_in_delta(0.1, methods[2].total_time, 0.01)
+    assert_in_delta(0, methods[2].wait_time, 0.01)
+    assert_in_delta(0.1, methods[2].self_time, 0.01)
+    assert_equal(1, methods[2].called)
+
+    result2 = RubyProf.profile do
+      RubyProf::C1.hello
+    end
+
+    # Merge the trees
+    methods = result1.threads.first.methods.sort.reverse
+    assert_equal(3, methods.length)
+
+    assert_equal('CallInfoTest#test_merge', methods[0].full_name)
+    assert_in_delta(0.1, methods[0].total_time, 0.01)
+    assert_in_delta(0, methods[0].wait_time, 0.01)
+    assert_in_delta(0, methods[0].self_time, 0.01)
+    assert_equal(1, methods[0].called)
+
+    assert_equal('<Class::RubyProf::C1>#hello', methods[1].full_name)
+    assert_in_delta(0.1, methods[1].total_time, 0.01)
+    assert_in_delta(0, methods[1].wait_time, 0.01)
+    assert_in_delta(0, methods[1].self_time, 0.01)
+    assert_equal(1, methods[1].called)
+
+    assert_equal('Kernel#sleep', methods[2].full_name)
+    assert_in_delta(0.1, methods[2].total_time, 0.01)
+    assert_in_delta(0, methods[2].wait_time, 0.01)
+    assert_in_delta(0.1, methods[2].self_time, 0.01)
+    assert_equal(1, methods[2].called)
+  end
+end
+
diff --git a/test/call_info_visitor_test.rb b/test/call_info_visitor_test.rb
new file mode 100644
index 0000000..35b274f
--- /dev/null
+++ b/test/call_info_visitor_test.rb
@@ -0,0 +1,31 @@
+#!/usr/bin/env ruby
+# encoding: UTF-8
+
+require File.expand_path('../test_helper', __FILE__)
+
+class CallInfoVisitorTest < Test::Unit::TestCase
+  def setup
+    # Need to use wall time for this test due to the sleep calls
+    RubyProf::measure_mode = RubyProf::WALL_TIME
+  end
+
+  def test_visit
+    result = RubyProf.profile do
+      RubyProf::C1.hello
+    end
+
+    visitor = RubyProf::CallInfoVisitor.new(result.threads.first)
+
+    method_names = Array.new
+
+    visitor.visit do |call_info, event|
+      method_names << call_info.target.full_name if event == :enter
+    end
+
+    assert_equal(3, method_names.length)
+    assert_equal("CallInfoVisitorTest#test_visit", method_names[0])
+    assert_equal("<Class::RubyProf::C1>#hello", method_names[1])
+    assert_equal("Kernel#sleep", method_names[2])
+  end
+end
+
diff --git a/test/duplicate_names_test.rb b/test/duplicate_names_test.rb
index 172ff3f..29a9398 100755
--- a/test/duplicate_names_test.rb
+++ b/test/duplicate_names_test.rb
@@ -1,7 +1,7 @@
 #!/usr/bin/env ruby
+# encoding: UTF-8
 
-require 'test/unit'
-require 'ruby-prof'
+require File.expand_path('../test_helper', __FILE__)
 
 class DuplicateNames < Test::Unit::TestCase
   def test_names
@@ -19,10 +19,10 @@ class DuplicateNames < Test::Unit::TestCase
       eval str
       Foo::Bar.new.foo
     end
-    
+
     # There should be 3 foo methods
-    methods = result.threads.values.first.sort.reverse
-    
+    methods = result.threads.first.methods.sort.reverse
+
     methods = methods.select do |method|
       method.full_name == 'DuplicateNames::Foo::Bar#foo'
     end
diff --git a/test/dynamic_method_test.rb b/test/dynamic_method_test.rb
new file mode 100755
index 0000000..56fc876
--- /dev/null
+++ b/test/dynamic_method_test.rb
@@ -0,0 +1,74 @@
+#!/usr/bin/env ruby
+# encoding: UTF-8
+
+require File.expand_path("../test_helper", __FILE__)
+
+class DynamicMethodTest < Test::Unit::TestCase
+  def setup
+    # Need to use wall time for this test due to the sleep calls
+    RubyProf::measure_mode = RubyProf::WALL_TIME
+  end
+
+  def test_dynamic_method
+    result = RubyProf.profile do
+      1.times {RubyProf::C1.new.hello}
+    end
+
+    # Methods called
+    #  Kernel#sleep
+    #  <Class::BasicObject>#allocate
+    #  #{RubyProf.parent_object}#inizialize
+    #  RubyProf::C1#hello
+    #  Class#new
+    #  Integer#times
+    #  DynamicMethodTest#test_dynamic_method
+
+    methods = result.threads.first.methods.sort.reverse
+    assert_equal(RubyProf.ruby_2? ? 6 : 7, methods.length)
+
+    # Check times
+    assert_equal("DynamicMethodTest#test_dynamic_method", methods[0].full_name)
+    assert_in_delta(0.2, methods[0].total_time, 0.02)
+    assert_in_delta(0.0, methods[0].wait_time, 0.02)
+    assert_in_delta(0.0, methods[0].self_time, 0.02)
+
+    assert_equal("Integer#times", methods[1].full_name)
+    assert_in_delta(0.2, methods[1].total_time, 0.02)
+    assert_in_delta(0.0, methods[1].wait_time, 0.02)
+    assert_in_delta(0.0, methods[1].self_time, 0.02)
+
+    assert_equal("RubyProf::C1#hello", methods[2].full_name)
+    assert_in_delta(0.2, methods[2].total_time, 0.02)
+    assert_in_delta(0.0, methods[2].wait_time, 0.02)
+    assert_in_delta(0.0, methods[2].self_time, 0.02)
+
+    assert_equal("Kernel#sleep", methods[3].full_name)
+    assert_in_delta(0.2, methods[3].total_time, 0.01)
+    assert_in_delta(0.0, methods[3].wait_time, 0.01)
+    assert_in_delta(0.2, methods[3].self_time, 0.01)
+
+    assert_equal("Class#new", methods[4].full_name)
+    assert_in_delta(0.0, methods[4].total_time, 0.01)
+    assert_in_delta(0.0, methods[4].wait_time, 0.01)
+    assert_in_delta(0.0, methods[4].self_time, 0.01)
+
+    # the timing difference between #initialize and #allocate is so small
+    # that we cannot rely on #initialize appearing first.
+    # so switch them, if necessary
+    if methods[5].full_name =~ /#allocate/
+      methods[5], methods[6] = methods[6], methods[5]
+    end
+
+    assert_equal("#{RubyProf.parent_object}#initialize", methods[5].full_name)
+    assert_in_delta(0.0, methods[5].total_time, 0.01)
+    assert_in_delta(0.0, methods[5].wait_time, 0.01)
+    assert_in_delta(0.0, methods[5].self_time, 0.01)
+
+    unless RubyProf.ruby_2?
+      assert_equal("<Class::#{RubyProf.parent_object}>#allocate", methods[6].full_name)
+      assert_in_delta(0.0, methods[6].total_time, 0.01)
+      assert_in_delta(0.0, methods[6].wait_time, 0.01)
+      assert_in_delta(0.0, methods[6].self_time, 0.01)
+    end
+  end
+end
diff --git a/test/enumerable_test.rb b/test/enumerable_test.rb
new file mode 100755
index 0000000..1757a3b
--- /dev/null
+++ b/test/enumerable_test.rb
@@ -0,0 +1,16 @@
+#!/usr/bin/env ruby
+# encoding: UTF-8
+
+require File.expand_path('../test_helper', __FILE__)
+
+# --  Test for bug
+# http://github.com/rdp/ruby-prof/issues#issue/12
+
+class EnumerableTest < Test::Unit::TestCase
+  def test_enumerable
+    result = RubyProf.profile do
+      3.times {  [1,2,3].any? {|n| n} }
+    end
+    assert_equal(result.threads.first.methods.length, 4)
+  end
+end
diff --git a/test/exceptions_test.rb b/test/exceptions_test.rb
index 5116c8b..983faca 100755
--- a/test/exceptions_test.rb
+++ b/test/exceptions_test.rb
@@ -1,15 +1,16 @@
 #!/usr/bin/env ruby
-require 'test/unit'
-require 'ruby-prof'
+# encoding: UTF-8
+
+require File.expand_path('../test_helper', __FILE__)
 
 class ExceptionsTest < Test::Unit::TestCase
   def test_profile
     result = begin
-      RubyProf.profile do 
+      RubyProf.profile do
         raise(RuntimeError, 'Test error')
       end
-    rescue => e
-    end    
+    rescue
+    end
     assert_not_nil(result)
   end
 end
diff --git a/test/exclude_threads_test.rb b/test/exclude_threads_test.rb
index 4c2fdb3..46612e0 100755
--- a/test/exclude_threads_test.rb
+++ b/test/exclude_threads_test.rb
@@ -1,54 +1,54 @@
 #!/usr/bin/env ruby
+# encoding: UTF-8
 
-require 'test/unit'
-require 'ruby-prof'
+require File.expand_path('../test_helper', __FILE__)
 
 
 # --  Tests ----
 class ExcludeThreadsTest < Test::Unit::TestCase
-  def test_exclude_threads
-
-    def thread1_proc
-      sleep(0.5)
-      sleep(2)
-    end
-
-    def thread2_proc
-      sleep(0.5)
-      sleep(2)
-    end
-        
-    thread1 = Thread.new do 
-      thread1_proc
-    end
-
-    thread2 = Thread.new do
-      thread2_proc
-    end
-
-    RubyProf::exclude_threads = [ thread2 ]
- 
-    RubyProf.start
-
-    thread1.join
-    thread2.join
-
-    result = RubyProf.stop
-
-    RubyProf::exclude_threads = nil
-
-    assert_equal(2, result.threads.length)
-
-    output = Array.new
-    result.threads.each do | thread_id, methods |
-      methods.each do | m |
-        if m.full_name.index("ExcludeThreadsTest#thread") == 0
-          output.push(m.full_name)
-        end
-      end
-    end
-
-    assert_equal(1, output.length)
-    assert_equal("ExcludeThreadsTest#thread1_proc", output[0])
+  def test_exclude_threads
+
+    def thread1_proc
+      sleep(0.5)
+      sleep(2)
+    end
+
+    def thread2_proc
+      sleep(0.5)
+      sleep(2)
+    end
+
+    thread1 = Thread.new do
+      thread1_proc
+    end
+
+    thread2 = Thread.new do
+      thread2_proc
+    end
+
+    RubyProf::exclude_threads = [ thread2 ]
+
+    RubyProf.start
+
+    thread1.join
+    thread2.join
+
+    result = RubyProf.stop
+
+    RubyProf::exclude_threads = nil
+
+    assert_equal(2, result.threads.length)
+
+    output = Array.new
+    result.threads.each do |thread|
+      thread.methods.each do | m |
+        if m.full_name.index("ExcludeThreadsTest#thread") == 0
+          output.push(m.full_name)
+        end
+      end
+    end
+
+    assert_equal(1, output.length)
+    assert_equal("ExcludeThreadsTest#thread1_proc", output[0])
   end
-end
\ No newline at end of file
+end
diff --git a/test/exec_test.rb b/test/exec_test.rb
new file mode 100755
index 0000000..137a883
--- /dev/null
+++ b/test/exec_test.rb
@@ -0,0 +1,14 @@
+#!/usr/bin/env ruby
+# encoding: UTF-8
+
+require File.expand_path('../test_helper', __FILE__)
+
+# --  Test for bug when it loads with no frames
+
+class ExecTest < Test::Unit::TestCase
+  def test_being_able_to_run_its_binary
+    Dir.chdir(File.dirname(__FILE__)) do
+      assert system(OS.ruby_bin + " ruby-prof-bin do_nothing.rb")
+    end
+  end
+end
diff --git a/test/fiber_test.rb b/test/fiber_test.rb
new file mode 100755
index 0000000..216f9fb
--- /dev/null
+++ b/test/fiber_test.rb
@@ -0,0 +1,65 @@
+#!/usr/bin/env ruby
+# encoding: UTF-8
+
+require File.expand_path('../test_helper', __FILE__)
+require 'timeout'
+require 'set'
+begin
+  require 'fiber'
+rescue LoadError
+end
+
+# --  Tests ----
+class FiberTest < Test::Unit::TestCase
+
+  def fiber_test
+    @fiber_ids << Fiber.current.object_id
+    enum = Enumerator.new do |yielder|
+        [1,2].each do |x|
+          @fiber_ids << Fiber.current.object_id
+          sleep 0.1
+          yielder.yield x
+        end
+      end
+    while true
+      begin
+        x = enum.next
+      rescue StopIteration
+        break
+      end
+    end
+    sleep 0.1
+  end
+
+  def setup
+    # Need to use wall time for this test due to the sleep calls
+    RubyProf::measure_mode = RubyProf::WALL_TIME
+    @fiber_ids  = Set.new
+    @root_fiber = Fiber.current.object_id
+    @thread_id  = Thread.current.object_id
+    @result     = RubyProf.profile { fiber_test }
+  end
+
+  def test_fibers
+    profiled_fiber_ids = @result.threads.map(&:fiber_id)
+    assert_equal(2, @result.threads.length)
+    assert_equal([@thread_id], @result.threads.map(&:id).uniq)
+    assert_equal(@fiber_ids, Set.new(profiled_fiber_ids))
+
+    assert profiled_fiber_ids.include?(@root_fiber)
+    assert(root_fiber_profile = @result.threads.detect{|t| t.fiber_id == @root_fiber})
+    assert(enum_fiber_profile = @result.threads.detect{|t| t.fiber_id != @root_fiber})
+
+    assert_in_delta(0.3, root_fiber_profile.total_time, 0.01)
+    assert_in_delta(0.2, enum_fiber_profile.total_time, 0.01)
+
+    assert(method_next = root_fiber_profile.methods.detect{|m| m.full_name == "Enumerator#next"})
+    assert(method_each = enum_fiber_profile.methods.detect{|m| m.full_name == "Enumerator#each"})
+
+    assert_in_delta(0.2, method_next.total_time, 0.01)
+    assert_in_delta(0.2, method_each.total_time, 0.01)
+
+    # RubyProf::CallInfoPrinter.new(@result).print
+  end
+
+end if RUBY_VERSION >= "1.9"
diff --git a/test/line_number_test.rb b/test/line_number_test.rb
index 8742f44..6584f89 100755
--- a/test/line_number_test.rb
+++ b/test/line_number_test.rb
@@ -1,18 +1,16 @@
 #!/usr/bin/env ruby
-require 'test/unit'
-require 'ruby-prof'
-require 'prime'
+# encoding: UTF-8
+
+require File.expand_path('../test_helper', __FILE__)
 
 class LineNumbers
   def method1
-    a = 3
   end
-  
+
   def method2
-    a = 3
     method1
   end
-  
+
   def method3
     sleep(1)
   end
@@ -22,35 +20,35 @@ end
 class LineNumbersTest < Test::Unit::TestCase
   def test_function_line_no
     numbers = LineNumbers.new
-    
+
     result = RubyProf.profile do
       numbers.method2
     end
 
-    methods = result.threads.values.first.sort.reverse
+    methods = result.threads.first.methods.sort.reverse
     assert_equal(3, methods.length)
-    
+
     method = methods[0]
     assert_equal('LineNumbersTest#test_function_line_no', method.full_name)
-    assert_equal(27, method.line)
-    
+    assert_equal(25, method.line)
+
     method = methods[1]
     assert_equal('LineNumbers#method2', method.full_name)
-    assert_equal(11, method.line)
-    
+    assert_equal(10, method.line)
+
     method = methods[2]
     assert_equal('LineNumbers#method1', method.full_name)
     assert_equal(7, method.line)
   end
-  
+
   def test_c_function
     numbers = LineNumbers.new
-    
+
     result = RubyProf.profile do
       numbers.method3
     end
 
-    methods = result.threads.values.first.sort_by {|method| method.full_name}
+    methods = result.threads.first.methods.sort_by {|method| method.full_name}
     assert_equal(3, methods.length)
 
     # Methods:
@@ -61,13 +59,13 @@ class LineNumbersTest < Test::Unit::TestCase
     method = methods[0]
     assert_equal('Kernel#sleep', method.full_name)
     assert_equal(0, method.line)
-    
+
     method = methods[1]
     assert_equal('LineNumbers#method3', method.full_name)
-    assert_equal(16, method.line)
-    
+    assert_equal(14, method.line)
+
     method = methods[2]
     assert_equal('LineNumbersTest#test_c_function', method.full_name)
-    assert_equal(50, method.line)
+    assert_equal(48, method.line)
   end
-end
\ No newline at end of file
+end
diff --git a/test/measure_allocations_test.rb b/test/measure_allocations_test.rb
new file mode 100644
index 0000000..eb28c82
--- /dev/null
+++ b/test/measure_allocations_test.rb
@@ -0,0 +1,25 @@
+#!/usr/bin/env ruby
+# encoding: UTF-8
+
+require File.expand_path('../test_helper', __FILE__)
+
+class MeasureAllocationsTest < Test::Unit::TestCase
+  def test_allocations_mode
+    RubyProf::measure_mode = RubyProf::ALLOCATIONS
+    assert_equal(RubyProf::ALLOCATIONS, RubyProf::measure_mode)
+  end
+
+  def test_allocations_enabled_defined
+    assert(defined?(RubyProf::ALLOCATIONS_ENABLED))
+  end
+
+  if RubyProf::ALLOCATIONS_ENABLED
+    def test_allocations
+      t = RubyProf.measure_allocations
+      assert_kind_of Integer, t
+
+      u = RubyProf.measure_allocations
+      assert u > t, [t, u].inspect
+    end
+  end
+end
diff --git a/test/measure_cpu_time_test.rb b/test/measure_cpu_time_test.rb
new file mode 100644
index 0000000..b8146da
--- /dev/null
+++ b/test/measure_cpu_time_test.rb
@@ -0,0 +1,220 @@
+#!/usr/bin/env ruby
+# encoding: UTF-8
+
+require File.expand_path('../test_helper', __FILE__)
+
+class MeasureCpuTimeTest < Test::Unit::TestCase
+  def setup
+    # Need to use wall time for this test due to the sleep calls
+    RubyProf::measure_mode = RubyProf::CPU_TIME
+  end
+
+  def test_mode
+    RubyProf::measure_mode = RubyProf::CPU_TIME
+    assert_equal(RubyProf::CPU_TIME, RubyProf::measure_mode)
+  end
+
+  def test_cpu_time_enabled_defined
+    assert(defined?(RubyProf::CPU_TIME_ENABLED))
+  end
+
+  def test_class_methods
+    result = RubyProf.profile do
+      RubyProf::C1.hello
+    end
+
+    # Length should be 3:
+    #   MeasureCpuTimeTest#test_class_methods
+    #   <Class::RubyProf::C1>#hello
+    #   Kernel#sleep
+
+    methods = result.threads.first.methods.sort.reverse
+    assert_equal(3, methods.length)
+
+    # Check the names
+    assert_equal('MeasureCpuTimeTest#test_class_methods', methods[0].full_name)
+    assert_equal('<Class::RubyProf::C1>#hello', methods[1].full_name)
+    assert_equal('Kernel#sleep', methods[2].full_name)
+
+    # Check times
+    assert_in_delta(0.1, methods[0].total_time, 0.01)
+    assert_in_delta(0, methods[0].wait_time, 0.01)
+    assert_in_delta(0, methods[0].self_time, 0.01)
+
+    assert_in_delta(0.1, methods[1].total_time, 0.01)
+    assert_in_delta(0, methods[1].wait_time, 0.01)
+    assert_in_delta(0, methods[1].self_time, 0.01)
+
+    assert_in_delta(0.1, methods[2].total_time, 0.01)
+    assert_in_delta(0, methods[2].wait_time, 0.01)
+    assert_in_delta(0.1, methods[2].self_time, 0.01)
+  end
+
+  def test_instance_methods
+    result = RubyProf.profile do
+      RubyProf::C1.new.hello
+    end
+
+    # Methods called
+    #   MeasureCpuTimeTest#test_instance_methods
+    #   Class.new
+    #   Class:Object#allocate
+    #   for Object#initialize
+    #   C1#hello
+    #   Kernel#sleep
+
+    methods = result.threads.first.methods.sort.reverse
+    assert_equal(RubyProf.ruby_2? ? 5 : 6, methods.length)
+    names = methods.map(&:full_name)
+    assert_equal('MeasureCpuTimeTest#test_instance_methods', names[0])
+    assert_equal('RubyProf::C1#hello', names[1])
+    assert_equal('Kernel#sleep', names[2])
+    assert_equal('Class#new', names[3])
+
+    # order can differ
+    assert(names.include?("#{RubyProf.parent_object}#initialize"))
+    unless RubyProf.ruby_2?
+      assert(names.include?("<Class::#{RubyProf.parent_object}>#allocate"))
+    end
+
+    # Check times
+    assert_in_delta(0.2, methods[0].total_time, 0.02)
+    assert_in_delta(0, methods[0].wait_time, 0.02)
+    assert_in_delta(0, methods[0].self_time, 0.02)
+
+    assert_in_delta(0.2, methods[1].total_time, 0.02)
+    assert_in_delta(0, methods[1].wait_time, 0.02)
+    assert_in_delta(0, methods[1].self_time, 0.02)
+
+    assert_in_delta(0.2, methods[2].total_time, 0.02)
+    assert_in_delta(0, methods[2].wait_time, 0.02)
+    assert_in_delta(0.2, methods[2].self_time, 0.02)
+
+    assert_in_delta(0, methods[3].total_time, 0.01)
+    assert_in_delta(0, methods[3].wait_time, 0.01)
+    assert_in_delta(0, methods[3].self_time, 0.01)
+
+    assert_in_delta(0, methods[4].total_time, 0.01)
+    assert_in_delta(0, methods[4].wait_time, 0.01)
+    assert_in_delta(0, methods[4].self_time, 0.01)
+
+    unless RubyProf.ruby_2?
+      assert_in_delta(0, methods[5].total_time, 0.01)
+      assert_in_delta(0, methods[5].wait_time, 0.01)
+      assert_in_delta(0, methods[5].self_time, 0.01)
+    end
+  end
+
+  def test_module_methods
+    result = RubyProf.profile do
+      RubyProf::C2.hello
+    end
+
+    # Methods:
+    #   MeasureCpuTimeTest#test_module_methods
+    #   M1#hello
+    #   Kernel#sleep
+
+    methods = result.threads.first.methods.sort.reverse
+    assert_equal(3, methods.length)
+
+    assert_equal('MeasureCpuTimeTest#test_module_methods', methods[0].full_name)
+    assert_equal('RubyProf::M1#hello', methods[1].full_name)
+    assert_equal('Kernel#sleep', methods[2].full_name)
+
+    # Check times
+    assert_in_delta(0.3, methods[0].total_time, 0.1)
+    assert_in_delta(0, methods[0].wait_time, 0.02)
+    assert_in_delta(0, methods[0].self_time, 0.02)
+
+    assert_in_delta(0.3, methods[1].total_time, 0.1)
+    assert_in_delta(0, methods[1].wait_time, 0.02)
+    assert_in_delta(0, methods[1].self_time, 0.02)
+
+    assert_in_delta(0.3, methods[2].total_time, 0.1)
+    assert_in_delta(0, methods[2].wait_time, 0.02)
+    assert_in_delta(0.3, methods[2].self_time, 0.1)
+  end
+
+  def test_module_instance_methods
+    result = RubyProf.profile do
+      RubyProf::C2.new.hello
+    end
+
+    # Methods:
+    #   MeasureCpuTimeTest#test_module_instance_methods
+    #   Class#new
+    #   <Class::Object>#allocate
+    #   Object#initialize
+    #   M1#hello
+    #   Kernel#sleep
+
+    methods = result.threads.first.methods.sort.reverse
+    assert_equal(RubyProf.ruby_2? ? 5 : 6, methods.length)
+    names = methods.map(&:full_name)
+    assert_equal('MeasureCpuTimeTest#test_module_instance_methods', names[0])
+    assert_equal('RubyProf::M1#hello', names[1])
+    assert_equal('Kernel#sleep', names[2])
+    assert_equal('Class#new', names[3])
+
+    # order can differ
+    assert(names.include?("#{RubyProf.parent_object}#initialize"))
+    unless RubyProf.ruby_2?
+      assert(names.include?("<Class::#{RubyProf.parent_object}>#allocate"))
+    end
+
+    # Check times
+    assert_in_delta(0.3, methods[0].total_time, 0.1)
+    assert_in_delta(0, methods[0].wait_time, 0.1)
+    assert_in_delta(0, methods[0].self_time, 0.1)
+
+    assert_in_delta(0.3, methods[1].total_time, 0.02)
+    assert_in_delta(0, methods[1].wait_time, 0.01)
+    assert_in_delta(0, methods[1].self_time, 0.01)
+
+    assert_in_delta(0.3, methods[2].total_time, 0.02)
+    assert_in_delta(0, methods[2].wait_time, 0.01)
+    assert_in_delta(0.3, methods[2].self_time, 0.02)
+
+    assert_in_delta(0, methods[3].total_time, 0.01)
+    assert_in_delta(0, methods[3].wait_time, 0.01)
+    assert_in_delta(0, methods[3].self_time, 0.01)
+
+    assert_in_delta(0, methods[4].total_time, 0.01)
+    assert_in_delta(0, methods[4].wait_time, 0.01)
+    assert_in_delta(0, methods[4].self_time, 0.01)
+
+    unless RubyProf.ruby_2?
+      assert_in_delta(0, methods[5].total_time, 0.01)
+      assert_in_delta(0, methods[5].wait_time, 0.01)
+      assert_in_delta(0, methods[5].self_time, 0.01)
+    end
+  end
+
+  def test_singleton
+    c3 = RubyProf::C3.new
+
+    class << c3
+      def hello
+      end
+    end
+
+    result = RubyProf.profile do
+      c3.hello
+    end
+
+    methods = result.threads.first.methods.sort.reverse
+    assert_equal(2, methods.length)
+
+    assert_equal('MeasureCpuTimeTest#test_singleton', methods[0].full_name)
+    assert_equal('<Object::RubyProf::C3>#hello', methods[1].full_name)
+
+    assert_in_delta(0, methods[0].total_time, 0.01)
+    assert_in_delta(0, methods[0].wait_time, 0.01)
+    assert_in_delta(0, methods[0].self_time, 0.01)
+
+    assert_in_delta(0, methods[1].total_time, 0.01)
+    assert_in_delta(0, methods[1].wait_time, 0.01)
+    assert_in_delta(0, methods[1].self_time, 0.01)
+  end
+end
diff --git a/test/measure_gc_runs_test.rb b/test/measure_gc_runs_test.rb
new file mode 100755
index 0000000..9462e65
--- /dev/null
+++ b/test/measure_gc_runs_test.rb
@@ -0,0 +1,32 @@
+#!/usr/bin/env ruby
+# encoding: UTF-8
+
+require File.expand_path('../test_helper', __FILE__)
+
+class MeasureGCRunsTest < Test::Unit::TestCase
+  include MemoryTestHelper
+
+  def test_gc_runs_mode
+    RubyProf::measure_mode = RubyProf::GC_RUNS
+    assert_equal(RubyProf::GC_RUNS, RubyProf::measure_mode)
+  end
+
+  def test_gc_runs_enabled_defined
+    assert(defined?(RubyProf::GC_RUNS_ENABLED))
+  end
+
+  if RubyProf::GC_RUNS_ENABLED
+    def test_gc_runs
+      t = RubyProf.measure_gc_runs
+      assert_kind_of Integer, t
+
+      GC.enable_stats
+      GC.start
+
+      u = RubyProf.measure_gc_runs
+      assert u > t, [t, u].inspect
+      RubyProf::measure_mode = RubyProf::GC_RUNS
+      memory_test_helper
+    end
+  end
+end
diff --git a/test/measure_gc_time_test.rb b/test/measure_gc_time_test.rb
new file mode 100755
index 0000000..6ad3416
--- /dev/null
+++ b/test/measure_gc_time_test.rb
@@ -0,0 +1,36 @@
+#!/usr/bin/env ruby
+# encoding: UTF-8
+
+require File.expand_path('../test_helper', __FILE__)
+
+class MeasureGCTimeTest < Test::Unit::TestCase
+  include MemoryTestHelper
+
+  def test_gc_time_mode
+    RubyProf::measure_mode = RubyProf::GC_TIME
+    assert_equal(RubyProf::GC_TIME, RubyProf::measure_mode)
+  end
+
+  def test_gc_time_enabled_defined
+    assert(defined?(RubyProf::GC_TIME_ENABLED))
+  end
+
+  if RubyProf::GC_TIME_ENABLED
+    def test_gc_time
+      RubyProf::measure_mode = RubyProf::GC_TIME
+      RubyProf.enable_gc_stats_if_needed
+
+      t = RubyProf.measure_gc_time
+      assert_kind_of Float, t
+
+      GC.start
+
+      u = RubyProf.measure_gc_time
+      assert u > t, [t, u].inspect
+
+      memory_test_helper
+    ensure
+      RubyProf.disable_gc_stats_if_needed
+    end
+  end
+end
diff --git a/test/measure_memory_test.rb b/test/measure_memory_test.rb
new file mode 100755
index 0000000..aa94e60
--- /dev/null
+++ b/test/measure_memory_test.rb
@@ -0,0 +1,31 @@
+#!/usr/bin/env ruby
+# encoding: UTF-8
+
+require File.expand_path('../test_helper', __FILE__)
+
+class MeasureMemoryTest < Test::Unit::TestCase
+  include MemoryTestHelper
+
+  def test_memory_mode
+    RubyProf::measure_mode = RubyProf::MEMORY
+    assert_equal(RubyProf::MEMORY, RubyProf::measure_mode)
+  end
+
+  def test_memory_enabled_defined
+    assert(defined?(RubyProf::MEMORY_ENABLED))
+  end
+
+  if RubyProf::MEMORY_ENABLED
+    def test_memory
+      t = RubyProf.measure_memory
+      assert_kind_of Float, t
+
+      u = RubyProf.measure_memory
+      assert(u > t, [t, u].inspect)
+      RubyProf::measure_mode = RubyProf::MEMORY
+      total = memory_test_helper
+      assert(total > 0, 'Should measure more than zero kilobytes of memory usage')
+      assert_not_equal(0, total % 1, 'Should not truncate fractional kilobyte measurements')
+    end
+  end
+end
diff --git a/test/measure_process_time_test.rb b/test/measure_process_time_test.rb
new file mode 100755
index 0000000..45a9cf7
--- /dev/null
+++ b/test/measure_process_time_test.rb
@@ -0,0 +1,62 @@
+#!/usr/bin/env ruby
+# encoding: UTF-8
+
+require File.expand_path('../test_helper', __FILE__)
+
+class MeasureProcessTimeTest < Test::Unit::TestCase
+  def setup
+    # Need to fix this for linux (windows works since PROCESS_TIME is WALL_TIME anyway)
+    RubyProf::measure_mode = RubyProf::PROCESS_TIME
+  end
+
+  def test_mode
+    assert_equal(RubyProf::PROCESS_TIME, RubyProf::measure_mode)
+  end
+
+  def test_process_time_enabled_defined
+    assert(defined?(RubyProf::PROCESS_TIME_ENABLED))
+  end
+
+  def test_primes
+    start = Process.times
+    result = RubyProf.profile do
+      run_primes(10000)
+    end
+    finish = Process.times
+
+    total_time = (finish.utime - start.utime) + (finish.stime - start.stime)
+
+    thread = result.threads.first
+    assert_in_delta(total_time, thread.total_time, 0.03)
+
+    methods = result.threads.first.methods.sort.reverse
+
+    if RUBY_VERSION =~ /^1\.8/
+      methods.reject!{|m| m.full_name =~ /^Fixnum/ || m.full_name == 'Object#find_largest'}
+    end
+    if RUBY_VERSION =~ /^(1\.9\.2|2\.0)/
+      assert_equal 15, methods.length
+    else
+      assert_equal 16, methods.length
+    end
+
+    # Check times
+    assert_equal("MeasureProcessTimeTest#test_primes", methods[0].full_name)
+    assert_in_delta(total_time, methods[0].total_time, 0.02)
+    assert_in_delta(0.0, methods[0].wait_time, 0.01)
+    assert_in_delta(0.0, methods[0].self_time, 0.01)
+
+    assert_equal("Object#run_primes", methods[1].full_name)
+    assert_in_delta(total_time, methods[1].total_time, 0.02)
+    assert_in_delta(0.0, methods[1].wait_time, 0.01)
+    assert_in_delta(0.0, methods[1].self_time, 0.01)
+
+    assert_equal("Object#find_primes", methods[2].full_name)
+    assert_equal("Array#select", methods[3].full_name)
+    assert_equal("Object#is_prime", methods[4].full_name)
+    assert_equal("Integer#upto", methods[5].full_name)
+    assert_equal("Object#make_random_array", methods[6].full_name)
+    assert_equal("Array#each_index", methods[7].full_name)
+    assert_equal("Kernel#rand", methods[8].full_name)
+  end
+end
diff --git a/test/measure_wall_time_test.rb b/test/measure_wall_time_test.rb
new file mode 100644
index 0000000..5d35879
--- /dev/null
+++ b/test/measure_wall_time_test.rb
@@ -0,0 +1,255 @@
+#!/usr/bin/env ruby
+# encoding: UTF-8
+
+require File.expand_path('../test_helper', __FILE__)
+
+class MeasureWallTimeTest < Test::Unit::TestCase
+  def setup
+    # Need to use wall time for this test due to the sleep calls
+    RubyProf::measure_mode = RubyProf::WALL_TIME
+  end
+
+  def test_mode
+    RubyProf::measure_mode = RubyProf::WALL_TIME
+    assert_equal(RubyProf::WALL_TIME, RubyProf::measure_mode)
+  end
+
+  def test_wall_time_enabled_defined
+    assert(defined?(RubyProf::WALL_TIME_ENABLED))
+  end
+
+  def test_class_methods
+    result = RubyProf.profile do
+      RubyProf::C1.hello
+    end
+
+    thread = result.threads.first
+    assert_in_delta(0.1, thread.total_time, 0.01)
+
+    top_methods = thread.top_methods
+    assert_equal(1, top_methods.count)
+    assert_equal("MeasureWallTimeTest#test_class_methods", top_methods[0].full_name)
+
+    # Length should be 3:
+    #   MeasureWallTimeTest#test_class_methods
+    #   <Class::RubyProf::C1>#hello
+    #   Kernel#sleep
+
+    methods = result.threads.first.methods.sort.reverse
+    assert_equal(3, methods.length)
+
+    # Check the names
+    assert_equal('MeasureWallTimeTest#test_class_methods', methods[0].full_name)
+    assert_equal('<Class::RubyProf::C1>#hello', methods[1].full_name)
+    assert_equal('Kernel#sleep', methods[2].full_name)
+
+    # Check times
+    assert_in_delta(0.1, methods[0].total_time, 0.01)
+    assert_in_delta(0, methods[0].wait_time, 0.01)
+    assert_in_delta(0, methods[0].self_time, 0.01)
+
+    assert_in_delta(0.1, methods[1].total_time, 0.01)
+    assert_in_delta(0, methods[1].wait_time, 0.01)
+    assert_in_delta(0, methods[1].self_time, 0.01)
+
+    assert_in_delta(0.1, methods[2].total_time, 0.01)
+    assert_in_delta(0, methods[2].wait_time, 0.01)
+    assert_in_delta(0.1, methods[2].self_time, 0.01)
+  end
+
+  def test_instance_methods
+    result = RubyProf.profile do
+      RubyProf::C1.new.hello
+    end
+
+    thread = result.threads.first
+    assert_in_delta(0.2, thread.total_time, 0.01)
+
+    top_methods = thread.top_methods
+    assert_equal(1, top_methods.count)
+    assert_equal("MeasureWallTimeTest#test_instance_methods", top_methods[0].full_name)
+
+    # Methods called
+    #   MeasureWallTimeTest#test_instance_methods
+    #   Class.new
+    #   Class:Object#allocate
+    #   for Object#initialize
+    #   C1#hello
+    #   Kernel#sleep
+
+    methods = result.threads.first.methods.sort.reverse
+    assert_equal(RubyProf.ruby_2? ? 5 : 6, methods.length)
+    names = methods.map(&:full_name)
+    assert_equal('MeasureWallTimeTest#test_instance_methods', names[0])
+    assert_equal('RubyProf::C1#hello', names[1])
+    assert_equal('Kernel#sleep', names[2])
+    assert_equal('Class#new', names[3])
+
+    # order can differ
+    assert(names.include?("#{RubyProf.parent_object}#initialize"))
+    unless RubyProf.ruby_2?
+      assert(names.include?("<Class::#{RubyProf.parent_object}>#allocate"))
+    end
+
+    # Check times
+    assert_in_delta(0.2, methods[0].total_time, 0.02)
+    assert_in_delta(0, methods[0].wait_time, 0.02)
+    assert_in_delta(0, methods[0].self_time, 0.02)
+
+    assert_in_delta(0.2, methods[1].total_time, 0.02)
+    assert_in_delta(0, methods[1].wait_time, 0.02)
+    assert_in_delta(0, methods[1].self_time, 0.02)
+
+    assert_in_delta(0.2, methods[2].total_time, 0.02)
+    assert_in_delta(0, methods[2].wait_time, 0.02)
+    assert_in_delta(0.2, methods[2].self_time, 0.02)
+
+    assert_in_delta(0, methods[3].total_time, 0.01)
+    assert_in_delta(0, methods[3].wait_time, 0.01)
+    assert_in_delta(0, methods[3].self_time, 0.01)
+
+    assert_in_delta(0, methods[4].total_time, 0.01)
+    assert_in_delta(0, methods[4].wait_time, 0.01)
+    assert_in_delta(0, methods[4].self_time, 0.01)
+
+    unless RubyProf.ruby_2?
+      assert_in_delta(0, methods[5].total_time, 0.01)
+      assert_in_delta(0, methods[5].wait_time, 0.01)
+      assert_in_delta(0, methods[5].self_time, 0.01)
+    end
+  end
+
+  def test_module_methods
+    result = RubyProf.profile do
+      RubyProf::C2.hello
+    end
+
+    thread = result.threads.first
+    assert_in_delta(0.3, thread.total_time, 0.01)
+
+    top_methods = thread.top_methods
+    assert_equal(1, top_methods.count)
+    assert_equal("MeasureWallTimeTest#test_module_methods", top_methods[0].full_name)
+
+    # Methods:
+    #   MeasureWallTimeTest#test_module_methods
+    #   M1#hello
+    #   Kernel#sleep
+
+    methods = result.threads.first.methods.sort.reverse
+    assert_equal(3, methods.length)
+
+    assert_equal('MeasureWallTimeTest#test_module_methods', methods[0].full_name)
+    assert_equal('RubyProf::M1#hello', methods[1].full_name)
+    assert_equal('Kernel#sleep', methods[2].full_name)
+
+    # Check times
+    assert_in_delta(0.3, methods[0].total_time, 0.1)
+    assert_in_delta(0, methods[0].wait_time, 0.02)
+    assert_in_delta(0, methods[0].self_time, 0.02)
+
+    assert_in_delta(0.3, methods[1].total_time, 0.1)
+    assert_in_delta(0, methods[1].wait_time, 0.02)
+    assert_in_delta(0, methods[1].self_time, 0.02)
+
+    assert_in_delta(0.3, methods[2].total_time, 0.1)
+    assert_in_delta(0, methods[2].wait_time, 0.02)
+    assert_in_delta(0.3, methods[2].self_time, 0.1)
+  end
+
+  def test_module_instance_methods
+    result = RubyProf.profile do
+      RubyProf::C2.new.hello
+    end
+
+    thread = result.threads.first
+    assert_in_delta(0.3, thread.total_time, 0.01)
+
+    top_methods = thread.top_methods
+    assert_equal(1, top_methods.count)
+    assert_equal("MeasureWallTimeTest#test_module_instance_methods", top_methods[0].full_name)
+
+    # Methods:
+    #   MeasureWallTimeTest#test_module_instance_methods
+    #   Class#new
+    #   <Class::Object>#allocate
+    #   Object#initialize
+    #   M1#hello
+    #   Kernel#sleep
+
+    methods = result.threads.first.methods.sort.reverse
+    assert_equal(RubyProf.ruby_2? ? 5 : 6, methods.length)
+    names = methods.map(&:full_name)
+    assert_equal('MeasureWallTimeTest#test_module_instance_methods', names[0])
+    assert_equal('RubyProf::M1#hello', names[1])
+    assert_equal('Kernel#sleep', names[2])
+    assert_equal('Class#new', names[3])
+
+    # order can differ
+    assert(names.include?("#{RubyProf.parent_object}#initialize"))
+    unless RubyProf.ruby_2?
+      assert(names.include?("<Class::#{RubyProf.parent_object}>#allocate"))
+    end
+
+    # Check times
+    assert_in_delta(0.3, methods[0].total_time, 0.1)
+    assert_in_delta(0, methods[0].wait_time, 0.1)
+    assert_in_delta(0, methods[0].self_time, 0.1)
+
+    assert_in_delta(0.3, methods[1].total_time, 0.02)
+    assert_in_delta(0, methods[1].wait_time, 0.01)
+    assert_in_delta(0, methods[1].self_time, 0.01)
+
+    assert_in_delta(0.3, methods[2].total_time, 0.02)
+    assert_in_delta(0, methods[2].wait_time, 0.01)
+    assert_in_delta(0.3, methods[2].self_time, 0.02)
+
+    assert_in_delta(0, methods[3].total_time, 0.01)
+    assert_in_delta(0, methods[3].wait_time, 0.01)
+    assert_in_delta(0, methods[3].self_time, 0.01)
+
+    assert_in_delta(0, methods[4].total_time, 0.01)
+    assert_in_delta(0, methods[4].wait_time, 0.01)
+    assert_in_delta(0, methods[4].self_time, 0.01)
+
+    unless RubyProf.ruby_2?
+      assert_in_delta(0, methods[5].total_time, 0.01)
+      assert_in_delta(0, methods[5].wait_time, 0.01)
+      assert_in_delta(0, methods[5].self_time, 0.01)
+    end
+  end
+
+  def test_singleton
+    c3 = RubyProf::C3.new
+
+    class << c3
+      def hello
+      end
+    end
+
+    result = RubyProf.profile do
+      c3.hello
+    end
+
+    thread = result.threads.first
+    assert_in_delta(0.0, thread.total_time, 0.01)
+
+    top_methods = thread.top_methods
+    assert_equal(1, top_methods.count)
+    assert_equal("MeasureWallTimeTest#test_singleton", top_methods[0].full_name)
+
+    methods = result.threads.first.methods.sort.reverse
+    assert_equal(2, methods.length)
+
+    assert_equal('MeasureWallTimeTest#test_singleton', methods[0].full_name)
+    assert_equal('<Object::RubyProf::C3>#hello', methods[1].full_name)
+
+    assert_in_delta(0, methods[0].total_time, 0.01)
+    assert_in_delta(0, methods[0].wait_time, 0.01)
+    assert_in_delta(0, methods[0].self_time, 0.01)
+
+    assert_in_delta(0, methods[1].total_time, 0.01)
+    assert_in_delta(0, methods[1].wait_time, 0.01)
+    assert_in_delta(0, methods[1].self_time, 0.01)
+  end
+end
\ No newline at end of file
diff --git a/test/measurement_test.rb b/test/measurement_test.rb
deleted file mode 100755
index f1df249..0000000
--- a/test/measurement_test.rb
+++ /dev/null
@@ -1,121 +0,0 @@
-#!/usr/bin/env ruby
-require 'test/unit'
-require 'ruby-prof'
-
-class MeasurementTest < Test::Unit::TestCase
-  def setup
-    GC.enable_stats if GC.respond_to?(:enable_stats)
-  end
-
-  def teardown
-    GC.disable_stats if GC.respond_to?(:disable_stats)
-  end
-
-  def test_process_time_mode
-    RubyProf::measure_mode = RubyProf::PROCESS_TIME
-    assert_equal(RubyProf::PROCESS_TIME, RubyProf::measure_mode)
-  end
-
-  def test_process_time
-    t = RubyProf.measure_process_time
-    assert_kind_of(Float, t)
-
-    u = RubyProf.measure_process_time
-    assert(u >= t, [t, u].inspect)
-  end
-
-  def test_wall_time_mode
-    RubyProf::measure_mode = RubyProf::WALL_TIME
-    assert_equal(RubyProf::WALL_TIME, RubyProf::measure_mode)
-  end
-
-  def test_wall_time
-    t = RubyProf.measure_wall_time
-    assert_kind_of Float, t
-
-    u = RubyProf.measure_wall_time
-    assert u >= t, [t, u].inspect
-  end
-
-  if RubyProf::CPU_TIME
-    def test_cpu_time_mode
-      RubyProf::measure_mode = RubyProf::CPU_TIME
-      assert_equal(RubyProf::CPU_TIME, RubyProf::measure_mode)
-    end
-    
-    def test_cpu_time
-      RubyProf.cpu_frequency = 2.33e9
-
-      t = RubyProf.measure_cpu_time
-      assert_kind_of Float, t
-
-      u = RubyProf.measure_cpu_time
-      assert u > t, [t, u].inspect
-    end
-  end
-
-  if RubyProf::ALLOCATIONS
-    def test_allocations_mode
-      RubyProf::measure_mode = RubyProf::ALLOCATIONS
-      assert_equal(RubyProf::ALLOCATIONS, RubyProf::measure_mode)
-    end
-
-    def test_allocations
-      t = RubyProf.measure_allocations
-      assert_kind_of Integer, t
-
-      u = RubyProf.measure_allocations
-      assert u > t, [t, u].inspect
-    end
-  end
-
-  if RubyProf::MEMORY
-    def test_memory_mode
-      RubyProf::measure_mode = RubyProf::MEMORY
-      assert_equal(RubyProf::MEMORY, RubyProf::measure_mode)
-    end
-
-    def test_memory
-      t = RubyProf.measure_memory
-      assert_kind_of Integer, t
-
-      u = RubyProf.measure_memory
-      assert(u >= t, [t, u].inspect)
-
-      result = RubyProf.profile {Array.new}
-      total = result.threads.values.first.methods.inject(0) { |sum, m| sum + m.total_time }
-
-      assert(total > 0, 'Should measure more than zero kilobytes of memory usage')
-      assert_not_equal(0, total % 1, 'Should not truncate fractional kilobyte measurements')
-    end
-  end
-
-  if RubyProf::GC_RUNS
-    def test_gc_runs_mode
-      RubyProf::measure_mode = RubyProf::GC_RUNS
-      assert_equal(RubyProf::GC_RUNS, RubyProf::measure_mode)
-    end
-
-    def test_gc_runs
-      t = RubyProf.measure_gc_runs
-      assert_kind_of Integer, t
-
-      GC.start
-
-      u = RubyProf.measure_gc_runs
-      assert u > t, [t, u].inspect
-    end
-  end
-
-  if RubyProf::GC_TIME
-    def test_gc_time
-      t = RubyProf.measure_gc_time
-      assert_kind_of Integer, t
-
-      GC.start
-
-      u = RubyProf.measure_gc_time
-      assert u > t, [t, u].inspect
-    end
-  end
-end
\ No newline at end of file
diff --git a/test/method_elimination_test.rb b/test/method_elimination_test.rb
new file mode 100755
index 0000000..631fccc
--- /dev/null
+++ b/test/method_elimination_test.rb
@@ -0,0 +1,84 @@
+#!/usr/bin/env ruby
+# encoding: UTF-8
+
+require File.expand_path('../test_helper', __FILE__)
+
+# Test data
+#     A
+#    / \
+#   B   C
+#        \
+#         B
+
+module MethodElimination
+  def self.a
+    1.times {|i| c}
+  end
+
+  def self.b
+    sleep 0.1
+  end
+
+  def self.c
+    1.times {|i| b}
+  end
+end
+
+class MethodEliminationTest < Test::Unit::TestCase
+  def setup
+    # Need to use wall time for this test due to the sleep calls
+    RubyProf::measure_mode = RubyProf::WALL_TIME
+  end
+
+  def test_setting_parent
+    result = RubyProf.profile do
+      1000.times { 1+1 }
+    end
+    method_infos = result.threads.first.methods.sort.reverse
+    assert(m1 = method_infos[0])
+    assert(c1 = m1.call_infos.first)
+    assert_nil(c1.parent)
+  end
+
+  def test_methods_can_be_eliminated
+    RubyProf.start
+    5.times {MethodElimination.a}
+    result = RubyProf.stop
+
+    methods = result.threads.first.methods.sort.reverse
+
+    assert_equal(6, methods.count)
+    assert_equal('MethodEliminationTest#test_methods_can_be_eliminated', methods[0].full_name)
+    assert_equal('Integer#times', methods[1].full_name)
+    assert_equal('<Module::MethodElimination>#a', methods[2].full_name)
+    assert_equal('<Module::MethodElimination>#c', methods[3].full_name)
+    assert_equal('<Module::MethodElimination>#b', methods[4].full_name)
+    assert_equal('Kernel#sleep', methods[5].full_name)
+
+    result.eliminate_methods!([/Integer#times/])
+
+    methods = result.threads.first.methods.sort.reverse
+    assert_equal(5, methods.count)
+    assert_equal('MethodEliminationTest#test_methods_can_be_eliminated', methods[0].full_name)
+    assert_equal('<Module::MethodElimination>#a', methods[1].full_name)
+    assert_equal('<Module::MethodElimination>#c', methods[2].full_name)
+    assert_equal('<Module::MethodElimination>#b', methods[3].full_name)
+    assert_equal('Kernel#sleep', methods[4].full_name)
+  end
+
+  private
+
+  def assert_method_has_been_eliminated(result, eliminated_method)
+    result.threads.each do |thread|
+      thread.methods.each do |method|
+        method.call_infos.each do |ci|
+          assert(ci.target != eliminated_method, "broken self")
+          assert(ci.parent.target != eliminated_method, "broken parent") if ci.parent
+          ci.children.each do |callee|
+            assert(callee.target != eliminated_method, "broken kid")
+          end
+        end
+      end
+    end
+  end
+end
diff --git a/test/module_test.rb b/test/module_test.rb
index ff94bf9..0ed065d 100755
--- a/test/module_test.rb
+++ b/test/module_test.rb
@@ -1,6 +1,7 @@
 #!/usr/bin/env ruby
-require 'test/unit'
-require 'ruby-prof'
+# encoding: UTF-8
+
+require File.expand_path('../test_helper', __FILE__)
 
 # Need to use wall time for this test due to the sleep calls
 RubyProf::measure_mode = RubyProf::WALL_TIME
@@ -16,7 +17,7 @@ module Bar
     sleep(0.5)
     Foo::hello
   end
-  
+
   def hello
     sleep(0.5)
     Bar::hello
@@ -31,24 +32,14 @@ class ModuleTest < Test::Unit::TestCase
       hello
     end
 
-    methods = result.threads.values.first.sort.reverse
-      
+    methods = result.threads.first.methods
+
     # Length should be 5
     assert_equal(5, methods.length)
-    
-    method = methods[0]
-    assert_equal('ModuleTest#test_nested_modules', method.full_name)
-    
-    method = methods[1]
-    assert_equal('Bar#hello', method.full_name)
-
-    method = methods[2]
-    assert_equal('Kernel#sleep', method.full_name)
-    
-    method = methods[3]
-    assert_equal('<Module::Bar>#hello', method.full_name)
-    
-    method = methods[4]
-    assert_equal('<Module::Foo>#hello', method.full_name)
-  end 
+
+    # these methods should be in there... (hard to tell order though).
+    for name in ['ModuleTest#test_nested_modules','Bar#hello','Kernel#sleep','<Module::Bar>#hello','<Module::Foo>#hello']
+      assert methods.map(&:full_name).include?( name )
+    end
+  end
 end
diff --git a/test/multi_printer_test.rb b/test/multi_printer_test.rb
new file mode 100755
index 0000000..80f4a3d
--- /dev/null
+++ b/test/multi_printer_test.rb
@@ -0,0 +1,82 @@
+#!/usr/bin/env ruby
+# encoding: UTF-8
+
+require File.expand_path('../test_helper', __FILE__)
+
+# Test data
+#     A
+#    / \
+#   B   C
+#        \
+#         B
+
+class MSTPT
+  def a
+    100.times{b}
+    300.times{c}
+    c;c;c
+  end
+
+  def b
+    sleep 0
+  end
+
+  def c
+    5.times{b}
+  end
+end
+
+class MultiPrinterTest < Test::Unit::TestCase
+  def setup
+    # Need to use wall time for this test due to the sleep calls
+    RubyProf::measure_mode = RubyProf::WALL_TIME
+  end
+
+  def test_all_profiles_can_be_created
+    start_time = Time.now
+    RubyProf.start
+    5.times{MSTPT.new.a}
+    result = RubyProf.stop
+    end_time = Time.now
+    expected_time = end_time - start_time
+    stack = graph = nil
+    assert_nothing_raised { stack, graph = print(result) }
+    re = Regexp.new('
+\s*<table>
+\s*<tr>
+\s*<th>Thread ID</th>
+\s*(<th>Fiber ID</th>)?
+\s*<th>Total Time</th>
+\s*</tr>
+\s*
+\s*<tr>
+\s*(<td>([\.0-9]+)</td>)?
+\s*<td><a href="#-?\d+">-?\d+</a></td>
+\s*<td>([\.0-9e]+)</td>
+\s*</tr>
+\s*
+\s*</table>')
+    assert_match(re, graph)
+    graph =~ re
+    display_time = $4.to_f
+    assert_in_delta expected_time, display_time, 0.001
+  end
+
+  private
+  def print(result)
+    test = caller.first =~ /in `(.*)'/ ? $1 : "test"
+    path = RubyProf.tmpdir
+    profile = "ruby_prof_#{test}"
+    printer = RubyProf::MultiPrinter.new(result)
+    printer.print(:path => path, :profile => profile,
+                  :threshold => 0, :min_percent => 0, :title => "ruby_prof #{test}")
+    if RUBY_PLATFORM =~ /darwin/ && ENV['SHOW_RUBY_PROF_PRINTER_OUTPUT']=="1"
+      system("open '#{printer.stack_profile}'")
+    end
+    if GC.respond_to?(:dump_file_and_line_info)
+      GC.start
+      GC.dump_file_and_line_info("heap.dump")
+    end
+    [File.read(printer.stack_profile), File.read(printer.graph_profile)]
+  end
+end
diff --git a/test/no_method_class_test.rb b/test/no_method_class_test.rb
index 9273dd6..49c4d48 100755
--- a/test/no_method_class_test.rb
+++ b/test/no_method_class_test.rb
@@ -1,13 +1,15 @@
 #!/usr/bin/env ruby
-require 'ruby-prof'
+# encoding: UTF-8
+
+require File.expand_path('../test_helper', __FILE__)
 
 # Make sure this works with no class or method
-result = RubyProf.profile do 
+result = RubyProf.profile do
   sleep 1
 end
 
-methods = result.threads.values.first
+methods = result.threads.first.methods
 global_method = methods.sort_by {|method| method.full_name}.first
 if global_method.full_name != 'Global#[No method]'
   raise(RuntimeError, "Wrong method name.  Expected: Global#[No method].  Actual: #{global_method.full_name}")
-end
\ No newline at end of file
+end
diff --git a/test/pause_resume_test.rb b/test/pause_resume_test.rb
new file mode 100755
index 0000000..37e3568
--- /dev/null
+++ b/test/pause_resume_test.rb
@@ -0,0 +1,166 @@
+#!/usr/bin/env ruby
+# encoding: UTF-8
+
+require File.expand_path('../test_helper', __FILE__)
+
+class PauseResumeTest < Test::Unit::TestCase
+  def setup
+    # Need to use wall time for this test due to the sleep calls
+    RubyProf::measure_mode = RubyProf::WALL_TIME
+  end
+
+  def test_pause_resume
+    # Measured
+    RubyProf.start
+    RubyProf::C1.hello
+
+    # Not measured
+    RubyProf.pause
+    sleep 1
+    RubyProf::C1.hello
+
+    # Measured
+    RubyProf.resume
+    RubyProf::C1.hello
+
+    result = RubyProf.stop
+
+    # Length should be 3:
+    #   PauseResumeTest#test_pause_resume
+    #   <Class::RubyProf::C1>#hello
+    #   Kernel#sleep
+
+    methods = result.threads.first.methods.sort_by {|method_info| method_info.full_name}
+    # remove methods called by pause/resume
+    called_methods = ['Array#include?', 'Fixnum#==', 'Kernel#respond_to?', 'Kernel#respond_to_missing?']
+    methods.reject!{|m| called_methods.include?(m.full_name) }
+    # TODO: fix pause/resume to not include those methods in the first place
+    assert_equal(3, methods.length)
+
+    # Check the names
+    assert_equal('<Class::RubyProf::C1>#hello', methods[0].full_name)
+    assert_equal('Kernel#sleep', methods[1].full_name)
+    assert_equal('PauseResumeTest#test_pause_resume', methods[2].full_name)
+
+    # Check times
+    assert_in_delta(0.2, methods[0].total_time, 0.01)
+    assert_in_delta(0, methods[0].wait_time, 0.01)
+    assert_in_delta(0, methods[0].self_time, 0.01)
+
+    assert_in_delta(0.2, methods[1].total_time, 0.01)
+    assert_in_delta(0, methods[1].wait_time, 0.01)
+    assert_in_delta(0.2, methods[1].self_time, 0.01)
+
+    assert_in_delta(0.2, methods[2].total_time, 0.01)
+    assert_in_delta(0, methods[2].wait_time, 0.01)
+    assert_in_delta(0, methods[2].self_time, 0.01)
+  end
+
+  # pause/resume in the same frame
+  def test_pause_resume_1
+    profile = RubyProf::Profile.new(RubyProf::WALL_TIME,[])
+
+    profile.start
+    method_1a
+
+    profile.pause
+    method_1b
+
+    profile.resume
+    method_1c
+
+    result = profile.stop
+    assert_in_delta(0.6, result.threads[0].methods.select{|m| m.full_name =~ /test_pause_resume_1$/}[0].total_time, 0.05)
+  end
+  def method_1a; sleep 0.2 end
+  def method_1b; sleep 1   end
+  def method_1c; sleep 0.4 end
+
+  # pause in parent frame, resume in child
+  def test_pause_resume_2
+    profile = RubyProf::Profile.new(RubyProf::WALL_TIME,[])
+
+    profile.start
+    method_2a
+
+    profile.pause
+    sleep 0.5
+    method_2b(profile)
+
+    result = profile.stop
+    assert_in_delta(0.6, result.threads[0].methods.select{|m| m.full_name =~ /test_pause_resume_2$/}[0].total_time, 0.05)
+  end
+  def method_2a; sleep 0.2 end
+  def method_2b(profile); sleep 0.5; profile.resume; sleep 0.4 end
+
+  # pause in child frame, resume in parent
+  def test_pause_resume_3
+    profile = RubyProf::Profile.new(RubyProf::WALL_TIME,[])
+
+    profile.start
+    method_3a(profile)
+
+    sleep 0.5
+    profile.resume
+    method_3b
+
+    result = profile.stop
+    assert_in_delta(0.6, result.threads[0].methods.select{|m| m.full_name =~ /test_pause_resume_3$/}[0].total_time, 0.05)
+  end
+  def method_3a(profile); sleep 0.2; profile.pause; sleep 0.5 end
+  def method_3b; sleep 0.4 end
+
+  def test_pause_seq
+    profile = RubyProf::Profile.new(RubyProf::WALL_TIME,[])
+    profile.start ; assert !profile.paused?
+    profile.pause ; assert profile.paused?
+    profile.resume; assert !profile.paused?
+    profile.pause ; assert profile.paused?
+    profile.pause ; assert profile.paused?
+    profile.resume; assert !profile.paused?
+    profile.resume; assert !profile.paused?
+    profile.stop  ; assert !profile.paused?
+  end
+
+  def test_pause_block
+    profile = RubyProf::Profile.new(RubyProf::WALL_TIME,[])
+    profile.start
+    profile.pause
+    assert profile.paused?
+
+    times_block_invoked = 0
+    retval= profile.resume{
+      times_block_invoked += 1
+      120 + times_block_invoked
+    }
+    assert_equal 1, times_block_invoked
+    assert profile.paused?
+
+    assert_equal 121, retval, "resume() should return the result of the given block."
+
+    profile.stop
+  end
+
+  def test_pause_block_with_error
+    profile = RubyProf::Profile.new(RubyProf::WALL_TIME,[])
+    profile.start
+    profile.pause
+    assert profile.paused?
+
+    begin
+      profile.resume{ raise }
+      flunk 'Exception expected.'
+    rescue
+      assert profile.paused?
+    end
+
+    profile.stop
+  end
+
+  def test_resume_when_not_paused
+    profile = RubyProf::Profile.new(RubyProf::WALL_TIME,[])
+    profile.start ; assert !profile.paused?
+    profile.resume; assert !profile.paused?
+    profile.stop  ; assert !profile.paused?
+  end
+end
diff --git a/test/prime.rb b/test/prime.rb
index 5ef16b6..0049a48 100644
--- a/test/prime.rb
+++ b/test/prime.rb
@@ -1,7 +1,7 @@
 # A silly little test program that finds prime numbers.  It
 # is intentionally badly designed to show off the use
 # of ruby-prof.
-# 
+#
 # Source from http://people.cs.uchicago.edu/~bomb154/154/maclabs/profilers-lab/
 
 def make_random_array(length, maxnum)
@@ -9,10 +9,10 @@ def make_random_array(length, maxnum)
   result.each_index do |i|
     result[i] = rand(maxnum)
   end
-    
+
   result
 end
- 
+
 def is_prime(x)
   y = 2
   y.upto(x-1) do |i|
@@ -34,7 +34,6 @@ def find_largest(primes)
   # Intentionally use upto for example purposes
   # (upto is also called from is_prime)
   0.upto(primes.length-1) do |i|
-    sleep(0.02)
     prime = primes[i]
     if prime > largest
       largest = prime
@@ -43,16 +42,13 @@ def find_largest(primes)
   largest
 end
 
-def run_primes
-  length = 10
-  maxnum = 10000
-  
+def run_primes(length=10, maxnum=1000)
   # Create random numbers
   random_array = make_random_array(length, maxnum)
-  
+
   # Find the primes
   primes = find_primes(random_array)
-  
+
   # Find the largest primes
-  largest = find_largest(primes)
-end
\ No newline at end of file
+  find_largest(primes)
+end
diff --git a/test/prime_test.rb b/test/prime_test.rb
deleted file mode 100755
index 3fbc9db..0000000
--- a/test/prime_test.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/usr/bin/env ruby
-require 'test/unit'
-require 'ruby-prof'
-require 'prime'
-
-# --  Tests ----
-class PrimeTest< Test::Unit::TestCase
-  def test_consistency
-    result = RubyProf.profile do
-      run_primes
-    end
-  end
-end
\ No newline at end of file
diff --git a/test/printers_test.rb b/test/printers_test.rb
index 195e61d..d92b11c 100755
--- a/test/printers_test.rb
+++ b/test/printers_test.rb
@@ -1,71 +1,257 @@
 #!/usr/bin/env ruby
-require 'test/unit'
-require 'ruby-prof'
-require 'prime'
+# encoding: UTF-8
+
+require File.expand_path('../test_helper', __FILE__)
+require 'stringio'
+require 'fileutils'
 
 # --  Tests ----
 class PrintersTest < Test::Unit::TestCase
   def setup
-    RubyProf::measure_mode = RubyProf::PROCESS_TIME
+    # WALL_TIME so we can use sleep in our test and get same measurements on linux and windows
+    RubyProf::measure_mode = RubyProf::WALL_TIME
     @result = RubyProf.profile do
-      run_primes
+      run_primes(200)
     end
   end
-    
+
   def test_printers
-    printer = RubyProf::FlatPrinter.new(@result)
-    printer.print(STDOUT)
-    
-    printer = RubyProf::GraphHtmlPrinter.new(@result)
-    printer.print
-    
-    printer = RubyProf::GraphPrinter.new(@result)
-    printer.print
-    
-    printer = RubyProf::CallTreePrinter.new(@result)
-    printer.print(STDOUT)
+    assert_nothing_raised do
+      output = ENV['SHOW_RUBY_PROF_PRINTER_OUTPUT'] == "1" ? STDOUT : StringIO.new('')
 
-    # we should get here
-    assert(true)
+      printer = RubyProf::CallInfoPrinter.new(@result)
+      printer.print(output)
+
+      printer = RubyProf::CallTreePrinter.new(@result)
+      printer.print(output)
+
+      printer = RubyProf::FlatPrinter.new(@result)
+      printer.print(output)
+
+      printer = RubyProf::FlatPrinterWithLineNumbers.new(@result)
+      printer.print(output)
+
+      printer = RubyProf::GraphHtmlPrinter.new(@result)
+      printer.print(output)
+
+      printer = RubyProf::GraphPrinter.new(@result)
+      printer.print(output)
+    end
+  end
+
+  def test_print_to_files
+    assert_nothing_raised do
+      output_dir = 'examples2'
+
+      if ENV['SAVE_NEW_PRINTER_EXAMPLES']
+        output_dir = 'examples'
+      end
+      FileUtils.mkdir_p output_dir
+
+      printer = RubyProf::DotPrinter.new(@result)
+      File.open("#{output_dir}/graph.dot", "w") {|f| printer.print(f)}
+
+      printer = RubyProf::CallStackPrinter.new(@result)
+      File.open("#{output_dir}/stack.html", "w") {|f| printer.print(f, :application => "primes")}
+
+      printer = RubyProf::MultiPrinter.new(@result)
+      printer.print(:path => "#{output_dir}", :profile => "multi", :application => "primes")
+      for file in ['empty.png', 'graph.dot', 'minus.png', 'multi.flat.txt', 'multi.graph.html', 'multi.grind.dat', 'multi.stack.html', 'plus.png', 'stack.html']
+        existant_file = output_dir + '/' + file
+        assert File.size(existant_file) > 0
+      end
+    end
   end
 
   def test_flat_string
+    output = helper_test_flat_string(RubyProf::FlatPrinter)
+    assert_no_match(/prime.rb/, output)
+  end
+
+  def helper_test_flat_string(klass)
     output = ''
-    
-    printer = RubyProf::FlatPrinter.new(@result)
-    assert_nothing_raised { printer.print(output) }
-    
+
+    printer = klass.new(@result)
+    printer.print(output)
+
     assert_match(/Thread ID: -?\d+/i, output)
+    assert_match(/Fiber ID: -?\d+/i, output) unless RUBY_VERSION =~ /^1.8/
     assert_match(/Total: \d+\.\d+/i, output)
     assert_match(/Object#run_primes/i, output)
+    output
+  end
+
+  def test_flat_string_with_numbers
+    output = helper_test_flat_string RubyProf::FlatPrinterWithLineNumbers
+    assert_match(/prime.rb/, output)
+    assert_no_match(/ruby_runtime:0/, output)
+    assert_match(/called from/, output)
+
+    # should combine common parents
+    if RUBY_VERSION < '1.9'
+      assert_equal(3, output.scan(/Object#is_prime/).length)
+    else
+      # 1.9 inlines it's  Fixnum#- so we don't see as many
+      assert_equal(2, output.scan(/Object#is_prime/).length)
+    end
+    assert_no_match(/\.\/test\/prime.rb/, output) # don't use relative paths
   end
-    
+
   def test_graph_html_string
     output = ''
     printer = RubyProf::GraphHtmlPrinter.new(@result)
-    assert_nothing_raised { printer.print(output) }
+    printer.print(output)
 
-    assert_match( /DTD HTML 4\.01/i, output )
-    assert_match( %r{<th>Total Time</th>}i, output )
-    assert_match( /Object#run_primes/i, output )
+    assert_match(/DTD HTML 4\.01/i, output)
+    assert_match( %r{<th>Total Time</th>}i, output)
+    assert_match(/Object#run_primes/i, output)
   end
-    
+
   def test_graph_string
     output = ''
     printer = RubyProf::GraphPrinter.new(@result)
-    assert_nothing_raised { printer.print(output) }
+    printer.print(output)
 
-    assert_match( /Thread ID: -?\d+/i, output )
-    assert_match( /Total Time: \d+\.\d+/i, output )
-    assert_match( /Object#run_primes/i, output )
+    assert_match(/Thread ID: -?\d+/i, output)
+    assert_match(/Fiber ID: -?\d+/i, output) unless RUBY_VERSION =~ /^1.8/
+    assert_match(/Total Time: \d+\.\d+/i, output)
+    assert_match(/Object#run_primes/i, output)
   end
-    
+
   def test_call_tree_string
     output = ''
     printer = RubyProf::CallTreePrinter.new(@result)
-    assert_nothing_raised { printer.print(output) }
+    printer.print(output)
+    assert_match(/fn=Object#find_primes/i, output)
+    assert_match(/events: wall_time/i, output)
+    assert_no_match(/d\d\d\d\d\d/, output) # old bug looked [in error] like Object::run_primes(d5833116)
+  end
+
+  def do_nothing
+    start = Time.now
+    while(Time.now == start)
+    end
+  end
+
+  def test_all_with_small_percentiles
+    result = RubyProf.profile do
+      sleep 2
+      do_nothing
+    end
+
+    # RubyProf::CallTreePrinter doesn't "do" a min_percent
+    # RubyProf::FlatPrinter only outputs if self time > percent...
+    # RubyProf::FlatPrinterWithLineNumbers same
+    for klass in [ RubyProf::GraphPrinter, RubyProf::GraphHtmlPrinter]
+      printer = klass.new(result)
+      out = ''
+      printer.print(out, :min_percent => 0.00000001)
+      assert_match(/do_nothing/, out)
+    end
+
+  end
+
+  def test_flat_result_sorting_by_self_time_is_default
+    printer = RubyProf::FlatPrinter.new(@result)
+
+    printer.print(output = '')
+    self_times = flat_output_nth_column_values(output, 3)
+
+    assert_sorted self_times
+  end
+
+  def test_flat_result_sorting
+    printer = RubyProf::FlatPrinter.new(@result)
+
+    sort_method_with_column_number = {:total_time => 2, :self_time => 3, :wait_time => 4, :children_time => 5}
+
+    sort_method_with_column_number.each_pair do |sort_method, n|
+      printer.print(output = '', :sort_method => sort_method)
+      times = flat_output_nth_column_values(output, n)
+      assert_sorted times
+    end
+  end
+
+  def test_flat_result_with_line_numbers_sorting_by_self_time_is_default
+    printer = RubyProf::FlatPrinterWithLineNumbers.new(@result)
+
+    printer.print(output = '')
+    self_times = flat_output_nth_column_values(output, 3)
+
+    assert_sorted self_times
+  end
+
+  def test_flat_with_line_numbers_result_sorting
+    printer = RubyProf::FlatPrinterWithLineNumbers.new(@result)
+
+    sort_method_with_column_number = {:total_time => 2, :self_time => 3, :wait_time => 4, :children_time => 5}
+
+    sort_method_with_column_number.each_pair do |sort_method, n|
+      printer.print(output = '', :sort_method => sort_method)
+      times = flat_output_nth_column_values(output, n)
+      assert_sorted times
+    end
+  end
+
+  def test_graph_result_sorting_by_total_time_is_default
+    printer = RubyProf::GraphPrinter.new(@result)
+    printer.print(output = '')
+    total_times = graph_output_nth_column_values(output, 3)
+
+    assert_sorted total_times
+  end
+
+  def test_graph_results_sorting
+    printer = RubyProf::GraphPrinter.new(@result)
+
+    sort_method_with_column_number = {:total_time => 3, :self_time => 4, :wait_time => 5, :children_time => 6}
+
+    sort_method_with_column_number.each_pair do |sort_method, n|
+      printer.print(output = '', :sort_method => sort_method)
+      times = graph_output_nth_column_values(output, n)
+      assert_sorted times
+    end
+  end
+
+  def test_graph_html_result_sorting_by_total_time_is_default
+    printer = RubyProf::GraphHtmlPrinter.new(@result)
+    printer.print(output = '')
+    total_times = graph_html_output_nth_column_values(output, 3)
+
+    assert_sorted total_times
+  end
+
+  def test_graph_html_result_sorting
+    printer = RubyProf::GraphHtmlPrinter.new(@result)
+
+    sort_method_with_column_number = {:total_time => 3, :self_time => 4, :wait_time => 5, :children_time => 6}
+
+    sort_method_with_column_number.each_pair do |sort_method, n|
+      printer.print(output = '', :sort_method => sort_method)
+      times = graph_html_output_nth_column_values(output, n)
+      assert_sorted times
+    end
+  end
+
+  private
+  def flat_output_nth_column_values(output, n)
+    only_method_calls = output.split("\n").select { |line| line =~ /^ +\d+/ }
+    only_method_calls.collect { |line| line.split(/ +/)[n] }
+  end
+
+  def graph_output_nth_column_values(output, n)
+    only_root_calls = output.split("\n").select { |line| line =~ /^ +[\d\.]+%/ }
+    only_root_calls.collect { |line| line.split(/ +/)[n] }
+  end
+
+  def graph_html_output_nth_column_values(output, n)
+    only_root_calls = output.split('<tr class="method">')
+    only_root_calls.delete_at(0)
+    only_root_calls.collect {|line| line.scan(/[\d\.]+/)[n - 1] }
+  end
 
-    assert_match(/fn=Object::find_primes/i, output)
-    assert_match(/events: process_time/i, output)
+  def assert_sorted array
+    array = array.map{|n| n.to_f} # allow for > 10s times to sort right, since lexographically 4.0 > 10.0
+    assert_equal array, array.sort.reverse, "Array #{array.inspect} is not sorted"
   end
 end
diff --git a/test/recursive_test.rb b/test/recursive_test.rb
index 56f1e0f..e9eec1a 100755
--- a/test/recursive_test.rb
+++ b/test/recursive_test.rb
@@ -1,7 +1,9 @@
 #!/usr/bin/env ruby
-require 'test/unit'
-require 'ruby-prof'
+# encoding: UTF-8
 
+require File.expand_path('../test_helper', __FILE__)
+
+# Simple recursive test
 def simple(n)
   sleep(1)
   n -= 1
@@ -9,17 +11,25 @@ def simple(n)
   simple(n)
 end
 
-def cycle(n)
-  sub_cycle(n)
-end
 
-def sub_cycle(n)
+# More complicated recursive test
+def render_partial(i)
   sleep(1)
-  n -= 1
-  return if n == 0
-  cycle(n)
+  case i
+  when 0
+    render_partial(10)
+  when 1
+    2.times do |j|
+      render_partial(j + 10)
+    end
+  end
 end
 
+def render
+  2.times do |i|
+    render_partial(i)
+  end
+end
 
 # --  Tests ----
 class RecursiveTest < Test::Unit::TestCase
@@ -33,222 +43,173 @@ class RecursiveTest < Test::Unit::TestCase
       simple(2)
     end
 
-    methods = result.threads.values.first.sort.reverse
-    assert_equal(6, methods.length)
+    # Remove Fixnum+, Fixnum== for less than Ruby 1.9
+    result.eliminate_methods!(%w(Fixnum#== Fixnum#-))
+
+    methods = result.threads.first.methods.sort.reverse
+    assert_equal(3, methods.length)
 
+    # Method 0: RecursiveTest#test_simple
     method = methods[0]
     assert_equal('RecursiveTest#test_simple', method.full_name)
     assert_equal(1, method.called)
-    assert_in_delta(2, method.total_time, 0.01)
+    assert_in_delta(2, method.total_time, 0.1)
     assert_in_delta(0, method.self_time, 0.01)
     assert_in_delta(0, method.wait_time, 0.01)
-    assert_in_delta(2, method.children_time, 0.01)
+    assert_in_delta(2, method.children_time, 0.1)
 
     assert_equal(1, method.call_infos.length)
     call_info = method.call_infos[0]
+    assert(!call_info.recursive)
     assert_equal('RecursiveTest#test_simple', call_info.call_sequence)
     assert_equal(1, call_info.children.length)
 
+    # Method 1: Object#simple
     method = methods[1]
     assert_equal('Object#simple', method.full_name)
-    assert_equal(1, method.called)
-    assert_in_delta(2, method.total_time, 0.01)
-    assert_in_delta(0, method.self_time, 0.01)
-    assert_in_delta(0, method.wait_time, 0.01)
-    assert_in_delta(2, method.children_time, 0.01)
-
-    assert_equal(1, method.call_infos.length)
-    call_info = method.call_infos[0]
-    assert_equal('RecursiveTest#test_simple->Object#simple', call_info.call_sequence)
-    assert_equal(4, call_info.children.length)
-
-    method = methods[2]
-    assert_equal('Kernel#sleep', method.full_name)
     assert_equal(2, method.called)
-    assert_in_delta(2, method.total_time, 0.01)
-    assert_in_delta(2, method.self_time, 0.01)
-    assert_in_delta(0, method.wait_time, 0.01)
-    assert_in_delta(0, method.children_time, 0.01)
+    assert_in_delta(2, method.total_time, 0.1)
+    assert_in_delta(0, method.self_time, 0.1)
+    assert_in_delta(0, method.wait_time, 0.1)
+    assert_in_delta(2, method.children_time, 0.1)
 
     assert_equal(2, method.call_infos.length)
-    call_info = method.call_infos[0]
-    assert_equal('RecursiveTest#test_simple->Object#simple->Kernel#sleep', call_info.call_sequence)
-    assert_equal(0, call_info.children.length)
 
-    call_info = method.call_infos[1]
-    assert_equal('RecursiveTest#test_simple->Object#simple->Object#simple-1->Kernel#sleep', call_info.call_sequence)
-    assert_equal(0, call_info.children.length)
-
-    method = methods[3]
-    assert_equal('Object#simple-1', method.full_name)
-    assert_equal(1, method.called)
-    assert_in_delta(1, method.total_time, 0.01)
-    assert_in_delta(0, method.self_time, 0.01)
-    assert_in_delta(0, method.wait_time, 0.01)
-    assert_in_delta(1, method.children_time, 0.01)
-
-    assert_equal(1, method.call_infos.length)
-    call_info = method.call_infos[0]
-    assert_equal('RecursiveTest#test_simple->Object#simple->Object#simple-1', call_info.call_sequence)
-    assert_equal(3, call_info.children.length)
-
-    method = methods[4]
-    assert_equal('Fixnum#-', method.full_name)
-    assert_equal(2, method.called)
-    assert_in_delta(0, method.total_time, 0.01)
-    assert_in_delta(0, method.self_time, 0.01)
-    assert_in_delta(0, method.wait_time, 0.01)
-    assert_in_delta(0, method.children_time, 0.01)
-
-    assert_equal(2, method.call_infos.length)
-    call_info = method.call_infos[0]
-    assert_equal('RecursiveTest#test_simple->Object#simple->Fixnum#-', call_info.call_sequence)
-    assert_equal(0, call_info.children.length)
+    call_info = method.call_infos.first
+    assert_equal(2, call_info.children.length)
+    assert_equal('RecursiveTest#test_simple->Object#simple', call_info.call_sequence)
+    assert(!call_info.recursive)
 
-    call_info = method.call_infos[1]
-    assert_equal('RecursiveTest#test_simple->Object#simple->Object#simple-1->Fixnum#-', call_info.call_sequence)
-    assert_equal(0, call_info.children.length)
+    call_info = method.call_infos.last
+    assert_equal(1, call_info.children.length)
+    assert_equal('RecursiveTest#test_simple->Object#simple->Object#simple', call_info.call_sequence)
+    assert(call_info.recursive)
 
-    method = methods[5]
-    assert_equal('Fixnum#==', method.full_name)
+    method = methods[2]
+    assert_equal('Kernel#sleep', method.full_name)
     assert_equal(2, method.called)
-    assert_in_delta(0, method.total_time, 0.01)
-    assert_in_delta(0, method.self_time, 0.01)
-    assert_in_delta(0, method.wait_time, 0.01)
-    assert_in_delta(0, method.children_time, 0.01)
+    assert_in_delta(2, method.total_time, 0.1)
+    assert_in_delta(2, method.self_time, 0.1)
+    assert_in_delta(0, method.wait_time, 0.1)
+    assert_in_delta(0, method.children_time, 0.1)
 
     assert_equal(2, method.call_infos.length)
     call_info = method.call_infos[0]
-    assert_equal('RecursiveTest#test_simple->Object#simple->Fixnum#==', call_info.call_sequence)
+    assert_equal('RecursiveTest#test_simple->Object#simple->Kernel#sleep', call_info.call_sequence)
     assert_equal(0, call_info.children.length)
+    assert(!call_info.recursive)
 
     call_info = method.call_infos[1]
-    assert_equal('RecursiveTest#test_simple->Object#simple->Object#simple-1->Fixnum#==', call_info.call_sequence)
+    assert_equal('RecursiveTest#test_simple->Object#simple->Object#simple->Kernel#sleep', call_info.call_sequence)
     assert_equal(0, call_info.children.length)
+    assert(!call_info.recursive)
   end
-  
+
   def test_cycle
     result = RubyProf.profile do
-      cycle(2)
+      render
     end
 
-    methods = result.threads.values.first.sort.reverse
-    assert_equal(8, methods.length)
+    methods = result.threads.first.methods.sort.reverse
+    if RUBY_VERSION < '1.9' # Fixnum#+, Fixnum#===, Kernel#===
+      assert_equal(8, methods.length)
+    else
+      assert_equal(5, methods.length)
+    end
 
     method = methods[0]
     assert_equal('RecursiveTest#test_cycle', method.full_name)
     assert_equal(1, method.called)
-    assert_in_delta(2, method.total_time, 0.01)
+    assert_in_delta(5, method.total_time, 0.1)
     assert_in_delta(0, method.self_time, 0.01)
     assert_in_delta(0, method.wait_time, 0.01)
-    assert_in_delta(2, method.children_time, 0.01)
+    assert_in_delta(5, method.children_time, 0.1)
 
     assert_equal(1, method.call_infos.length)
     call_info = method.call_infos[0]
     assert_equal('RecursiveTest#test_cycle', call_info.call_sequence)
     assert_equal(1, call_info.children.length)
+    assert(!call_info.recursive)
 
     method = methods[1]
-    assert_equal('Object#cycle', method.full_name)
+    assert_equal('Object#render', method.full_name)
     assert_equal(1, method.called)
-    assert_in_delta(2, method.total_time, 0.01)
+    assert_in_delta(5, method.total_time, 0.1)
     assert_in_delta(0, method.self_time, 0.01)
     assert_in_delta(0, method.wait_time, 0.01)
-    assert_in_delta(2, method.children_time, 0.01)
+    assert_in_delta(5, method.children_time, 0.1)
 
     assert_equal(1, method.call_infos.length)
     call_info = method.call_infos[0]
-    assert_equal('RecursiveTest#test_cycle->Object#cycle', call_info.call_sequence)
+    assert_equal('RecursiveTest#test_cycle->Object#render', call_info.call_sequence)
     assert_equal(1, call_info.children.length)
+    assert(!call_info.recursive)
 
     method = methods[2]
-    assert_equal('Object#sub_cycle', method.full_name)
-    assert_equal(1, method.called)
-    assert_in_delta(2, method.total_time, 0.01)
-    assert_in_delta(0, method.self_time, 0.01)
-    assert_in_delta(0, method.wait_time, 0.01)
-    assert_in_delta(2, method.children_time, 0.01)
-
-    assert_equal(1, method.call_infos.length)
-    call_info = method.call_infos[0]
-    assert_equal('RecursiveTest#test_cycle->Object#cycle->Object#sub_cycle', call_info.call_sequence)
-    assert_equal(4, call_info.children.length)
-
-    method = methods[3]
-    assert_equal('Kernel#sleep', method.full_name)
+    assert_equal('Integer#times', method.full_name)
     assert_equal(2, method.called)
-    assert_in_delta(2, method.total_time, 0.01)
-    assert_in_delta(2, method.self_time, 0.01)
-    assert_in_delta(0, method.wait_time, 0.01)
-    assert_in_delta(0, method.children_time, 0.01)
+    assert_in_delta(5, method.total_time, 0.1)
+    assert_in_delta(0, method.self_time, 0.1)
+    assert_in_delta(0, method.wait_time, 0.1)
+    assert_in_delta(5, method.children_time, 0.1)
 
     assert_equal(2, method.call_infos.length)
     call_info = method.call_infos[0]
-    assert_equal('RecursiveTest#test_cycle->Object#cycle->Object#sub_cycle->Kernel#sleep', call_info.call_sequence)
-    assert_equal(0, call_info.children.length)
+    assert_equal('RecursiveTest#test_cycle->Object#render->Integer#times', call_info.call_sequence)
+    assert_equal(1, call_info.children.length)
+    assert(!call_info.recursive)
 
     call_info = method.call_infos[1]
-    assert_equal('RecursiveTest#test_cycle->Object#cycle->Object#sub_cycle->Object#cycle-1->Object#sub_cycle-1->Kernel#sleep', call_info.call_sequence)
-    assert_equal(0, call_info.children.length)
+    assert_equal('RecursiveTest#test_cycle->Object#render->Integer#times->Object#render_partial->Integer#times', call_info.call_sequence)
+    assert_equal(1 + (RUBY_VERSION < '1.9.0' ? 1 : 0), call_info.children.length)
+    assert(call_info.recursive)
 
-    method = methods[4]
-    assert_equal('Object#cycle-1', method.full_name)
-    assert_equal(1, method.called)
-    assert_in_delta(1, method.total_time, 0.01)
-    assert_in_delta(0, method.self_time, 0.01)
+    method = methods[3]
+    assert_equal('Object#render_partial', method.full_name)
+    assert_equal(5, method.called)
+    assert_in_delta(5, method.total_time, 0.1)
+    assert_in_delta(0, method.self_time, 0.1)
     assert_in_delta(0, method.wait_time, 0.01)
-    assert_in_delta(1, method.children_time, 0.01)
+    assert_in_delta(5, method.children_time, 0.05)
 
-    assert_equal(1, method.call_infos.length)
+    assert_equal(3, method.call_infos.length)
     call_info = method.call_infos[0]
-    assert_equal('RecursiveTest#test_cycle->Object#cycle->Object#sub_cycle->Object#cycle-1', call_info.call_sequence)
-    assert_equal(1, call_info.children.length)
+    assert_equal('RecursiveTest#test_cycle->Object#render->Integer#times->Object#render_partial', call_info.call_sequence)
+    assert_equal(3 + (RUBY_VERSION < '1.9.0' ? 1 : 0), call_info.children.length)
+    assert(!call_info.recursive)
 
-    method = methods[5]
-    assert_equal('Object#sub_cycle-1', method.full_name)
-    assert_equal(1, method.called)
-    assert_in_delta(1, method.total_time, 0.01)
-    assert_in_delta(0, method.self_time, 0.01)
-    assert_in_delta(0, method.wait_time, 0.01)
-    assert_in_delta(1, method.children_time, 0.01)
+    call_info = method.call_infos[1]
+    assert_equal('RecursiveTest#test_cycle->Object#render->Integer#times->Object#render_partial->Object#render_partial', call_info.call_sequence)
+    assert_equal(1 + (RUBY_VERSION < '1.9.0' ? 1 : 0), call_info.children.length)
+    assert(call_info.recursive)
 
-    assert_equal(1, method.call_infos.length)
-    call_info = method.call_infos[0]
-    assert_equal('RecursiveTest#test_cycle->Object#cycle->Object#sub_cycle->Object#cycle-1->Object#sub_cycle-1', call_info.call_sequence)
-    assert_equal(3, call_info.children.length)
+    call_info = method.call_infos[2]
+    assert_equal('RecursiveTest#test_cycle->Object#render->Integer#times->Object#render_partial->Integer#times->Object#render_partial', call_info.call_sequence)
+    assert_equal(1 + (RUBY_VERSION < '1.9.0' ? 1 : 0), call_info.children.length)
+    assert(call_info.recursive)
 
-    method = methods[6]
-    assert_equal('Fixnum#-', method.full_name)
-    assert_equal(2, method.called)
-    assert_in_delta(0, method.total_time, 0.01)
-    assert_in_delta(0, method.self_time, 0.01)
+    method = methods[4]
+    assert_equal('Kernel#sleep', method.full_name)
+    assert_equal(5, method.called)
+    assert_in_delta(5, method.total_time, 0.1)
+    assert_in_delta(5, method.self_time, 0.1)
     assert_in_delta(0, method.wait_time, 0.01)
     assert_in_delta(0, method.children_time, 0.01)
 
-    assert_equal(2, method.call_infos.length)
+    assert_equal(3, method.call_infos.length)
     call_info = method.call_infos[0]
-    assert_equal('RecursiveTest#test_cycle->Object#cycle->Object#sub_cycle->Fixnum#-', call_info.call_sequence)
+    assert_equal('RecursiveTest#test_cycle->Object#render->Integer#times->Object#render_partial->Kernel#sleep', call_info.call_sequence)
     assert_equal(0, call_info.children.length)
+    assert(!call_info.recursive)
 
     call_info = method.call_infos[1]
-    assert_equal('RecursiveTest#test_cycle->Object#cycle->Object#sub_cycle->Object#cycle-1->Object#sub_cycle-1->Fixnum#-', call_info.call_sequence)
-    assert_equal(0, call_info.children.length)
-
-    method = methods[7]
-    assert_equal('Fixnum#==', method.full_name)
-    assert_equal(2, method.called)
-    assert_in_delta(0, method.total_time, 0.01)
-    assert_in_delta(0, method.self_time, 0.01)
-    assert_in_delta(0, method.wait_time, 0.01)
-    assert_in_delta(0, method.children_time, 0.01)
-
-    assert_equal(2, method.call_infos.length)
-    call_info = method.call_infos[0]
-    assert_equal('RecursiveTest#test_cycle->Object#cycle->Object#sub_cycle->Fixnum#==', call_info.call_sequence)
+    assert_equal('RecursiveTest#test_cycle->Object#render->Integer#times->Object#render_partial->Object#render_partial->Kernel#sleep', call_info.call_sequence)
     assert_equal(0, call_info.children.length)
+    assert(!call_info.recursive)
 
-    call_info = method.call_infos[1]
-    assert_equal('RecursiveTest#test_cycle->Object#cycle->Object#sub_cycle->Object#cycle-1->Object#sub_cycle-1->Fixnum#==', call_info.call_sequence)
+    call_info = method.call_infos[2]
+    assert_equal('RecursiveTest#test_cycle->Object#render->Integer#times->Object#render_partial->Integer#times->Object#render_partial->Kernel#sleep', call_info.call_sequence)
     assert_equal(0, call_info.children.length)
+    assert(!call_info.recursive)
   end
-end
\ No newline at end of file
+end
diff --git a/test/singleton_test.rb b/test/singleton_test.rb
index 9ac4914..d032a09 100755
--- a/test/singleton_test.rb
+++ b/test/singleton_test.rb
@@ -1,7 +1,7 @@
 #!/usr/bin/env ruby
+# encoding: UTF-8
 
-require 'test/unit'
-require 'ruby-prof'
+require File.expand_path('../test_helper', __FILE__)
 require 'timeout'
 
 # --  Test for bug [#5657]
@@ -32,6 +32,7 @@ class SingletonTest < Test::Unit::TestCase
       assert_equal(1, a.as.size)
     end
     printer = RubyProf::FlatPrinter.new(result)
-    printer.print(STDOUT)
+    output = ENV['SHOW_RUBY_PROF_PRINTER_OUTPUT'] == "1" ? STDOUT : ''
+    printer.print(output)
   end
-end
\ No newline at end of file
+end
diff --git a/test/stack_printer_test.rb b/test/stack_printer_test.rb
new file mode 100755
index 0000000..0e0fb26
--- /dev/null
+++ b/test/stack_printer_test.rb
@@ -0,0 +1,78 @@
+#!/usr/bin/env ruby
+# encoding: UTF-8
+
+require File.expand_path('../test_helper', __FILE__)
+
+# Test data
+#     A
+#    / \
+#   B   C
+#        \
+#         B
+
+class STPT
+  def a
+    100.times{b}
+    300.times{c}
+    c;c;c
+  end
+
+  def b
+    sleep 0
+  end
+
+  def c
+    5.times{b}
+  end
+end
+
+class StackPrinterTest < Test::Unit::TestCase
+  def setup
+    # Need to use wall time for this test due to the sleep calls
+    RubyProf::measure_mode = RubyProf::WALL_TIME
+  end
+
+  def test_stack_can_be_printed
+    start_time = Time.now
+    RubyProf.start
+    5.times{STPT.new.a}
+    result = RubyProf.stop
+    end_time = Time.now
+    expected_time = end_time - start_time
+
+    file_contents = nil
+    assert_nothing_raised { file_contents = print(result) }
+    # TODO: why are thread ids negative on travis-ci.org (32 bit build maybe?)
+    re = /Thread: (-?\d+)(, Fiber: (-?\d+))? \(100\.00% ~ ([\.0-9]+)\)/
+    assert_match(re, file_contents)
+    file_contents =~ re
+    actual_time = $4.to_f
+    assert_in_delta(expected_time, actual_time, 0.1)
+  end
+
+  def test_method_elimination
+    RubyProf.start
+    5.times{STPT.new.a}
+    result = RubyProf.stop
+    assert_nothing_raised {
+      # result.dump
+      result.eliminate_methods!([/Integer#times/])
+      # $stderr.puts "================================"
+      # result.dump
+      print(result)
+    }
+  end
+
+  private
+  def print(result)
+    test = caller.first =~ /in `(.*)'/ ? $1 : "test"
+    testfile_name = "#{RubyProf.tmpdir}/ruby_prof_#{test}.html"
+    # puts "printing to #{testfile_name}"
+    printer = RubyProf::CallStackPrinter.new(result)
+    File.open(testfile_name, "w") {|f| printer.print(f, :threshold => 0, :min_percent => 0, :title => "ruby_prof #{test}")}
+    system("open '#{testfile_name}'") if RUBY_PLATFORM =~ /darwin/ && ENV['SHOW_RUBY_PROF_PRINTER_OUTPUT']=="1"
+    assert File.exist?(testfile_name), "#{testfile_name} does not exist"
+    assert File.readable?(testfile_name), "#{testfile_name} is no readable"
+    File.read(testfile_name)
+  end
+end
diff --git a/test/stack_test.rb b/test/stack_test.rb
index 7c991fa..345171a 100755
--- a/test/stack_test.rb
+++ b/test/stack_test.rb
@@ -1,7 +1,7 @@
 #!/usr/bin/env ruby
+# encoding: UTF-8
 
-require 'test/unit'
-require 'ruby-prof'
+require File.expand_path('../test_helper', __FILE__)
 
 # Test data
 #     A
@@ -46,17 +46,17 @@ class StackTest < Test::Unit::TestCase
     #   StackClass#c
     #   StackClass#b
 
-    methods = result.threads.values.first.sort.reverse
+    methods = result.threads.first.methods.sort.reverse
     assert_equal(5, methods.length)
 
     # Check StackTest#test_call_sequence
     method = methods[0]
     assert_equal('StackTest#test_call_sequence', method.full_name)
     assert_equal(1, method.called)
-    assert_in_delta(8, method.total_time, 0.01)
+    assert_in_delta(8, method.total_time, 0.25)
     assert_in_delta(0, method.wait_time, 0.01)
     assert_in_delta(0, method.self_time, 0.01)
-    assert_in_delta(8, method.children_time, 0.01)
+    assert_in_delta(8, method.children_time, 0.25)
     assert_equal(1, method.call_infos.length)
 
     call_info = method.call_infos[0]
@@ -67,24 +67,24 @@ class StackTest < Test::Unit::TestCase
     method = methods[1]
     assert_equal('StackClass#a', method.full_name)
     assert_equal(1, method.called)
-    assert_in_delta(8, method.total_time, 0.01)
+    assert_in_delta(8, method.total_time, 0.15)
     assert_in_delta(0, method.wait_time, 0.01)
     assert_in_delta(0, method.self_time, 0.01)
-    assert_in_delta(8, method.children_time, 0.01)
+    assert_in_delta(8, method.children_time, 0.05)
     assert_equal(1, method.call_infos.length)
 
     call_info = method.call_infos[0]
     assert_equal('StackTest#test_call_sequence->StackClass#a', call_info.call_sequence)
     assert_equal(3, call_info.children.length)
-    
+
     # Check Kernel#sleep
     method = methods[2]
     assert_equal('Kernel#sleep', method.full_name)
     assert_equal(4, method.called)
-    assert_in_delta(8, method.total_time, 0.01)
+    assert_in_delta(8, method.total_time, 0.05)
     assert_in_delta(0, method.wait_time, 0.01)
-    assert_in_delta(8, method.self_time, 0.01)
-    assert_in_delta(0, method.children_time, 0.01)
+    assert_in_delta(8, method.self_time, 0.05)
+    assert_in_delta(0, method.children_time, 0.05)
     assert_equal(4, method.call_infos.length)
 
     call_info = method.call_infos[0]
@@ -107,10 +107,10 @@ class StackTest < Test::Unit::TestCase
     method = methods[3]
     assert_equal('StackClass#c', method.full_name)
     assert_equal(1, method.called)
-    assert_in_delta(5, method.total_time, 0.01)
+    assert_in_delta(5, method.total_time, 0.05)
     assert_in_delta(0, method.wait_time, 0.01)
     assert_in_delta(0, method.self_time, 0.01)
-    assert_in_delta(5, method.children_time, 0.01)
+    assert_in_delta(5, method.children_time, 0.05)
     assert_equal(1, method.call_infos.length)
 
     call_info = method.call_infos[0]
@@ -121,10 +121,10 @@ class StackTest < Test::Unit::TestCase
     method = methods[4]
     assert_equal('StackClass#b', method.full_name)
     assert_equal(2, method.called)
-    assert_in_delta(4, method.total_time, 0.01)
+    assert_in_delta(4, method.total_time, 0.05)
     assert_in_delta(0, method.wait_time, 0.01)
     assert_in_delta(0, method.self_time, 0.01)
-    assert_in_delta(4, method.children_time, 0.01)
+    assert_in_delta(4, method.children_time, 0.05)
     assert_equal(2, method.call_infos.length)
 
     call_info = method.call_infos[0]
@@ -135,4 +135,4 @@ class StackTest < Test::Unit::TestCase
     assert_equal('StackTest#test_call_sequence->StackClass#a->StackClass#c->StackClass#b', call_info.call_sequence)
     assert_equal(1, call_info.children.length)
   end
-end
\ No newline at end of file
+end
diff --git a/test/start_stop_test.rb b/test/start_stop_test.rb
index c5976e5..4e47edf 100755
--- a/test/start_stop_test.rb
+++ b/test/start_stop_test.rb
@@ -1,8 +1,8 @@
 #!/usr/bin/env ruby
+# encoding: UTF-8
+
+require File.expand_path('../test_helper', __FILE__)
 
-require 'test/unit'
-require 'ruby-prof'
- 
 class StartStopTest < Test::Unit::TestCase
   def setup
     # Need to use wall time for this test due to the sleep calls
@@ -22,6 +22,23 @@ class StartStopTest < Test::Unit::TestCase
     sleep(2)
     @result = RubyProf.stop
   end
+  
+  def test_extra_stop_should_raise
+    RubyProf.start
+    assert_raise(RuntimeError) do
+      RubyProf.start
+    end
+    
+    assert_raise(RuntimeError) do
+      RubyProf.profile {}
+    end
+    
+    RubyProf.stop # ok
+    assert_raise(RuntimeError) do
+      RubyProf.stop
+    end
+  end
+    
 
   def test_different_methods
     method1
@@ -36,17 +53,17 @@ class StartStopTest < Test::Unit::TestCase
     #   StartStopTest#method3
     #   Kernel#sleep
 
-    methods = @result.threads.values.first.sort.reverse
+    methods = @result.threads.first.methods.sort.reverse
     assert_equal(4, methods.length)
 
     # Check StackTest#test_call_sequence
     method = methods[0]
     assert_equal('StartStopTest#method1', method.full_name)
     assert_equal(1, method.called)
-    assert_in_delta(2, method.total_time, 0.01)
-    assert_in_delta(0, method.wait_time, 0.01)
-    assert_in_delta(0, method.self_time, 0.01)
-    assert_in_delta(2, method.children_time, 0.01)
+    assert_in_delta(2, method.total_time, 0.05)
+    assert_in_delta(0, method.wait_time, 0.02)
+    assert_in_delta(0, method.self_time, 0.02)
+    assert_in_delta(2, method.children_time, 0.05)
     assert_equal(1, method.call_infos.length)
 
     call_info = method.call_infos[0]
@@ -56,10 +73,10 @@ class StartStopTest < Test::Unit::TestCase
     method = methods[1]
     assert_equal('StartStopTest#method2', method.full_name)
     assert_equal(1, method.called)
-    assert_in_delta(2, method.total_time, 0.01)
-    assert_in_delta(0, method.wait_time, 0.01)
-    assert_in_delta(0, method.self_time, 0.01)
-    assert_in_delta(2, method.children_time, 0.01)
+    assert_in_delta(2, method.total_time, 0.05)
+    assert_in_delta(0, method.wait_time, 0.02)
+    assert_in_delta(0, method.self_time, 0.02)
+    assert_in_delta(2, method.children_time, 0.05)
     assert_equal(1, method.call_infos.length)
 
     call_info = method.call_infos[0]
@@ -69,10 +86,10 @@ class StartStopTest < Test::Unit::TestCase
     method = methods[2]
     assert_equal('StartStopTest#method3', method.full_name)
     assert_equal(1, method.called)
-    assert_in_delta(2, method.total_time, 0.01)
-    assert_in_delta(0, method.wait_time, 0.01)
-    assert_in_delta(0, method.self_time, 0.01)
-    assert_in_delta(2, method.children_time, 0.01)
+    assert_in_delta(2, method.total_time, 0.02)
+    assert_in_delta(0, method.wait_time, 0.02)
+    assert_in_delta(0, method.self_time, 0.02)
+    assert_in_delta(2, method.children_time, 0.02)
     assert_equal(1, method.call_infos.length)
 
     call_info = method.call_infos[0]
@@ -82,14 +99,14 @@ class StartStopTest < Test::Unit::TestCase
     method = methods[3]
     assert_equal('Kernel#sleep', method.full_name)
     assert_equal(1, method.called)
-    assert_in_delta(2, method.total_time, 0.01)
-    assert_in_delta(0, method.wait_time, 0.01)
-    assert_in_delta(2, method.self_time, 0.01)
-    assert_in_delta(0, method.children_time, 0.01)
+    assert_in_delta(2, method.total_time, 0.02)
+    assert_in_delta(0, method.wait_time, 0.02)
+    assert_in_delta(2, method.self_time, 0.02)
+    assert_in_delta(0, method.children_time, 0.02)
     assert_equal(1, method.call_infos.length)
 
     call_info = method.call_infos[0]
     assert_equal('StartStopTest#method1->StartStopTest#method2->StartStopTest#method3->Kernel#sleep', call_info.call_sequence)
     assert_equal(0, call_info.children.length)
   end
-end
\ No newline at end of file
+end
diff --git a/test/test_helper.rb b/test/test_helper.rb
new file mode 100644
index 0000000..f4d0289
--- /dev/null
+++ b/test/test_helper.rb
@@ -0,0 +1,115 @@
+# encoding: UTF-8
+
+# Make RubyMine happy
+require "rubygems"
+gem "minitest"
+
+if ENV["RM_INFO"] || ENV["TEAMCITY_VERSION"]
+  if RUBY_PLATFORM =~ /(win32|mingw)/
+    gem "win32console"
+  end
+  gem "minitest-reporters"
+  require 'minitest/reporters'
+  MiniTest::Reporters.use!
+end
+
+require "minitest/pride"
+
+# To make testing/debugging easier, test within this source tree versus an installed gem
+dir = File.dirname(__FILE__)
+root = File.expand_path(File.join(dir, '..'))
+lib = File.expand_path(File.join(root, 'lib'))
+ext = File.expand_path(File.join(root, 'ext', 'ruby_prof'))
+
+$LOAD_PATH << lib
+$LOAD_PATH << ext
+
+require 'ruby-prof'
+require 'test/unit'
+require File.expand_path('../prime', __FILE__)
+
+# Some classes used in measurement tests
+module RubyProf
+  class C1
+    def C1.hello
+      sleep(0.1)
+    end
+
+    def hello
+      sleep(0.2)
+    end
+  end
+
+  module M1
+    def hello
+      sleep(0.3)
+    end
+  end
+
+  class C2
+    include M1
+    extend M1
+  end
+
+  class C3
+    def hello
+      sleep(0.4)
+    end
+  end
+
+  module M4
+    def hello
+      sleep(0.5)
+    end
+  end
+
+  module M5
+    include M4
+    def goodbye
+      hello
+    end
+  end
+
+  class C6
+    include M5
+    def test
+      goodbye
+    end
+  end
+
+  def self.ruby_major_version
+    match = RUBY_VERSION.match(/(\d)\.(\d)/)
+    return Integer(match[1])
+  end
+
+  def self.ruby_minor_version
+    match = RUBY_VERSION.match(/(\d)\.(\d)/)
+    return Integer(match[2])
+  end
+
+  def self.parent_object
+    if ruby_major_version == 1 && ruby_minor_version == 8
+      Object
+    else
+      BasicObject
+    end
+  end
+
+  def self.ruby_2?
+    ruby_major_version == 2
+  end
+
+  # store printer output in this directory
+  def self.tmpdir
+    File.expand_path('../../tmp', __FILE__)
+  end
+end
+
+module MemoryTestHelper
+  def memory_test_helper
+    result = RubyProf.profile {Array.new}
+    total = result.threads.first.methods.inject(0) { |sum, m| sum + m.total_time }
+    assert(total < 1_000_000, 'Total should not have subtract overflow error')
+    total
+  end
+end
diff --git a/test/test_suite.rb b/test/test_suite.rb
index 8bc3c01..0b19758 100644
--- a/test/test_suite.rb
+++ b/test/test_suite.rb
@@ -1,23 +1,37 @@
-require 'test/unit'
+# encoding: utf-8
 
-require 'aggregate_test'
-require 'basic_test'
-require 'duplicate_names_test'
-require 'exceptions_test'
-require 'line_number_test'
-require 'measurement_test'
-require 'module_test'
-require 'no_method_class_test'
-require 'prime_test'
-require 'printers_test'
-require 'recursive_test'
-require 'singleton_test'
-require 'stack_test'
-require 'start_stop_test'
-require 'thread_test'
-require 'unique_call_path_test'
+require File.expand_path("../test_helper", __FILE__)
 
-# Can't use this one here cause it breaks
-# the rest of the unit tets (Ruby Prof gets
-# started twice).
-#require 'profile_unit_test'
+%w(aggregate_test
+   basic_test
+   call_info_visitor_test
+   duplicate_names_test
+   dynamic_method_test
+   enumerable_test
+   exceptions_test
+   exclude_threads_test
+   line_number_test
+
+   measure_allocations_test
+   measure_cpu_time_test
+   measure_gc_runs_test
+   measure_gc_time_test
+   measure_memory_test
+   measure_process_time_test
+   measure_wall_time_test
+
+   method_elimination_test
+   module_test
+   multi_printer_test
+   no_method_class_test
+   pause_resume_test
+   printers_test
+   recursive_test
+   singleton_test
+   stack_test
+   stack_printer_test
+   start_stop_test
+   thread_test
+   unique_call_path_test).each do |test|
+  require File.expand_path("../#{test}", __FILE__)
+end
\ No newline at end of file
diff --git a/test/thread_test.rb b/test/thread_test.rb
index 2af3b25..58446cf 100755
--- a/test/thread_test.rb
+++ b/test/thread_test.rb
@@ -1,6 +1,7 @@
 #!/usr/bin/env ruby
-require 'test/unit'
-require 'ruby-prof'
+# encoding: UTF-8
+
+require File.expand_path('../test_helper', __FILE__)
 require 'timeout'
 
 # --  Tests ----
@@ -19,55 +20,57 @@ class ThreadTest < Test::Unit::TestCase
 
     thread.join
     result = RubyProf.stop
-
-    assert_equal(2, result.threads.keys.length)
+    assert_equal(2, result.threads.length)
   end
 
   def test_thread_identity
     RubyProf.start
-
-    thread = Thread.new do
+    sleep_thread = Thread.new do
       sleep(1)
     end
-
-    thread.join
+    sleep_thread.join
     result = RubyProf.stop
 
-    thread_ids = result.threads.keys.sort
-    threads = [Thread.current, thread].sort_by {|thread| thread.object_id}
+    thread_ids = result.threads.map {|thread| thread.id}.sort
+    threads = [Thread.current, sleep_thread]
+    assert_equal(2, result.threads.length)
 
-    assert_equal(threads[0].object_id, thread_ids[0])
-    assert_equal(threads[1].object_id, thread_ids[1])
+    assert(thread_ids.include?(threads[0].object_id))
+    assert(thread_ids.include?(threads[1].object_id))
 
     assert_instance_of(Thread, ObjectSpace._id2ref(thread_ids[0]))
-    assert_equal(threads[0], ObjectSpace._id2ref(thread_ids[0]))
+    assert(threads.include?(ObjectSpace._id2ref(thread_ids[0])))
 
     assert_instance_of(Thread, ObjectSpace._id2ref(thread_ids[1]))
-    assert_equal(threads[1], ObjectSpace._id2ref(thread_ids[1]))
+    assert(threads.include?(ObjectSpace._id2ref(thread_ids[1])))
   end
 
   def test_thread_timings
-    RubyProf.start
-
+        RubyProf.start
     thread = Thread.new do
+      sleep 0 # force it to hit thread.join, below, first
+      # thus forcing sleep(1), below, to be counted as (wall) self_time
+      # since we currently count time "in some other thread" as self.wait_time
+      # for whatever reason
       sleep(1)
     end
-
     thread.join
-
     result = RubyProf.stop
 
     # Check background thread
-    methods = result.threads[thread.object_id].sort.reverse
+    assert_equal(2, result.threads.length)
+
+    rp_thread = result.threads.detect {|athread| athread.id == thread.object_id}
+    methods = rp_thread.methods.sort.reverse
     assert_equal(2, methods.length)
 
     method = methods[0]
     assert_equal('ThreadTest#test_thread_timings', method.full_name)
     assert_equal(1, method.called)
-    assert_in_delta(1, method.total_time, 0.01)
-    assert_in_delta(0, method.self_time, 0.01)
-    assert_in_delta(1, method.wait_time, 0.01)
-    assert_in_delta(0, method.children_time, 0.01)
+    assert_in_delta(1, method.total_time, 0.05)
+    assert_in_delta(0, method.self_time, 0.05)
+    assert_in_delta(0, method.wait_time, 0.05)
+    assert_in_delta(1, method.children_time, 0.05)
     assert_equal(1, method.call_infos.length)
     call_info = method.call_infos[0]
     assert_equal('ThreadTest#test_thread_timings', call_info.call_sequence)
@@ -75,11 +78,11 @@ class ThreadTest < Test::Unit::TestCase
 
     method = methods[1]
     assert_equal('Kernel#sleep', method.full_name)
-    assert_equal(1, method.called)
-    assert_in_delta(1, method.total_time, 0.01)
-    assert_in_delta(1.0, method.self_time, 0.01)
-    assert_in_delta(0, method.wait_time, 0.01)
-    assert_in_delta(0, method.children_time, 0.01)
+    assert_equal(2, method.called)
+    assert_in_delta(1, method.total_time, 0.05)
+    assert_in_delta(1.0, method.self_time, 0.05)
+    assert_in_delta(0, method.wait_time, 0.05)
+    assert_in_delta(0, method.children_time, 0.05)
 
     assert_equal(1, method.call_infos.length)
     call_info = method.call_infos[0]
@@ -87,17 +90,21 @@ class ThreadTest < Test::Unit::TestCase
     assert_equal(0, call_info.children.length)
 
     # Check foreground thread
-    methods = result.threads[Thread.current.object_id].sort.reverse
+    rp_thread = result.threads.detect {|athread| athread.id == Thread.current.object_id}
+    methods = rp_thread.methods.sort.reverse
     assert_equal(4, methods.length)
     methods = methods.sort.reverse
 
     method = methods[0]
     assert_equal('ThreadTest#test_thread_timings', method.full_name)
-    assert_equal(0, method.called)
-    assert_in_delta(1, method.total_time, 0.01)
-    assert_in_delta(0, method.self_time, 0.01)
-    assert_in_delta(1.0, method.wait_time, 0.01)
-    assert_in_delta(0, method.children_time, 0.01)
+    # the sub calls to Object#new, when popped,
+    # cause the parent frame to be created for method #test_thread_timings, which means a +1 when it's popped in the end
+    # xxxx a test that shows it the other way, too (never creates parent frame--if that's even possible)
+    assert_equal(1, method.called)
+    assert_in_delta(1, method.total_time, 0.05)
+    assert_in_delta(0, method.self_time, 0.05)
+    assert_in_delta(0, method.wait_time, 0.05)
+    assert_in_delta(1, method.children_time, 0.05)
 
     assert_equal(1, method.call_infos.length)
     call_info = method.call_infos[0]
@@ -107,10 +114,10 @@ class ThreadTest < Test::Unit::TestCase
     method = methods[1]
     assert_equal('Thread#join', method.full_name)
     assert_equal(1, method.called)
-    assert_in_delta(1, method.total_time, 0.01)
-    assert_in_delta(0, method.self_time, 0.01)
-    assert_in_delta(1.0, method.wait_time, 0.01)
-    assert_in_delta(0, method.children_time, 0.01)
+    assert_in_delta(1, method.total_time, 0.05)
+    assert_in_delta(0, method.self_time, 0.05)
+    assert_in_delta(1.0, method.wait_time, 0.05)
+    assert_in_delta(0, method.children_time, 0.05)
 
     assert_equal(1, method.call_infos.length)
     call_info = method.call_infos[0]
@@ -120,10 +127,10 @@ class ThreadTest < Test::Unit::TestCase
     method = methods[2]
     assert_equal('<Class::Thread>#new', method.full_name)
     assert_equal(1, method.called)
-    assert_in_delta(0, method.total_time, 0.01)
-    assert_in_delta(0, method.self_time, 0.01)
-    assert_in_delta(0, method.wait_time, 0.01)
-    assert_in_delta(0, method.children_time, 0.01)
+    assert_in_delta(0, method.total_time, 0.05)
+    assert_in_delta(0, method.self_time, 0.05)
+    assert_in_delta(0, method.wait_time, 0.05)
+    assert_in_delta(0, method.children_time, 0.05)
 
     assert_equal(1, method.call_infos.length)
     call_info = method.call_infos[0]
@@ -133,21 +140,33 @@ class ThreadTest < Test::Unit::TestCase
     method = methods[3]
     assert_equal('Thread#initialize', method.full_name)
     assert_equal(1, method.called)
-    assert_in_delta(0, method.total_time, 0.01)
-    assert_in_delta(0, method.self_time, 0.01)
-    assert_in_delta(0, method.wait_time, 0.01)
-    assert_in_delta(0, method.children_time, 0.01)
+    assert_in_delta(0, method.total_time, 0.05)
+    assert_in_delta(0, method.self_time, 0.05)
+    assert_in_delta(0, method.wait_time, 0.05)
+    assert_in_delta(0, method.children_time, 0.05)
 
     assert_equal(1, method.call_infos.length)
     call_info = method.call_infos[0]
     assert_equal('ThreadTest#test_thread_timings-><Class::Thread>#new->Thread#initialize', call_info.call_sequence)
     assert_equal(0, call_info.children.length)
   end
-  
+
+  # useless test
+  def test_thread_back_and_forth
+      result = RubyProf.profile do
+              a = Thread.new { 100_000.times { sleep 0 }}
+              b = Thread.new { 100_000.times { sleep 0 }}
+              a.join
+              b.join
+      end
+      methods = result.threads.map {|thread| thread.methods}
+      assert(methods.flatten.sort[-1].total_time < 10) # 10s. Amazingly, this can fail in OS X at times. Amazing.
+  end
+
   def test_thread
-    result = RubyProf.profile do
+    RubyProf.profile do
       begin
-        status = Timeout::timeout(2) do
+        Timeout::timeout(2) do
           while true
             next
           end
@@ -156,4 +175,4 @@ class ThreadTest < Test::Unit::TestCase
       end
     end
   end
-end
\ No newline at end of file
+end
diff --git a/test/unique_call_path_test.rb b/test/unique_call_path_test.rb
index d3f9a04..a3397b1 100755
--- a/test/unique_call_path_test.rb
+++ b/test/unique_call_path_test.rb
@@ -1,7 +1,7 @@
 #!/usr/bin/env ruby
+# encoding: UTF-8
 
-require 'test/unit'
-require 'ruby-prof'
+require File.expand_path('../test_helper', __FILE__)
 
 class UniqueCallPath
   def method_a(i)
@@ -17,7 +17,6 @@ class UniqueCallPath
   end
 
   def method_c
-    c = 3
   end
 
   def method_k(i)
@@ -36,8 +35,8 @@ class UniqueCallPathTest < Test::Unit::TestCase
     end
 
     root_methods = Array.new
-    result.threads.each do | thread_id, methods |
-      methods.each do | m |
+    result.threads.each do |thread|
+      thread.methods.each do | m |
         if m.root?
           root_methods.push(m)
         end
@@ -57,8 +56,8 @@ class UniqueCallPathTest < Test::Unit::TestCase
     end
 
     root_methods = Array.new
-    result.threads.each do | thread_id, methods |
-      methods.each do | m |
+    result.threads.each do |thread|
+      thread.methods.each do | m |
         if m.root?
           root_methods.push(m)
         end
@@ -92,8 +91,8 @@ class UniqueCallPathTest < Test::Unit::TestCase
     end
 
     root_methods = Array.new
-    result.threads.each do | thread_id, methods |
-      methods.each do | m |
+    result.threads.each do |thread|
+      thread.methods.each do | m |
         if m.root?
           root_methods.push(m)
         end
@@ -112,7 +111,7 @@ class UniqueCallPathTest < Test::Unit::TestCase
       end
     end
 
-    assert !call_info_a.nil? 
+    assert !call_info_a.nil?
 
     children_of_a = Array.new
 
@@ -122,15 +121,24 @@ class UniqueCallPathTest < Test::Unit::TestCase
       end
     end
 
-    assert_equal(4, call_info_a.target.children.length)
+    if RUBY_VERSION < '1.9'
+      assert_equal(4, call_info_a.target.children.length)
+    else
+      assert_equal(2, call_info_a.target.children.length)
+    end
 
     children_of_a = children_of_a.sort do |c1, c2|
       c1.target.full_name <=> c2.target.full_name
     end
+    if RUBY_VERSION < '1.9'
+      assert_equal(2, children_of_a.length)
+      assert_equal("Fixnum#==", children_of_a[0].target.full_name)
+      assert_equal("UniqueCallPath#method_b", children_of_a[1].target.full_name)
+    else
+      assert_equal(1, children_of_a.length)
+      assert_equal("UniqueCallPath#method_b", children_of_a[0].target.full_name)
+    end
 
-    assert_equal(2, children_of_a.length)
-    assert_equal("Fixnum#==", children_of_a[0].target.full_name)
-    assert_equal("UniqueCallPath#method_b", children_of_a[1].target.full_name)
   end
 
   def test_id2ref
@@ -141,8 +149,8 @@ class UniqueCallPathTest < Test::Unit::TestCase
     end
 
     root_methods = Array.new
-    result.threads.each do | thread_id, methods |
-      methods.each do | m |
+    result.threads.each do |thread|
+      thread.methods.each do | m |
         if m.root?
           root_methods.push(m)
         end
@@ -151,7 +159,7 @@ class UniqueCallPathTest < Test::Unit::TestCase
 
     child = root_methods[0].children[0]
 
-    assert_not_equal(0, child.id)
+    assert_not_equal(0, child.object_id)
     #assert_equal(RubyProf::CallInfo.id2ref(child.id).target.full_name, child.target.full_name)
   end
 
@@ -164,8 +172,8 @@ class UniqueCallPathTest < Test::Unit::TestCase
     end
 
     root_methods = Array.new
-    result.threads.each do | thread_id, methods |
-      methods.each do | m |
+    result.threads.each do |thread|
+      thread.methods.each do | m |
         if m.root?
           root_methods.push(m)
         end
@@ -191,16 +199,26 @@ class UniqueCallPathTest < Test::Unit::TestCase
       end
     end
 
-    assert_equal(4, call_info_a.target.children.length)
+    if RUBY_VERSION < '1.9'
+      assert_equal(4, call_info_a.target.children.length)
+    else
+      assert_equal(2, call_info_a.target.children.length)
+    end
 
     children_of_a = children_of_a.sort do |c1, c2|
       c1.target.full_name <=> c2.target.full_name
     end
 
-    assert_equal(2, children_of_a.length)
-    assert_equal(1, children_of_a[0].called)
-    assert_equal("Fixnum#==", children_of_a[0].target.full_name)
-    assert_equal(1, children_of_a[1].called)
-    assert_equal("UniqueCallPath#method_b", children_of_a[1].target.full_name)
+    if RUBY_VERSION < '1.9'
+      assert_equal(2, children_of_a.length)
+      assert_equal(1, children_of_a[0].called)
+      assert_equal("Fixnum#==", children_of_a[0].target.full_name)
+      assert_equal(1, children_of_a[1].called)
+      assert_equal("UniqueCallPath#method_b", children_of_a[1].target.full_name)
+    else
+      assert_equal(1, children_of_a.length)
+      assert_equal(1, children_of_a[0].called)
+      assert_equal("UniqueCallPath#method_b", children_of_a[0].target.full_name)
+    end
   end
-end
\ No newline at end of file
+end

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-prof.git



More information about the Pkg-ruby-extras-commits mailing list