ruby-prof 0.4.1-mswin32 → 0.5.0-mswin32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. data/CHANGES +30 -0
  2. data/README +65 -25
  3. data/Rakefile +33 -32
  4. data/bin/ruby-prof +100 -83
  5. data/examples/graph.html +65 -69
  6. data/ext/measure_allocations.h +43 -0
  7. data/ext/measure_cpu_time.h +138 -0
  8. data/ext/measure_process_time.h +41 -0
  9. data/ext/measure_wall_time.h +42 -0
  10. data/ext/ruby_prof.c +737 -653
  11. data/lib/ruby-prof.rb +41 -38
  12. data/lib/ruby-prof/abstract_printer.rb +42 -0
  13. data/lib/ruby-prof/call_tree_printer.rb +69 -0
  14. data/lib/ruby-prof/flat_printer.rb +78 -75
  15. data/lib/ruby-prof/graph_html_printer.rb +241 -228
  16. data/lib/ruby-prof/graph_printer.rb +160 -141
  17. data/lib/ruby-prof/profile_test_case.rb +80 -0
  18. data/lib/ruby-prof/rails_plugin/ruby-prof/init.rb +6 -0
  19. data/lib/ruby-prof/rails_plugin/ruby-prof/lib/profiling.rb +52 -0
  20. data/lib/ruby-prof/task.rb +147 -0
  21. data/lib/ruby_prof.so +0 -0
  22. data/test/basic_test.rb +65 -35
  23. data/test/duplicate_names_test.rb +20 -24
  24. data/test/gc.log +5 -0
  25. data/test/measure_mode_test.rb +79 -0
  26. data/test/module_test.rb +31 -18
  27. data/test/no_method_class_test.rb +14 -0
  28. data/test/prime1.rb +17 -0
  29. data/test/prime2.rb +26 -0
  30. data/test/prime3.rb +17 -0
  31. data/test/prime_test.rb +10 -10
  32. data/test/printers_test.rb +14 -12
  33. data/test/profile_unit_test.rb +24 -0
  34. data/test/recursive_test.rb +105 -17
  35. data/test/singleton_test.rb +38 -0
  36. data/test/start_test.rb +24 -0
  37. data/test/test_helper.rb +33 -29
  38. data/test/test_suite.rb +10 -2
  39. data/test/thread_test.rb +123 -17
  40. data/test/timing_test.rb +70 -29
  41. metadata +28 -30
  42. data/doc/created.rid +0 -1
  43. data/doc/files/LICENSE.html +0 -0
  44. data/doc/files/README.html +0 -376
  45. data/doc/files/bin/ruby-prof.html +0 -143
  46. data/doc/files/examples/flat_txt.html +0 -179
  47. data/doc/files/examples/graph_html.html +0 -948
  48. data/doc/files/examples/graph_txt.html +0 -297
  49. data/doc/files/ext/ruby_prof_c.html +0 -101
  50. data/doc/files/lib/ruby-prof/flat_printer_rb.html +0 -101
  51. data/doc/files/lib/ruby-prof/graph_html_printer_rb.html +0 -108
  52. data/doc/files/lib/ruby-prof/graph_printer_rb.html +0 -101
  53. data/doc/files/lib/ruby-prof/profiletask_rb.html +0 -109
  54. data/doc/files/lib/ruby-prof_rb.html +0 -111
  55. data/doc/files/lib/unprof_rb.html +0 -108
  56. data/doc/rdoc-style.css +0 -208
  57. data/lib/ruby-prof/profiletask.rb +0 -150
  58. data/test/clock_mode_test.rb +0 -73
data/test/timing_test.rb CHANGED
@@ -4,23 +4,24 @@ require 'test/unit'
4
4
  require 'ruby-prof'
5
5
  require 'test_helper'
6
6
 
7
+ # Need to use wall time for this test due to the sleep calls
8
+ RubyProf::measure_mode = RubyProf::WALL_TIME
9
+
7
10
  def method1
