This repository has been archived by the owner on Apr 23, 2024. It is now read-only.
/
template.tmpl
378 lines (334 loc) · 15.6 KB
/
template.tmpl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
<script id="profilerCornerTemplate" type="text/x-jquery-tmpl">
<div class="g-m-p-corner"></div>
</script>
<script id="profilerCornerEntryTemplate" type="text/x-jquery-tmpl">
<div class="entry">
<div class="entry-icons">
{{if temporary_redirect}}↯{{/if}}
{{if appstats_results.likely_dupes}}
<span class="likely-duplicates" title="Duplicate RPCs">D</span>
{{/if}}
</div>
<div class="total-time">
${profiler_results.total_time} <span class="ms">ms</span>
</div>
</div>
</script>
<script id="profilerRequestLogTemplate" type="text/x-jquery-tmpl">
<span class="request-log">
<span title="This request spent ${pending_ms} ms in the pending queue, waiting to be served.">
${pending_ms} <span class="ms">ms</span> <strong>pending</strong>
</span> —
{{if loading_request}}
<span title="This was a loading request, which means it was served by a new instance.">
<strong>Loading request</strong>
</span> —
{{/if}}
<a href="/gae_mini_profiler/shared?request_id=${encodeURIComponent(request_id)}">Share request profile</a>
</span>
</script>
<script id="profilerTemplate" type="text/x-jquery-tmpl">
<div class="g-m-p" style="display:none;">
<div class="title">
<div class="header">
${profiler_results.total_time} <span class="ms">ms</span>: <span class="url" title="${url}">${url}</span>
</div>
</div>
<div class="settings" style="display:none;">
<table>
<tr>
<th>CPU profiling</th>
<th>RPC profiling</th>
</tr>
<tr>
<td>
<input type="radio" id="cpu_instrumented" name="cpu" value="instrumented"/><label for="cpu_instrumented"> instrumented</label><br>
<input type="radio" id="cpu_sampling" name="cpu" value="sampling"/><label for="cpu_sampling"> sampling</label><br>
<input type="radio" id="cpu_linebyline" name="cpu" value="linebyline"/><label for="cpu_linebyline"> line-by-line</label><br>
<input type="radio" id="cpu_disabled" name="cpu" value=""/><label for="cpu_disabled"> disabled</label>
</td>
<td>
<input type="radio" id="rpc_enabled" name="rpc" value="rpc"/><label for="rpc_enabled"> enabled</label><br>
<input type="radio" id="rpc_disabled" name="rpc" value=""/><label for="rpc_disabled"> disabled</label>
</td>
</tr>
<tr class="tips">
<td>CPU profiling either keeps track of all function calls and their timings (instrumented), periodically examines the call stack to figure out in which functions time is being spent during a request (sampling), or tracks only specific functions (line-by-line).</td>
<td>RPC profiling monitors all remote procedure calls (think datastore queries, memcache accesses, and URL fetches) and their timings.</td>
</tr>
</table>
</div>
{{if mode == "simple"}}
<div class="simple-timing">Detailed timing information is disabled. <a class="settings-link uses_script" href="#">Settings</a></div>
{{else}}
<div class="date_and_share">
{{if temporary_redirect}}
<span class="redirect" title="Temporary redirect">↯ (302 redirect)</span>
{{/if}}
<a href="/gae_mini_profiler/shared?request_id=${encodeURIComponent(request_id)}" class="uses_script request-log-link">More request info</a>
<span class="request-log request-log-${logging_request_id}" style="display:none;"><em>loading more request info...</em></span>
— <a class="settings-link uses_script" href="#">Settings</a>
</div>
{{if !GaeMiniProfiler.isCpuEnabled(mode)}}
<div class="expand">
<em>CPU profiling is disabled.</em>
</div>
{{else}}
<div class="expand">
<a href="#profile-link" class="profile-link link uses_script">Profile</a>
<div class="summary">
{{if GaeMiniProfiler.isInstrumentedEnabled(mode)}}
${profiler_results.total_time} <span class="ms">ms</span> spent in ${profiler_results.total_call_count} function calls
{{else GaeMiniProfiler.isSamplingEnabled(mode)}}
${profiler_results.total_samples} sampled stack trace{{if profiler_results.total_samples != 1}}s{{/if}}
{{else GaeMiniProfiler.isLineByLineEnabled(mode)}}
${profiler_results.num_functions_marked} profiled function{{if profiler_results.num_functions_marked != 1}}s{{/if}}
{{/if}}
</div>
</div>
<div class="profiler-details details fancy-scrollbar" style="display:none;">
{{if GaeMiniProfiler.isInstrumentedEnabled(mode)}}
<a class="download-profile-link" href="/gae_mini_profiler/shared/raw?request_id=${encodeURIComponent(request_id)}" class="uses_script">Download raw profile</a>
<table>
<thead>
<tr>
<th class="left">function</th>
<th class="right headerSortDown"><nobr>total ms</nobr></th>
<th class="right"><nobr>own ms</nobr></th>
<th class="right">calls</th>
<th class="right"><nobr>total per call</nobr></th>
</tr>
</thead>
{{each profiler_results.calls}}
<tr>
<td title="${$value.func_desc}">${$value.func_desc_short}</td>
<td class="right">${$value.cumulative_time}</td>
<td class="right">${$value.total_time}</td>
<td class="right">
{{if $value.callers_desc.length}}
<a class="callers-link uses_script" href="#callers">${$value.total_call_count}</a>
<div class="callers" style="display:none;">
<span class="callers-label">Called by</span>
<div class="callers-content">
{{each $value.callers_desc}}
<div>
<span title="${$value.func_desc}"><nobr>${$value.func_desc_short}</nobr></span>
</div>
{{/each}}
</div>
</div>
{{else}}
${$value.total_call_count}
{{/if}}
</td>
<td class="right">${$value.per_call_cumulative}</td>
</tr>
{{/each}}
</table>
{{else GaeMiniProfiler.isSamplingEnabled(mode)}}
Sample number:
<input class="sample-number-input" type="text"/>
Time: <span class="sample-timestamp"></span>
<table class="sample-table">
<thead>
<tr>
<th class="left">depth</th>
<th class="left">stack frame</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
{{/if}}
{{if GaeMiniProfiler.isLineByLineEnabled(mode)}}
{{if profiler_results.err_msg}}
<span class="warn">
{{html profiler_results.err_msg}}
</span>
{{else profiler_results.num_functions_marked == 0}}
<span>
To mark functions for profiling, put this in the source of the
file containing the function you want to profile:
</span>
<code>
from gae_mini_profiler.linebyline_profiler import line_profile<br>
<br>
# You can use it as a decorator...<br>
class SomeClass(object):<br>
@line_profile<br>
def some_instance_method(self):<br>
self.cool_stuff()<br>
<br>
# ...or regular function call<br>
line_profile(SomeClass.some_instance_method)<br>
line_profile(some_other_function)
</code>
{{/if}}
{{each(i, fn_result) profiler_results.calls}}
<h3>${fn_result.func_name}</h3>
<h4>${fn_result.filename}:${fn_result.start_lineno}</h4>
<span>
Total Time: ${fn_result.total_time_ms_s} ms
</span>
<table>
<thead>
<th> </th>
<th> </th>
<th><nobr>% Time</nobr></th>
<th><nobr>Time (ms)</nobr></th>
<th>Hits</th>
</thead>
<tbody>
{{each(j, timing) fn_result.timings}}
{{if timing.perc_time > 10}}
<tr class="linebyline-gt-10">
{{else timing.perc_time > 1}}
<tr class="linebyline-gt-1">
{{else}}
<tr>
{{/if}}
<td>${timing.lineno}</td>
<td><pre>${timing.line}</pre></td>
{{if timing.numhits != -1}}
<td>${timing.perc_time_s}</td>
<td>${timing.time_ms_s}</td>
<td>${timing.numhits}</td>
{{else}}
<td> </td>
<td> </td>
<td> </td>
{{/if}}
</tr>
{{/each}}
</tbody>
</table>
{{/each}}
{{/if}}
</div>
{{/if}}
{{if !GaeMiniProfiler.isRpcEnabled(mode)}}
<div class="expand">
<em>Remote Procedure Call profiling is disabled.</em>
</div>
{{else}}
<div class="expand">
<a href="#rpc-link" class="rpc-link link uses_script">Remote Procedure Calls</a>
<div class="summary">
${appstats_results.total_time} <span class="ms">ms</span>
spent in ${appstats_results.total_call_count} RPC{{if appstats_results.total_call_count != 1}}s{{/if}}
{{if appstats_results.likely_dupes}}
<span class="warn">(likely dupes)</span>
{{/if}}
</div>
</div>
<div class="rpc-details details fancy-scrollbar" style="display:none;">
<a class="appstats-link" target="_appstats" href="/_ah/stats/details?time=${appstats_results.appstats_key}">Full Appstats Details</a>
{{if appstats_results.calls.length}}
<table class="rpc-service-totals">
<thead>
<tr>
<th class="left"><nobr>service type</nobr></th>
<th class="right">calls</th>
<th class="right">misses</th>
<th class="right headerSortDown"><nobr>total ms</nobr></th>
</tr>
</thead>
{{each appstats_results.service_totals}}
<tr>
<td>${$value.service_prefix}</td>
<td class="right">${$value.total_call_count}</td>
<td class="right">${$value.total_misses}</td>
<td class="right">${$value.total_time}</td>
</tr>
{{/each}}
</table>
<table>
<thead>
<tr>
<th class="left">service</th>
<th class="right headerSortDown"><nobr>start ms</nobr></th>
<th class="right">ms</th>
<th class="left">request</th>
<th class="left">response</th>
</tr>
</thead>
{{each appstats_results.calls}}
<tr>
<td>${$value.service}</td>
<td class="right">
<a class="callers-link uses_script" href="#callers">${$value.start_offset}</a>
<div class="callers" style="display:none;">
<span class="callers-label">Called by</span>
<div class="callers-content">
{{each $value.stack_frames_desc}}
<div><nobr>${$value}</nobr></div>
{{/each}}
</div>
</div>
</td>
<td class="right">${$value.total_time}</td>
<td>
{{if $value.likely_dupe}}
<span class="warn">Likely duplicate of previous RPC</span>
{{/if}}
<span title="${$value.request}">
${$value.request_short}
</span>
</td>
<td>
<span title="${$value.response}">
${$value.response_short}
</span>
</td>
</tr>
{{/each}}
</table>
{{/if}}
</div>
{{/if}}
<div class="expand">
<a href="#logs-link" class="logs-link link uses_script">Logs</a>
<div class="summary">
{{each [10,20,30,40,50]}}
{{if log_count[$value] > 0}}
<span class='loglevel ll${$value}'></span> ×${log_count[$value]}
{{/if}}
{{/each}}
</div>
</div>
<div class="logs-details details fancy-scrollbar" style="display:none;">
<div id="slider">
Min level:
<span class="loglevel"></span>
<span class="minlevel-text"></span>
<div class="container"><div class="control"></div></div>
</div>
<table>
<thead>
<tr>
<th class="left">log</th>
<th class="left">time</th>
<th class="left"><nobr>fn</nobr></th>
<th class="left"><nobr>file</nobr></th>
<th class="left"><nobr>line</nobr></th>
<th class="left"><nobr>message</nobr></th>
</tr>
</thead>
{{each logs}}
<tr class="ll${$value[0]}">
<td class="left" class="${$value[0]}"><span class='loglevel ll${$value[0]}'><span>${$value[0]}</span></span></td>
<td class="left">${$value[1]}</td>
<td class="left">${$value[2]}</td>
<td class="left">${$value[3]}</td>
<td class="left">${$value[4]}</td>
<td class="left">
<pre>
${$value[5]}
</pre> </td>
</tr>
{{/each}}
</table>
</div>
{{/if}}
</div>
</script>