javacore-analyser 2.0rc1__py3-none-any.whl → 2.1.0.dev66__py3-none-any.whl

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.
@@ -59,7 +59,7 @@ class AbstractSnapshotCollection(abc.ABC):
59
59
  self.thread_snapshots.append(snapshot)
60
60
 
61
61
  def index_of(self, snapshot):
62
- for i in range(len(self.thread_snapshotssnaps)):
62
+ for i in range(len(self.thread_snapshots)):
63
63
  if self.thread_snapshots[i] == snapshot: return i
64
64
  return -1
65
65
 
@@ -142,7 +142,7 @@ class AbstractSnapshotCollection(abc.ABC):
142
142
  result = 0
143
143
  for i in self.thread_snapshots:
144
144
  el = i.get_java_stack_depth()
145
- if el>result:
145
+ if el > result:
146
146
  result = el
147
147
  return result
148
148
 
@@ -30,10 +30,11 @@ ENCODING = '1TICHARSET'
30
30
  DATA_OUTPUT_SUBDIR = '/data/'
31
31
  DEFAULT_FILE_DELIMITER = ';'
32
32
 
33
- MIN_JAVACORE_SIZE = 5 * 1024 # Minimal Javacore size in bytes
33
+ MIN_JAVACORE_SIZE = 5 * 1024 # Minimal Javacore size in bytes
34
34
 
35
35
  DATE_FORMAT = "%Y-%m-%d %H:%M:%S"
36
36
 
37
37
  # Web application constants
38
38
  DEFAULT_REPORTS_DIR = "reports"
39
39
  DEFAULT_PORT = 5000
40
+ TEMP_DIR = "temp_data" # Folder to store temporary data for creating reports
@@ -15,6 +15,8 @@ $('.show').click(function () {
15
15
  }
16
16
  });
17
17
 
