Spaces:
Running
Running
first commit
Browse files- index.html +40 -18
index.html
CHANGED
|
@@ -1,19 +1,41 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
</html>
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Device Performance Checker</title>
|
| 7 |
+
<script>
|
| 8 |
+
function getCPUInfo() {
|
| 9 |
+
const start = performance.now();
|
| 10 |
+
let sum = 0;
|
| 11 |
+
for (let i = 0; i < 1e7; i++) { sum += Math.sqrt(i); }
|
| 12 |
+
const end = performance.now();
|
| 13 |
+
document.getElementById("cpu-result").innerText = `CPU Benchmark: ${(end - start).toFixed(2)} ms`;
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
function getGPUInfo() {
|
| 17 |
+
const canvas = document.createElement("canvas");
|
| 18 |
+
const gl = canvas.getContext("webgl") || canvas.getContext("experimental-webgl");
|
| 19 |
+
if (!gl) {
|
| 20 |
+
document.getElementById("gpu-result").innerText = "WebGL not supported";
|
| 21 |
+
return;
|
| 22 |
+
}
|
| 23 |
+
const debugInfo = gl.getExtension("WEBGL_debug_renderer_info");
|
| 24 |
+
const vendor = gl.getParameter(debugInfo.UNMASKED_VENDOR_WEBGL);
|
| 25 |
+
const renderer = gl.getParameter(debugInfo.UNMASKED_RENDERER_WEBGL);
|
| 26 |
+
document.getElementById("gpu-result").innerText = `GPU: ${renderer} (Vendor: ${vendor})`;
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
function runBenchmarks() {
|
| 30 |
+
getCPUInfo();
|
| 31 |
+
getGPUInfo();
|
| 32 |
+
}
|
| 33 |
+
</script>
|
| 34 |
+
</head>
|
| 35 |
+
<body onload="runBenchmarks()">
|
| 36 |
+
<h1>Device Performance Checker</h1>
|
| 37 |
+
<p id="cpu-result">CPU Benchmark: Running...</p>
|
| 38 |
+
<p id="gpu-result">GPU Info: Detecting...</p>
|
| 39 |
+
<button onclick="runBenchmarks()">Re-run Tests</button>
|
| 40 |
+
</body>
|
| 41 |
</html>
|