8
- sleep(1)
11
+ sleep(1)
9
12
  end
10
13
 
11
14
  def method2
12
- sleep(2)
13
- method1
15
+ sleep(2)
16
+ method1
14
17
  end
15
18
 
16
19
  def method3
17
- sleep(3)
18
- method2
19
- method1
20
+ sleep(3)
21
+ method2
22
+ method1
20
23
  end
21
24
 
22
- # Need to use wall time for this test due to the sleep calls
23
- RubyProf::clock_mode = RubyProf::WALL_TIME
24
25
 
25
26
  class TimingTest < Test::Unit::TestCase
26
27
 
@@ -28,63 +29,103 @@ class TimingTest < Test::Unit::TestCase
28
29
  result = RubyProf.profile do
29
30
  method1
30
31
  end
31
-
32
+
32
33
  assert_equal(1, result.threads.length)
33
34
 
34
35
  methods = result.threads.values.first
35
36
  assert_equal(3, methods.length)
37
+
38
+ methods = methods.sort.reverse
36
39
 
37
- method = methods['#toplevel']
38
- assert_not_nil(method)
40
+ method = methods[0]
41
+ assert_equal('TimingTest#test_basic', method.full_name)
39
42
  assert_in_delta(1, method.total_time, 0.02)
40
43
  assert_in_delta(0, method.self_time, 0.02)
41
- assert_in_delta(1, method.called, 0.02)
44
+ assert_in_delta(0, method.wait_time, 0.02)
45
+ assert_in_delta(1, method.children_time, 0.02)
46
+ assert_equal(0, method.called)
42
47
  assert_equal(0, method.parents.length)
43
48
  assert_equal(1, method.children.length)
44
-
45
- method = methods['Object#method1']
46
- assert_not_nil(method)
49
+
50
+ method = methods[1]
51
+ assert_equal('Object#method1', method.full_name)
47
52
  assert_in_delta(1, method.total_time, 0.02)
48
53
  assert_in_delta(0, method.self_time, 0.02)
54
+ assert_in_delta(0, method.wait_time, 0.02)
49
55
  assert_equal(1, method.called)
50
56
  assert_equal(1, method.parents.length)
51
57
  assert_equal(1, method.children.length)
52
58
 
53
- sleep = methods['Kernel#sleep']
54
- assert_not_nil(sleep)
55
- assert_in_delta(1, sleep.total_time, 0.02)
56
- assert_in_delta(1, sleep.self_time, 0.02)
57
- assert_in_delta(0, sleep.children_time, 0.02)
58
- assert_equal(1, sleep.called)
59
- assert_equal(1, sleep.parents.length)
60
- assert_equal(0, sleep.children.length)
59
+ method = methods[2]
60
+ assert_equal('Kernel#sleep', method.full_name)
61
+ assert_in_delta(1, method.total_time, 0.02)
62
+ assert_in_delta(1, method.self_time, 0.02)
63
+ assert_in_delta(0, method.wait_time, 0.02)
64
+ assert_in_delta(0, method.children_time, 0.02)
65
+ assert_equal(1, method.called)
66
+ assert_equal(1, method.parents.length)
67
+ assert_equal(0, method.children.length)
61
68
  end
62
69
 
63
70
  def test_timings
64
71
  result = RubyProf.profile do
65
72
  method3
66
73
  end
67
-
74
+
68
75
  assert_equal(1, result.threads.length)
69
76
  methods = result.threads.values.first
70
77
  assert_equal(5, methods.length)
78
+
79
+ methods = methods.sort.reverse
71
80
 
72
- method = methods['#toplevel']
73
- assert_not_nil(method)
81
+ method = methods[0]
82
+ assert_equal('TimingTest#test_timings', method.full_name)
74
83
  assert_in_delta(7, method.total_time, 0.02)
75
84
  assert_in_delta(0, method.self_time, 0.02)