18
+
19
+
18
20
  function expand_it(whichEl, link) {
19
21
  whichEl.style.display = (whichEl.style.display == "none") ? "" : "none";
20
22
  //if (link) {
@@ -0,0 +1,17 @@
1
+ <!DOCTYPE html>
2
+
3
+ <!--
4
+ # Copyright IBM Corp. 2024 - 2024
5
+ # SPDX-License-Identifier: Apache-2.0
6
+ -->
7
+
8
+ <html lang="en">
9
+ <head>
10
+ <meta http-equiv="refresh" content="30" /> <!-- Refresh this page every 30s until generated page appears -->
11
+ <meta charset="UTF-8">
12
+ <title>The page is being generated</title>
13
+ </head>
14
+ <body>
15
+ <h1>The page is being generated. Once it is ready, it will appear here.</h1>
16
+ </body>
17
+ </html>
@@ -49,10 +49,32 @@ $(function() {
49
49
  searchInNode(rootNode, searchTerm);
50
50
  }
51
51
 
52
+ function processChild(child) {
53
+ try {
54
+ if (isDomNode(child) && child.classList.contains('toggle_expand')) {
55
+ for (i = 0; i < child.childNodes.length; ++i) {
56
+ grandchild = child.childNodes[i];
57
+ if (isDomNode(grandchild) && grandchild.text == '[+] Expand') {
58
+ grandchild.text = '[-] Collapse';
59
+ }
60
+ }
61
+ }
62
+ } catch(err) {
63
+ console.log(err);
64
+ }
65
+ }
66
+
52
67
  function searchInNode(node, searchTerm) {
53
68
  if (!isDomNode(node)) return;
54
69
  if (node.textContent.toUpperCase().match(searchTerm.toUpperCase())) {
55
70
  // expand the node here
71
+ if (!node.classList.contains('show-all')) {
72
+ node.classList.add('show-all');
73
+ for (i = 0; i < node.childNodes.length; ++i) {
74
+ child = node.childNodes[i];
75
+ processChild(child);
76
+ }
77
+ }
56
78
  if (node.getAttribute('style') && node.style.display == "none") {
57
79
  node.style.display = "";
58
80
  }
@@ -145,12 +145,34 @@ const loadChartGC = function() {
145
145
  });
146
146
 
147
147
  // 3. find the HEAP_SIZE
148
- const MB_SIZE = Math.pow(1024, 2)
148
+ const MB_SIZE = Math.pow(1024, 2);
149
+ let heapAsString = document.getElementById('sys_info_table').rows[2].cells[1].innerHTML;
149
150
  let HEAP_SIZE;
150
- if(document.getElementById('sys_info_table').rows[2].cells[1].innerHTML.slice(-1).toLowerCase() === 'g')
151
- HEAP_SIZE = Number(document.getElementById('sys_info_table').rows[2].cells[1].innerHTML.slice(0, -1)) * MB_SIZE * 1024;
152
- else
153
- HEAP_SIZE = Number(document.getElementById('sys_info_table').rows[2].cells[1].innerHTML.slice(0, -1)) * MB_SIZE;
151
+ let heapUnit = heapAsString.slice(-1).toLowerCase();
152
+
153
+ if(!isNaN(Number(heapUnit))) {
154
+ HEAP_SIZE = Number(heapAsString);
155
+ }
156
+ else {
157
+
158
+ switch (heapUnit) {
159
+ case "g":
160
+ HEAP_SIZE =
161
+ Number(heapAsString.slice(0, -1)) * MB_SIZE * 1024;
162
+ break;
163
+ case "m":
164
+ HEAP_SIZE =
165
+ Number(heapAsString.slice(0, -1)) * MB_SIZE;
166
+ break;
167
+ case "k":
168
+ HEAP_SIZE =
169
+ Number(heapAsString.slice(0, -1)) * 1024;
170
+ break;
171
+ default:
172
+ console.log("Hmm, what now .. heap unit undefined!");
173
+ break;
174
+ }
175
+ }
154
176
 
155
177
  // 4. create input data for GC chart
156
178
  // start with gc collection done after the first javacore creation
@@ -20,139 +20,148 @@
20
20
  <script type="text/javascript" src="../data/jquery/wait2scripts.js"> _ </script>
21
21
  <script type="text/javascript" src="../data/jquery/sorting.js"> _ </script>
22
22
  <script type="text/javascript" src="../data/expand.js"> _ </script>
23
-
24
-
23
+ <script src="../data/jquery/jquery.mark.min.js"> _ </script>
24
+ <script type="text/javascript" src="../data/jquery/search.js"> _ </script>
25
25
  </head>
26
26
 
27
27
  <body id="doc_body" height="100%">
28
- <p class="right"><a href="../index.html"> Back to Main page </a></p>
29
- <h2>Wait Report for: <b>{id}</b></h2>
30
- <div id="all_threads">
31
- <table id="javacore_threads_table" class="tablesorter_blue">
32
- <thead>
33
- <tr>
34
- <th class="sixty">Thread name</th>
35
- <th>Total CPU usage (s)</th>
36
- <th>% CPU usage</th>
37
- <th>Memory allocated since last GC (MB)</th>
38
- <th>Java stack depth</th>
39
- <th>Status</th>
40
- </tr>
41
- </thead>
42
- <tbody>
43
- <xsl:for-each select="//Thread/all_snapshot_collection/snapshot_collection/stack[file_name='{id}']">
44
- <xsl:variable name="i" select="position()" />
28
+ <div class="searchbar">
29
+ <input id="search-input" type="search" />
30
+ <button data-search="search" id="search-button">Search</button>
31
+ <button data-search="next">Next</button>
32
+ <button data-search="prev">Prev</button>
33
+ <button data-search="clear">✖</button>
34
+ </div>
35
+ <div class="content">
36
+ <p class="right"><a href="../index.html"> Back to Main page </a></p>
37
+ <h2>Wait Report for: <b>{id}</b></h2>
38
+ <div id="all_threads">
39
+ <table id="javacore_threads_table" class="tablesorter_blue">
40
+ <thead>
45
41
  <tr>
46
- <td class="left">
47
- <div>
48
- <xsl:attribute name="id">
49
- <xsl:value-of select="concat('stack',$i)"/>
50
- </xsl:attribute>
51
- <a target="_blank">
52
- <xsl:attribute name="href">
53
- <xsl:value-of select="concat('../threads/thread_', thread_hash, '.html')"/>
42
+ <th class="sixty">Thread name</th>
43
+ <th>Total CPU usage (s)</th>
44
+ <th>% CPU usage</th>
45
+ <th>Memory allocated since last GC (MB)</th>
46
+ <th>Java stack depth</th>
47
+ <th>Status</th>
48
+ </tr>
49
+ </thead>
50
+ <tbody>
51
+ <xsl:for-each select="//Thread/all_snapshot_collection/snapshot_collection/stack[file_name='{id}']">
52
+ <xsl:variable name="i" select="position()" />
53
+ <tr>
54
+ <td class="left">
55
+ <div>
56
+ <xsl:attribute name="id">
57
+ <xsl:value-of select="concat('stack',$i)"/>
54
58
  </xsl:attribute>
55
- <xsl:value-of select="thread_name"/>
56
- </a>
57
- <xsl:choose>
58
- <xsl:when test="stack_depth &gt; 0">
59
- <div>
60
- <div class="toggle_expand">
61
- <a href="javaScript:;" class="show">[+] Expand</a> <!-- "show" class is used in expand.js -->
59
+ <a target="_blank">
60
+ <xsl:attribute name="href">
61
+ <xsl:value-of select="concat('../threads/thread_', thread_hash, '.html')"/>
62
+ </xsl:attribute>
63
+ <xsl:value-of select="thread_name"/>
64
+ </a>
65
+ <xsl:choose>
66
+ <xsl:when test="stack_depth &gt; 0">
67
+ <div>
68
+ <div class="toggle_expand">
69
+ <a href="javaScript:;" class="show">[+] Expand</a> <!-- "show" class is used in expand.js -->
70
+ </div>
71
+ <p class="stacktrace">
72
+ <xsl:for-each select="*[starts-with(name(), 'line')]">
73
+ <span>
74
+ <xsl:attribute name="class">
75
+ <xsl:value-of select="@kind"/>
76
+ </xsl:attribute>
77
+ <xsl:value-of select="current()"/>
78
+ </span>
79
+ <br/>
80
+ </xsl:for-each>
81
+ </p>
62
82
  </div>
63
- <p class="stacktrace">
64
- <xsl:for-each select="*[starts-with(name(), 'line')]">
65
- <span>
66
- <xsl:attribute name="class">
67
- <xsl:value-of select="@kind"/>
68
- </xsl:attribute>
69
- <xsl:value-of select="current()"/>
70
- </span>
71
- <br/>
72
- </xsl:for-each>
73
- </p>
74
- </div>
83
+ </xsl:when>
84
+ <xsl:otherwise>
85
+ No stack
86
+ </xsl:otherwise>
87
+ </xsl:choose>
88
+ </div>
89
+ </td>
90
+ <td>
91
+ <xsl:choose>
92
+ <xsl:when test="cpu_usage &gt;= 0">
93
+ <xsl:value-of select='format-number(cpu_usage, "0.00")'/>
75
94
  </xsl:when>
76
95
  <xsl:otherwise>
77
- No stack
96
+ <div class="warning">[!]
97
+ <span class="warningtooltip">Error computing CPU usage, javacores may be corrupted</span>
98
+ </div>
78
99
  </xsl:otherwise>
79
100
  </xsl:choose>
80
- </div>
81
- </td>
82
- <td>
83
- <xsl:choose>
84
- <xsl:when test="cpu_usage &gt;= 0">
85
- <xsl:value-of select='format-number(cpu_usage, "0.00")'/>
86
- </xsl:when>
87
- <xsl:otherwise>
88
- <div class="warning">[!]
89
- <span class="warningtooltip">Error computing CPU usage, javacores may be corrupted</span>
90
- </div>
91
- </xsl:otherwise>
92
- </xsl:choose>
93
- </td>
94
- <td>
95
- <xsl:choose>
96
- <xsl:when test="cpu_percentage &gt;= 0">
97
- <xsl:value-of select='format-number(cpu_percentage, "0.0")'/>
98
- </xsl:when>
99
- <xsl:otherwise>
100
- <div class="warning">[!]
101
- <span class="warningtooltip">Error computing CPU percentage, javacores may be corrupted</span>
102
- </div>
103
- </xsl:otherwise>
104
- </xsl:choose>
105
- </td>
106
- <td><xsl:value-of select='format-number(allocated_memory div 1024 div 1024, "0.00")'/></td>
107
- <td><xsl:value-of select='java_stack_depth'/></td>
108
- <xsl:choose>
109
- <xsl:when test="state='CW'">
110
- <td class="waiting">Waiting on condition</td>
111
- </xsl:when>
112
- <xsl:when test="state='R'">
113
- <td class="runnable">Runnable</td>
114
- </xsl:when>
115
- <xsl:when test="state='P'">
116
- <td class="parked">
101
+ </td>
102
+ <td>
117
103
  <xsl:choose>
118
- <xsl:when test="blocked_by=''">
119
- Parked
104
+ <xsl:when test="cpu_percentage &gt;= 0">
105
+ <xsl:value-of select='format-number(cpu_percentage, "0.0")'/>
120
106
  </xsl:when>
121
107
  <xsl:otherwise>
122
- <a target="_blank">
123
- <xsl:attribute name="href">
124
- <xsl:value-of select="concat('../threads/thread_', blocked_by/@thread_hash, '.html')"/>
125
- </xsl:attribute>
126
- <xsl:attribute name="title">
127
- <xsl:value-of select="blocked_by/@name" />
128
- </xsl:attribute>
129
- Parked on <xsl:value-of select="blocked_by/@thread_id"/>
130
- </a>
108
+ <div class="warning">[!]
109
+ <span class="warningtooltip">Error computing CPU percentage, javacores may be corrupted</span>
110
+ </div>
131
111
  </xsl:otherwise>
132
112
  </xsl:choose>
133
113
  </td>
134
- </xsl:when>
135
- <xsl:when test="state='B'">
136
- <td class="blocked">
137
- <a target="_blank">
138
- <xsl:attribute name="href">
139
- <xsl:value-of select="concat('../threads/thread_', blocked_by/@thread_hash, '.html')"/>
140
- </xsl:attribute>
141
- <xsl:attribute name="title">
142
- <xsl:value-of select="blocked_by/@name" />
143
- </xsl:attribute>
144
- Blocked by <xsl:value-of select="blocked_by/@thread_id"/>
145
- </a>
146
- </td>
147
- </xsl:when>
148
- <xsl:otherwise>
149
- <td><xsl:value-of select="state"/></td>
150
- </xsl:otherwise>
151
- </xsl:choose>
152
- </tr>
153
- </xsl:for-each>
154
- </tbody>
155
- </table>
114
+ <td><xsl:value-of select='format-number(allocated_memory div 1024 div 1024, "0.00")'/></td>
115
+ <td><xsl:value-of select='java_stack_depth'/></td>
116
+ <xsl:choose>
117
+ <xsl:when test="state='CW'">
118
+ <td class="waiting">Waiting on condition</td>
119
+ </xsl:when>
120
+ <xsl:when test="state='R'">
121
+ <td class="runnable">Runnable</td>
122
+ </xsl:when>
123
+ <xsl:when test="state='P'">
124
+ <td class="parked">
125
+ <xsl:choose>
126
+ <xsl:when test="blocked_by=''">
127
+ Parked
128
+ </xsl:when>
129
+ <xsl:otherwise>
130
+ <a target="_blank">
131
+ <xsl:attribute name="href">
132
+ <xsl:value-of select="concat('../threads/thread_', blocked_by/@thread_hash, '.html')"/>
133
+ </xsl:attribute>
134
+ <xsl:attribute name="title">
135
+ <xsl:value-of select="blocked_by/@name" />
136
+ </xsl:attribute>
137
+ Parked on <xsl:value-of select="blocked_by/@thread_id"/>
138
+ </a>
139
+ </xsl:otherwise>
140
+ </xsl:choose>
141
+ </td>
142
+ </xsl:when>
143
+ <xsl:when test="state='B'">
144
+ <td class="blocked">
145
+ <a target="_blank">
146
+ <xsl:attribute name="href">
147
+ <xsl:value-of select="concat('../threads/thread_', blocked_by/@thread_hash, '.html')"/>
148
+ </xsl:attribute>
149
+ <xsl:attribute name="title">
150
+ <xsl:value-of select="blocked_by/@name" />
151
+ </xsl:attribute>
152
+ Blocked by <xsl:value-of select="blocked_by/@thread_id"/>
153
+ </a>
154
+ </td>
155
+ </xsl:when>
156
+ <xsl:otherwise>
157
+ <td><xsl:value-of select="state"/></td>
158
+ </xsl:otherwise>
159
+ </xsl:choose>
160
+ </tr>
161
+ </xsl:for-each>
162
+ </tbody>
163
+ </table>
164
+ </div>
156
165
  </div>
157
166
  </body>
158
167
  <script type="text/javascript" src="../data/expand.js"> _ <!-- underscore character is required to prevent converting to <script /> which does not work --> </script>
@@ -748,7 +748,7 @@
748
748
 
749
749
  <p></p>
750
750
  <div class="margined">
751
- <a href="https://w3.ibm.com/w3publisher/wait2-tool" target="_blank">Documentation</a>
751
+ <a href="https://github.com/IBM/javacore-analyser/wiki" target="_blank">Documentation</a>
752
752
  </div>
753
753
  <div class="margined">
754
754
  In case of any issues with the tool use Slack group: