blob: a82815af6fbb0d37af8f8371f9a28be593991087 (
plain)
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
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Server stats</title>
<style>
table, td {
border: 1px solid #333;
}
thead {
background-color: #333;
color: #fff;
}
</style>
</head>
<body>
<h1>Server stats</h1>
<table>
<thead>
<tr>
<th colspan="2">Memory usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>RSS</td>
<td id="rss"></td>
</tr>
<tr>
<td>Heap total</td>
<td id="heapTotal"></td>
</tr>
<tr>
<td>Heap used</td>
<td id="heapUsed"></td>
</tr>
<tr>
<td>External</td>
<td id="external"></td>
</tr>
</tbody>
</table>
<script>
(function() {
const rss = document.getElementById('rss');
const heapTotal = document.getElementById('heapTotal');
const heapUsed = document.getElementById('heapUsed');
const external = document.getElementById('external');
const ws = new WebSocket(`ws://${location.host}`);
ws.onmessage = function(event) {
const data = JSON.parse(event.data);
rss.textContent = data.rss;
heapTotal.textContent = data.heapTotal;
heapUsed.textContent = data.heapUsed;
external.textContent = data.external;
};
})();
</script>
</body>
</html>
|