85
+ assert_in_delta(0, method.wait_time, 0.02)
76
86
  assert_in_delta(7, method.children_time, 0.02)
77
- assert_equal(1, method.called)
87
+ assert_equal(0, method.called)
78
88
  assert_equal(0, method.parents.length)
79
89
  assert_equal(1, method.children.length)
80
90
 
81
- method = methods['Object#method3']
82
- assert_not_nil(method)
91
+ method = methods[1]
92
+ assert_equal('Object#method3', method.full_name)
83
93
  assert_in_delta(7, method.total_time, 0.02)
84
94
  assert_in_delta(0, method.self_time, 0.02)
95
+ assert_in_delta(0, method.wait_time, 0.02)
85
96
  assert_in_delta(7, method.children_time, 0.02)
86
97
  assert_equal(1, method.called)
87
98
  assert_equal(1, method.parents.length)
88
99
  assert_equal(3, method.children.length)
100
+
101
+ method = methods[2]
102
+ assert_equal('Kernel#sleep', method.full_name)
103
+ assert_in_delta(7, method.total_time, 0.02)
104
+ assert_in_delta(7, method.self_time, 0.02)
105
+ assert_in_delta(0, method.wait_time, 0.02)
106
+ assert_in_delta(0, method.children_time, 0.02)
107
+ assert_equal(4, method.called)
108
+ assert_equal(3, method.parents.length)
109
+ assert_equal(0, method.children.length)
110
+
111
+ method = methods[3]
112
+ assert_equal('Object#method2', method.full_name)
113
+ assert_in_delta(3, method.total_time, 0.02)
114
+ assert_in_delta(0, method.self_time, 0.02)
115
+ assert_in_delta(0, method.wait_time, 0.02)
116
+ assert_in_delta(3, method.children_time, 0.02)
117
+ assert_equal(1, method.called)
118
+ assert_equal(1, method.parents.length)
119
+ assert_equal(2, method.children.length)
120
+
121
+ method = methods[4]
122
+ assert_equal('Object#method1', method.full_name)
123
+ assert_in_delta(2, method.total_time, 0.02)
124
+ assert_in_delta(0, method.self_time, 0.02)
125
+ assert_in_delta(0, method.wait_time, 0.02)
126
+ assert_in_delta(2, method.children_time, 0.02)
127
+ assert_equal(2, method.called)
128
+ assert_equal(2, method.parents.length)
129
+ assert_equal(1, method.children.length)
89
130
  end
90
131
  end
metadata CHANGED
@@ -1,10 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.8.11
2
+ rubygems_version: 0.9.2
3
3
  specification_version: 1
4
4
  name: ruby-prof
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.4.1
7
- date: 2006-06-22 15:36:48 -06:00
6
+ version: 0.5.0
7
+ date: 2007-07-09 00:05:23 -06:00
8
8
  summary: Fast Ruby profiler
9
9
  require_paths:
10
10
  - lib
@@ -20,11 +20,12 @@ required_ruby_version: !ruby/object:Gem::Version::Requirement
20
20
  requirements:
21
21
  - - ">="
22
22
  - !ruby/object:Gem::Version
23
- version: 1.8.2
23
+ version: 1.8.4
24
24
  version:
25
25
  platform: mswin32
26
26
  signing_key:
27
27
  cert_chain:
28
+ post_install_message:
28
29
  authors:
29
30
  - Shugo Maeda and Charlie Savage
30
31
  files:
@@ -36,46 +37,43 @@ files:
36
37
  - lib/ruby-prof
37
38
  - lib/ruby-prof.rb
38
39
  - lib/unprof.rb
40
+ - lib/ruby-prof/abstract_printer.rb
41
+ - lib/ruby-prof/call_tree_printer.rb
39
42
  - lib/ruby-prof/flat_printer.rb
40
43
  - lib/ruby-prof/graph_html_printer.rb
41
44
  - lib/ruby-prof/graph_printer.rb
