rubyrun 0.9.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.
- data/LICENSE +13 -0
- data/README +77 -0
- data/Rakefile +241 -0
- data/bin/confgure +2 -0
- data/docs/rubyrun-0.9.0.htm +6344 -0
- data/docs/rubyrun-0.9.0.pdf +0 -0
- data/docs/rubyrun-0.9.0_files/colorschememapping.xml +2 -0
- data/docs/rubyrun-0.9.0_files/filelist.xml +29 -0
- data/docs/rubyrun-0.9.0_files/header.htm +141 -0
- data/docs/rubyrun-0.9.0_files/image001.jpg +0 -0
- data/docs/rubyrun-0.9.0_files/image002.jpg +0 -0
- data/docs/rubyrun-0.9.0_files/image003.jpg +0 -0
- data/docs/rubyrun-0.9.0_files/image004.jpg +0 -0
- data/docs/rubyrun-0.9.0_files/image005.jpg +0 -0
- data/docs/rubyrun-0.9.0_files/image006.jpg +0 -0
- data/docs/rubyrun-0.9.0_files/image007.jpg +0 -0
- data/docs/rubyrun-0.9.0_files/image008.jpg +0 -0
- data/docs/rubyrun-0.9.0_files/image009.jpg +0 -0
- data/docs/rubyrun-0.9.0_files/image010.jpg +0 -0
- data/docs/rubyrun-0.9.0_files/image011.jpg +0 -0
- data/docs/rubyrun-0.9.0_files/image012.jpg +0 -0
- data/docs/rubyrun-0.9.0_files/image013.jpg +0 -0
- data/docs/rubyrun-0.9.0_files/image014.jpg +0 -0
- data/docs/rubyrun-0.9.0_files/image015.jpg +0 -0
- data/docs/rubyrun-0.9.0_files/image016.jpg +0 -0
- data/docs/rubyrun-0.9.0_files/image017.png +0 -0
- data/docs/rubyrun-0.9.0_files/image018.jpg +0 -0
- data/docs/rubyrun-0.9.0_files/image019.jpg +0 -0
- data/docs/rubyrun-0.9.0_files/image020.jpg +0 -0
- data/docs/rubyrun-0.9.0_files/image021.jpg +0 -0
- data/docs/rubyrun-0.9.0_files/image022.png +0 -0
- data/docs/rubyrun-0.9.0_files/themedata.thmx +0 -0
- data/etc/rubyrun_opts.yml +132 -0
- data/ext/extconf.rb +4 -0
- data/ext/rubyrunnative__.bundle +0 -0
- data/ext/rubyrunnative__.c +154 -0
- data/ext/rubyrunnative__.def +2 -0
- data/ext/rubyrunnative__.h +36 -0
- data/ext/rubyrunnative__.so +0 -0
- data/ext/rubyrunnative__linux.so +0 -0
- data/html/classes/Module.html +174 -0
- data/html/classes/Object.html +151 -0
- data/html/classes/RubyRunBufferMgr__.html +182 -0
- data/html/classes/RubyRunCommander__.html +578 -0
- data/html/classes/RubyRunDad__.html +144 -0
- data/html/classes/RubyRunGlobals.html +248 -0
- data/html/classes/RubyRunHTMLWriter/RubyRunHTMLDevice.html +157 -0
- data/html/classes/RubyRunHTMLWriter.html +186 -0
- data/html/classes/RubyRunHTML__.html +198 -0
- data/html/classes/RubyRunInitializer__.html +821 -0
- data/html/classes/RubyRunInstrumentor__.html +576 -0
- data/html/classes/RubyRunMonitor__.html +298 -0
- data/html/classes/RubyRunRSS.html +302 -0
- data/html/classes/RubyRunReport__.html +294 -0
- data/html/classes/RubyRunTracer__.html +253 -0
- data/html/classes/RubyRunUtils__.html +376 -0
- data/html/created.rid +1 -0
- data/html/files/LICENSE.html +119 -0
- data/html/files/README.html +197 -0
- data/html/files/lib/rubyrun/rubyrun_buffer_mgr___rb.html +101 -0
- data/html/files/lib/rubyrun/rubyrun_commander___rb.html +101 -0
- data/html/files/lib/rubyrun/rubyrun_dad___rb.html +101 -0
- data/html/files/lib/rubyrun/rubyrun_globals_rb.html +101 -0
- data/html/files/lib/rubyrun/rubyrun_html___rb.html +101 -0
- data/html/files/lib/rubyrun/rubyrun_html_writer___rb.html +108 -0
- data/html/files/lib/rubyrun/rubyrun_initializer___rb.html +112 -0
- data/html/files/lib/rubyrun/rubyrun_instrumentor___rb.html +116 -0
- data/html/files/lib/rubyrun/rubyrun_monitor___rb.html +116 -0
- data/html/files/lib/rubyrun/rubyrun_rb.html +121 -0
- data/html/files/lib/rubyrun/rubyrun_report___rb.html +101 -0
- data/html/files/lib/rubyrun/rubyrun_rss___rb.html +108 -0
- data/html/files/lib/rubyrun/rubyrun_tracer___rb.html +110 -0
- data/html/files/lib/rubyrun/rubyrun_utils___rb.html +108 -0
- data/html/files/lib/rubyrunm_rb.html +116 -0
- data/html/fr_class_index.html +42 -0
- data/html/fr_file_index.html +43 -0
- data/html/fr_method_index.html +96 -0
- data/html/index.html +24 -0
- data/html/rdoc-style.css +208 -0
- data/lib/rubyrun/rubyrun.rb +78 -0
- data/lib/rubyrun/rubyrun_buffer_mgr__.rb +49 -0
- data/lib/rubyrun/rubyrun_commander__.rb +196 -0
- data/lib/rubyrun/rubyrun_dad__.rb +35 -0
- data/lib/rubyrun/rubyrun_globals.rb +51 -0
- data/lib/rubyrun/rubyrun_html__.rb +136 -0
- data/lib/rubyrun/rubyrun_html_writer__.rb +64 -0
- data/lib/rubyrun/rubyrun_initializer__.rb +286 -0
- data/lib/rubyrun/rubyrun_instrumentor__.rb +226 -0
- data/lib/rubyrun/rubyrun_monitor__.rb +237 -0
- data/lib/rubyrun/rubyrun_report__.rb +109 -0
- data/lib/rubyrun/rubyrun_rss__.rb +97 -0
- data/lib/rubyrun/rubyrun_tracer__.rb +79 -0
- data/lib/rubyrun/rubyrun_utils__.rb +98 -0
- data/lib/rubyrun/rubyrunnative__.so +0 -0
- data/lib/rubyrunm.rb +10 -0
- metadata +149 -0
@@ -0,0 +1,578 @@
|
|
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>Module: RubyRunCommander__</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>Module</strong></td>
|
53
|
+
<td class="class-name-in-header">RubyRunCommander__</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../files/lib/rubyrun/rubyrun_commander___rb.html">
|
59
|
+
lib/rubyrun/rubyrun_commander__.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
</table>
|
66
|
+
</div>
|
67
|
+
<!-- banner header -->
|
68
|
+
|
69
|
+
<div id="bodyContent">
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
<div id="contextContent">
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
</div>
|
78
|
+
|
79
|
+
<div id="method-list">
|
80
|
+
<h3 class="section-bar">Methods</h3>
|
81
|
+
|
82
|
+
<div class="name-list">
|
83
|
+
<a href="#M000013">dump_object_map</a>
|
84
|
+
<a href="#M000011">dump_reports</a>
|
85
|
+
<a href="#M000010">dump_thread_status</a>
|
86
|
+
<a href="#M000021">exit_monitor?</a>
|
87
|
+
<a href="#M000019">hard_kill?</a>
|
88
|
+
<a href="#M000012">kill_threads</a>
|
89
|
+
<a href="#M000020">object_map?</a>
|
90
|
+
<a href="#M000016">remove_cmd_folder</a>
|
91
|
+
<a href="#M000015">return_joined_thread</a>
|
92
|
+
<a href="#M000018">soft_kill?</a>
|
93
|
+
<a href="#M000017">thread_status?</a>
|
94
|
+
<a href="#M000022">unsupport_function</a>
|
95
|
+
<a href="#M000014">update_perf_metrics</a>
|
96
|
+
</div>
|
97
|
+
</div>
|
98
|
+
|
99
|
+
</div>
|
100
|
+
|
101
|
+
|
102
|
+
<!-- if includes -->
|
103
|
+
|
104
|
+
<div id="section">
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
<!-- if method_list -->
|
114
|
+
<div id="methods">
|
115
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
116
|
+
|
117
|
+
<div id="method-M000013" class="method-detail">
|
118
|
+
<a name="M000013"></a>
|
119
|
+
|
120
|
+
<div class="method-heading">
|
121
|
+
<a href="#M000013" class="method-signature">
|
122
|
+
<span class="method-name">dump_object_map</span><span class="method-args">()</span>
|
123
|
+
</a>
|
124
|
+
</div>
|
125
|
+
|
126
|
+
<div class="method-description">
|
127
|
+
<p>
|
128
|
+
Show the top 20 Ruby classes which have the largest no. of instances in
|
129
|
+
memory The snapshot is taken after a gc call is made
|
130
|
+
</p>
|
131
|
+
<p><a class="source-toggle" href="#"
|
132
|
+
onclick="toggleCode('M000013-source');return false;">[Source]</a></p>
|
133
|
+
<div class="method-source-code" id="M000013-source">
|
134
|
+
<pre>
|
135
|
+
<span class="ruby-comment cmt"># File lib/rubyrun/rubyrun_commander__.rb, line 103</span>
|
136
|
+
103: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">dump_object_map</span>
|
137
|
+
104: <span class="ruby-identifier">start_time</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>
|
138
|
+
105: <span class="ruby-identifier">$rubyrun_obj_map_reporter</span> = <span class="ruby-constant">RubyRunHTMLWriter</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@rubyrun_report_folder</span> <span class="ruby-operator">+</span> <span class="ruby-value str">'/'</span> <span class="ruby-operator">+</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">basename</span>(<span class="ruby-identifier">$0</span>, <span class="ruby-value str">".*"</span>) <span class="ruby-operator">+</span> <span class="ruby-value str">'_'</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">$$</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-value str">'_object_map.html'</span>, <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">shift_age</span> = <span class="ruby-value">10</span>, <span class="ruby-identifier">shift_size</span> = <span class="ruby-value">4096000</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">$rubyrun_obj_map_reporter</span>
|
139
|
+
106: <span class="ruby-identifier">object_map</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
|
140
|
+
107: <span class="ruby-identifier">ttl_object</span> = <span class="ruby-value">0</span>
|
141
|
+
108: <span class="ruby-constant">ObjectSpace</span>.<span class="ruby-identifier">garbage_collect</span>
|
142
|
+
109: <span class="ruby-constant">ObjectSpace</span>.<span class="ruby-identifier">each_object</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">obj</span><span class="ruby-operator">|</span>
|
143
|
+
110: <span class="ruby-identifier">ttl_object</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
|
144
|
+
111: <span class="ruby-identifier">object_map</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">obj</span>.<span class="ruby-identifier">class</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">object_map</span>[<span class="ruby-identifier">obj</span>.<span class="ruby-identifier">class</span>] <span class="ruby-operator">+=</span> <span class="ruby-value">1</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">object_map</span>[<span class="ruby-identifier">obj</span>.<span class="ruby-identifier">class</span>] = <span class="ruby-value">1</span>
|
145
|
+
112: }
|
146
|
+
113: <span class="ruby-identifier">results</span> = <span class="ruby-identifier">object_map</span>.<span class="ruby-identifier">sort</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">a</span>,<span class="ruby-identifier">b</span><span class="ruby-operator">|</span> <span class="ruby-identifier">a</span>[<span class="ruby-value">1</span>]<span class="ruby-operator"><=></span><span class="ruby-identifier">b</span>[<span class="ruby-value">1</span>]}.<span class="ruby-identifier">reverse!</span>
|
147
|
+
114: <span class="ruby-identifier">table_content</span> = <span class="ruby-value str">''</span>
|
148
|
+
115: <span class="ruby-identifier">odd_row</span> <span class="ruby-operator">||=</span><span class="ruby-keyword kw">true</span>
|
149
|
+
116: <span class="ruby-value">20</span>.<span class="ruby-identifier">times</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
|
150
|
+
117: <span class="ruby-identifier">table_content</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">sprintf</span>(<span class="ruby-node">"#{odd_row ? OBJ_MAP_ODD_ROW : OBJ_MAP_EVEN_ROW}"</span>,
|
151
|
+
118: <span class="ruby-identifier">results</span>[<span class="ruby-identifier">i</span>][<span class="ruby-value">0</span>], <span class="ruby-identifier">results</span>[<span class="ruby-identifier">i</span>][<span class="ruby-value">1</span>].<span class="ruby-identifier">to_s</span>)
|
152
|
+
119: <span class="ruby-identifier">odd_row</span> = <span class="ruby-operator">!</span><span class="ruby-identifier">odd_row</span>
|
153
|
+
120: }
|
154
|
+
121: <span class="ruby-identifier">html_content</span> = <span class="ruby-constant">OBJ_MAP_HTML</span>.<span class="ruby-identifier">sub</span>(<span class="ruby-regexp re">/%START_TIMESTAMP%/</span>,<span class="ruby-identifier">start_time</span>.<span class="ruby-identifier">strftime</span>(<span class="ruby-value str">"%H:%M:%S %m/%d/%Y"</span>))
|
155
|
+
122: <span class="ruby-identifier">html_content</span>.<span class="ruby-identifier">sub!</span>(<span class="ruby-regexp re">/%OBJ_MAP_ROW%/</span>,<span class="ruby-identifier">table_content</span>)
|
156
|
+
123: <span class="ruby-identifier">$rubyrun_obj_map_reporter</span>.<span class="ruby-identifier">info</span>(<span class="ruby-identifier">html_content</span>)
|
157
|
+
124: <span class="ruby-keyword kw">end</span>
|
158
|
+
</pre>
|
159
|
+
</div>
|
160
|
+
</div>
|
161
|
+
</div>
|
162
|
+
|
163
|
+
<div id="method-M000011" class="method-detail">
|
164
|
+
<a name="M000011"></a>
|
165
|
+
|
166
|
+
<div class="method-heading">
|
167
|
+
<a href="#M000011" class="method-signature">
|
168
|
+
<span class="method-name">dump_reports</span><span class="method-args">(dump_all_reports = false)</span>
|
169
|
+
</a>
|
170
|
+
</div>
|
171
|
+
|
172
|
+
<div class="method-description">
|
173
|
+
<p>
|
174
|
+
Dump Controller/Actions response time metrics metrics structure metrics[0]
|
175
|
+
Thread ID metrics[1] Timestamp of the request metrics[2] URL metrics[3]
|
176
|
+
Controller name metrics[4] Action name metrics[5] Response time metrics[6]
|
177
|
+
Action time metrics[7] Database IO time metrics[8] View time metrics[9]
|
178
|
+
Uncaptured time metrics[10] Dispatch wait time
|
179
|
+
</p>
|
180
|
+
<p><a class="source-toggle" href="#"
|
181
|
+
onclick="toggleCode('M000011-source');return false;">[Source]</a></p>
|
182
|
+
<div class="method-source-code" id="M000011-source">
|
183
|
+
<pre>
|
184
|
+
<span class="ruby-comment cmt"># File lib/rubyrun/rubyrun_commander__.rb, line 46</span>
|
185
|
+
46: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">dump_reports</span>(<span class="ruby-identifier">dump_all_reports</span> = <span class="ruby-keyword kw">false</span>)
|
186
|
+
47: <span class="ruby-identifier">buffer</span> = <span class="ruby-identifier">return_and_switch_buffer</span>
|
187
|
+
48: <span class="ruby-identifier">buffer</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">metrics</span><span class="ruby-operator">|</span>
|
188
|
+
49: <span class="ruby-comment cmt"># Last element is 1, representing a request count of 1, used for calculating average response time for this controller/action</span>
|
189
|
+
50: <span class="ruby-identifier">update_perf_metrics</span>(<span class="ruby-identifier">metrics</span>[<span class="ruby-value">3</span>], {<span class="ruby-identifier">metrics</span>[<span class="ruby-value">4</span>] =<span class="ruby-operator">></span> [<span class="ruby-identifier">metrics</span>[<span class="ruby-value">5</span>],<span class="ruby-identifier">metrics</span>[<span class="ruby-value">6</span>],<span class="ruby-identifier">metrics</span>[<span class="ruby-value">7</span>],<span class="ruby-identifier">metrics</span>[<span class="ruby-value">8</span>],<span class="ruby-identifier">metrics</span>[<span class="ruby-value">9</span>],<span class="ruby-identifier">metrics</span>[<span class="ruby-value">10</span>],<span class="ruby-value">1</span>]})
|
190
|
+
51: }
|
191
|
+
52: <span class="ruby-ivar">@rubyrun_req_count</span> <span class="ruby-operator">||=</span> <span class="ruby-value">0</span>
|
192
|
+
53: <span class="ruby-ivar">@rubyrun_req_count</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">buffer</span>.<span class="ruby-identifier">length</span>
|
193
|
+
54: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">$rubyrun_config</span>[<span class="ruby-value str">'OUTPUT'</span>].<span class="ruby-identifier">include?</span>(<span class="ruby-constant">RUBYRUN_OUTPUT_PERF_SUMMARY</span>) <span class="ruby-operator">&&</span> <span class="ruby-identifier">dump_all_reports</span>
|
194
|
+
55: <span class="ruby-identifier">create_rss_channels</span> <span class="ruby-keyword kw">if</span> (<span class="ruby-operator">!</span><span class="ruby-identifier">$rubyrun_perf_summary_rss</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">$rubyrun_rails_env</span>)
|
195
|
+
56: <span class="ruby-identifier">add_perf_summary_rss_item</span>(<span class="ruby-ivar">@rubyrun_req_count</span>)
|
196
|
+
57: <span class="ruby-ivar">@rubyrun_req_count</span> = <span class="ruby-value">0</span>
|
197
|
+
58: <span class="ruby-keyword kw">end</span>
|
198
|
+
59: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">$rubyrun_config</span>[<span class="ruby-value str">'OUTPUT'</span>].<span class="ruby-identifier">include?</span>(<span class="ruby-constant">RUBYRUN_OUTPUT_TXN_LOG</span>)
|
199
|
+
60: <span class="ruby-identifier">create_csv_files</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">$rubyrun_txn_log_reporter</span>
|
200
|
+
61: <span class="ruby-identifier">add_txn_log_csv_item</span>(<span class="ruby-identifier">buffer</span>)
|
201
|
+
62: <span class="ruby-keyword kw">end</span>
|
202
|
+
63: <span class="ruby-identifier">buffer</span>.<span class="ruby-identifier">clear</span> <span class="ruby-comment cmt"># Clear the buffer so that the main thread will push the data into a blank bucket</span>
|
203
|
+
64: <span class="ruby-keyword kw">end</span>
|
204
|
+
</pre>
|
205
|
+
</div>
|
206
|
+
</div>
|
207
|
+
</div>
|
208
|
+
|
209
|
+
<div id="method-M000010" class="method-detail">
|
210
|
+
<a name="M000010"></a>
|
211
|
+
|
212
|
+
<div class="method-heading">
|
213
|
+
<a href="#M000010" class="method-signature">
|
214
|
+
<span class="method-name">dump_thread_status</span><span class="method-args">()</span>
|
215
|
+
</a>
|
216
|
+
</div>
|
217
|
+
|
218
|
+
<div class="method-description">
|
219
|
+
<p>
|
220
|
+
Use Thread.list to list show thread status, and native code to display the
|
221
|
+
last line # and function of the threads
|
222
|
+
</p>
|
223
|
+
<p><a class="source-toggle" href="#"
|
224
|
+
onclick="toggleCode('M000010-source');return false;">[Source]</a></p>
|
225
|
+
<div class="method-source-code" id="M000010-source">
|
226
|
+
<pre>
|
227
|
+
<span class="ruby-comment cmt"># File lib/rubyrun/rubyrun_commander__.rb, line 20</span>
|
228
|
+
20: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">dump_thread_status</span>
|
229
|
+
21: (<span class="ruby-identifier">unsupport_function</span>; <span class="ruby-keyword kw">return</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">$rubyrun_native</span>
|
230
|
+
22: <span class="ruby-identifier">$rubyrun_thread_status_reporter</span> = <span class="ruby-constant">RubyRunHTMLWriter</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@rubyrun_report_folder</span> <span class="ruby-operator">+</span> <span class="ruby-value str">'/'</span> <span class="ruby-operator">+</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">basename</span>(<span class="ruby-identifier">$0</span>, <span class="ruby-value str">".*"</span>) <span class="ruby-operator">+</span> <span class="ruby-value str">'_'</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">$$</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-value str">'_thread_status.html'</span>, <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">shift_age</span> = <span class="ruby-value">10</span>, <span class="ruby-identifier">shift_size</span> = <span class="ruby-value">4096000</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">$rubyrun_thread_status_reporter</span>
|
231
|
+
23: <span class="ruby-identifier">start_time</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>
|
232
|
+
24: <span class="ruby-identifier">th_data_hash</span> = <span class="ruby-constant">RubyRunNative__</span>.<span class="ruby-identifier">get_all_top_stacks</span>
|
233
|
+
25: <span class="ruby-identifier">odd_row</span> <span class="ruby-operator">||=</span> <span class="ruby-keyword kw">true</span>
|
234
|
+
26: <span class="ruby-identifier">table_content</span> = <span class="ruby-value str">''</span>
|
235
|
+
27: <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">list</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">th</span><span class="ruby-operator">|</span>
|
236
|
+
28: <span class="ruby-identifier">thread_id</span> = <span class="ruby-identifier">get_thread_id</span>(<span class="ruby-identifier">th</span>)
|
237
|
+
29: <span class="ruby-identifier">table_content</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">sprintf</span>(<span class="ruby-node">"#{odd_row ? THREAD_STATUS_ODD_ROW : THREAD_STATUS_EVEN_ROW}"</span>,
|
238
|
+
30: <span class="ruby-identifier">thread_id</span>, <span class="ruby-identifier">th</span>.<span class="ruby-identifier">status</span>, <span class="ruby-identifier">get_top_stack</span>(<span class="ruby-identifier">th_data_hash</span>, <span class="ruby-identifier">thread_id</span>))
|
239
|
+
31: <span class="ruby-identifier">odd_row</span> = <span class="ruby-operator">!</span><span class="ruby-identifier">odd_row</span>
|
240
|
+
32: }
|
241
|
+
33: <span class="ruby-identifier">html_content</span> = <span class="ruby-constant">THREAD_STATUS_HTML</span>.<span class="ruby-identifier">sub</span>(<span class="ruby-regexp re">/%START_TIMESTAMP%/</span>,<span class="ruby-identifier">start_time</span>.<span class="ruby-identifier">strftime</span>(<span class="ruby-value str">"%H:%M:%S %m/%d/%Y"</span>))
|
242
|
+
34: <span class="ruby-identifier">html_content</span>.<span class="ruby-identifier">sub!</span>(<span class="ruby-regexp re">/%THREAD_STATUS_ROW%/</span>,<span class="ruby-identifier">table_content</span>)
|
243
|
+
35: <span class="ruby-identifier">$rubyrun_thread_status_reporter</span>.<span class="ruby-identifier">info</span>(<span class="ruby-identifier">html_content</span>)
|
244
|
+
36: <span class="ruby-keyword kw">end</span>
|
245
|
+
</pre>
|
246
|
+
</div>
|
247
|
+
</div>
|
248
|
+
</div>
|
249
|
+
|
250
|
+
<div id="method-M000021" class="method-detail">
|
251
|
+
<a name="M000021"></a>
|
252
|
+
|
253
|
+
<div class="method-heading">
|
254
|
+
<a href="#M000021" class="method-signature">
|
255
|
+
<span class="method-name">exit_monitor?</span><span class="method-args">()</span>
|
256
|
+
</a>
|
257
|
+
</div>
|
258
|
+
|
259
|
+
<div class="method-description">
|
260
|
+
<p>
|
261
|
+
If exists, indicate to the monitor thread to exit
|
262
|
+
</p>
|
263
|
+
<p><a class="source-toggle" href="#"
|
264
|
+
onclick="toggleCode('M000021-source');return false;">[Source]</a></p>
|
265
|
+
<div class="method-source-code" id="M000021-source">
|
266
|
+
<pre>
|
267
|
+
<span class="ruby-comment cmt"># File lib/rubyrun/rubyrun_commander__.rb, line 187</span>
|
268
|
+
187: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">exit_monitor?</span>
|
269
|
+
188: <span class="ruby-constant">File</span>.<span class="ruby-identifier">exists?</span>(<span class="ruby-constant">ENV</span>[<span class="ruby-constant">RUBYRUN_WORKING_DIR</span>] <span class="ruby-operator">+</span> <span class="ruby-constant">RUBYRUN_CMD_EXIT</span>)
|
270
|
+
189: <span class="ruby-keyword kw">end</span>
|
271
|
+
</pre>
|
272
|
+
</div>
|
273
|
+
</div>
|
274
|
+
</div>
|
275
|
+
|
276
|
+
<div id="method-M000019" class="method-detail">
|
277
|
+
<a name="M000019"></a>
|
278
|
+
|
279
|
+
<div class="method-heading">
|
280
|
+
<a href="#M000019" class="method-signature">
|
281
|
+
<span class="method-name">hard_kill?</span><span class="method-args">()</span>
|
282
|
+
</a>
|
283
|
+
</div>
|
284
|
+
|
285
|
+
<div class="method-description">
|
286
|
+
<p>
|
287
|
+
If exists, indicate to the monitor thread that a hard kill (kill all
|
288
|
+
threads including the main thread) command is sent
|
289
|
+
</p>
|
290
|
+
<p><a class="source-toggle" href="#"
|
291
|
+
onclick="toggleCode('M000019-source');return false;">[Source]</a></p>
|
292
|
+
<div class="method-source-code" id="M000019-source">
|
293
|
+
<pre>
|
294
|
+
<span class="ruby-comment cmt"># File lib/rubyrun/rubyrun_commander__.rb, line 177</span>
|
295
|
+
177: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">hard_kill?</span>
|
296
|
+
178: <span class="ruby-constant">File</span>.<span class="ruby-identifier">exists?</span>(<span class="ruby-constant">ENV</span>[<span class="ruby-constant">RUBYRUN_WORKING_DIR</span>] <span class="ruby-operator">+</span> <span class="ruby-constant">RUBYRUN_CMD_HARD_KILL</span> <span class="ruby-operator">+</span> <span class="ruby-value str">'_'</span> <span class="ruby-operator">+</span> <span class="ruby-constant">Process</span>.<span class="ruby-identifier">pid</span>.<span class="ruby-identifier">to_s</span>)
|
297
|
+
179: <span class="ruby-keyword kw">end</span>
|
298
|
+
</pre>
|
299
|
+
</div>
|
300
|
+
</div>
|
301
|
+
</div>
|
302
|
+
|
303
|
+
<div id="method-M000012" class="method-detail">
|
304
|
+
<a name="M000012"></a>
|
305
|
+
|
306
|
+
<div class="method-heading">
|
307
|
+
<a href="#M000012" class="method-signature">
|
308
|
+
<span class="method-name">kill_threads</span><span class="method-args">(monitor_thr)</span>
|
309
|
+
</a>
|
310
|
+
</div>
|
311
|
+
|
312
|
+
<div class="method-description">
|
313
|
+
<p>
|
314
|
+
The way to do soft/hard kill is to performa a thr.raise on the thread from
|
315
|
+
the thread monitor. Using the begin/rescue created around the block in
|
316
|
+
Thread.new by <a
|
317
|
+
href="RubyRunInstrumentor__.html">RubyRunInstrumentor__</a>, the raise will
|
318
|
+
be rescued and $@ is then extracted to a global hash. Softkill only kills
|
319
|
+
non-main threads. Hardkill kills the main thread also but as the last step.
|
320
|
+
</p>
|
321
|
+
<p><a class="source-toggle" href="#"
|
322
|
+
onclick="toggleCode('M000012-source');return false;">[Source]</a></p>
|
323
|
+
<div class="method-source-code" id="M000012-source">
|
324
|
+
<pre>
|
325
|
+
<span class="ruby-comment cmt"># File lib/rubyrun/rubyrun_commander__.rb, line 72</span>
|
326
|
+
72: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">kill_threads</span>(<span class="ruby-identifier">monitor_thr</span>)
|
327
|
+
73: (<span class="ruby-identifier">unsupport_function</span>; <span class="ruby-keyword kw">return</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">$rubyrun_native</span>
|
328
|
+
74: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">$rubyrun_thread_dump_reporter</span>
|
329
|
+
75: <span class="ruby-identifier">$rubyrun_thread_dump_reporter</span> = <span class="ruby-constant">Logger</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@rubyrun_report_folder</span> <span class="ruby-operator">+</span> <span class="ruby-value str">'/'</span> <span class="ruby-operator">+</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">basename</span>(<span class="ruby-identifier">$0</span>, <span class="ruby-value str">".*"</span>) <span class="ruby-operator">+</span> <span class="ruby-value str">'_'</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">$$</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-value str">'_thread_dump.txt'</span>, <span class="ruby-identifier">shift_age</span> = <span class="ruby-value">10</span>, <span class="ruby-identifier">shift_size</span> = <span class="ruby-value">4096000</span>)
|
330
|
+
76: <span class="ruby-identifier">$rubyrun_thread_dump_reporter</span>.<span class="ruby-identifier">level</span> = <span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-constant">INFO</span>
|
331
|
+
77: <span class="ruby-keyword kw">class</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">$rubyrun_thread_dump_reporter</span>
|
332
|
+
78: <span class="ruby-identifier">include</span> <span class="ruby-constant">RubyRunUtils__</span>
|
333
|
+
79: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">format_message</span> (<span class="ruby-identifier">severity</span>, <span class="ruby-identifier">timestamp</span>, <span class="ruby-identifier">progname</span>, <span class="ruby-identifier">msg</span>)
|
334
|
+
80: <span class="ruby-node">"[#{timestamp.strftime("%Y-%m-%d %H:%M:%S")}.#{("%.3f" % timestamp.to_f).split('.')[1]}] #{get_thread_id} #{msg}\n"</span>
|
335
|
+
81: <span class="ruby-keyword kw">end</span>
|
336
|
+
82: <span class="ruby-keyword kw">end</span>
|
337
|
+
83: <span class="ruby-keyword kw">end</span>
|
338
|
+
84: <span class="ruby-identifier">th_data_hash</span> = <span class="ruby-constant">RubyRunNative__</span>.<span class="ruby-identifier">get_all_top_stacks</span>
|
339
|
+
85: <span class="ruby-identifier">j_th_id</span> = <span class="ruby-identifier">return_joined_thread</span>(<span class="ruby-identifier">th_data_hash</span>)
|
340
|
+
86: <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">list</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">th</span><span class="ruby-operator">|</span>
|
341
|
+
87: <span class="ruby-identifier">th_id</span> = <span class="ruby-identifier">get_thread_id</span>(<span class="ruby-identifier">th</span>)
|
342
|
+
88: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">th</span>.<span class="ruby-identifier">status</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'sleep'</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">th_id</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">get_thread_id</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">th_id</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">get_thread_id</span>(<span class="ruby-identifier">monitor_thr</span>) <span class="ruby-operator">&&</span>
|
343
|
+
89: <span class="ruby-identifier">th_id</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">get_thread_id</span>(<span class="ruby-constant">Thread</span>.<span class="ruby-identifier">main</span>) <span class="ruby-operator">&&</span> <span class="ruby-identifier">th_id</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">j_th_id</span>
|
344
|
+
90: <span class="ruby-identifier">$rubyrun_thread_dump_reporter</span>.<span class="ruby-identifier">info</span> <span class="ruby-node">"*** Raising exception #{RUBYRUN_KILL_3_STRING} to #{get_thread_id(th)} ***"</span>
|
345
|
+
91: <span class="ruby-identifier">th</span>.<span class="ruby-identifier">raise</span> <span class="ruby-constant">ThreadError</span>, <span class="ruby-constant">RUBYRUN_KILL_3_STRING</span>
|
346
|
+
92: <span class="ruby-keyword kw">end</span>
|
347
|
+
93: }
|
348
|
+
94: <span class="ruby-identifier">sleep</span> <span class="ruby-value">3</span>
|
349
|
+
95: <span class="ruby-identifier">back_trace_all</span>(<span class="ruby-identifier">th_data_hash</span>)
|
350
|
+
96: <span class="ruby-identifier">hard_kill</span> = <span class="ruby-identifier">hard_kill?</span>
|
351
|
+
97: <span class="ruby-identifier">remove_cmd_folder</span>
|
352
|
+
98: <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">main</span>.<span class="ruby-identifier">raise</span> <span class="ruby-constant">ThreadError</span>, <span class="ruby-constant">RUBYRUN_KILL_3_STRING</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">hard_kill</span>
|
353
|
+
99: <span class="ruby-keyword kw">end</span>
|
354
|
+
</pre>
|
355
|
+
</div>
|
356
|
+
</div>
|
357
|
+
</div>
|
358
|
+
|
359
|
+
<div id="method-M000020" class="method-detail">
|
360
|
+
<a name="M000020"></a>
|
361
|
+
|
362
|
+
<div class="method-heading">
|
363
|
+
<a href="#M000020" class="method-signature">
|
364
|
+
<span class="method-name">object_map?</span><span class="method-args">()</span>
|
365
|
+
</a>
|
366
|
+
</div>
|
367
|
+
|
368
|
+
<div class="method-description">
|
369
|
+
<p>
|
370
|
+
If exists, indicate to the montior thread that a object map is requested
|
371
|
+
</p>
|
372
|
+
<p><a class="source-toggle" href="#"
|
373
|
+
onclick="toggleCode('M000020-source');return false;">[Source]</a></p>
|
374
|
+
<div class="method-source-code" id="M000020-source">
|
375
|
+
<pre>
|
376
|
+
<span class="ruby-comment cmt"># File lib/rubyrun/rubyrun_commander__.rb, line 182</span>
|
377
|
+
182: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">object_map?</span>
|
378
|
+
183: <span class="ruby-constant">File</span>.<span class="ruby-identifier">exists?</span>(<span class="ruby-constant">ENV</span>[<span class="ruby-constant">RUBYRUN_WORKING_DIR</span>] <span class="ruby-operator">+</span> <span class="ruby-constant">RUBYRUN_CMD_OBJECT_MAP</span>)
|
379
|
+
184: <span class="ruby-keyword kw">end</span>
|
380
|
+
</pre>
|
381
|
+
</div>
|
382
|
+
</div>
|
383
|
+
</div>
|
384
|
+
|
385
|
+
<div id="method-M000016" class="method-detail">
|
386
|
+
<a name="M000016"></a>
|
387
|
+
|
388
|
+
<div class="method-heading">
|
389
|
+
<a href="#M000016" class="method-signature">
|
390
|
+
<span class="method-name">remove_cmd_folder</span><span class="method-args">()</span>
|
391
|
+
</a>
|
392
|
+
</div>
|
393
|
+
|
394
|
+
<div class="method-description">
|
395
|
+
<p>
|
396
|
+
Remove the cmd_kill-3 folder or file if any
|
397
|
+
</p>
|
398
|
+
<p><a class="source-toggle" href="#"
|
399
|
+
onclick="toggleCode('M000016-source');return false;">[Source]</a></p>
|
400
|
+
<div class="method-source-code" id="M000016-source">
|
401
|
+
<pre>
|
402
|
+
<span class="ruby-comment cmt"># File lib/rubyrun/rubyrun_commander__.rb, line 155</span>
|
403
|
+
155: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">remove_cmd_folder</span>
|
404
|
+
156: [<span class="ruby-constant">RUBYRUN_CMD_SOFT_KILL</span>, <span class="ruby-constant">RUBYRUN_CMD_HARD_KILL</span>].<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">cmd</span><span class="ruby-operator">|</span>
|
405
|
+
157: <span class="ruby-identifier">path</span> = <span class="ruby-constant">ENV</span>[<span class="ruby-constant">RUBYRUN_WORKING_DIR</span>] <span class="ruby-operator">+</span> <span class="ruby-identifier">cmd</span> <span class="ruby-operator">+</span> <span class="ruby-value str">'_'</span> <span class="ruby-operator">+</span> <span class="ruby-constant">Process</span>.<span class="ruby-identifier">pid</span>.<span class="ruby-identifier">to_s</span>
|
406
|
+
158: <span class="ruby-keyword kw">next</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-identifier">path</span>)
|
407
|
+
159: <span class="ruby-constant">File</span>.<span class="ruby-identifier">directory?</span>(<span class="ruby-identifier">path</span>) <span class="ruby-operator">?</span> <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">path</span>) <span class="ruby-operator">:</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">path</span>)
|
408
|
+
160: }
|
409
|
+
161: <span class="ruby-keyword kw">end</span>
|
410
|
+
</pre>
|
411
|
+
</div>
|
412
|
+
</div>
|
413
|
+
</div>
|
414
|
+
|
415
|
+
<div id="method-M000015" class="method-detail">
|
416
|
+
<a name="M000015"></a>
|
417
|
+
|
418
|
+
<div class="method-heading">
|
419
|
+
<a href="#M000015" class="method-signature">
|
420
|
+
<span class="method-name">return_joined_thread</span><span class="method-args">(th_data_hash)</span>
|
421
|
+
</a>
|
422
|
+
</div>
|
423
|
+
|
424
|
+
<div class="method-description">
|
425
|
+
<p>
|
426
|
+
If a thread is joined this method returns the joining thread ID
|
427
|
+
</p>
|
428
|
+
<p><a class="source-toggle" href="#"
|
429
|
+
onclick="toggleCode('M000015-source');return false;">[Source]</a></p>
|
430
|
+
<div class="method-source-code" id="M000015-source">
|
431
|
+
<pre>
|
432
|
+
<span class="ruby-comment cmt"># File lib/rubyrun/rubyrun_commander__.rb, line 145</span>
|
433
|
+
145: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">return_joined_thread</span>(<span class="ruby-identifier">th_data_hash</span>)
|
434
|
+
146: <span class="ruby-identifier">th_data_hash</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">th</span>, <span class="ruby-identifier">top_stack</span><span class="ruby-operator">|</span>
|
435
|
+
147: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">th</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">get_thread_id</span>(<span class="ruby-constant">Thread</span>.<span class="ruby-identifier">main</span>))
|
436
|
+
148: <span class="ruby-identifier">top_stack</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/\*\*(.+?)\*\*/</span>
|
437
|
+
149: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">$1</span>
|
438
|
+
150: <span class="ruby-keyword kw">end</span>
|
439
|
+
151: }
|
440
|
+
152: <span class="ruby-keyword kw">end</span>
|
441
|
+
</pre>
|
442
|
+
</div>
|
443
|
+
</div>
|
444
|
+
</div>
|
445
|
+
|
446
|
+
<div id="method-M000018" class="method-detail">
|
447
|
+
<a name="M000018"></a>
|
448
|
+
|
449
|
+
<div class="method-heading">
|
450
|
+
<a href="#M000018" class="method-signature">
|
451
|
+
<span class="method-name">soft_kill?</span><span class="method-args">()</span>
|
452
|
+
</a>
|
453
|
+
</div>
|
454
|
+
|
455
|
+
<div class="method-description">
|
456
|
+
<p>
|
457
|
+
If exists, indicate to the monitor thread that a soft kill (kill all
|
458
|
+
threads except the main thread) command is sent
|
459
|
+
</p>
|
460
|
+
<p><a class="source-toggle" href="#"
|
461
|
+
onclick="toggleCode('M000018-source');return false;">[Source]</a></p>
|
462
|
+
<div class="method-source-code" id="M000018-source">
|
463
|
+
<pre>
|
464
|
+
<span class="ruby-comment cmt"># File lib/rubyrun/rubyrun_commander__.rb, line 171</span>
|
465
|
+
171: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">soft_kill?</span>
|
466
|
+
172: <span class="ruby-constant">File</span>.<span class="ruby-identifier">exists?</span>(<span class="ruby-constant">ENV</span>[<span class="ruby-constant">RUBYRUN_WORKING_DIR</span>] <span class="ruby-operator">+</span> <span class="ruby-constant">RUBYRUN_CMD_SOFT_KILL</span> <span class="ruby-operator">+</span> <span class="ruby-value str">'_'</span> <span class="ruby-operator">+</span> <span class="ruby-constant">Process</span>.<span class="ruby-identifier">pid</span>.<span class="ruby-identifier">to_s</span>)
|
467
|
+
173: <span class="ruby-keyword kw">end</span>
|
468
|
+
</pre>
|
469
|
+
</div>
|
470
|
+
</div>
|
471
|
+
</div>
|
472
|
+
|
473
|
+
<div id="method-M000017" class="method-detail">
|
474
|
+
<a name="M000017"></a>
|
475
|
+
|
476
|
+
<div class="method-heading">
|
477
|
+
<a href="#M000017" class="method-signature">
|
478
|
+
<span class="method-name">thread_status?</span><span class="method-args">()</span>
|
479
|
+
</a>
|
480
|
+
</div>
|
481
|
+
|
482
|
+
<div class="method-description">
|
483
|
+
<p>
|
484
|
+
If exists, indicate to the monitor thread that a thread status report is
|
485
|
+
requested
|
486
|
+
</p>
|
487
|
+
<p><a class="source-toggle" href="#"
|
488
|
+
onclick="toggleCode('M000017-source');return false;">[Source]</a></p>
|
489
|
+
<div class="method-source-code" id="M000017-source">
|
490
|
+
<pre>
|
491
|
+
<span class="ruby-comment cmt"># File lib/rubyrun/rubyrun_commander__.rb, line 165</span>
|
492
|
+
165: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">thread_status?</span>
|
493
|
+
166: <span class="ruby-constant">File</span>.<span class="ruby-identifier">exists?</span>(<span class="ruby-constant">ENV</span>[<span class="ruby-constant">RUBYRUN_WORKING_DIR</span>] <span class="ruby-operator">+</span> <span class="ruby-constant">RUBYRUN_CMD_STATUS</span>)
|
494
|
+
167: <span class="ruby-keyword kw">end</span>
|
495
|
+
</pre>
|
496
|
+
</div>
|
497
|
+
</div>
|
498
|
+
</div>
|
499
|
+
|
500
|
+
<div id="method-M000022" class="method-detail">
|
501
|
+
<a name="M000022"></a>
|
502
|
+
|
503
|
+
<div class="method-heading">
|
504
|
+
<a href="#M000022" class="method-signature">
|
505
|
+
<span class="method-name">unsupport_function</span><span class="method-args">()</span>
|
506
|
+
</a>
|
507
|
+
</div>
|
508
|
+
|
509
|
+
<div class="method-description">
|
510
|
+
<p>
|
511
|
+
Log if native library can‘t be loaded or not found
|
512
|
+
</p>
|
513
|
+
<p><a class="source-toggle" href="#"
|
514
|
+
onclick="toggleCode('M000022-source');return false;">[Source]</a></p>
|
515
|
+
<div class="method-source-code" id="M000022-source">
|
516
|
+
<pre>
|
517
|
+
<span class="ruby-comment cmt"># File lib/rubyrun/rubyrun_commander__.rb, line 192</span>
|
518
|
+
192: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">unsupport_function</span>
|
519
|
+
193: <span class="ruby-identifier">$rubyrun_logger</span>.<span class="ruby-identifier">info</span> <span class="ruby-value str">"Native library not available. Function not supported."</span>
|
520
|
+
194: <span class="ruby-keyword kw">end</span>
|
521
|
+
</pre>
|
522
|
+
</div>
|
523
|
+
</div>
|
524
|
+
</div>
|
525
|
+
|
526
|
+
<div id="method-M000014" class="method-detail">
|
527
|
+
<a name="M000014"></a>
|
528
|
+
|
529
|
+
<div class="method-heading">
|
530
|
+
<a href="#M000014" class="method-signature">
|
531
|
+
<span class="method-name">update_perf_metrics</span><span class="method-args">(controller, action_metrics_hash)</span>
|
532
|
+
</a>
|
533
|
+
</div>
|
534
|
+
|
535
|
+
<div class="method-description">
|
536
|
+
<p>
|
537
|
+
metrics hash is a global collection point for all metrics (averaged) for
|
538
|
+
all actions by controller Use serialization before updating this global
|
539
|
+
hash Structure of $rubyrun_metrics_hash: controller_name => {action_name
|
540
|
+
=> [response_time, action_time,
|
541
|
+
</p>
|
542
|
+
<pre>
|
543
|
+
db_io_time, view_time,
|
544
|
+
uncaptured_time, dispatch_wait_time,
|
545
|
+
request_count]}
|
546
|
+
</pre>
|
547
|
+
<p><a class="source-toggle" href="#"
|
548
|
+
onclick="toggleCode('M000014-source');return false;">[Source]</a></p>
|
549
|
+
<div class="method-source-code" id="M000014-source">
|
550
|
+
<pre>
|
551
|
+
<span class="ruby-comment cmt"># File lib/rubyrun/rubyrun_commander__.rb, line 134</span>
|
552
|
+
134: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">update_perf_metrics</span>(<span class="ruby-identifier">controller</span>, <span class="ruby-identifier">action_metrics_hash</span>)
|
553
|
+
135: <span class="ruby-identifier">$rubyrun_metrics_hash</span>[<span class="ruby-identifier">controller</span>].<span class="ruby-identifier">merge!</span>(<span class="ruby-identifier">action_metrics_hash</span>) {<span class="ruby-operator">|</span><span class="ruby-identifier">action</span>, <span class="ruby-identifier">o_metrics</span>, <span class="ruby-identifier">new_metrics</span><span class="ruby-operator">|</span>
|
554
|
+
136: <span class="ruby-identifier">o_metrics</span>.<span class="ruby-identifier">each_index</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span>
|
555
|
+
137: (<span class="ruby-identifier">o_metrics</span>[<span class="ruby-identifier">x</span>] <span class="ruby-operator">+=</span> <span class="ruby-identifier">new_metrics</span>[<span class="ruby-identifier">x</span>]; <span class="ruby-keyword kw">break</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">x</span> <span class="ruby-operator">==</span> (<span class="ruby-identifier">o_metrics</span>.<span class="ruby-identifier">length</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>) <span class="ruby-comment cmt"># Calculate the total request count for this controller/action</span>
|
556
|
+
138: <span class="ruby-identifier">o_metrics</span>[<span class="ruby-identifier">x</span>] = (<span class="ruby-identifier">o_metrics</span>[<span class="ruby-identifier">x</span>] <span class="ruby-operator">*</span> <span class="ruby-identifier">o_metrics</span>.<span class="ruby-identifier">last</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">new_metrics</span>[<span class="ruby-identifier">x</span>])<span class="ruby-operator">/</span>(<span class="ruby-identifier">o_metrics</span>.<span class="ruby-identifier">last</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">new_metrics</span>.<span class="ruby-identifier">last</span>).<span class="ruby-identifier">to_f</span>
|
557
|
+
139: }
|
558
|
+
140: <span class="ruby-identifier">o_metrics</span>
|
559
|
+
141: }
|
560
|
+
142: <span class="ruby-keyword kw">end</span>
|
561
|
+
</pre>
|
562
|
+
</div>
|
563
|
+
</div>
|
564
|
+
</div>
|
565
|
+
|
566
|
+
|
567
|
+
</div>
|
568
|
+
|
569
|
+
|
570
|
+
</div>
|
571
|
+
|
572
|
+
|
573
|
+
<div id="validator-badges">
|
574
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
575
|
+
</div>
|
576
|
+
|
577
|
+
</body>
|
578
|
+
</html>
|