jeremy-ruby-prof 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. data/CHANGES +158 -0
  2. data/LICENSE +23 -0
  3. data/README +416 -0
  4. data/Rakefile +141 -0
  5. data/bin/ruby-prof +196 -0
  6. data/examples/flat.txt +55 -0
  7. data/examples/graph.html +823 -0
  8. data/examples/graph.txt +170 -0
  9. data/ext/extconf.rb +24 -0
  10. data/ext/measure_allocations.h +58 -0
  11. data/ext/measure_cpu_time.h +149 -0
  12. data/ext/measure_memory.h +104 -0
  13. data/ext/measure_process_time.h +52 -0
  14. data/ext/measure_wall_time.h +53 -0
  15. data/ext/ruby_prof.c +1680 -0
  16. data/lib/ruby-prof.rb +45 -0
  17. data/lib/ruby-prof/abstract_printer.rb +42 -0
  18. data/lib/ruby-prof/call_tree_printer.rb +76 -0
  19. data/lib/ruby-prof/flat_printer.rb +76 -0
  20. data/lib/ruby-prof/graph_html_printer.rb +255 -0
  21. data/lib/ruby-prof/graph_printer.rb +163 -0
  22. data/lib/ruby-prof/profile_test.rb +147 -0
  23. data/lib/ruby-prof/task.rb +147 -0
  24. data/lib/unprof.rb +8 -0
  25. data/test/basic_test.rb +190 -0
  26. data/test/duplicate_names_test.rb +33 -0
  27. data/test/exceptions_test.rb +19 -0
  28. data/test/line_number_test.rb +69 -0
  29. data/test/measure_mode_test.rb +91 -0
  30. data/test/measurement_test.rb +61 -0
  31. data/test/module_test.rb +57 -0
  32. data/test/no_method_class_test.rb +14 -0
  33. data/test/prime.rb +60 -0
  34. data/test/prime1.rb +17 -0
  35. data/test/prime2.rb +26 -0
  36. data/test/prime3.rb +17 -0
  37. data/test/prime_test.rb +24 -0
  38. data/test/printers_test.rb +74 -0
  39. data/test/profile_unit_test.rb +24 -0
  40. data/test/recursive_test.rb +144 -0
  41. data/test/singleton_test.rb +38 -0
  42. data/test/start_test.rb +24 -0
  43. data/test/test_helper.rb +55 -0
  44. data/test/test_suite.rb +20 -0
  45. data/test/thread_test.rb +135 -0
  46. data/test/timing_test.rb +133 -0
  47. metadata +112 -0