42
- - lib/ruby-prof/profiletask.rb
45
+ - lib/ruby-prof/profile_test_case.rb
46
+ - lib/ruby-prof/rails_plugin
47
+ - lib/ruby-prof/task.rb
48
+ - lib/ruby-prof/rails_plugin/ruby-prof
49
+ - lib/ruby-prof/rails_plugin/ruby-prof/init.rb
50
+ - lib/ruby-prof/rails_plugin/ruby-prof/lib
51
+ - lib/ruby-prof/rails_plugin/ruby-prof/lib/profiling.rb
43
52
  - examples/flat.txt
44
53
  - examples/graph.html
45
54
  - examples/graph.txt
46
55
  - ext/extconf.rb
56
+ - ext/measure_allocations.h
57
+ - ext/measure_cpu_time.h
58
+ - ext/measure_process_time.h
59
+ - ext/measure_wall_time.h
47
60
  - ext/ruby_prof.c
48
- - ext/win32
49
- - doc/classes
50
- - doc/created.rid
51
- - doc/files
52
- - doc/rdoc-style.css
53
- - doc/files/bin
54
- - doc/files/examples
55
- - doc/files/ext
56
- - doc/files/lib
57
- - doc/files/LICENSE.html
58
- - doc/files/README.html
59
- - doc/files/bin/ruby-prof.html
60
- - doc/files/examples/flat_txt.html
61
- - doc/files/examples/graph_html.html
62
- - doc/files/examples/graph_txt.html
63
- - doc/files/ext/ruby_prof_c.html
64
- - doc/files/lib/ruby-prof
65
- - doc/files/lib/ruby-prof_rb.html
66
- - doc/files/lib/unprof_rb.html
67
- - doc/files/lib/ruby-prof/flat_printer_rb.html
68
- - doc/files/lib/ruby-prof/graph_html_printer_rb.html
69
- - doc/files/lib/ruby-prof/graph_printer_rb.html
70
- - doc/files/lib/ruby-prof/profiletask_rb.html
71
61
  - test/basic_test.rb
72
- - test/clock_mode_test.rb
73
62
  - test/duplicate_names_test.rb
63
+ - test/gc.log
64
+ - test/measure_mode_test.rb
74
65
  - test/module_test.rb
66
+ - test/no_method_class_test.rb
75
67
  - test/prime.rb
68
+ - test/prime1.rb
69
+ - test/prime2.rb
70
+ - test/prime3.rb
76
71
  - test/prime_test.rb
77
72
  - test/printers_test.rb
73
+ - test/profile_unit_test.rb
78
74
  - test/recursive_test.rb
75
+ - test/singleton_test.rb
76
+ - test/start_test.rb
79
77
  - test/test_helper.rb
80
78
  - test/test_suite.rb
81
79
  - test/thread_test.rb
@@ -93,10 +91,10 @@ rdoc_options:
93
91
  - README
94
92
  extra_rdoc_files:
95
93
  - bin/ruby-prof
94
+ - ext/ruby_prof.c
96
95
  - examples/flat.txt
97
96
  - examples/graph.txt
98
97
  - examples/graph.html
99
- - ext/ruby_prof.c
100
98
  - README
101
99
  - LICENSE
102
100
  executables:
