ruby-prof 0.4.0-mswin32
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +17 -0
- data/LICENSE +23 -0
- data/README +220 -0
- data/Rakefile +141 -0
- data/bin/ruby-prof +154 -0
- data/doc/classes/RubyProf.html +563 -0
- data/doc/classes/RubyProf/CallInfo.html +274 -0
- data/doc/classes/RubyProf/FlatPrinter.html +207 -0
- data/doc/classes/RubyProf/GraphHtmlPrinter.html +538 -0
- data/doc/classes/RubyProf/GraphPrinter.html +240 -0
- data/doc/classes/RubyProf/MethodInfo.html +556 -0
- data/doc/classes/RubyProf/ProfileTask.html +395 -0
- data/doc/classes/RubyProf/Result.html +234 -0
- data/doc/created.rid +1 -0
- data/doc/files/LICENSE.html +142 -0
- data/doc/files/README.html +376 -0
- data/doc/files/bin/ruby-prof.html +143 -0
- data/doc/files/examples/flat_txt.html +187 -0
- data/doc/files/examples/graph_html.html +948 -0
- data/doc/files/examples/graph_txt.html +305 -0
- data/doc/files/ext/ruby_prof_c.html +101 -0
- data/doc/files/lib/ruby-prof/flat_printer_rb.html +101 -0
- data/doc/files/lib/ruby-prof/graph_html_printer_rb.html +108 -0
- data/doc/files/lib/ruby-prof/graph_printer_rb.html +101 -0
- data/doc/files/lib/ruby-prof/profiletask_rb.html +109 -0
- data/doc/files/lib/ruby-prof_rb.html +111 -0
- data/doc/files/lib/unprof_rb.html +108 -0
- data/doc/fr_class_index.html +34 -0
- data/doc/fr_file_index.html +39 -0
- data/doc/fr_method_index.html +67 -0
- data/doc/index.html +24 -0
- data/doc/rdoc-style.css +208 -0
- data/examples/flat.txt +57 -0
- data/examples/graph.html +827 -0
- data/examples/graph.txt +171 -0
- data/ext/extconf.rb +19 -0
- data/ext/ruby_prof.c +1433 -0
- data/lib/ruby-prof.rb +38 -0
- data/lib/ruby-prof/flat_printer.rb +76 -0
- data/lib/ruby-prof/graph_html_printer.rb +227 -0
- data/lib/ruby-prof/graph_printer.rb +142 -0
- data/lib/ruby-prof/profiletask.rb +150 -0
- data/lib/ruby_prof.so +0 -0
- data/lib/unprof.rb +8 -0
- data/test/basic_test.rb +141 -0
- data/test/clock_mode_test.rb +73 -0
- data/test/module_test.rb +45 -0
- data/test/prime.rb +58 -0
- data/test/prime_test.rb +24 -0
- data/test/printers_test.rb +28 -0
- data/test/recursive_test.rb +55 -0
- data/test/test.rb +3 -0
- data/test/test_helper.rb +45 -0
- data/test/test_suite.rb +9 -0
- data/test/thread_test.rb +32 -0
- data/test/timing_test.rb +90 -0
- metadata +122 -0
@@ -0,0 +1,395 @@
|
|
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::ProfileTask</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::ProfileTask</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/lib/ruby-prof/profiletask_rb.html">
|
59
|
+
lib/ruby-prof/profiletask.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
|
+
Rake::TestTask
|
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
|
+
Create a profile task. All of the options provided by the Rake:TestTask are
|
84
|
+
supported except the loader which is set to ruby-prof. For detailed
|
85
|
+
information please refer to the Rake:TestTask documentation.
|
86
|
+
</p>
|
87
|
+
<p>
|
88
|
+
ruby-prof specific options include:
|
89
|
+
</p>
|
90
|
+
<pre>
|
91
|
+
output_dir - For each file specified an output
|
92
|
+
file with profile information will be
|
93
|
+
written to the output directory.
|
94
|
+
By default, the output directory is
|
95
|
+
called "profile" and is created underneath
|
96
|
+
the current working directory.
|
97
|
+
|
98
|
+
printer - Specifies the output printer. Valid values include
|
99
|
+
:flat, :graph, and :graph_html.
|
100
|
+
|
101
|
+
min_percent - Methods that take less than the specified percent
|
102
|
+
will not be written out.
|
103
|
+
</pre>
|
104
|
+
<p>
|
105
|
+
Example:
|
106
|
+
</p>
|
107
|
+
<pre>
|
108
|
+
require 'ruby-prof/task'
|
109
|
+
|
110
|
+
ruby-prof::RubyProfTask.new do |t|
|
111
|
+
t.test_files = FileList['test/test*.rb']
|
112
|
+
t.output_dir = "c:/temp"
|
113
|
+
t.printer = :graph
|
114
|
+
t.min_percent = 10
|
115
|
+
end
|
116
|
+
</pre>
|
117
|
+
<p>
|
118
|
+
If the task is invoked with a "test=filename" command line
|
119
|
+
option, then the list of test files will be overridden to include only the
|
120
|
+
filename specified on the command line. This provides an easy way to run
|
121
|
+
just one test.
|
122
|
+
</p>
|
123
|
+
<p>
|
124
|
+
If rake is invoked with a "options=options" command line option,
|
125
|
+
then the given options are passed to ruby-prof.
|
126
|
+
</p>
|
127
|
+
<p>
|
128
|
+
If rake is invoked with a "ruby-profPATH=path/to/ruby-prof"
|
129
|
+
command line option, then the given ruby-prof executable will be used;
|
130
|
+
otherwise the one in your PATH will be used.
|
131
|
+
</p>
|
132
|
+
<p>
|
133
|
+
Examples:
|
134
|
+
</p>
|
135
|
+
<pre>
|
136
|
+
rake ruby-prof # profiles all unit tests
|
137
|
+
rake ruby-prof TEST=just_one_file.rb # profiles one unit test
|
138
|
+
rake ruby-prof PATTERN=*.rb # profiles all files
|
139
|
+
</pre>
|
140
|
+
|
141
|
+
</div>
|
142
|
+
|
143
|
+
|
144
|
+
</div>
|
145
|
+
|
146
|
+
<div id="method-list">
|
147
|
+
<h3 class="section-bar">Methods</h3>
|
148
|
+
|
149
|
+
<div class="name-list">
|
150
|
+
<a href="#M000041">create_output_directory</a>
|
151
|
+
<a href="#M000038">define</a>
|
152
|
+
<a href="#M000037">new</a>
|
153
|
+
<a href="#M000040">output_directory</a>
|
154
|
+
<a href="#M000039">run_script</a>
|
155
|
+
</div>
|
156
|
+
</div>
|
157
|
+
|
158
|
+
</div>
|
159
|
+
|
160
|
+
|
161
|
+
<!-- if includes -->
|
162
|
+
|
163
|
+
<div id="section">
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
<div id="attribute-list">
|
170
|
+
<h3 class="section-bar">Attributes</h3>
|
171
|
+
|
172
|
+
<div class="name-list">
|
173
|
+
<table>
|
174
|
+
<tr class="top-aligned-row context-row">
|
175
|
+
<td class="context-item-name">min_percent</td>
|
176
|
+
<td class="context-item-value"> [W] </td>
|
177
|
+
<td class="context-item-desc"></td>
|
178
|
+
</tr>
|
179
|
+
<tr class="top-aligned-row context-row">
|
180
|
+
<td class="context-item-name">output_dir</td>
|
181
|
+
<td class="context-item-value"> [W] </td>
|
182
|
+
<td class="context-item-desc"></td>
|
183
|
+
</tr>
|
184
|
+
<tr class="top-aligned-row context-row">
|
185
|
+
<td class="context-item-name">printer</td>
|
186
|
+
<td class="context-item-value"> [W] </td>
|
187
|
+
<td class="context-item-desc"></td>
|
188
|
+
</tr>
|
189
|
+
</table>
|
190
|
+
</div>
|
191
|
+
</div>
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
<!-- if method_list -->
|
196
|
+
<div id="methods">
|
197
|
+
<h3 class="section-bar">Public Class methods</h3>
|
198
|
+
|
199
|
+
<div id="method-M000037" class="method-detail">
|
200
|
+
<a name="M000037"></a>
|
201
|
+
|
202
|
+
<div class="method-heading">
|
203
|
+
<a href="#M000037" class="method-signature">
|
204
|
+
<span class="method-name">new</span><span class="method-args">(name=:profile) {|self if block_given?| ...}</span>
|
205
|
+
</a>
|
206
|
+
</div>
|
207
|
+
|
208
|
+
<div class="method-description">
|
209
|
+
<p><a class="source-toggle" href="#"
|
210
|
+
onclick="toggleCode('M000037-source');return false;">[Source]</a></p>
|
211
|
+
<div class="method-source-code" id="M000037-source">
|
212
|
+
<pre>
|
213
|
+
<span class="ruby-comment cmt"># File lib/ruby-prof/profiletask.rb, line 62</span>
|
214
|
+
62: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">name</span>=<span class="ruby-identifier">:profile</span>)
|
215
|
+
63: <span class="ruby-ivar">@name</span> = <span class="ruby-identifier">name</span>
|
216
|
+
64: <span class="ruby-ivar">@libs</span> = [<span class="ruby-value str">"lib"</span>]
|
217
|
+
65: <span class="ruby-ivar">@pattern</span> = <span class="ruby-keyword kw">nil</span>
|
218
|
+
66: <span class="ruby-ivar">@options</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
|
219
|
+
67: <span class="ruby-ivar">@test_files</span> = <span class="ruby-keyword kw">nil</span>
|
220
|
+
68: <span class="ruby-ivar">@verbose</span> = <span class="ruby-keyword kw">false</span>
|
221
|
+
69: <span class="ruby-ivar">@warning</span> = <span class="ruby-keyword kw">false</span>
|
222
|
+
70: <span class="ruby-ivar">@loader</span> = <span class="ruby-identifier">:ruby_prof</span>
|
223
|
+
71: <span class="ruby-ivar">@ruby_opts</span> = []
|
224
|
+
72: <span class="ruby-ivar">@output_dir</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">Dir</span>.<span class="ruby-identifier">getwd</span>, <span class="ruby-value str">"profile"</span>)
|
225
|
+
73: <span class="ruby-ivar">@printer</span> = <span class="ruby-identifier">:graph</span>
|
226
|
+
74: <span class="ruby-ivar">@min_percent</span> = <span class="ruby-value">0</span>
|
227
|
+
75: <span class="ruby-keyword kw">yield</span> <span class="ruby-keyword kw">self</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
|
228
|
+
76: <span class="ruby-ivar">@pattern</span> = <span class="ruby-value str">'test/test*.rb'</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@pattern</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">&&</span> <span class="ruby-ivar">@test_files</span>.<span class="ruby-identifier">nil?</span>
|
229
|
+
77: <span class="ruby-identifier">define</span>
|
230
|
+
78: <span class="ruby-keyword kw">end</span>
|
231
|
+
</pre>
|
232
|
+
</div>
|
233
|
+
</div>
|
234
|
+
</div>
|
235
|
+
|
236
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
237
|
+
|
238
|
+
<div id="method-M000041" class="method-detail">
|
239
|
+
<a name="M000041"></a>
|
240
|
+
|
241
|
+
<div class="method-heading">
|
242
|
+
<a href="#M000041" class="method-signature">
|
243
|
+
<span class="method-name">create_output_directory</span><span class="method-args">()</span>
|
244
|
+
</a>
|
245
|
+
</div>
|
246
|
+
|
247
|
+
<div class="method-description">
|
248
|
+
<p><a class="source-toggle" href="#"
|
249
|
+
onclick="toggleCode('M000041-source');return false;">[Source]</a></p>
|
250
|
+
<div class="method-source-code" id="M000041-source">
|
251
|
+
<pre>
|
252
|
+
<span class="ruby-comment cmt"># File lib/ruby-prof/profiletask.rb, line 139</span>
|
253
|
+
139: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">create_output_directory</span>
|
254
|
+
140: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-identifier">output_directory</span>)
|
255
|
+
141: <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">mkdir</span>(<span class="ruby-identifier">output_directory</span>)
|
256
|
+
142: <span class="ruby-keyword kw">end</span>
|
257
|
+
143: <span class="ruby-keyword kw">end</span>
|
258
|
+
</pre>
|
259
|
+
</div>
|
260
|
+
</div>
|
261
|
+
</div>
|
262
|
+
|
263
|
+
<div id="method-M000038" class="method-detail">
|
264
|
+
<a name="M000038"></a>
|
265
|
+
|
266
|
+
<div class="method-heading">
|
267
|
+
<a href="#M000038" class="method-signature">
|
268
|
+
<span class="method-name">define</span><span class="method-args">()</span>
|
269
|
+
</a>
|
270
|
+
</div>
|
271
|
+
|
272
|
+
<div class="method-description">
|
273
|
+
<p>
|
274
|
+
Create the tasks defined by this task lib.
|
275
|
+
</p>
|
276
|
+
<p><a class="source-toggle" href="#"
|
277
|
+
onclick="toggleCode('M000038-source');return false;">[Source]</a></p>
|
278
|
+
<div class="method-source-code" id="M000038-source">
|
279
|
+
<pre>
|
280
|
+
<span class="ruby-comment cmt"># File lib/ruby-prof/profiletask.rb, line 81</span>
|
281
|
+
81: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">define</span>
|
282
|
+
82: <span class="ruby-identifier">create_output_directory</span>
|
283
|
+
83:
|
284
|
+
84: <span class="ruby-identifier">lib_path</span> = <span class="ruby-ivar">@libs</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">File</span><span class="ruby-operator">::</span><span class="ruby-constant">PATH_SEPARATOR</span>)
|
285
|
+
85: <span class="ruby-identifier">desc</span> <span class="ruby-value str">"Profile"</span> <span class="ruby-operator">+</span> (<span class="ruby-ivar">@name</span><span class="ruby-operator">==</span><span class="ruby-identifier">:profile</span> <span class="ruby-operator">?</span> <span class="ruby-value str">""</span> <span class="ruby-operator">:</span> <span class="ruby-node">" for #{@name}"</span>)
|
286
|
+
86:
|
287
|
+
87: <span class="ruby-identifier">task</span> <span class="ruby-ivar">@name</span> <span class="ruby-keyword kw">do</span>
|
288
|
+
88: <span class="ruby-ivar">@ruby_opts</span>.<span class="ruby-identifier">unshift</span>( <span class="ruby-node">"-I#{lib_path}"</span> )
|
289
|
+
89: <span class="ruby-ivar">@ruby_opts</span>.<span class="ruby-identifier">unshift</span>( <span class="ruby-value str">"-w"</span> ) <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@warning</span>
|
290
|
+
90: <span class="ruby-ivar">@ruby_opts</span>.<span class="ruby-identifier">push</span>(<span class="ruby-value str">"-S ruby-prof"</span>)
|
291
|
+
91: <span class="ruby-ivar">@ruby_opts</span>.<span class="ruby-identifier">push</span>(<span class="ruby-node">"--printer #{@printer}"</span>)
|
292
|
+
92: <span class="ruby-ivar">@ruby_opts</span>.<span class="ruby-identifier">push</span>(<span class="ruby-node">"--min_percent #{@min_percent}"</span>)
|
293
|
+
93:
|
294
|
+
94: <span class="ruby-identifier">file_list</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">file_path</span><span class="ruby-operator">|</span>
|
295
|
+
95: <span class="ruby-identifier">run_script</span>(<span class="ruby-identifier">file_path</span>)
|
296
|
+
96: <span class="ruby-keyword kw">end</span>
|
297
|
+
97: <span class="ruby-keyword kw">end</span>
|
298
|
+
98: <span class="ruby-keyword kw">self</span>
|
299
|
+
99: <span class="ruby-keyword kw">end</span>
|
300
|
+
</pre>
|
301
|
+
</div>
|
302
|
+
</div>
|
303
|
+
</div>
|
304
|
+
|
305
|
+
<div id="method-M000040" class="method-detail">
|
306
|
+
<a name="M000040"></a>
|
307
|
+
|
308
|
+
<div class="method-heading">
|
309
|
+
<a href="#M000040" class="method-signature">
|
310
|
+
<span class="method-name">output_directory</span><span class="method-args">()</span>
|
311
|
+
</a>
|
312
|
+
</div>
|
313
|
+
|
314
|
+
<div class="method-description">
|
315
|
+
<p><a class="source-toggle" href="#"
|
316
|
+
onclick="toggleCode('M000040-source');return false;">[Source]</a></p>
|
317
|
+
<div class="method-source-code" id="M000040-source">
|
318
|
+
<pre>
|
319
|
+
<span class="ruby-comment cmt"># File lib/ruby-prof/profiletask.rb, line 135</span>
|
320
|
+
135: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">output_directory</span>
|
321
|
+
136: <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-ivar">@output_dir</span>)
|
322
|
+
137: <span class="ruby-keyword kw">end</span>
|
323
|
+
</pre>
|
324
|
+
</div>
|
325
|
+
</div>
|
326
|
+
</div>
|
327
|
+
|
328
|
+
<div id="method-M000039" class="method-detail">
|
329
|
+
<a name="M000039"></a>
|
330
|
+
|
331
|
+
<div class="method-heading">
|
332
|
+
<a href="#M000039" class="method-signature">
|
333
|
+
<span class="method-name">run_script</span><span class="method-args">(script_path)</span>
|
334
|
+
</a>
|
335
|
+
</div>
|
336
|
+
|
337
|
+
<div class="method-description">
|
338
|
+
<p>
|
339
|
+
Run script
|
340
|
+
</p>
|
341
|
+
<p><a class="source-toggle" href="#"
|
342
|
+
onclick="toggleCode('M000039-source');return false;">[Source]</a></p>
|
343
|
+
<div class="method-source-code" id="M000039-source">
|
344
|
+
<pre>
|
345
|
+
<span class="ruby-comment cmt"># File lib/ruby-prof/profiletask.rb, line 102</span>
|
346
|
+
102: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">run_script</span>(<span class="ruby-identifier">script_path</span>)
|
347
|
+
103: <span class="ruby-identifier">run_code</span> = <span class="ruby-value str">''</span>
|
348
|
+
104: <span class="ruby-constant">RakeFileUtils</span>.<span class="ruby-identifier">verbose</span>(<span class="ruby-ivar">@verbose</span>) <span class="ruby-keyword kw">do</span>
|
349
|
+
105: <span class="ruby-identifier">file_name</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">basename</span>(<span class="ruby-identifier">script_path</span>, <span class="ruby-constant">File</span>.<span class="ruby-identifier">extname</span>(<span class="ruby-identifier">script_path</span>))
|
350
|
+
106: <span class="ruby-keyword kw">case</span> <span class="ruby-ivar">@printer</span>
|
351
|
+
107: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:flat</span>, <span class="ruby-identifier">:graph</span>
|
352
|
+
108: <span class="ruby-identifier">file_name</span> <span class="ruby-operator">+=</span> <span class="ruby-value str">".txt"</span>
|
353
|
+
109: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:graph_html</span>
|
354
|
+
110: <span class="ruby-identifier">file_name</span> <span class="ruby-operator">+=</span> <span class="ruby-value str">".html"</span>
|
355
|
+
111: <span class="ruby-keyword kw">else</span>
|
356
|
+
112: <span class="ruby-identifier">file_name</span> <span class="ruby-operator">+=</span> <span class="ruby-value str">".txt"</span>
|
357
|
+
113: <span class="ruby-keyword kw">end</span>
|
358
|
+
114:
|
359
|
+
115: <span class="ruby-identifier">output_file_path</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">output_directory</span>, <span class="ruby-identifier">file_name</span>)
|
360
|
+
116:
|
361
|
+
117: <span class="ruby-identifier">command_line</span> = <span class="ruby-ivar">@ruby_opts</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">" "</span>) <span class="ruby-operator">+</span>
|
362
|
+
118: <span class="ruby-value str">" --file="</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">output_file_path</span> <span class="ruby-operator">+</span>
|
363
|
+
119: <span class="ruby-value str">" "</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">script_path</span>
|
364
|
+
120:
|
365
|
+
121: <span class="ruby-identifier">puts</span> <span class="ruby-value str">"ruby "</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">command_line</span>
|
366
|
+
122: <span class="ruby-comment cmt"># We have to catch the exeption to continue on. However,</span>
|
367
|
+
123: <span class="ruby-comment cmt"># the error message will have been output to STDERR</span>
|
368
|
+
124: <span class="ruby-comment cmt"># already by the time we get here so we don't have to</span>
|
369
|
+
125: <span class="ruby-comment cmt"># do that again</span>
|
370
|
+
126: <span class="ruby-keyword kw">begin</span>
|
371
|
+
127: <span class="ruby-identifier">ruby</span> <span class="ruby-identifier">command_line</span>
|
372
|
+
128: <span class="ruby-keyword kw">rescue</span>
|
373
|
+
129: <span class="ruby-keyword kw">end</span>
|
374
|
+
130: <span class="ruby-identifier">puts</span> <span class="ruby-value str">""</span>
|
375
|
+
131: <span class="ruby-identifier">puts</span> <span class="ruby-value str">""</span>
|
376
|
+
132: <span class="ruby-keyword kw">end</span>
|
377
|
+
133: <span class="ruby-keyword kw">end</span>
|
378
|
+
</pre>
|
379
|
+
</div>
|
380
|
+
</div>
|
381
|
+
</div>
|
382
|
+
|
383
|
+
|
384
|
+
</div>
|
385
|
+
|
386
|
+
|
387
|
+
</div>
|
388
|
+
|
389
|
+
|
390
|
+
<div id="validator-badges">
|
391
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
392
|
+
</div>
|
393
|
+
|
394
|
+
</body>
|
395
|
+
</html>
|
@@ -0,0 +1,234 @@
|
|
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::Result</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::Result</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="Result.html">RubyProf::Result</a> class is used to store the
|
84
|
+
results of a profiling run. And instace of the class is returned from the
|
85
|
+
methods <a href="../RubyProf.html#M000003">RubyProf#stop</a> and <a
|
86
|
+
href="../RubyProf.html#M000004">RubyProf#profile</a>.
|
87
|
+
</p>
|
88
|
+
<p>
|
89
|
+
<a href="Result.html">RubyProf::Result</a> has one field, called threads,
|
90
|
+
which is a hash table keyed on thread ID. For each thread id, the hash
|
91
|
+
table stores another hash table that contains profiling information for
|
92
|
+
each method called during the threads execution. That hash table is keyed
|
93
|
+
on method name and contains <a
|
94
|
+
href="MethodInfo.html">RubyProf::MethodInfo</a> objects.
|
95
|
+
</p>
|
96
|
+
|
97
|
+
</div>
|
98
|
+
|
99
|
+
|
100
|
+
</div>
|
101
|
+
|
102
|
+
<div id="method-list">
|
103
|
+
<h3 class="section-bar">Methods</h3>
|
104
|
+
|
105
|
+
<div class="name-list">
|
106
|
+
<a href="#M000035">threads</a>
|
107
|
+
<a href="#M000036">toplevel</a>
|
108
|
+
</div>
|
109
|
+
</div>
|
110
|
+
|
111
|
+
</div>
|
112
|
+
|
113
|
+
|
114
|
+
<!-- if includes -->
|
115
|
+
|
116
|
+
<div id="section">
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
<!-- if method_list -->
|
126
|
+
<div id="methods">
|
127
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
128
|
+
|
129
|
+
<div id="method-M000035" class="method-detail">
|
130
|
+
<a name="M000035"></a>
|
131
|
+
|
132
|
+
<div class="method-heading">
|
133
|
+
<a href="#M000035" class="method-signature">
|
134
|
+
<span class="method-name"><br />
|
135
|
+
threads → Hash<br />
|
136
|
+
</span>
|
137
|
+
</a>
|
138
|
+
</div>
|
139
|
+
|
140
|
+
<div class="method-description">
|
141
|
+
<p>
|
142
|
+
Returns a hash table keyed on thread ID. For each thread id, the hash table
|
143
|
+
stores another hash table that contains profiling information for each
|
144
|
+
method called during the threads execution. That hash table is keyed on
|
145
|
+
method name and contains <a href="MethodInfo.html">RubyProf::MethodInfo</a>
|
146
|
+
objects.
|
147
|
+
</p>
|
148
|
+
<p><a class="source-toggle" href="#"
|
149
|
+
onclick="toggleCode('M000035-source');return false;">[Source]</a></p>
|
150
|
+
<div class="method-source-code" id="M000035-source">
|
151
|
+
<pre>
|
152
|
+
/* call-seq:
|
153
|
+
threads -> Hash
|
154
|
+
|
155
|
+
Returns a hash table keyed on thread ID. For each thread id,
|
156
|
+
the hash table stores another hash table that contains profiling
|
157
|
+
information for each method called during the threads execution.
|
158
|
+
That hash table is keyed on method name and contains
|
159
|
+
RubyProf::MethodInfo objects. */
|
160
|
+
static VALUE
|
161
|
+
prof_result_threads(VALUE self)
|
162
|
+
{
|
163
|
+
prof_result_t *prof_result = get_prof_result(self);
|
164
|
+
return prof_result->threads;
|
165
|
+
}
|
166
|
+
</pre>
|
167
|
+
</div>
|
168
|
+
</div>
|
169
|
+
</div>
|
170
|
+
|
171
|
+
<div id="method-M000036" class="method-detail">
|
172
|
+
<a name="M000036"></a>
|
173
|
+
|
174
|
+
<div class="method-heading">
|
175
|
+
<a href="#M000036" class="method-signature">
|
176
|
+
<span class="method-name"><br />
|
177
|
+
thread_id = int<br />
|
178
|
+
toplevel(thread_id) → RubyProf::MethodInfo<br />
|
179
|
+
</span>
|
180
|
+
</a>
|
181
|
+
</div>
|
182
|
+
|
183
|
+
<div class="method-description">
|
184
|
+
<p>
|
185
|
+
Returns the <a href="MethodInfo.html">RubyProf::MethodInfo</a> object that
|
186
|
+
represents the root calling method for this thread. This method will always
|
187
|
+
be named <a href="Result.html#M000036">toplevel</a> and contains the total
|
188
|
+
amount of time spent executing code in this thread.
|
189
|
+
</p>
|
190
|
+
<p><a class="source-toggle" href="#"
|
191
|
+
onclick="toggleCode('M000036-source');return false;">[Source]</a></p>
|
192
|
+
<div class="method-source-code" id="M000036-source">
|
193
|
+
<pre>
|
194
|
+
/* call-seq:
|
195
|
+
thread_id = int
|
196
|
+
toplevel(thread_id) -> RubyProf::MethodInfo
|
197
|
+
|
198
|
+
Returns the RubyProf::MethodInfo object that represents the root
|
199
|
+
calling method for this thread. This method will always
|
200
|
+
be named #toplevel and contains the total amount of time spent
|
201
|
+
executing code in this thread. */
|
202
|
+
static VALUE
|
203
|
+
prof_result_toplevel(VALUE self, VALUE thread_id)
|
204
|
+
{
|
205
|
+
prof_result_t *prof_result = get_prof_result(self);
|
206
|
+
VALUE methods = rb_hash_aref(prof_result->threads, thread_id);
|
207
|
+
VALUE key = method_name(Qnil, toplevel_id);
|
208
|
+
VALUE result = rb_hash_aref(methods, key);
|
209
|
+
|
210
|
+
if (result == Qnil)
|
211
|
+
{
|
212
|
+
/* Should never happen */
|
213
|
+
rb_raise(rb_eRuntimeError, "Could not find toplevel method information");
|
214
|
+
}
|
215
|
+
return result;
|
216
|
+
}
|
217
|
+
</pre>
|
218
|
+
</div>
|
219
|
+
</div>
|
220
|
+
</div>
|
221
|
+
|
222
|
+
|
223
|
+
</div>
|
224
|
+
|
225
|
+
|
226
|
+
</div>
|
227
|
+
|
228
|
+
|
229
|
+
<div id="validator-badges">
|
230
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
231
|
+
</div>
|
232
|
+
|
233
|
+
</body>
|
234
|
+
</html>
|