data/CHANGES ADDED
@@ -0,0 +1,158 @@
1
+ 0.6.1 (2008-02-25)
2
+ ========================
3
+
4
+ ruby-prof 0.6.1 add support for profiling tests cases.
5
+
6
+ Features
7
+ --------
8
+ * Added two new methods - RubyProf.resume and RubyProf.pause.
9
+ RubyProf.resume takes an optional block, which ensures that
10
+ RubyProf.pause is called. For example:
11
+
12
+ 10.times do |i|
13
+ RubyProf.resume do
14
+ # Some long process
15
+ end
16
+ end
17
+
18
+ result = RubyProf.stop
19
+
20
+ * Added support for profiling tests that use Ruby's built-in
21
+ unit test framework (ie, test derived from
22
+ Test::Unit::TestCase). To enable profiling simply add
23
+ the following line of code to your test class:
24
+
25
+ include RubyProf::Test
26
+
27
+ By default, profiling results are written to the current
28
+ processes working directory. To change this, or other
29
+ profiling options, simply modify the PROFILE_OPTIONS hash
30
+ table as needed.
31
+
32
+ * Used the new support for profiling test cases to revamp
33
+ the way that Rails profiling works. For more information
34
+ please refer to RubyProf's documentation.
35
+
36
+
37
+ Fixes
38
+ -------
39
+ * RubyProf.profile no longer crashes if an exception is
40
+ thrown during a profiling run.
41
+
42
+
43
+ 0.6.0 (2008-02-03)
44
+ ========================
45
+
46
+ ruby-prof 0.6.0 adds support for Ruby 1.9 and memory profiling.
47
+
48
+ Features
49
+ --------
50
+ * Added support for ruby 1.9 (Shugo Maeda)
51
+ * Added support for outputting printer results to a String, Array or IO
52
+ object (Michael Granger)
53
+ * Add new memory profiling mode. Note this mode depends on a
54
+ patched Ruby interpreter (Alexander Dymo)
55
+
56
+ Fixes
57
+ -------
58
+ * Improvements to GraphHtmlPrinter including updated documentation,
59
+ fixes for min_time support, ability to specify templates using
60
+ strings or filenames, and table layout fixes (Makoto Kuwata)
61
+ * Fixes to scaling factor for calltrees so that precision is not lost
62
+ due to the conversion to doubles (Sylvain Joyeux)
63
+ * Changed constant ALLOCATED_OBJECTS to ALLOCATIONS in the C code to
64
+ match the Ruby code (Sylvain Joyeux)
65
+ * Added support for calltree printer to ruby-prof binary script (Sylvain Joyeux)
66
+ * Fix support for the allocator measure mode to extconf.rb (Sylvain Joyeux)
67
+ * Honor measure mode when specified on the command line (Sylvain Joyeux)
68
+ * Sorting of methods by total time was incorrect (Dan Fitch, Charlie Savage)
69
+ * Fix ruby-prof to work with the latest version of GEMS (Alexander Dymo)
70
+ * Always define MEASURE_CPU_TIME and MEASURE_ALLOCATIONS in Ruby code, but
71
+ set their values to nil if the functionality is not available.
72
+
73
+
74
+ 0.5.2 (2007-07-19)
75
+ ========================
76
+
77
+ ruby-prof 0.5.2 is a bug fix release.
78
+
79
+ Fixes
80
+ -------
81
+ * Include missing rails plugin
82
+
83
+
84
+ 0.5.1 (2007-07-18)
85
+ ========================
86
+
87
+ ruby-prof 0.5.1 is a bug fix and performance release.
88
+
89
+ Performance
90
+ --------
91
+ * Significantly reduced the number of thread lookups by
92
+ caching the last executed thread.
93
+
94
+ Fixes
95
+ -------
96
+ * Properly escape method names in HTML reports
97
+ * Fix use of -m and --min-percent command line switches
98
+ * Default source file information to ruby_runtime#0 for c calls
99
+ * Moved rails_plugin to top level so it is more obvious
100
+ * Updated rails_plugin to write reports to the current
101
+ Rails log directory
102
+ * Added additional tests
103
+
104
+
105
+ 0.5.0 (2007-07-09)
106
+ ========================
107
+
108
+ Features
109
+ --------
110
+ * Added support for timing multi-threaded applications
111
+ * Added support for 64 bit systems (patch from Diego 'Flameeyes' Petten)
112
+ * Added suport for outputting data in the format used by
113
+ KCacheGrind (patch from Carl Shimer)
114
+ * Add filename and line numbers to call tree information (patch from Carl Shimer)
115
+ * Added Visual Studio 2005 project file.
116
+ * Added replace-progname switch, als rcov.
117
+ * Added better support for recursive methods
118
+ * Added better support for profiling Rails applications
119
+
120
+ Fixes
121
+ -------
122
+ * Fixes bug when the type of an attached object (singleton) is inherited
123
+ from T_OBJECT as opposed to being a T_OBJECT (identified by Francis Cianfrocca)
124
+ * ruby-prof now works in IRB.
125
+ * Fix sort order in reports.
126
+ * Fixed rdoc compile error.
127
+ * Fix tabs in erb template for graph html report on windows.
128
+
129
+ 0.4.1 (2006-06-26)
130
+ ========================
131
+
132
+ Features
133
+ --------
134
+ * Added a RubyProf.running? method to indicate whether a profile is in progress.
135
+ * Added tgz and zip archives to release
136
+
137
+ Fixes
138
+ -------
139
+ * Duplicate method names are now allowed
140
+ * The documentation has been updated to show the correct API usage is RubyProf.stop not RubyProf.end
141
+
142
+
143
+ 0.4.0 (2006-06-16)
144
+ ========================
145
+ Features
146
+ --------
147
+ * added support for call graphs
148
+ * added support for printers. Currently there is a FlatPrinter,
149
+ GraphPrinter and GraphHtmlPrinter.
150
+ * added support for recursive methods
151
+ * added Windows support
152
+ * now packaged as a RubyGem
153
+
154
+ Fixes
155
+ -------
156
+ * Fixes bug where RubyProf would crash depending on the
157
+ way it was invoked - for example, it did not run when
158
+ used with Arachno Ruby's customized version of Ruby.
data/LICENSE ADDED
@@ -0,0 +1,23 @@
1
+ Copyright (C) 2005 Shugo Maeda <shugo@ruby-lang.org>
2
+ All rights reserved.
3
+ *
4
+ Redistribution and use in source and binary forms, with or without
5
+ modification, are permitted provided that the following conditions
6
+ are met:
7
+ 1. Redistributions of source code must retain the above copyright
8
+ notice, this list of conditions and the following disclaimer.
9
+ 2. Redistributions in binary form must reproduce the above copyright
10
+ notice, this list of conditions and the following disclaimer in the
11
+ documentation and/or other materials provided with the distribution.
12
+ *
13
+ THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
14
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16
+ ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
17
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19
+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21
+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22
+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23
+ SUCH DAMAGE.
data/README ADDED
@@ -0,0 +1,416 @@
1
+ = ruby-prof
2
+
3
+ == Overview
4
+
5
+ ruby-prof is a fast code profiler for Ruby. Its features include:
6
+
7
+ * Speed - it is a C extension and therefore many times faster than the standard Ruby profiler.
8
+ * Modes - Ruby prof can measure a number of different parameters, including
9
+ call times, memory usage and object allocations.
10
+ * Reports - can generate text and cross-referenced html reports
11
+ - Flat Profiles - similar to the reports generated by the standard Ruby profiler
12
+ - Graph profiles - similar to GProf, these show how long a method runs, which methods call it and which methods it calls.
13
+ - Call tree profiles - outputs results in the calltree format suitable for the KCacheGrind profiling tool.
14
+ * Threads - supports profiling multiple threads simultaneously
15
+ * Recursive calls - supports profiling recursive method calls
16
+
17
+
18
+ == Requirements
19
+
20
+ ruby-prof requires Ruby 1.8.4 or higher.
21
+
22
+ If you are running Linux or Unix you'll need a C compiler so the extension
23
+ can be compiled when it is installed.
24
+
25
+ If you are running Windows, then install the Windows specific RubyGem which
26
+ includes an already built extension.
27
+
28
+
29
+ == Install
30
+
31
+ The easiest way to install ruby-prof is by using Ruby Gems. To install:
32
+
33
+ <tt>gem install ruby-prof</tt>
34
+
35
+ If you are running Windows, make sure to install the Win32 RubyGem which
36
+ includes a pre-built binary.
37
+
38
+ ruby-prof is also available as a tarred gzip archive and zip archive.
39
+
40
+ == Usage
41
+
42
+ There are three ways of running ruby-prof.
43
+
44
+
45
+ === ruby-prof executable
46
+
47
+ The first is to use ruby-prof to run the Ruby program
48
+ you want to profile. For more information refer to
49
+ the ruby-prof documentation[link:files/bin/ruby-prof.html].
50
+
51
+
52
+ === ruby-prof API
53
+
54
+ The second way is to use the ruby-prof API to profile
55
+ particular segments of code.
56
+
57
+ require 'ruby-prof'
58
+
59
+ # Profile the code
60
+ RubyProf.start
61
+ ...
62
+ [code to profile]
63
+ ...
64
+ result = RubyProf.stop
65
+
66
+ # Print a flat profile to text
67
+ printer = RubyProf::FlatPrinter.new(result)
68
+ printer.print(STDOUT, 0)
69
+
70
+ Alternatively, you can use a block to tell ruby-prof what
71
+ to profile:
72
+
73
+ require 'ruby-prof'
74
+
75
+ # Profile the code
76
+ result = RubyProf.profile do
77
+ ...
78
+ [code to profile]
79
+ ...
80
+ end
81
+
82
+ # Print a graph profile to text
83
+ printer = RubyProf::GraphPrinter.new(result)
84
+ printer.print(STDOUT, 0)
85
+
86
+ Starting with the 0.6.1 release, ruby-prof also supports pausing and resuming
87
+ profiling runs.
88
+
89
+ require 'ruby-prof'
90
+
91
+ # Profile the code
92
+ RubyProf.start
93
+ [code to profile]
94
+ RubyProf.pause
95
+ [other code]
96
+ RubyProf.resume
97
+ [code to profile]
98
+ result = RubyProf.stop
99
+
100
+ Note that resume will automatically call start if a profiling run
101
+ has not yet started. In addition, resume can also take a block:
102
+
103
+ require 'ruby-prof'
104
+
105
+ # Profile the code
106
+ RubyProf.resume do
107
+ [code to profile]
108
+ end
109
+
110
+ data = RubyProf.stop
111
+
112
+ With this usage, resume will automatically call pause at the
113
+ end of the block.
114
+
115
+
116
+ === require unprof
117
+
118
+ The third way of using ruby-prof is by requiring unprof.rb:
119
+
120
+ require 'unprof'
121
+
122
+ This will start profiling immediately and will output the results
123
+ using a flat profile report.
124
+
125
+ This method is provided for backwards compatibility. Using
126
+ {ruby-prof}[link:files/bin/ruby-prof.html] provides more flexibility.
127
+
128
+
129
+ == Profiling Tests
130
+
131
+ Starting with the 0.6.1 release, ruby-prof supports profiling tests cases
132
+ written using Ruby's built-in unit test framework (ie, test derived from
133
+ Test::Unit::TestCase). To enable profiling simply add the following line
134
+ of code to your test class:
135
+
136
+ include RubyProf::Test
137
+
138
+ Each test method is profiled separately. ruby-prof will run each test method
139
+ once as a warmup and then ten additional times to gather profile data.
140
+ Note that the profile data will *not* include the class's setup or
141
+ teardown methods.
142
+
143
+ Separate reports are generated for each method and saved, by default,
144
+ in the test process's working directory. To change this, or other profiling
145
+ options, modify your test class's PROFILE_OPTIONS hash table. To globally
146
+ change test profiling options, modify RubyProf::Test::PROFILE_OPTIONS.
147
+
148
+
149
+ == Profiling Rails
150
+
151
+ To profile a Rails application it is vital to run it using production like
152
+ settings (cache classes, cache view lookups, etc.). Otherwise, Rail's
153
+ dependency loading code will overwhelm any time spent in the application
154
+ itself (our tests show that Rails dependency loading causes a roughly 6x
155
+ slowdown). The best way to do this is create a new Rails environment,
156
+ profile.rb.
157
+
158
+ So to profile Rails:
159
+
160
+ 1. Create a new profile.rb environment - or simply copy the example file
161
+ in ruby-prof/rails/environment/profile.rb
162
+
163
+ 2. Copy the file:
164
+
165
+ ruby-prof/rails/profile_test_helper.rb
166
+
167
+ To:
168
+
169
+ your_rails_app/test/profile_test_helper.rb
170
+
171
+ 3. Create a new test directory for profiling:
172
+
173
+ your_rails_app/test/profile
174
+
175
+
176
+ 4. Write unit, functional or integration tests specifically designed
177
+ to profile some part of your Rails application. At the top
178
+ of each test, replace this line:
179
+
180
+ require File.dirname(__FILE__) + '/../test_helper'
181
+
182
+ With:
183
+
184
+ require File.dirname(__FILE__) + '/../profile_test_helper'
185
+
186
+ For example:
187
+
188
+ require File.dirname(__FILE__) + '/../profile_test_helper'
189
+
190
+ class ExampleTest < Test::Unit::TestCase
191
+ include RubyProf::Test
192
+ fixtures ....
193
+
194
+ def test_stuff
195
+ puts "Test method"
196
+ end
197
+ end
198
+
199
+ 5. Now run your tests. Results will be written to:
200
+
201
+ your_rails_app/tmp/profile
202
+
203
+
204
+ == Reports
205
+
206
+ ruby-prof can generate a number of different reports:
207
+
208
+ * Flat Reports
209
+ * Graph Reports
210
+ * HTML Graph Reports
211
+ * Call graphs
212
+
213
+ Flat profiles show the overall time spent in each method. They
214
+ are a good of quickly identifying which methods take the most time.
215
+ An example of a flat profile and an explanation can be found in
216
+ {examples/flat.txt}[link:files/examples/flat_txt.html].
217
+
218
+ Graph profiles also show the overall time spent in each method.
219
+ In addition, they also show which methods call the current
220
+ method and which methods its calls. Thus they are good for
221
+ understanding how methods gets called and provide insight into
222
+ the flow of your program. An example text graph profile
223
+ is located at {examples/graph.txt}[link:files/examples/graph_txt.html].
224
+
225
+ HTML Graph profiles are the same as graph profiles, except
226
+ output is generated in hyper-linked HTML. Since graph profiles
227
+ can be quite large, the embedded links make it much easier to
228
+ navigate the results. An example html graph profile
229
+ is located at {examples/graph.html}[link:files/examples/graph_html.html].
230
+
231
+ HTML Graph profiles are the same as graph profiles, except
232
+ output is generated in hyper-linked HTML. Since graph profiles
233
+ can be quite large, the embedded links make it much easier to
234
+ navigate the results. An example html graph profile
235
+ is located at {examples/graph.html}[link:files/examples/graph_html.html].
236
+
237
+ Call graphs output results in the calltree profile format which is used
238
+ by KCachegrind. Call graph support was generously donated by Carl Shimer.
239
+ More information about the format can be found at
240
+ the {KCachegrind}[link:http://kcachegrind.sourceforge.net/cgi-bin/show.cgi/KcacheGrindCalltreeFormat] site.
241
+
242
+
243
+ == Printers
244
+
245
+ Reports are created by printers. Supported printers include:
246
+
247
+ * RubyProf::FlatPrinter - Creates a flat report in text format
248
+ * RubyProf::GraphPrinter - Creates a call graph report in text format
249
+ * RubyProf::GraphHtmlPrinter - Creates a call graph report in HTML (separate files per thread)
250
+ * RubyProf::CallTreePrinter - Creates a call tree report compatible with KCachegrind.
251
+
252
+ To use a printer:
253
+
254
+ result = RubyProf.end
255
+ printer = RubyProf::GraphPrinter.new(result)
256
+ printer.print(STDOUT, 0)
257
+
258
+ The first parameter is any writable IO object such as STDOUT or a file.
259
+ The second parameter, which has a default value of 0, specifies
260
+ the minimum percentage a method must take to be printed. Percentages
261
+ should be specified as integers in the range 0 to 100. For more
262
+ information please see the documentation for the different printers.
263
+
264
+
265
+ == Measurements
266
+
267
+ Depending on the mode and platform, ruby-prof can measure various
268
+ aspects of a Ruby program. Supported measurements include:
269
+
270
+ * process time
271
+ * wall time
272
+ * cpu time
273
+ * object allocations
274
+ * memory usage
275
+
276
+ Process time measures the time used by a process between any two moments.
277
+ It is unaffected by other processes concurrently running
278
+ on the system. Note that Windows does not support measuring process
279
+ times - therefore, all measurements on Windows use wall time.
280
+
281
+ Wall time measures the real-world time elapsed between any two moments.
282
+ If there are other processes concurrently running on the system
283
+ that use significant CPU or disk time during a profiling run
284
+ then the reported results will be too large.
285
+
286
+ CPU time uses the CPU clock counter to measure time. The returned
287
+ values are dependent on the correctly setting the CPU's frequency.
288
+ This mode is only supported on Pentium or PowerPC platforms.
289
+
290
+ Object allocation reports show how many objects each method in
291
+ a program allocates. This support was added by Sylvain Joyeux
292
+ and requires a patched Ruby interpreter. For more information, see:
293
+ http://rubyforge.org/tracker/index.php?func=detail&aid=11497&group_id=426&atid=1700
294
+
295
+ Memory usage reports show how much memory each method in a program
296
+ uses. This support was added by Alexander Dymo and requires a
297
+ patched Ruby interpreter. For more information, see:
298
+ http://rubyforge.org/tracker/index.php?func=detail&aid=17676&group_id=1814&atid=7062.
299
+
300
+
301
+ To set the measurement:
302
+
303
+ * RubyProf.measure_mode = RubyProf::PROCESS_TIME
304
+ * RubyProf.measure_mode = RubyProf::WALL_TIME
305
+ * RubyProf.measure_mode = RubyProf::CPU_TIME
306
+ * RubyProf.measure_mode = RubyProf::ALLOCATIONS
307
+ * RubyProf.measure_mode = RubyProf::MEMORY
308
+
309
+ The default value is RubyProf::PROCESS_TIME.
310
+
311
+ You may also specify the measure_mode by using the RUBY_PROF_MEASURE_MODE
312
+ environment variable:
313
+
314
+ * export RUBY_PROF_MEASURE_MODE=process
315
+ * export RUBY_PROF_MEASURE_MODE=wall
316
+ * export RUBY_PROF_MEASURE_MODE=cpu
317
+ * export RUBY_PROF_MEASURE_MODE=allocations
318
+
319
+ Note that these values have changed since ruby-prof-0.3.0.
320
+
321
+ On Linux, process time is measured using the clock method provided
322
+ by the C runtime library. Note that the clock method does not
323
+ report time spent in the kernel or child processes and therefore
324
+ does not measure time spent in methods such as Kernel.sleep method.
325
+ If you need to measure these values, then use wall time. Wall time
326
+ is measured using the gettimeofday kernel method.
327
+
328
+ On Windows, timings are always wall times. If you set the clock
329
+ mode to PROCESS_TIME, then timing are read using the clock method
330
+ provided by the C runtime library. Note though, these values are
331
+ wall times on Windows and not process times like on Linux.
332
+ Wall time is measured using the GetLocalTime API.
333
+
334
+ If you use wall time, the results will be affected by other
335
+ processes running on your computer, network delays, disk access,
336
+ etc. As result, for the best results, try to make sure your
337
+ computer is only performing your profiling run and is
338
+ otherwise quiescent.
339
+
340
+ On both platforms, cpu time is measured using the RDTSC assembly
341
+ function provided by the Pentium and PowerPC platforms. CPU time
342
+ is dependent on the cpu's frequency. On Linux, ruby-prof attempts
343
+ to read this value from "/proc/cpuinfo." On Windows, you must
344
+ specify the clock frequency. This can be done using the
345
+ RUBY_PROF_CPU_FREQUENCY environment variable:
346
+
347
+ export RUBY_PROF_CPU_FREQUENCY=<value>
348
+
349
+ You can also directly set the cpu frequency by calling:
350
+
351
+ RubyProf.cpu_frequency = <value>
352
+
353
+
354
+ == Recursive Calls
355
+
356
+ Recursive calls occur when method A calls method A and cycles
357
+ occur when method A calls method B calls method C calls method A.
358
+ ruby-prof detects both direct recursive calls and cycles. Both
359
+ are indicated in reports by a dash and number following a method
360
+ name. For example, here is a flat profile from the test method
361
+ RecursiveTest#test_recursive:
362
+
363
+
364
+ %self total self wait child calls name
365
+ 100.00 2.00 2.00 0.00 0.00 2 Kernel#sleep
366
+ 0.00 2.00 0.00 0.00 2.00 0 RecursiveTest#test_cycle
367
+ 0.00 0.00 0.00 0.00 0.00 2 Fixnum#==
368
+ 0.00 0.00 0.00 0.00 0.00 2 Fixnum#-
369
+ 0.00 1.00 0.00 0.00 1.00 1 Object#sub_cycle-1
370
+ 0.00 2.00 0.00 0.00 2.00 1 Object#sub_cycle
371
+ 0.00 2.00 0.00 0.00 2.00 1 Object#cycle
372
+ 0.00 1.00 0.00 0.00 1.00 1 Object#cycle-1
373
+
374
+ Notice the presence of Object#cycle and Object#cycle-1. The -1 means
375
+ the method was either recursively called (directly or indirectly).
376
+
377
+ However, the self time values for recursive calls should always
378
+ be accurate. It is also believed that the total times are
379
+ accurate, but these should be carefully analyzed to verify their veracity.
380
+
381
+
382
+ == Multi-threaded Applications
383
+
384
+ Unfortunately, Ruby does not provide an internal api
385
+ for detecting thread context switches. As a result, the
386
+ timings ruby-prof reports for each thread may be slightly
387
+ inaccurate. In particular, this will happen for newly
388
+ spanned threads that immediately go to sleep. For instance,
389
+ if you use Ruby's timeout library to wait for 2 seconds,
390
+ the 2 seconds will be assigned to the foreground thread
391
+ and not the newly created background thread. These errors
392
+ can largely be avoided if the background thread performs an
393
+ operation before going to sleeep.
394
+
395
+
396
+ == Performance
397
+
398
+ Significant effort has been put into reducing ruby-prof's overhead
399
+ as much as possible. Our tests show that the overhead associated
400
+ with profiling code varies considerably with the code being
401
+ profiled. Most programs will run approximately twice as slow
402
+ while highly recursive programs (like the fibonacci series test)
403
+ will run three times slower.
404
+
405
+
406
+ == Windows Binary
407
+
408
+ The Windows binary is built with the latest version of MinGW. The source
409
+ repository also includes a Microsoft VC++ 2005 solution. If you wish to run
410
+ a debug version of ruby-prof on Windows, then it is highly recommended
411
+ you use VC++.
412
+
413
+
414
+ == License
415
+
416
+ See LICENSE for license information.