1 | <%inherit file="/base.mako"/> |
---|
2 | <%namespace file="/message.mako" import="render_msg" /> |
---|
3 | |
---|
4 | <%def name="title()">Memory Profiling</%def> |
---|
5 | <% |
---|
6 | import re |
---|
7 | from xml.sax.saxutils import escape, unescape |
---|
8 | %> |
---|
9 | |
---|
10 | <style type="text/css"> |
---|
11 | a.breadcrumb:link, |
---|
12 | a.breadcrumb:visited, |
---|
13 | a.breadcrumb:active { |
---|
14 | text-decoration: none; |
---|
15 | } |
---|
16 | a.breadcrumb:hover { |
---|
17 | text-decoration: underline; |
---|
18 | } |
---|
19 | </style> |
---|
20 | |
---|
21 | <h2>Memory Profiling</h2> |
---|
22 | |
---|
23 | <ul class="manage-table-actions"> |
---|
24 | <li><a class="action-button" href="${h.url_for( controller='admin', action='memdump', dump=True )}">Dump memory (warning: hangs server!)</a></li> |
---|
25 | <li><a class="action-button" href="${h.url_for( controller='admin', action='memdump', setref=True )}">Set reference point</a></li> |
---|
26 | </ul> |
---|
27 | |
---|
28 | <%def name="htmlize( heap )"> |
---|
29 | <% |
---|
30 | s = escape( str( heap ) ) |
---|
31 | new_s = "" |
---|
32 | id_re = re.compile('^(\s+)([0-9]+)') |
---|
33 | for line in s.split( '\n' ): |
---|
34 | try: |
---|
35 | id = id_re.search( line ).group( 2 ) |
---|
36 | except: |
---|
37 | id = None |
---|
38 | new_s += re.sub( id_re, r'\1<a href="' + h.url_for( controller='admin', action='memdump', ids=ids, sorts=sorts, new_id=id ) + r'">\2</a>', line ) |
---|
39 | if id and heap[int(id)].count == 1: |
---|
40 | new_s += " <a href='%s'>theone</a>\n" % h.url_for( ids=ids, sorts=sorts, new_id=id, theone=True ) |
---|
41 | else: |
---|
42 | new_s += "\n" |
---|
43 | return new_s |
---|
44 | %> |
---|
45 | </%def> |
---|
46 | |
---|
47 | %if message: |
---|
48 | ${render_msg( message, status )} |
---|
49 | %endif |
---|
50 | |
---|
51 | %if heap is None: |
---|
52 | No memory dump available. Click "Dump memory" to create one. |
---|
53 | %else: |
---|
54 | <pre> |
---|
55 | <br/> |
---|
56 | You are here: ${breadcrumb}<br/> |
---|
57 | %if breadcrumb.endswith( 'theone' ): |
---|
58 | ${heap} |
---|
59 | %else: |
---|
60 | <nobr> |
---|
61 | Sort: |
---|
62 | <a href="${h.url_for( controller='admin', action='memdump', ids=ids, sorts=sorts, new_sort='Class')}">Class</a> | |
---|
63 | <a href="${h.url_for( controller='admin', action='memdump', ids=ids, sorts=sorts, new_sort='Clodo' )}">Clodo</a> | |
---|
64 | <a href="${h.url_for( controller='admin', action='memdump', ids=ids, sorts=sorts, new_sort='Id' )}">Id</a> | |
---|
65 | <a href="${h.url_for( controller='admin', action='memdump', ids=ids, sorts=sorts, new_sort='Idset' )}">Idset</a> | |
---|
66 | <a href="${h.url_for( controller='admin', action='memdump', ids=ids, sorts=sorts, new_sort='Module' )}">Module</a> | |
---|
67 | <a href="${h.url_for( controller='admin', action='memdump', ids=ids, sorts=sorts, new_sort='Unity' )}">Unity</a> | |
---|
68 | <a href="${h.url_for( controller='admin', action='memdump', ids=ids, sorts=sorts, new_sort='Rcs' )}">Rcs</a> | |
---|
69 | <a href="${h.url_for( controller='admin', action='memdump', ids=ids, sorts=sorts, new_sort='Size' )}">Size</a> | |
---|
70 | <a href="${h.url_for( controller='admin', action='memdump', ids=ids, sorts=sorts, new_sort='Type' )}">Type</a> | |
---|
71 | <a href="${h.url_for( controller='admin', action='memdump', ids=ids, sorts=sorts, new_sort='Via' )}">Via</a> |
---|
72 | </nobr> |
---|
73 | ${htmlize( heap )} |
---|
74 | %endif |
---|
75 | </pre> |
---|
76 | %endif |
---|