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
@@ -1,297 +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: graph.txt</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>graph.txt</h1>
51
- <table class="header-table">
52
- <tr class="top-aligned-row">
53
- <td><strong>Path:</strong></td>
54
- <td>examples/graph.txt
55
- </td>
56
- </tr>
57
- <tr class="top-aligned-row">
58
- <td><strong>Last Update:</strong></td>
59
- <td>Thu Jun 22 15:51:29 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>Graph Profiles</h1>
73
- <p>
74
- Graph profiles show how long each method runs, which methods call it and
75
- which methods it calls.
76
- </p>
77
- <p>
78
- As an example, here is the output from running printers_test.rb:
79
- </p>
80
- <p>
81
- Thread ID: 21277412
82
- </p>
83
- <pre>
84
- %total %self total self children calls Name
85
- --------------------------------------------------------------------------------
86
- 100.00% 0.00% 8.77 0.00 8.77 1 #toplevel
87
- 8.77 0.00 8.77 1/1 Object#run_primes
88
- --------------------------------------------------------------------------------
89
- 8.77 0.00 8.77 1/1 #toplevel
90
- 100.00% 0.00% 8.77 0.00 8.77 1 Object#run_primes
91
- 0.02 0.00 0.02 1/1 Object#make_random_array
92
- 2.09 0.00 2.09 1/1 Object#find_largest
93
- 6.66 0.00 6.66 1/1 Object#find_primes
94
- --------------------------------------------------------------------------------
95
- 6.63 4.06 2.56 500/501 Object#is_prime
96
- 2.09 0.00 2.09 1/501 Object#find_largest
97
- 99.48% 46.34% 8.72 4.06 4.66 501 Integer#upto
98
- 0.00 0.00 0.00 61/61 Array#[]
99
- 0.00 0.00 0.00 61/61 Fixnum#&gt;
100
- 2.09 2.09 0.00 61/61 Kernel.sleep
101
- 1.24 1.24 0.00 250862/250862 Fixnum#==
102
- 1.33 1.33 0.00 250862/250862 Fixnum#%
103
- --------------------------------------------------------------------------------
104
- 6.66 0.01 6.64 1/1 Object#find_primes
105
- 75.93% 0.17% 6.66 0.01 6.64 1 Array#select
106
- 6.64 0.01 6.63 500/500 Object#is_prime
107
- --------------------------------------------------------------------------------
108
- 6.66 0.00 6.66 1/1 Object#run_primes
109
- 75.93% 0.00% 6.66 0.00 6.66 1 Object#find_primes
110
- 6.66 0.01 6.64 1/1 Array#select
111
- --------------------------------------------------------------------------------
112
- 6.64 0.01 6.63 500/500 Array#select
113
- 75.76% 0.17% 6.64 0.01 6.63 500 Object#is_prime
114
- 0.00 0.00 0.00 500/501 Fixnum#-
115
- 6.63 4.06 2.56 500/501 Integer#upto
116
- --------------------------------------------------------------------------------
117
- 2.09 0.00 2.09 1/1 Object#run_primes
118
- 23.89% 0.00% 2.09 0.00 2.09 1 Object#find_largest
119
- 0.00 0.00 0.00 1/501 Fixnum#-
120
- 2.09 0.00 2.09 1/501 Integer#upto
121
- 0.00 0.00 0.00 1/1 Array#first
122
- 0.00 0.00 0.00 1/1 Array#length
123
- --------------------------------------------------------------------------------
124
- 2.09 2.09 0.00 61/61 Integer#upto
125
- 23.89% 23.89% 2.09 2.09 0.00 61 Kernel.sleep
126
- --------------------------------------------------------------------------------
127
- 1.33 1.33 0.00 250862/250862 Integer#upto
128
- 15.12% 15.12% 1.33 1.33 0.00 250862 Fixnum#%
129
- --------------------------------------------------------------------------------
130
- 1.24 1.24 0.00 250862/250862 Integer#upto
131
- 14.13% 14.13% 1.24 1.24 0.00 250862 Fixnum#==
132
- --------------------------------------------------------------------------------
133
- 0.02 0.00 0.02 1/1 Object#run_primes
134
- 0.18% 0.00% 0.02 0.00 0.02 1 Object#make_random_array
135
- 0.02 0.02 0.00 1/1 Array#each_index
136
- 0.00 0.00 0.00 1/1 Class#new
137
- --------------------------------------------------------------------------------
138
- 0.02 0.02 0.00 1/1 Object#make_random_array
139
- 0.18% 0.18% 0.02 0.02 0.00 1 Array#each_index
140
- 0.00 0.00 0.00 500/500 Kernel.rand
141
- 0.00 0.00 0.00 500/500 Array#[]=
142
- --------------------------------------------------------------------------------
143
- 0.00 0.00 0.00 500/501 Object#is_prime
144
- 0.00 0.00 0.00 1/501 Object#find_largest
145
- 0.00% 0.00% 0.00 0.00 0.00 501 Fixnum#-
146
- --------------------------------------------------------------------------------
147
- 0.00 0.00 0.00 1/1 Kernel.rand
148
- 0.00% 0.00% 0.00 0.00 0.00 1 Integer#to_int
149
- --------------------------------------------------------------------------------
150
- 0.00 0.00 0.00 1/1 Object#find_largest
151
- 0.00% 0.00% 0.00 0.00 0.00 1 Array#first
152
- --------------------------------------------------------------------------------
153
- 0.00 0.00 0.00 1/1 Class#new
154
- 0.00% 0.00% 0.00 0.00 0.00 1 Array#initialize
155
- --------------------------------------------------------------------------------
156
- 0.00 0.00 0.00 1/1 Object#find_largest
157
- 0.00% 0.00% 0.00 0.00 0.00 1 Array#length
158
- --------------------------------------------------------------------------------
159
- 0.00 0.00 0.00 1/1 Object#make_random_array
160
- 0.00% 0.00% 0.00 0.00 0.00 1 Class#new
161
- 0.00 0.00 0.00 1/1 Array#initialize
162
- --------------------------------------------------------------------------------
163
- 0.00 0.00 0.00 61/61 Integer#upto
164
- 0.00% 0.00% 0.00 0.00 0.00 61 Fixnum#&gt;
165
- --------------------------------------------------------------------------------
166
- 0.00 0.00 0.00 61/61 Integer#upto
167
- 0.00% 0.00% 0.00 0.00 0.00 61 Array#[]
168
- --------------------------------------------------------------------------------
169
- 0.00 0.00 0.00 500/500 Array#each_index
170
- 0.00% 0.00% 0.00 0.00 0.00 500 Array#[]=
171
- --------------------------------------------------------------------------------
172
- 0.00 0.00 0.00 500/500 Array#each_index
173
- 0.00% 0.00% 0.00 0.00 0.00 500 Kernel.rand
174
- 0.00 0.00 0.00 1/1 Integer#to_int
175
- </pre>
176
- <h2>Overview</h2>
177
- <p>
178
- Dashed lines divide the report into entries, with one entry per method.
179
- Entries are sorted by total time which is the time spent in the method plus
180
- its children.
181
- </p>
182
- <p>
183
- Each entry has a primary line demarked by values in the %total and %self
184
- columns. The primary line represents the method being profiled. Lines above
185
- it are the methods that called this method (parents) while the lines below
186
- it are the methods it called (children).
187
- </p>
188
- <p>
189
- All values are in seconds. For the primary line, the columns represent:
190
- </p>
191
- <pre>
192
- %total - The percentage of time spent in this method and its children
193
- %self - The percentage of time spent in this method
194
- total - The time spent in this method and its children.
195
- self - The time spent in this method.
196
- children - The time spent in this method's children.
197
- calls - The number of times this method was called.
198
- name - The name of the method.
199
- </pre>
200
- <p>
201
- The interpretation of method names is:
202
- </p>
203
- <ul>
204
- <li>toplevel - The root method that calls all other methods
205
-
206
- </li>
207
- <li>MyObject#test - An instance method &quot;test&quot; of the class
208
- &quot;MyObject&quot;
209
-
210
- </li>
211
- <li>&lt;Object:MyObject&gt;test - The &lt;&gt; characters indicate a singleton
212
- method on a singleton class.
213
-
214
- </li>
215
- </ul>
216
- <p>
217
- For example, we see that 99.48% of the time was spent in Integer#upto and
218
- its children. Of that time, 4.06 seconds was spent in Integer#upto itself
219
- and 4.66 in its children. Overall, Integer#upto was called 501 times.
220
- </p>
221
- <h2>Parents</h2>
222
- <p>
223
- In each entry, the lines above the primary line are the methods that called
224
- the current method. If the current method is a root method then no parents
225
- are shown.
226
- </p>
227
- <p>
228
- For parent lines, the columns represent:
229
- </p>
230
- <pre>
231
- total - The time spent in the current method and it children on behalf of the parent method.
232
- self - The time spent in this method on behalf of the parent method.
233
- children - The time spent in this method's children on behalf of the parent.
234
- calls - The number of times the parent method called this child
235
- </pre>
236
- <p>
237
- Looking at Integer#upto again, we see that it was called 500 times from
238
- Object#is_prime and 1 time from find_largest. Of the 8.72 total seconds
239
- spent in Integer#upto, 6.63 were done for Object#is_prime and 2.09 for
240
- Object#find_largest.
241
- </p>
242
- <h2>Children</h2>
243
- <p>
244
- In each entry, the lines below the primary line are the methods that the
245
- current method called. If the current method is a leaf method then no
246
- children are shown.
247
- </p>
248
- <p>
249
- For children lines, the columns represent:
250
- </p>
251
- <pre>
252
- total - The time spent in the child, and its children, on behalf of the current method
253
- self - The time spent in the child on behalf of the current method.
254
- children - The time spent in the child's children (ie, granchildren) in behalf of the current method
255
- calls - The number of times the child method was called by the current method.
256
- </pre>
257
- <p>
258
- Taking our example of Integer#upto, we see that it called five other
259
- methods - Array#[], Fixnum#&gt;, Kernel.sleep, Fixnum#= and Fixnum#%.
260
- Looking at Kernel.sleep, we see that its spent 2.09 seconds working for
261
- Integer#upto and its children spent 0 time working for Integer#upto. To see
262
- the overall time Kernel.sleep took we would have to look up its entry in
263
- the graph table.
264
- </p>
265
-
266
- </div>
267
-
268
-
269
- </div>
270
-
271
-
272
- </div>
273
-
274
-
275
- <!-- if includes -->
276
-
277
- <div id="section">
278
-
279
-
280
-
281
-
282
-
283
-
284
-
285
-
286
- <!-- if method_list -->
287
-
288
-
289
- </div>
290
-
291
-
292
- <div id="validator-badges">
293
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
294
- </div>
295
-
296
- </body>
297
- </html>
@@ -1,101 +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: ruby_prof.c</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>ruby_prof.c</h1>
51
- <table class="header-table">
52
- <tr class="top-aligned-row">
53
- <td><strong>Path:</strong></td>
54
- <td>ext/ruby_prof.c
55
- </td>
56
- </tr>
57
- <tr class="top-aligned-row">
58
- <td><strong>Last Update:</strong></td>
59
- <td>Thu Jun 22 16:36:21 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
-
72
-
73
- </div>
74
-
75
-
76
- </div>
77
-
78
-
79
- <!-- if includes -->
80
-
81
- <div id="section">
82
-
83
-
84
-
85
-
86
-
87
-
88
-
89
-
90
- <!-- if method_list -->
91
-
92
-
93
- </div>
94
-
95
-
96
- <div id="validator-badges">
97
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
98
- </div>
99
-
100
- </body>
101
- </html>
@@ -1,101 +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: flat_printer.rb</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>flat_printer.rb</h1>
51
- <table class="header-table">
52
- <tr class="top-aligned-row">
53
- <td><strong>Path:</strong></td>
54
- <td>lib/ruby-prof/flat_printer.rb
55
- </td>
56
- </tr>
57
- <tr class="top-aligned-row">
58
- <td><strong>Last Update:</strong></td>
59
- <td>Thu Jun 22 15:25:55 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
-
72
-
73
- </div>
74
-
75
-
76
- </div>
77
-
78
-
79
- <!-- if includes -->
80
-
81
- <div id="section">
82
-
83
-
84
-
85
-
86
-
87
-
88
-
89
-
90
- <!-- if method_list -->
91
-
92
-
93
- </div>
94
-
95
-
96
- <div id="validator-badges">
97
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
98
- </div>
99
-
100
- </body>
101
- </html>