-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
278 lines (253 loc) · 11.4 KB
/
index.html
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
<!doctype html>
<title>Sharat's TDA</title>
<meta charset="UTF-8">
<link href="styles.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,400i,600|Inconsolata" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
<div id="top" @drop.stop.prevent="drop($event)"
@dragover.stop.prevent="$event.dataTransfer.dropEffect = 'copy'">
<nav>
<strong class="logo">ThreaDance</strong>
<a href="#" :class="{active: activePane === 1}" @click.prevent="activePane = 1">Thread Dumps</a>
<a href="#" :class="{active: activePane === 2}" @click.prevent="activePane = 2">Compare Threads</a>
<a href="#" class="about-link" @click.prevent="showAboutOverlay = true">About</a>
</nav>
<dump-list-pane v-show="activePane === 1" :dumps="dumps" :thread-map="threadMap"></dump-list-pane>
<compare-thread-pane v-show="activePane === 2" :dumps="dumps" :thread-map="threadMap"></compare-thread-pane>
<div class="mask" v-show="isLoading || showAboutOverlay"></div>
<section class="about-overlay" v-if="showAboutOverlay">
<h1 style="margin-top: 0;">Welcome to Sharat's TDA</h1>
<p>This is a java thread dump analyser program written in JavaScript (using
<a href="https://vuejs.org" target="_blank">vue.js</a>). You may drop thread dump files anywhere on this
page and they will be processed entirely client side. There is no server-side processing capability.</p>
<p>A project by <a href="http://www.sharats.me" target="_blank">The Sharat's</a>. Source code hosted at
<a href="https://github.com/sharat87/tda">GitHub</a>.</p>
<p style="font-weight: 600; font-size: 1.2em; font-style: italic; margin-bottom: 0;">
Go on, drop some dump files!</p>
<a href="#" class="close-btn" @click.prevent="showAboutOverlay = false" v-show="dumps.length">
<i class="fa fa-window-close"></i></a>
</section>
</div>
<script type="text/x-template" id="dump-list-tpl">
<section class="pane">
<aside>
<ul class="dumps-list">
<li>
<a href="#" @click.prevent="activeDump = null" :class="{active: !activeDump}">Summary</a>
</li>
<li v-for="(dump, index) in dumps">
<a href="#" @click.prevent="activeDump = dump" :class="{active: activeDump === dump}">
<div class="filename">{{ dump.file.name }}</div>
<f-time :time="dump.time"></f-time>
<span v-if="index > 0" class="dump-time-diff">
+{{ (dump.time - dumps[index - 1].time) / 1000 }}s</span>
</a>
</li>
</ul>
</aside>
<section v-if="activeDump">
<h1>{{ activeDump.file.name }}</h1>
<f-time :time="activeDump.time"></f-time>
<p>Total thread count: {{ activeDump.threads.size }}</p>
<h2>Status Analysis</h2>
<!-- POC Bar chart
<svg width="100%" height="200px" style="padding: 1em;">
<template v-for="(value, key, index) in activeDump.statusCounts">
<rect fill="#b3ebff" x="0" :y="(.5 + index * 1.5) + 'em'"
:width="(100 * value / activeDump.threads.size) + '%'" height="1em"></rect>
<text x="0" :y="(1.5 + index * 1.5) + 'em'" font-family="Inconsolata" font-size="1em">
{{ key }}</text>
</template>
<rect x="0" y="0" width="100%" height="100%" fill="none" stroke="black"></rect>
</svg>
-->
<table class="stats-table">
<thead>
<tr>
<th>Method Name</th>
<th colspan="3">Thread Count</th>
</tr>
</thead>
<tbody>
<tr v-for="stat in activeDump.statusCounts">
<td>{{ stat.status }}</td>
<td class="val">{{ stat.count }}</td>
<td class="val">{{ stat.percentage }}%</td>
<td class="bar"><div :style="{width: stat.percentage + '%'}"></div></td>
</tr>
</tbody>
</table>
<h2>Lock Analysis</h2>
<label>
<input type="checkbox" v-model="hideLocksWithNoWaits">
<span>Hide locks with no waiting threads</span>
</label>
<table class="stats-table">
<thead>
<tr>
<th>Lock ID</th>
<th>Object Type</th>
<th>Waits</th>
<th>Held by</th>
</tr>
</thead>
<tbody>
<tr v-for="lock in activeDump.locks" v-if="!hideLocksWithNoWaits || lock.count > 0">
<td>{{ lock.id }}</td>
<td>{{ lock.type }}</td>
<td class="val">{{ lock.count }}</td>
<td>{{ lock.holder }}</td>
</tr>
</tbody>
</table>
<h2>Method Analysis</h2>
<div>
<span>Show only the top</span>
<label>
<input type="radio" name="methodTopLimit" v-model="methodTopLimit" value="5">
<span>5</span>
</label>
<label>
<input type="radio" name="methodTopLimit" v-model="methodTopLimit" value="10">
<span>10</span>
</label>
<label>
<input type="radio" name="methodTopLimit" v-model="methodTopLimit" value="20">
<span>20</span>
</label>
<label>
<input type="radio" name="methodTopLimit" v-model="methodTopLimit"
:value="activeDump.methodCounts.length" >
<span>All</span>
</label>
</div>
<table class="stats-table">
<thead>
<tr>
<th>Method Name</th>
<th colspan="3">Thread Count</th>
</tr>
</thead>
<tbody>
<tr v-for="stat in activeDump.methodCounts.slice(0, methodTopLimit)">
<td>{{ stat.method || 'NO JAVA STACK' }}</td>
<td class="val">{{ stat.count }}</td>
<td class="val">{{ stat.percentage }}%</td>
<td class="bar"><div :style="{width: stat.percentage + '%'}"></div></td>
</tr>
</tbody>
</table>
<h2>Threads</h2>
<div>
<input type="search" v-model="threadFilter" placeholder="Filter threads...">
</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>Status</th>
</tr>
</thead>
<tbody>
<tr v-for="thread in activeDumpThreadsFiltered">
<td>{{ thread.name }}</td>
<td>{{ thread.status.name }}</td>
</tr>
</tbody>
</table>
</section>
<section v-else>
<h1>Summary</h1>
<p>Loaded {{ dumps.length }} thread dump{{ dumps.length > 1 ? 's' : '' }}.</p>
<dl v-if="dumps.length > 1">
<dt>Oldest dump time</dt>
<dd><f-time :time="dumps[0].time"></f-time>
— {{ dumps[0].file.name }}</dd>
<dt>Newest dump time</dt>
<dd><f-time :time="dumps[dumps.length - 1].time"></f-time>
— {{ dumps[dumps.length - 1].file.name }}</dd>
</dl>
<h2>Lock Tracks</h2>
<p>Counts of threads waiting for each lock, in each dump file.</p>
<table class="stats-table">
<thead>
<tr>
<th>Lock ID</th>
<th v-for="dump in dumps">{{ dump.file.name }}</th>
</tr>
</thead>
<tbody>
<tr v-for="lock in lockTracks">
<td><code>{{ lock.id }}</code></td>
<td v-for="(dump, i) in dumps">{{ lock.counts.get(i) }}</td>
</tr>
</tbody>
</table>
<!-- Not a very clever list, yet.
<h2>Hang Suspects</h2>
<p>There's {{ hangSuspects.length }} suspects.</p>
<ol>
<li v-for="thread in hangSuspects">
{{ thread.name }}
</li>
</ol>
-->
</section>
</section>
</script>
<script type="text/x-template" id="compare-thread-tpl">
<section class="pane">
<div style="height: 24px;">
<label>
<span>Filter Threads:</span>
<input type="search" placeholder="Filter Threads..." v-model="threadsFilter">
</label>
<label>
<span>Filter Stack Traces:</span>
<input type="search" placeholder="Filter Stack Traces..." v-model="stackFilter">
</label>
<label>
<input type="checkbox" v-model="hideEmptyThreads">
<span>Hide threads with empty stack</span>
</label>
<button type="button" @click="threadsFilter = stackFilter = ''; hideEmptyThreads = false">
<i class="fa fa-times"></i> Clear
</button>
</div>
<div class="upper-pane" style="overflow: auto"
:style="{height: activeThread ? 'calc(100% - 224px)' : 'calc(100% - 24px)'}">
<table class="thread-compare">
<thead>
<tr>
<th>Thread</th>
<th v-for="dump in dumps">{{ dump.file.name }}</th>
</tr>
</thead>
<tbody>
<tr v-for="entry in threadMapFiltered" v-show="entry[1].show">
<td style="max-width: 220px">{{ entry[0] }}</td>
<td v-for="thread in entry[1].threads" @click="activeThread = thread || activeThread"
:class="[thread ? thread.status.name : '', {active: activeThread === thread}]"
v-if="thread !== '=DO='" :colspan="thread && thread.span || 1">
<span v-if="thread">
<i class="fa fa-fw" :class="thread.status.icon"></i>
{{ thread.method }}
</span>
<em v-else>~~Not present~~</em>
</td>
</tr>
</tbody>
</table>
</div>
<div class="lower-pane" style="height: 200px; overflow: auto; position: relative" v-if="activeThread">
<a href="#" class="close-btn" @click.prevent="activeThread = null">
<i class="fa fa-window-close"></i></a>
<h2>{{ activeThread.name }}
<small>({{ activeThread.status.raw }})</small>
</h2>
<pre>{{ activeThread.stack || 'No Stack Trace' }}</pre>
</div>
</section>
</script>
<script src="https://unpkg.com/vue/dist/vue.js"></script>
<script src="app.js"></script>