Add web worker stress application
Signed-off-by: Severin Kaderli <severin@kaderli.dev>
This commit is contained in:
parent
5e06c738e5
commit
93dfeb443b
3 changed files with 40 additions and 1 deletions
|
@ -58,4 +58,12 @@
|
||||||
* https://www.youtube.com/watch?v=L_ZBn6RVJ88
|
* https://www.youtube.com/watch?v=L_ZBn6RVJ88
|
||||||
|
|
||||||
# 2022-10-06
|
# 2022-10-06
|
||||||
*
|
* Mail Exchange with Reto about Experiments
|
||||||
|
* Work on persona
|
||||||
|
|
||||||
|
# 2022-10-07
|
||||||
|
* More experiments and data analysis
|
||||||
|
* Decide on CPU as sender element
|
||||||
|
|
||||||
|
# 2022-10-10
|
||||||
|
* Create small application to create stress on CPU using web workers
|
||||||
|
|
30
src/web-worker-stress/index.html
Normal file
30
src/web-worker-stress/index.html
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Document</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
Hello World!
|
||||||
|
<script>
|
||||||
|
let workers = [];
|
||||||
|
|
||||||
|
function startWorkers() {
|
||||||
|
for (let i = 0; i < 8; i++) {
|
||||||
|
workers.push(new Worker("worker.js"));
|
||||||
|
}
|
||||||
|
setTimeout(stopWorkers, 2000);
|
||||||
|
}
|
||||||
|
|
||||||
|
function stopWorkers() {
|
||||||
|
for (const worker of workers) {
|
||||||
|
worker.terminate();
|
||||||
|
}
|
||||||
|
setTimeout(startWorkers, 2000);
|
||||||
|
}
|
||||||
|
startWorkers();
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
1
src/web-worker-stress/worker.js
Normal file
1
src/web-worker-stress/worker.js
Normal file
|
@ -0,0 +1 @@
|
||||||
|
while(true){}
|
Reference in a new issue