data/doc/created.rid DELETED
@@ -1 +0,0 @@
1
- Thu Jun 22 15:36:41 Mountain Standard Time 2006
File without changes
@@ -1,376 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
6
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
- <head>
8
- <title>File: README</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
- <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
12
- <script type="text/javascript">
13
- // <![CDATA[
14
-
15
- function popupCode( url ) {
16
- window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
- }
18
-
19
- function toggleCode( id ) {
20
- if ( document.getElementById )
21
- elem = document.getElementById( id );
22
- else if ( document.all )
23
- elem = eval( "document.all." + id );
24
- else
25
- return false;
26
-
27
- elemStyle = elem.style;
28
-
29
- if ( elemStyle.display != "block" ) {
30
- elemStyle.display = "block"
31
- } else {
32
- elemStyle.display = "none"
33
- }
34
-
35
- return true;
36
- }
37
-
38
- // Make codeblocks hidden by default
39
- document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
-
41
- // ]]>
42
- </script>
43
-
44
- </head>
45
- <body>
46
-
47
-
48
-
49
- <div id="fileHeader">
50
- <h1>README</h1>
51
- <table class="header-table">
52
- <tr class="top-aligned-row">
53
- <td><strong>Path:</strong></td>
54
- <td>README
55
- </td>
56
- </tr>
57
- <tr class="top-aligned-row">
58
- <td><strong>Last Update:</strong></td>
59
- <td>Thu Jun 22 16:06:01 Mountain Standard Time 2006</td>
60
- </tr>
61
- </table>
62
- </div>
63
- <!-- banner header -->
64
-
65
- <div id="bodyContent">
66
-
67
-
68
-
69
- <div id="contextContent">
70
-
71
- <div id="description">
72
- <h1>ruby-prof</h1>
73
- <h2>Overview</h2>
74
- <p>
75
- ruby-prof is a fast code profiler for Ruby. Its features include:
76
- </p>
77
- <ul>
78
- <li>Speed - it is a C extension and therefore many times faster than the
79
- standard Ruby profiler.
80
-
81
- </li>
82
- <li>Flat Profiles - similar to the reports generated by the standard Ruby
83
- profiler
84
-
85
- </li>
86
- <li>Graph profiles - similar to GProf, these show how long a method runs, which
87
- methods call it and which methods it calls.
88
-
89
- </li>
90
- <li>Threads - supports profiling multiple threads simultaneously
91
-
92
- </li>
93
- <li>Recursive calls - supports profiling recursive method calls
94
-
95
- </li>
96
- <li>Reports - can generate both text and cross-referenced html reports
97
-
98
- </li>
99
- <li>Output - can output to standard out or to a file
100
-
101
- </li>
102
- </ul>
103
- <h2>Requirements</h2>
104
- <p>
105
- ruby-prof requires Ruby 1.8.2 or higher.
106
- </p>
107
- <p>
108
- If you are running Linux or Unix you&#8217;ll need a C compiler so the
109
- extension can be compiled when it is installed.
110
- </p>
111
- <p>
112
- If you are running Windows, then install the Windows specific RubyGem which
113
- includes an already built extension.
114
- </p>
115
- <h2>Install</h2>
116
- <p>
117
- ruby-prof is provided as a RubyGem. To install:
118
- </p>
119
- <p>
120
- <tt>gem install ruby-prof</tt>
121
- </p>
122
- <p>
123
- If you are running Windows, make sure to install the Win32 RubyGem which
124
- includes a pre-built binary.
125
- </p>
126
- <h2>Usage</h2>
127
- <p>
128
- There are three ways of running ruby-prof.
129
- </p>
130
- <h3>ruby-prof executable</h3>
131
- <p>
132
- The first is to use ruby-prof to run the Ruby program you want to profile.
133
- For more information refer to the ruby-prof <a
134
- href="bin/ruby-prof.html">documentation</a>.
135
- </p>
136
- <h3>ruby-prof API</h3>
137
- <p>
138
- The second way is to use the ruby-prof API to profile particular segments
139
- of code.
140
- </p>
141
- <pre>
142
- require 'ruby-prof'
143
-
144
- # Profile the code
145
- RubyProf.start
146
- ...
147
- [code to profile]
148
- ...
149
- result = RubyProf.stop
150
-
151
- # Print a flat profile to text
152
- printer = RubyProf::TextPrinter.new(result)
153
- printer.print(STDOUT, 0)
154
- </pre>
155
- <p>
156
- Alternatively, you can use a block to tell ruby-prof what to profile:
157
- </p>
158
- <pre>
159
- require 'ruby-prof'
160
-
161
- # Profile the code
162
- result = RubyProf.profile do
163
- ...
164
- [code to profile]
165
- ...
166
- end
167
-
168
- # Print a graph profile to text
169
- printer = RubyProf::GraphPrinter.new(result)
170
- printer.print(STDOUT, 0)
171
- </pre>
172
- <h3>require unprof</h3>
173
- <p>
174
- The third way of using ruby-prof is by requiring unprof.rb:
175
- </p>
176
- <pre>
177
- require 'unprof'
178
- </pre>
179
- <p>
180
- This will start profiling immediately and will output the results using a
181
- flat profile report.
182
- </p>
183
- <p>
184
- This method is provided for backwards compatibility. Using <a
185
- href="bin/ruby-prof.html">ruby-prof</a> provides more flexibility.
186
- </p>
187
- <h2>Reports</h2>
188
- <p>
189
- ruby-prof can generate flat profile and graph profile reports.
190
- </p>
191
- <p>
192
- Flat profiles show the overall time spent in each method. They are a good
193
- of quickly identifying which methods take the most time. An example of a
194
- flat profile and an explanation can be found in <a
195
- href="examples/flat_txt.html">examples/flat.txt</a>.
196
- </p>
197
- <p>
198
- Graph profiles also show the overall time spent in each method. In
199
- addition, they also show which methods call the current method and which
200
- methods its calls. Thus they are good for understanding how methods gets
201
- called and provide insight into the flow of your program. Graph profiles
202
- can be generated in text and html. Since the html is cross-referenced it is
203
- easier to work with. An example text graph profile is located at <a
204
- href="examples/graph_txt.html">examples/graph.txt</a> while an example html
205
- graph file is located at <a
206
- href="examples/graph_html.html">examples/graph.html</a>.
207
- </p>
208
- <p>
209
- Reports are created by printers. The current printers include:
210
- </p>
211
- <ul>
212
- <li><a href="../classes/RubyProf/FlatPrinter.html">RubyProf::FlatPrinter</a> -
213
- Creates a flat report in text format
214
-
215
- </li>
216
- <li><a href="../classes/RubyProf/GraphPrinter.html">RubyProf::GraphPrinter</a>
217
- - Creates a call graph report in text format
218
-
219
- </li>
220
- <li><a
221
- href="../classes/RubyProf/GraphHtmlPrinter.html">RubyProf::GraphHtmlPrinter</a>
222
- - Creates a call graph report in HTML (separate files per thread)
223
-
224
- </li>
225
- </ul>
226
- <p>
227
- To use a printer:
228
- </p>
229
- <pre>
230
- result = RubyProf.end
231
- printer = RubyProf::GraphPrinter.new(result)
232
- printer.print(STDOUT, 0)
233
- </pre>
234
- <p>
235
- The first parameter is any writable IO object such as STDOUT or a file. The
236
- second parameter, which has a default value of 0, specifies the minimum
237
- percentage a method must take to be printed. For more information please
238
- see the documentation for the different printers.
239
- </p>
240
- <h2>Timing Data</h2>
241
- <p>
242
- Depending on the mode and platform, ruby-prof can measure time in three
243
- ways - process time, wall time and cpu time.
244
- </p>
245
- <p>
246
- Process time measures the time used by a process between any two moments.
247
- It is unaffected by other processes concurrently running on the system.
248
- Note that Windows does not support measuring process times - therefore, all
249
- measurements on Windows use wall time.
250
- </p>
251
- <p>
252
- Wall time measures the real-world time elapsed between any two moments. If
253
- there are other processes concurrently running on the system that use
254
- significant CPU or disk time during a profiling run then the reported
255
- results will be too large.
256
- </p>
257
- <p>
258
- CPU time uses the CPU clock counter to measure time. The returned values
259
- are dependent on the correctly setting the CPU&#8217;s frequency. This mode
260
- is only supported on Pentium or PowerPC platforms.
261
- </p>
262
- <p>
263
- To set the clock_mode:
264
- </p>
265
- <pre>
266
- RubyProf.clock_mode = RubyProf::PROCESS_TIME
267
- RubyProf.clock_mode = RubyProf::WALL_TIME
268
- RubyProf.clock_mode = RubyProf::CPU_TIME
269
- </pre>
270
- <p>
271
- This default value is PROCESS_TIME.
272
- </p>
273
- <p>
274
- You may also specify the clock_mode by using the RUBY_PROF_CLOCK_MODE
275
- environment variable:
276
- </p>
277
- <pre>
278
- export RUBY_PROF_CLOCK_MODE=process
279
- export RUBY_PROF_CLOCK_MODE=wall
280
- export RUBY_PROF_CLOCK_MODE=cpu
281
- </pre>
282
- <p>
283
- Note that these values have changed since ruby-prof-0.3.0.
284
- </p>
285
- <p>
286
- On Linux, process time is measured using the clock method provided by the C
287
- runtime library. Note that the clock method does not report time spent in
288
- the kernel or child processes and therefore does not measure time spent in
289
- methods such as Kernel.sleep method. If you need to measure these values,
290
- then use wall time. Wall time is measured using the gettimeofday kernel
291
- method.
292
- </p>
293
- <p>
294
- On Windows, timings are always wall times. If you set the clock mode to
295
- PROCESS_TIME, then timing are read using the clock method provided by the C
296
- runtime library. Note though, these values are wall times on Windows and
297
- not process times like on Linux. Wall time is measured using the
298
- GetLocalTime API.
299
- </p>
300
- <p>
301
- On both platforms, cpu time is measured using the RDTSC assembly function
302
- provided by the Pentium and PowerPC platforms. CPU time is dependent on the
303
- cpu&#8217;s frequency. On Linux, ruby-prof attempts to read this value from
304
- &quot;/proc/cpuinfo.&quot; On Windows, you must specify the clock
305
- frequency. This can be done using the RUBY_PROF_CPU_FREQUENCY environment
306
- variable:
307
- </p>
308
- <pre>
309
- export RUBY_PROF_CPU_FREQUENCY=&lt;value&gt;
310
- </pre>
311
- <p>
312
- You can also directly set the cpu frequency by calling:
313
- </p>
314
- <pre>
315
- RubyProf.cpu_frequency = &lt;value&gt;
316
- </pre>
317
- <h2>Recursive Calls</h2>
318
- <p>
319
- Recursive calls occur when method A calls method A and cycles occur when
320
- method A calls method B calls method C calls method A. ruby-prof can detect
321
- recursive calls any cycle calls, but does not currently report these in its
322
- output.
323
- </p>
324
- <p>
325
- However, the self time values for recursive calls should always be
326
- accurate. It is also believed that the total times are accurate, but these
327
- should be carefully analyzed to verify their veracity.
328
- </p>
329
- <h2>Performance</h2>
330
- <p>
331
- Significant effort has been put into reducing ruby-prof&#8217;s overhead as
332
- much as possible. Our tests show that the overhead associated with
333
- profiling code varies considerably with the code being profiled. On the low
334
- end overhead is around 10% while on the high end its can around 80%.
335
- </p>
336
- <h2>Windows Binary</h2>
337
- <p>
338
- The Windows binary is built with the latest version of MinGW.
339
- </p>
340
- <h2>License</h2>
341
- <p>
342
- See LICENSE for license information.
343
- </p>
344
-
345
- </div>
346
-
347
-
348
- </div>
349
-
350
-
351
- </div>
352
-
353
-
354
- <!-- if includes -->
355
-
356
- <div id="section">
357
-
358
-
359
-
360
-
361
-
362
-
363
-
364
-
365
- <!-- if method_list -->
366
-
367
-
368
- </div>
369
-
370
-
371
- <div id="validator-badges">
372
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
373
- </div>
374
-
375
- </body>
376
- </html>