Sentry/assets/coffee/cpu.coffee

29 lines
932 B
CoffeeScript
Raw Normal View History

2022-05-25 14:28:19 -04:00
si = require('systeminformation')
window.addEventListener('load', () ->
# Grab the static CPU information
2022-05-25 14:28:19 -04:00
si.cpu()
.then((data) ->
2022-05-25 14:43:54 -04:00
document.getElementById('cpuInfo').innerText = data.brand
document.getElementById('cpuCores').innerText = data.physicalCores
document.getElementById('cpuThreads').innerText = data.cores
document.getElementById('cpuClockBase').innerText = data.speed
document.getElementById('cpuClockBoost').innerText = data.speedMax
2022-05-25 14:43:54 -04:00
).catch((error) ->
console.error(error)
)
# Start the CPU temperature loop
setCpuTemp()
, false)
setCpuTemp = () ->
2022-05-25 14:43:54 -04:00
si.cpuTemperature()
.then((data) ->
document.getElementById('cpuTemp').innerText = data.main
document.getElementById('cpuTempDisplay').children.item(0).style.height = ((100 - parseFloat(data.main)) + '%')
2022-05-25 14:43:54 -04:00
).catch((error) ->
console.error(error)
)
setTimeout(setCpuTemp, 2000)