ruby-prof 0.4.0-mswin32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. data/CHANGES +17 -0
  2. data/LICENSE +23 -0
  3. data/README +220 -0
  4. data/Rakefile +141 -0
  5. data/bin/ruby-prof +154 -0
  6. data/doc/classes/RubyProf.html +563 -0
  7. data/doc/classes/RubyProf/CallInfo.html +274 -0
  8. data/doc/classes/RubyProf/FlatPrinter.html +207 -0
  9. data/doc/classes/RubyProf/GraphHtmlPrinter.html +538 -0
  10. data/doc/classes/RubyProf/GraphPrinter.html +240 -0
  11. data/doc/classes/RubyProf/MethodInfo.html +556 -0
  12. data/doc/classes/RubyProf/ProfileTask.html +395 -0
  13. data/doc/classes/RubyProf/Result.html +234 -0
  14. data/doc/created.rid +1 -0
  15. data/doc/files/LICENSE.html +142 -0
  16. data/doc/files/README.html +376 -0
  17. data/doc/files/bin/ruby-prof.html +143 -0
  18. data/doc/files/examples/flat_txt.html +187 -0
  19. data/doc/files/examples/graph_html.html +948 -0
  20. data/doc/files/examples/graph_txt.html +305 -0
  21. data/doc/files/ext/ruby_prof_c.html +101 -0
  22. data/doc/files/lib/ruby-prof/flat_printer_rb.html +101 -0
  23. data/doc/files/lib/ruby-prof/graph_html_printer_rb.html +108 -0
  24. data/doc/files/lib/ruby-prof/graph_printer_rb.html +101 -0
  25. data/doc/files/lib/ruby-prof/profiletask_rb.html +109 -0
  26. data/doc/files/lib/ruby-prof_rb.html +111 -0
  27. data/doc/files/lib/unprof_rb.html +108 -0
  28. data/doc/fr_class_index.html +34 -0
  29. data/doc/fr_file_index.html +39 -0
  30. data/doc/fr_method_index.html +67 -0
  31. data/doc/index.html +24 -0
  32. data/doc/rdoc-style.css +208 -0
  33. data/examples/flat.txt +57 -0
  34. data/examples/graph.html +827 -0
  35. data/examples/graph.txt +171 -0
  36. data/ext/extconf.rb +19 -0
  37. data/ext/ruby_prof.c +1433 -0
  38. data/lib/ruby-prof.rb +38 -0
  39. data/lib/ruby-prof/flat_printer.rb +76 -0
  40. data/lib/ruby-prof/graph_html_printer.rb +227 -0
  41. data/lib/ruby-prof/graph_printer.rb +142 -0
  42. data/lib/ruby-prof/profiletask.rb +150 -0
  43. data/lib/ruby_prof.so +0 -0
  44. data/lib/unprof.rb +8 -0
  45. data/test/basic_test.rb +141 -0
  46. data/test/clock_mode_test.rb +73 -0
  47. data/test/module_test.rb +45 -0
  48. data/test/prime.rb +58 -0
  49. data/test/prime_test.rb +24 -0
  50. data/test/printers_test.rb +28 -0
  51. data/test/recursive_test.rb +55 -0
  52. data/test/test.rb +3 -0
  53. data/test/test_helper.rb +45 -0
  54. data/test/test_suite.rb +9 -0
  55. data/test/thread_test.rb +32 -0
  56. data/test/timing_test.rb +90 -0
  57. metadata +122 -0
@@ -0,0 +1,305 @@
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>Mon Jun 19 16:24:10 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 profiles. 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>Object#test - An instance method &quot;test&quot; on the class
208
+ &quot;Object&quot;
209
+
210
+ </li>
211
+ <li>&lt;Class:Object&gt;test - A class method &quot;test&quot; on the class
212
+ &quot;Object&quot;
213
+
214
+ </li>
215
+ <li>&lt;Object:Object&gt;test - A singleton method &quot;test&quot; on a
216
+ singleton class inherited from &quot;Object&quot;
217
+
218
+ </li>
219
+ <li>Module.test - An instance method &quot;test&quot; on the module
220
+ &quot;Module&quot;
221
+
222
+ </li>
223
+ </ul>
224
+ <p>
225
+ For example, we see that 99.48% of the time was spent in Integer#upto and
226
+ its children. Of that time, 4.06 seconds was spent in Integer#upto itself
227
+ and 4.66 in its children. Overall, Integer#upto was called 501 times.
228
+ </p>
229
+ <h2>Parents</h2>
230
+ <p>
231
+ In each entry, the lines above the primary line are the methods that called
232
+ the current method. If the current method is a root method then no parents
233
+ are shown.
234
+ </p>
235
+ <p>
236
+ For parent lines, the columns represent:
237
+ </p>
238
+ <pre>
239
+ total - The time spent in the current method and it children on behalf of the parent method.
240
+ self - The time spent in this method on behalf of the parent method.
241
+ children - The time spent in this method's children on behalf of the parent.
242
+ calls - The number of times the parent method called this child
243
+ </pre>
244
+ <p>
245
+ Looking at Integer#upto again, we see that it was called 500 times from
246
+ Object#is_prime and 1 time from find_largest. Of the 8.72 total seconds
247
+ spent in Integer#upto, 6.63 were done for Object#is_prime and 2.09 for
248
+ Object#find_largest.
249
+ </p>
250
+ <h2>Children</h2>
251
+ <p>
252
+ In each entry, the lines below the primary line are the methods that the
253
+ current method called. If the current method is a leaf method then no
254
+ children are shown.
255
+ </p>
256
+ <p>
257
+ For children lines, the columns represent:
258
+ </p>
259
+ <pre>
260
+ total - The time spent in the child, and its children, on behalf of the current method
261
+ self - The time spent in the child on behalf of the current method.
262
+ children - The time spent in the child's children (ie, granchildren) in behalf of the current method
263
+ calls - The number of times the child method was called by the current method.
264
+ </pre>
265
+ <p>
266
+ Taking our example of Integer#upto, we see that it called five other
267
+ methods - Array#[], Fixnum#&gt;, Kernel.sleep, Fixnum#= and Fixnum#%.
268
+ Looking at Kernel.sleep, we see that its spent 2.09 seconds working for
269
+ Integer#upto and its children spent 0 time working for Integer#upto. To see
270
+ the overall time Kernel.sleep took we would have to look up its entry in
271
+ the graph table.
272
+ </p>
273
+
274
+ </div>
275
+
276
+
277
+ </div>
278
+
279
+
280
+ </div>
281
+
282
+
283
+ <!-- if includes -->
284
+
285
+ <div id="section">
286
+
287
+
288
+
289
+
290
+
291
+
292
+
293
+
294
+ <!-- if method_list -->
295
+
296
+
297
+ </div>
298
+
299
+
300
+ <div id="validator-badges">
301
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
302
+ </div>
303
+
304
+ </body>
305
+ </html>
@@ -0,0 +1,101 @@
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>Wed Jun 21 00:27:04 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>
@@ -0,0 +1,101 @@
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>Wed Jun 21 00:38:39 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>