-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
executable file
·125 lines (104 loc) · 3.41 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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>HwINFO64</title>
<style type="text/css">
body {
font-family: monospace;
background-color: black;
color: lightgrey;
font-size: 1.4rem;
line-height: 2.5rem;
}
.space {
margin-left: 5%;
}
</style>
</head>
<body>
<div id="template">
<div>
<span data-field="gpu0.framerate.current"></span>
<span data-field="gpu0.framerate.unit" onclick="openFullscreen()"></span>
<span class="space">Load:</span>
<span data-field="gpu0.gpu_utilization.current"></span>
<span data-field="gpu0.gpu_utilization.unit"></span>
<span class="space">VRAM:</span>
<span data-field="gpu0.gpu_memory_usage.current"></span>
<span data-field="gpu0.gpu_memory_usage.unit"></span>
<div></div>
<span onclick="location.reload()">Temp:</span>
<span data-field="gpu0.gpu_temperature.current"></span>
<span data-field="gpu0.gpu_temperature.unit"></span>
<span class="space" onclick="location.reload()">Junction:</span>
<span data-field="gpu0.gpu_memory_junction_temperature.current"></span>
<span data-field="gpu0.gpu_memory_junction_temperature.unit"></span>
<br>
<br>
<br>
<span class="">CPU:</span>
<span data-field="cpu0.total_cpu_utility.current"></span>
<span data-field="cpu0.total_cpu_utility.unit"></span>
<span class="space">Temp:</span>
<span data-field="cpu0.cpu_tctl/tdie.current"></span>
<span data-field="cpu0.cpu_tctl/tdie.unit"></span>
<br>
<br>
<span class="">RAM:</span>
<span data-field="system.gigabyte_b550m_aorus_elite.physical_memory_used.current"></span>
<span data-field="system.gigabyte_b550m_aorus_elite.physical_memory_used.unit"></span>
</div>
</div>
</body>
<script type="text/javascript">
// this is not the frequency hwinfo uses to poll the sensors.
// it's just the frequency which the frontend polls the http server
// that serves the data
var serverPollingInterval = 2000;
function reload() {
fetch("/data")
.then((response) => {
return response.json();
}).then((data) => {
document.querySelectorAll('span[data-field]').forEach((e) => {
let prop = e.getAttribute('data-field')
if (typeof data[prop] == 'number') {
e.innerText = Math.trunc(parseFloat(data[prop])*100)/100
} else {
e.innerText = data[prop]
}
})
})
}
reload()
setInterval(function () {
reload()
}, serverPollingInterval, true)
/*let wakeLock = null;
// Function that attempts to request a wake lock.
const requestWakeLock = async () => {
try {
wakeLock = await navigator.wakeLock.request('screen');
wakeLock.addEventListener('release', () => {
console.log('Wake Lock was released');
});
console.log('Wake Lock is active');
} catch (err) {
console.error(`${err.name}, ${err.message}`);
}
};*/
/* View in fullscreen */
function openFullscreen() {
var elem = document.documentElement;
if (elem.requestFullscreen) {
elem.requestFullscreen();
} else if (elem.webkitRequestFullscreen) { /* Safari */
elem.webkitRequestFullscreen();
} else if (elem.msRequestFullscreen) { /* IE11 */
elem.msRequestFullscreen();
}
}
</script>
</html>