28 lines
779 B
HTML
28 lines
779 B
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head><title>CPU Hog Test</title></head>
|
|
<body>
|
|
<h1>CPU Hog Test</h1>
|
|
<p>This page runs a busy loop in setInterval to generate long tasks.</p>
|
|
<pre id="out"></pre>
|
|
<script>
|
|
// Busy loop every 250ms — should show up as long tasks + high cpu_busy_percent.
|
|
setInterval(function busyLoop() {
|
|
var start = performance.now();
|
|
while (performance.now() - start < 120) { /* burn 120ms */ }
|
|
document.getElementById('out').textContent =
|
|
'tick at ' + new Date().toISOString();
|
|
}, 250);
|
|
|
|
// Also spin a few extra timers to populate the timer_top list.
|
|
setInterval(function pollStatus() {
|
|
fetch('/test.json').catch(function(){});
|
|
}, 1000);
|
|
|
|
setInterval(function pollStatus2() {
|
|
fetch('/test.json').catch(function(){});
|
|
}, 2000);
|
|
</script>
|
|
</body>
|
|
</html>
|