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,240 @@
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::GraphPrinter</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::GraphPrinter</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../files/lib/ruby-prof/graph_printer_rb.html">
59
+ lib/ruby-prof/graph_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/graph_txt.html">graph</a> profile
84
+ reports as text. To use the graph printer:
85
+ </p>
86
+ <pre>
87
+ result = RubyProf.profile do
88
+ [code to profile]
89
+ end
90
+
91
+ printer = RubyProf::GraphPrinter.new(result, 5)
92
+ printer.print(STDOUT, 0)
93
+ </pre>
94
+ <p>
95
+ The constructor takes two arguments. The first is a <a
96
+ href="Result.html">RubyProf::Result</a> object generated from a profiling
97
+ run. The second is the minimum %total (the methods total time divided by
98
+ the overall total time) that a method must take for it to be printed out in
99
+ the report. Use this parameter to eliminate methods that are not important
100
+ to the overall profiling results.
101
+ </p>
102
+
103
+ </div>
104
+
105
+
106
+ </div>
107
+
108
+ <div id="method-list">
109
+ <h3 class="section-bar">Methods</h3>
110
+
111
+ <div class="name-list">
112
+ <a href="#M000031">new</a>&nbsp;&nbsp;
113
+ <a href="#M000032">print</a>&nbsp;&nbsp;
114
+ </div>
115
+ </div>
116
+
117
+ </div>
118
+
119
+
120
+ <!-- if includes -->
121
+
122
+ <div id="section">
123
+
124
+
125
+ <div id="constants-list">
126
+ <h3 class="section-bar">Constants</h3>
127
+
128
+ <div class="name-list">
129
+ <table summary="Constants">
130
+ <tr class="top-aligned-row context-row">
131
+ <td class="context-item-name">PERCENTAGE_WIDTH</td>
132
+ <td>=</td>
133
+ <td class="context-item-value">8</td>
134
+ </tr>
135
+ <tr class="top-aligned-row context-row">
136
+ <td class="context-item-name">TIME_WIDTH</td>
137
+ <td>=</td>
138
+ <td class="context-item-value">10</td>
139
+ </tr>
140
+ <tr class="top-aligned-row context-row">
141
+ <td class="context-item-name">CALL_WIDTH</td>
142
+ <td>=</td>
143
+ <td class="context-item-value">20</td>
144
+ </tr>
145
+ </table>
146
+ </div>
147
+ </div>
148
+
149
+
150
+
151
+
152
+
153
+
154
+ <!-- if method_list -->
155
+ <div id="methods">
156
+ <h3 class="section-bar">Public Class methods</h3>
157
+
158
+ <div id="method-M000031" class="method-detail">
159
+ <a name="M000031"></a>
160
+
161
+ <div class="method-heading">
162
+ <a href="#M000031" class="method-signature">
163
+ <span class="method-name">new</span><span class="method-args">(result, min_percent = 0)</span>
164
+ </a>
165
+ </div>
166
+
167
+ <div class="method-description">
168
+ <p>
169
+ Create a <a href="GraphPrinter.html">GraphPrinter</a>. <a
170
+ href="Result.html">Result</a> is a <a
171
+ href="Result.html">RubyProf::Result</a> object generated from a profiling
172
+ run.
173
+ </p>
174
+ <p><a class="source-toggle" href="#"
175
+ onclick="toggleCode('M000031-source');return false;">[Source]</a></p>
176
+ <div class="method-source-code" id="M000031-source">
177
+ <pre>
178
+ <span class="ruby-comment cmt"># File lib/ruby-prof/graph_printer.rb, line 27</span>
179
+ 27: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">result</span>, <span class="ruby-identifier">min_percent</span> = <span class="ruby-value">0</span>)
180
+ 28: <span class="ruby-ivar">@result</span> = <span class="ruby-identifier">result</span>
181
+ 29: <span class="ruby-ivar">@min_percent</span> = <span class="ruby-identifier">min_percent</span>
182
+ 30: <span class="ruby-keyword kw">end</span>
183
+ </pre>
184
+ </div>
185
+ </div>
186
+ </div>
187
+
188
+ <h3 class="section-bar">Public Instance methods</h3>
189
+
190
+ <div id="method-M000032" class="method-detail">
191
+ <a name="M000032"></a>
192
+
193
+ <div class="method-heading">
194
+ <a href="#M000032" class="method-signature">
195
+ <span class="method-name">print</span><span class="method-args">(output = STDOUT, min_percent = 0)</span>
196
+ </a>
197
+ </div>
198
+
199
+ <div class="method-description">
200
+ <p>
201
+ Print a graph report to the provided output.
202
+ </p>
203
+ <p>
204
+ output - Any IO oject, including STDOUT or a file. The default value is
205
+ STDOUT.
206
+ </p>
207
+ <p>
208
+ min_percent - The minimum %total (the methods total time divided by the
209
+ overall total time) that a method must take for it to be printed out in the
210
+ report. Default value is 0.
211
+ </p>
212
+ <p><a class="source-toggle" href="#"
213
+ onclick="toggleCode('M000032-source');return false;">[Source]</a></p>
214
+ <div class="method-source-code" id="M000032-source">
215
+ <pre>
216
+ <span class="ruby-comment cmt"># File lib/ruby-prof/graph_printer.rb, line 41</span>
217
+ 41: <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>)
218
+ 42: <span class="ruby-ivar">@output</span> = <span class="ruby-identifier">output</span>
219
+ 43: <span class="ruby-ivar">@min_percent</span> = <span class="ruby-identifier">min_percent</span>
220
+ 44:
221
+ 45: <span class="ruby-identifier">print_threads</span>
222
+ 46: <span class="ruby-keyword kw">end</span>
223
+ </pre>
224
+ </div>
225
+ </div>
226
+ </div>
227
+
228
+
229
+ </div>
230
+
231
+
232
+ </div>
233
+
234
+
235
+ <div id="validator-badges">
236
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
237
+ </div>
238
+
239
+ </body>
240
+ </html>
@@ -0,0 +1,556 @@
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::MethodInfo</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::MethodInfo</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
+ The <a href="MethodInfo.html">RubyProf::MethodInfo</a> class stores
84
+ profiling data for a method. One instance of the <a
85
+ href="MethodInfo.html">RubyProf::MethodInfo</a> class is created per method
86
+ called per thread. Thus, if a method is called in two different thread then
87
+ there will be two <a href="MethodInfo.html">RubyProf::MethodInfo</a>
88
+ objects created. <a href="MethodInfo.html">RubyProf::MethodInfo</a> objects
89
+ can be accessed via the <a href="Result.html">RubyProf::Result</a> object.
90
+ </p>
91
+
92
+ </div>
93
+
94
+
95
+ </div>
96
+
97
+ <div id="method-list">
98
+ <h3 class="section-bar">Methods</h3>
99
+
100
+ <div class="name-list">
101
+ <a href="#M000021">called</a>&nbsp;&nbsp;
102
+ <a href="#M000030">children</a>&nbsp;&nbsp;
103
+ <a href="#M000024">children_time</a>&nbsp;&nbsp;
104
+ <a href="#M000026">method_class</a>&nbsp;&nbsp;
105
+ <a href="#M000027">method_id</a>&nbsp;&nbsp;
106
+ <a href="#M000025">name</a>&nbsp;&nbsp;
107
+ <a href="#M000029">parents</a>&nbsp;&nbsp;
108
+ <a href="#M000023">self_time</a>&nbsp;&nbsp;
109
+ <a href="#M000028">thread_id</a>&nbsp;&nbsp;
110
+ <a href="#M000022">total_time</a>&nbsp;&nbsp;
111
+ </div>
112
+ </div>
113
+
114
+ </div>
115
+
116
+
117
+ <!-- if includes -->
118
+ <div id="includes">
119
+ <h3 class="section-bar">Included Modules</h3>
120
+
121
+ <div id="includes-list">
122
+ <span class="include-name">Comparable</span>
123
+ </div>
124
+ </div>
125
+
126
+ <div id="section">
127
+
128
+
129
+
130
+
131
+
132
+
133
+
134
+
135
+ <!-- if method_list -->
136
+ <div id="methods">
137
+ <h3 class="section-bar">Public Instance methods</h3>
138
+
139
+ <div id="method-M000021" class="method-detail">
140
+ <a name="M000021"></a>
141
+
142
+ <div class="method-heading">
143
+ <a href="#M000021" class="method-signature">
144
+ <span class="method-name"><br />
145
+ called &rarr; int<br />
146
+ </span>
147
+ </a>
148
+ </div>
149
+
150
+ <div class="method-description">
151
+ <p>
152
+ Returns the number of times this method was called.
153
+ </p>
154
+ <p><a class="source-toggle" href="#"
155
+ onclick="toggleCode('M000021-source');return false;">[Source]</a></p>
156
+ <div class="method-source-code" id="M000021-source">
157
+ <pre>
158
+ /* call-seq:
159
+ called -&gt; int
160
+
161
+ Returns the number of times this method was called. */
162
+ static VALUE
163
+ prof_method_called(VALUE self)
164
+ {
165
+ prof_method_t *result = get_prof_method(self);
166
+
167
+ return INT2NUM(result-&gt;called);
168
+ }
169
+ </pre>
170
+ </div>
171
+ </div>
172
+ </div>
173
+
174
+ <div id="method-M000030" class="method-detail">
175
+ <a name="M000030"></a>
176
+
177
+ <div class="method-heading">
178
+ <a href="#M000030" class="method-signature">
179
+ <span class="method-name"><br />
180
+ children &rarr; hash<br />
181
+ </span>
182
+ </a>
183
+ </div>
184
+
185
+ <div class="method-description">
186
+ <p>
187
+ Returns a hash table that lists all the methods that this method called
188
+ (ie, children). The hash table is keyed on method name and contains
189
+ references to <a href="CallInfo.html">RubyProf::CallInfo</a> objects.
190
+ </p>
191
+ <p><a class="source-toggle" href="#"
192
+ onclick="toggleCode('M000030-source');return false;">[Source]</a></p>
193
+ <div class="method-source-code" id="M000030-source">
194
+ <pre>
195
+ /* call-seq:
196
+ children -&gt; hash
197
+
198
+ Returns a hash table that lists all the methods that this method
199
+ called (ie, children). The hash table is keyed on method name
200
+ and contains references to RubyProf::CallInfo objects.*/
201
+ static VALUE
202
+ prof_method_children(VALUE self)
203
+ {
204
+ /* Returns a hash table, keyed on method name, of call info
205
+ objects for all methods that this method calls (children). */
206
+
207
+ VALUE children = rb_hash_new();
208
+ prof_method_t *result = get_prof_method(self);
209
+ st_foreach(result-&gt;children, prof_method_collect_children, children);
210
+ return children;
211
+ }
212
+ </pre>
213
+ </div>
214
+ </div>
215
+ </div>
216
+
217
+ <div id="method-M000024" class="method-detail">
218
+ <a name="M000024"></a>
219
+
220
+ <div class="method-heading">
221
+ <a href="#M000024" class="method-signature">
222
+ <span class="method-name"><br />
223
+ children_time &rarr; float<br />
224
+ </span>
225
+ </a>
226
+ </div>
227
+
228
+ <div class="method-description">
229
+ <p>
230
+ Returns the total amount of time spent in this method&#8217;s children.
231
+ </p>
232
+ <p><a class="source-toggle" href="#"
233
+ onclick="toggleCode('M000024-source');return false;">[Source]</a></p>
234
+ <div class="method-source-code" id="M000024-source">
235
+ <pre>
236
+ /* call-seq:
237
+ children_time -&gt; float
238
+
239
+ Returns the total amount of time spent in this method's children. */
240
+ static VALUE
241
+ prof_method_children_time(VALUE self)
242
+ {
243
+ prof_method_t *result = get_prof_method(self);
244
+ prof_clock_t children_time = result-&gt;total_time - result-&gt;self_time;
245
+ return rb_float_new(clock2sec(children_time));
246
+ }
247
+ </pre>
248
+ </div>
249
+ </div>
250
+ </div>
251
+
252
+ <div id="method-M000026" class="method-detail">
253
+ <a name="M000026"></a>
254
+
255
+ <div class="method-heading">
256
+ <a href="#M000026" class="method-signature">
257
+ <span class="method-name"><br />
258
+ method_class &rarr; klass<br />
259
+ </span>
260
+ </a>
261
+ </div>
262
+
263
+ <div class="method-description">
264
+ <p>
265
+ Returns the Ruby klass that owns this method.
266
+ </p>
267
+ <p><a class="source-toggle" href="#"
268
+ onclick="toggleCode('M000026-source');return false;">[Source]</a></p>
269
+ <div class="method-source-code" id="M000026-source">
270
+ <pre>
271
+ /* call-seq:
272
+ method_class -&gt; klass
273
+
274
+ Returns the Ruby klass that owns this method. */
275
+ static VALUE
276
+ prof_method_class(VALUE self)
277
+ {
278
+ prof_method_t *result = get_prof_method(self);
279
+
280
+ return result-&gt;klass;
281
+ }
282
+ </pre>
283
+ </div>
284
+ </div>
285
+ </div>
286
+
287
+ <div id="method-M000027" class="method-detail">
288
+ <a name="M000027"></a>
289
+
290
+ <div class="method-heading">
291
+ <a href="#M000027" class="method-signature">
292
+ <span class="method-name"><br />
293
+ method_id &rarr; ID<br />
294
+ </span>
295
+ </a>
296
+ </div>
297
+
298
+ <div class="method-description">
299
+ <p>
300
+ Returns the id of this method.
301
+ </p>
302
+ <p><a class="source-toggle" href="#"
303
+ onclick="toggleCode('M000027-source');return false;">[Source]</a></p>
304
+ <div class="method-source-code" id="M000027-source">
305
+ <pre>
306
+ /* call-seq:
307
+ method_id -&gt; ID
308
+
309
+ Returns the id of this method. */
310
+ static VALUE
311
+ prof_method_id(VALUE self)
312
+ {
313
+ prof_method_t *result = get_prof_method(self);
314
+
315
+ return ID2SYM(result-&gt;mid);
316
+ }
317
+ </pre>
318
+ </div>
319
+ </div>
320
+ </div>
321
+
322
+ <div id="method-M000025" class="method-detail">
323
+ <a name="M000025"></a>
324
+
325
+ <div class="method-heading">
326
+ <a href="#M000025" class="method-signature">
327
+ <span class="method-name"><br />
328
+ method_name &rarr; string<br />
329
+ </span>
330
+ </a>
331
+ </div>
332
+
333
+ <div class="method-description">
334
+ <p>
335
+ Returns the name of this object. The name may be in the form:
336
+ </p>
337
+ <pre>
338
+ Object#method
339
+ Module.method
340
+ .method
341
+ </pre>
342
+ <p><a class="source-toggle" href="#"
343
+ onclick="toggleCode('M000025-source');return false;">[Source]</a></p>
344
+ <div class="method-source-code" id="M000025-source">
345
+ <pre>
346
+ /* call-seq:
347
+ method_name -&gt; string
348
+
349
+ Returns the name of this object. The name may be in the form:
350
+ Object#method
351
+ Module.method
352
+ .method */
353
+ static VALUE
354
+ prof_method_name(VALUE self)
355
+ {
356
+ prof_method_t *method = get_prof_method(self);
357
+ return method_name(method-&gt;klass, method-&gt;mid);
358
+ }
359
+ </pre>
360
+ </div>
361
+ </div>
362
+ </div>
363
+
364
+ <div id="method-M000029" class="method-detail">
365
+ <a name="M000029"></a>
366
+
367
+ <div class="method-heading">
368
+ <a href="#M000029" class="method-signature">
369
+ <span class="method-name"><br />
370
+ parents &rarr; hash<br />
371
+ </span>
372
+ </a>
373
+ </div>
374
+
375
+ <div class="method-description">
376
+ <p>
377
+ Returns a hash table that lists all the methods that called this method
378
+ (ie, parents). The hash table is keyed on method name and contains
379
+ references to <a href="MethodInfo.html">RubyProf::MethodInfo</a> objects.
380
+ </p>
381
+ <p><a class="source-toggle" href="#"
382
+ onclick="toggleCode('M000029-source');return false;">[Source]</a></p>
383
+ <div class="method-source-code" id="M000029-source">
384
+ <pre>
385
+ /* call-seq:
386
+ parents -&gt; hash
387
+
388
+ Returns a hash table that lists all the methods that called this
389
+ method (ie, parents). The hash table is keyed on method name and contains references
390
+ to RubyProf::MethodInfo objects.*/
391
+ static VALUE
392
+ prof_method_parents(VALUE self)
393
+ {
394
+ VALUE result = rb_hash_new();
395
+ VALUE parents = rb_ary_new();
396
+ int len = 0;
397
+ int i = 0;
398
+
399
+ /* Get the list of parents */
400
+ prof_method_t *child = get_prof_method(self);
401
+ st_foreach(child-&gt;parents, prof_method_collect_parents, parents);
402
+
403
+ /* Iterate over each parent */
404
+ len = RARRAY(parents)-&gt;len;
405
+ for(i = 0; i&lt;len; i++)
406
+ {
407
+ prof_call_info_t *call_info;
408
+
409
+ /* First get the parent */
410
+ VALUE item = rb_ary_entry(parents, i);
411
+ prof_method_t *parent = (prof_method_t *)(FIX2INT(item));
412
+
413
+ /* Now get the call info */
414
+ call_info = child_table_lookup(parent-&gt;children, child-&gt;key);
415
+
416
+ if (call_info == NULL)
417
+ {
418
+ /* Should never happen */
419
+ rb_raise(rb_eRuntimeError,
420
+ &quot;Could not find parent call info object for %s&quot;,
421
+ method_name(child-&gt;klass, child-&gt;mid));
422
+ }
423
+
424
+ /* Create a new Ruby CallInfo object and store it into the hash
425
+ keyed on the parent's name. We use the parent's name because
426
+ we want to see that printed out for parent records in
427
+ a call graph. */
428
+ rb_hash_aset(result, method_name(parent-&gt;klass, parent-&gt;mid),
429
+ call_info_new(call_info));
430
+ }
431
+
432
+ return result;
433
+ }
434
+ </pre>
435
+ </div>
436
+ </div>
437
+ </div>
438
+
439
+ <div id="method-M000023" class="method-detail">
440
+ <a name="M000023"></a>
441
+
442
+ <div class="method-heading">
443
+ <a href="#M000023" class="method-signature">
444
+ <span class="method-name"><br />
445
+ self_time &rarr; float<br />
446
+ </span>
447
+ </a>
448
+ </div>
449
+
450
+ <div class="method-description">
451
+ <p>
452
+ Returns the total amount of time spent in this method.
453
+ </p>
454
+ <p><a class="source-toggle" href="#"
455
+ onclick="toggleCode('M000023-source');return false;">[Source]</a></p>
456
+ <div class="method-source-code" id="M000023-source">
457
+ <pre>
458
+ /* call-seq:
459
+ self_time -&gt; float
460
+
461
+ Returns the total amount of time spent in this method. */
462
+ static VALUE
463
+ prof_method_self_time(VALUE self)
464
+ {
465
+ prof_method_t *result = get_prof_method(self);
466
+
467
+ return rb_float_new(clock2sec(result-&gt;self_time));
468
+ }
469
+ </pre>
470
+ </div>
471
+ </div>
472
+ </div>
473
+
474
+ <div id="method-M000028" class="method-detail">
475
+ <a name="M000028"></a>
476
+
477
+ <div class="method-heading">
478
+ <a href="#M000028" class="method-signature">
479
+ <span class="method-name"><br />
480
+ thread_id &rarr; id<br />
481
+ </span>
482
+ </a>
483
+ </div>
484
+
485
+ <div class="method-description">
486
+ <p>
487
+ Returns the id of the thread that executed this method.
488
+ </p>
489
+ <p><a class="source-toggle" href="#"
490
+ onclick="toggleCode('M000028-source');return false;">[Source]</a></p>
491
+ <div class="method-source-code" id="M000028-source">
492
+ <pre>
493
+ /* call-seq:
494
+ thread_id -&gt; id
495
+
496
+ Returns the id of the thread that executed this method.*/
497
+ static VALUE
498
+ prof_thread_id(VALUE self)
499
+ {
500
+ prof_method_t *result = get_prof_method(self);
501
+
502
+ return INT2FIX(result-&gt;thread_id);
503
+ }
504
+ </pre>
505
+ </div>
506
+ </div>
507
+ </div>
508
+
509
+ <div id="method-M000022" class="method-detail">
510
+ <a name="M000022"></a>
511
+
512
+ <div class="method-heading">
513
+ <a href="#M000022" class="method-signature">
514
+ <span class="method-name"><br />
515
+ total_time &rarr; float<br />
516
+ </span>
517
+ </a>
518
+ </div>
519
+
520
+ <div class="method-description">
521
+ <p>
522
+ Returns the total amount of time spent in this method and its children.
523
+ </p>
524
+ <p><a class="source-toggle" href="#"
525
+ onclick="toggleCode('M000022-source');return false;">[Source]</a></p>
526
+ <div class="method-source-code" id="M000022-source">
527
+ <pre>
528
+ /* call-seq:
529
+ total_time -&gt; float
530
+
531
+ Returns the total amount of time spent in this method and its children. */
532
+ static VALUE
533
+ prof_method_total_time(VALUE self)
534
+ {
535
+ prof_method_t *result = get_prof_method(self);
536
+
537
+ return rb_float_new(clock2sec(result-&gt;total_time));
538
+ }
539
+ </pre>
540
+ </div>
541
+ </div>
542
+ </div>
543
+
544
+
545
+ </div>
546
+
547
+
548
+ </div>
549
+
550
+
551
+ <div id="validator-badges">
552
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
553
+ </div>
554
+
555
+ </body>
556
+ </html>