ruby-prof 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) 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/unprof.rb +8 -0
  44. data/test/basic_test.rb +141 -0
  45. data/test/clock_mode_test.rb +73 -0
  46. data/test/module_test.rb +45 -0
  47. data/test/prime.rb +58 -0
  48. data/test/prime_test.rb +24 -0
  49. data/test/printers_test.rb +28 -0
  50. data/test/recursive_test.rb +55 -0
  51. data/test/test.rb +3 -0
  52. data/test/test_helper.rb +45 -0
  53. data/test/test_suite.rb +9 -0
  54. data/test/thread_test.rb +32 -0
  55. data/test/timing_test.rb +90 -0
  56. metadata +121 -0
@@ -0,0 +1,274 @@
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>Class: RubyProf::CallInfo</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="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Class</strong></td>
53
+ <td class="class-name-in-header">RubyProf::CallInfo</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../files/ext/ruby_prof_c.html">
59
+ ext/ruby_prof.c
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ <tr class="top-aligned-row">
66
+ <td><strong>Parent:</strong></td>
67
+ <td>
68
+ Object
69
+ </td>
70
+ </tr>
71
+ </table>
72
+ </div>
73
+ <!-- banner header -->
74
+
75
+ <div id="bodyContent">
76
+
77
+
78
+
79
+ <div id="contextContent">
80
+
81
+ <div id="description">
82
+ <p>
83
+ <a href="CallInfo.html">RubyProf::CallInfo</a> is a helper class used by <a
84
+ href="MethodInfo.html">RubyProf::MethodInfo</a> to keep track of which
85
+ child methods were called and how long they took to execute.
86
+ </p>
87
+
88
+ </div>
89
+
90
+
91
+ </div>
92
+
93
+ <div id="method-list">
94
+ <h3 class="section-bar">Methods</h3>
95
+
96
+ <div class="name-list">
97
+ <a href="#M000009">called</a>&nbsp;&nbsp;
98
+ <a href="#M000012">children_time</a>&nbsp;&nbsp;
99
+ <a href="#M000011">self_time</a>&nbsp;&nbsp;
100
+ <a href="#M000010">total_time</a>&nbsp;&nbsp;
101
+ </div>
102
+ </div>
103
+
104
+ </div>
105
+
106
+
107
+ <!-- if includes -->
108
+
109
+ <div id="section">
110
+
111
+
112
+
113
+
114
+
115
+
116
+
117
+
118
+ <!-- if method_list -->
119
+ <div id="methods">
120
+ <h3 class="section-bar">Public Instance methods</h3>
121
+
122
+ <div id="method-M000009" class="method-detail">
123
+ <a name="M000009"></a>
124
+
125
+ <div class="method-heading">
126
+ <a href="#M000009" class="method-signature">
127
+ <span class="method-name"><br />
128
+ called &rarr; int<br />
129
+ </span>
130
+ </a>
131
+ </div>
132
+
133
+ <div class="method-description">
134
+ <p>
135
+ Returns the total amount of time this method was called.
136
+ </p>
137
+ <p><a class="source-toggle" href="#"
138
+ onclick="toggleCode('M000009-source');return false;">[Source]</a></p>
139
+ <div class="method-source-code" id="M000009-source">
140
+ <pre>
141
+ /* call-seq:
142
+ called -&gt; int
143
+
144
+ Returns the total amount of time this method was called. */
145
+ static VALUE
146
+ call_info_called(VALUE self)
147
+ {
148
+ prof_call_info_t *result = get_call_info_result(self);
149
+
150
+ return INT2NUM(result-&gt;called);
151
+ }
152
+ </pre>
153
+ </div>
154
+ </div>
155
+ </div>
156
+
157
+ <div id="method-M000012" class="method-detail">
158
+ <a name="M000012"></a>
159
+
160
+ <div class="method-heading">
161
+ <a href="#M000012" class="method-signature">
162
+ <span class="method-name"><br />
163
+ children_time &rarr; float<br />
164
+ </span>
165
+ </a>
166
+ </div>
167
+
168
+ <div class="method-description">
169
+ <p>
170
+ Returns the total amount of time spent in this method&#8217;s children.
171
+ </p>
172
+ <p><a class="source-toggle" href="#"
173
+ onclick="toggleCode('M000012-source');return false;">[Source]</a></p>
174
+ <div class="method-source-code" id="M000012-source">
175
+ <pre>
176
+ /* call-seq:
177
+ children_time -&gt; float
178
+
179
+ Returns the total amount of time spent in this method's children. */
180
+ static VALUE
181
+ call_info_children_time(VALUE self)
182
+ {
183
+ prof_call_info_t *result = get_call_info_result(self);
184
+ prof_clock_t children_time = result-&gt;total_time - result-&gt;self_time;
185
+ return rb_float_new(clock2sec(children_time));
186
+ }
187
+ </pre>
188
+ </div>
189
+ </div>
190
+ </div>
191
+
192
+ <div id="method-M000011" class="method-detail">
193
+ <a name="M000011"></a>
194
+
195
+ <div class="method-heading">
196
+ <a href="#M000011" class="method-signature">
197
+ <span class="method-name"><br />
198
+ self_time &rarr; float<br />
199
+ </span>
200
+ </a>
201
+ </div>
202
+
203
+ <div class="method-description">
204
+ <p>
205
+ Returns the total amount of time spent in this method.
206
+ </p>
207
+ <p><a class="source-toggle" href="#"
208
+ onclick="toggleCode('M000011-source');return false;">[Source]</a></p>
209
+ <div class="method-source-code" id="M000011-source">
210
+ <pre>
211
+ /* call-seq:
212
+ self_time -&gt; float
213
+
214
+ Returns the total amount of time spent in this method. */
215
+ static VALUE
216
+ call_info_self_time(VALUE self)
217
+ {
218
+ prof_call_info_t *result = get_call_info_result(self);
219
+
220
+ return rb_float_new(clock2sec(result-&gt;self_time));
221
+ }
222
+ </pre>
223
+ </div>
224
+ </div>
225
+ </div>
226
+
227
+ <div id="method-M000010" class="method-detail">
228
+ <a name="M000010"></a>
229
+
230
+ <div class="method-heading">
231
+ <a href="#M000010" class="method-signature">
232
+ <span class="method-name"><br />
233
+ total_time &rarr; float<br />
234
+ </span>
235
+ </a>
236
+ </div>
237
+
238
+ <div class="method-description">
239
+ <p>
240
+ Returns the total amount of time spent in this method and its children.
241
+ </p>
242
+ <p><a class="source-toggle" href="#"
243
+ onclick="toggleCode('M000010-source');return false;">[Source]</a></p>
244
+ <div class="method-source-code" id="M000010-source">
245
+ <pre>
246
+ /* call-seq:
247
+ total_time -&gt; float
248
+
249
+ Returns the total amount of time spent in this method and its children. */
250
+ static VALUE
251
+ call_info_total_time(VALUE self)
252
+ {
253
+ prof_call_info_t *result = get_call_info_result(self);
254
+
255
+ return rb_float_new(clock2sec(result-&gt;total_time));
256
+ }
257
+ </pre>
258
+ </div>
259
+ </div>
260
+ </div>
261
+
262
+
263
+ </div>
264
+
265
+
266
+ </div>
267
+
268
+
269
+ <div id="validator-badges">
270
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
271
+ </div>
272
+
273
+ </body>
274
+ </html>
@@ -0,0 +1,207 @@
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>Class: RubyProf::FlatPrinter</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="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Class</strong></td>
53
+ <td class="class-name-in-header">RubyProf::FlatPrinter</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../files/lib/ruby-prof/flat_printer_rb.html">
59
+ lib/ruby-prof/flat_printer.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ <tr class="top-aligned-row">
66
+ <td><strong>Parent:</strong></td>
67
+ <td>
68
+ Object
69
+ </td>
70
+ </tr>
71
+ </table>
72
+ </div>
73
+ <!-- banner header -->
74
+
75
+ <div id="bodyContent">
76
+
77
+
78
+
79
+ <div id="contextContent">
80
+
81
+ <div id="description">
82
+ <p>
83
+ Generates <a href="../../files/examples/flat_txt.html">flat</a> profile
84
+ reports as text. To use the flat printer:
85
+ </p>
86
+ <pre>
87
+ result = RubyProf.profile do
88
+ [code to profile]
89
+ end
90
+
91
+ printer = RubyProf::FlatPrinter.new(result)
92
+ printer.print(STDOUT, 0)
93
+ </pre>
94
+
95
+ </div>
96
+
97
+
98
+ </div>
99
+
100
+ <div id="method-list">
101
+ <h3 class="section-bar">Methods</h3>
102
+
103
+ <div class="name-list">
104
+ <a href="#M000033">new</a>&nbsp;&nbsp;
105
+ <a href="#M000034">print</a>&nbsp;&nbsp;
106
+ </div>
107
+ </div>
108
+
109
+ </div>
110
+
111
+
112
+ <!-- if includes -->
113
+
114
+ <div id="section">
115
+
116
+
117
+
118
+
119
+
120
+
121
+
122
+
123
+ <!-- if method_list -->
124
+ <div id="methods">
125
+ <h3 class="section-bar">Public Class methods</h3>
126
+
127
+ <div id="method-M000033" class="method-detail">
128
+ <a name="M000033"></a>
129
+
130
+ <div class="method-heading">
131
+ <a href="#M000033" class="method-signature">
132
+ <span class="method-name">new</span><span class="method-args">(result)</span>
133
+ </a>
134
+ </div>
135
+
136
+ <div class="method-description">
137
+ <p>
138
+ Create a <a href="FlatPrinter.html">FlatPrinter</a>. <a
139
+ href="Result.html">Result</a> is a <a
140
+ href="Result.html">RubyProf::Result</a> object generated from a profiling
141
+ run.
142
+ </p>
143
+ <p><a class="source-toggle" href="#"
144
+ onclick="toggleCode('M000033-source');return false;">[Source]</a></p>
145
+ <div class="method-source-code" id="M000033-source">
146
+ <pre>
147
+ <span class="ruby-comment cmt"># File lib/ruby-prof/flat_printer.rb, line 15</span>
148
+ 15: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">result</span>)
149
+ 16: <span class="ruby-ivar">@result</span> = <span class="ruby-identifier">result</span>
150
+ 17: <span class="ruby-keyword kw">end</span>
151
+ </pre>
152
+ </div>
153
+ </div>
154
+ </div>
155
+
156
+ <h3 class="section-bar">Public Instance methods</h3>
157
+
158
+ <div id="method-M000034" class="method-detail">
159
+ <a name="M000034"></a>
160
+
161
+ <div class="method-heading">
162
+ <a href="#M000034" class="method-signature">
163
+ <span class="method-name">print</span><span class="method-args">(output = STDOUT, min_percent = 0)</span>
164
+ </a>
165
+ </div>
166
+
167
+ <div class="method-description">
168
+ <p>
169
+ Print a flat profile report to the provided output.
170
+ </p>
171
+ <p>
172
+ output - Any IO oject, including STDOUT or a file. The default value is
173
+ STDOUT.
174
+ </p>
175
+ <p>
176
+ min_percent - The minimum %self (the methods self time divided by the
177
+ overall total time) that a method must take for it to be printed out in the
178
+ report. Default value is 0.
179
+ </p>
180
+ <p><a class="source-toggle" href="#"
181
+ onclick="toggleCode('M000034-source');return false;">[Source]</a></p>
182
+ <div class="method-source-code" id="M000034-source">
183
+ <pre>
184
+ <span class="ruby-comment cmt"># File lib/ruby-prof/flat_printer.rb, line 28</span>
185
+ 28: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">print</span>(<span class="ruby-identifier">output</span> = <span class="ruby-constant">STDOUT</span>, <span class="ruby-identifier">min_percent</span> = <span class="ruby-value">0</span>)
186
+ 29: <span class="ruby-ivar">@min_percent</span> = <span class="ruby-identifier">min_percent</span>
187
+ 30: <span class="ruby-ivar">@output</span> = <span class="ruby-identifier">output</span>
188
+ 31: <span class="ruby-identifier">print_threads</span>
189
+ 32: <span class="ruby-keyword kw">end</span>
190
+ </pre>
191
+ </div>
192
+ </div>
193
+ </div>
194
+
195
+
196
+ </div>
197
+
198
+
199
+ </div>
200
+
201
+
202
+ <div id="validator-badges">
203
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
204
+ </div>
205
+
206
+ </body>
207
+ </html>