ravenscott-blog/public/smi.html
2024-10-02 05:44:50 -04:00

118 lines
4.1 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>GPU Stats</title>
<style>
body {
background-color: #121212;
color: #ffffff;
font-family: Arial, sans-serif;
padding: 20px;
line-height: 1.6;
}
.container {
max-width: 800px;
margin: 0 auto;
padding: 20px;
border: 1px solid #333;
border-radius: 10px;
background-color: #1e1e1e;
}
.title {
font-size: 2em;
margin-bottom: 20px;
text-align: center;
}
.stat-group {
margin-bottom: 20px;
}
.stat-group h2 {
font-size: 1.5em;
margin-bottom: 10px;
border-bottom: 1px solid #444;
padding-bottom: 5px;
}
.stat {
margin-bottom: 10px;
}
.stat span {
font-weight: bold;
}
pre {
white-space: pre-wrap;
word-wrap: break-word;
}
</style>
</head>
<body>
<div class="container">
<div class="title">GPU Statistics</div>
<div id="gpu-stats"></div>
</div>
<script>
async function fetchGpuStats() {
try {
const response = await fetch('https://smi.x64.world/nvidia-smi');
const data = await response.json();
displayStats(data);
} catch (error) {
console.error('Error fetching GPU stats:', error);
}
}
function displayStats(data) {
const gpuStatsDiv = document.getElementById('gpu-stats');
const gpu = data.nvidia_smi_log.gpu;
gpuStatsDiv.innerHTML = `
<div class="stat-group">
<h2>Processes</h2>
${Array.isArray(gpu.processes.process_info) ? gpu.processes.process_info.map(process => `
<div class="stat"><span>Process ID:</span> ${process.pid}, <span>Name:</span> ${process.process_name}, <span>Memory Used:</span> ${process.used_memory}</div>
`).join('') : `<div class="stat"><span>Process ID:</span> ${gpu.processes.process_info.pid}, <span>Name:</span> ${gpu.processes.process_info.process_name}, <span>Memory Used:</span> ${gpu.processes.process_info.used_memory}</div>`}
</div>
<div class="stat-group">
<h2>Utilization</h2>
<div class="stat"><span>GPU Utilization:</span> ${gpu.utilization.gpu_util}</div>
<div class="stat"><span>Memory Utilization:</span> ${gpu.utilization.memory_util}</div>
</div>
<div class="stat-group">
<h2>Clocks</h2>
<div class="stat"><span>Graphics Clock:</span> ${gpu.clocks.graphics_clock}</div>
<div class="stat"><span>SM Clock:</span> ${gpu.clocks.sm_clock}</div>
<div class="stat"><span>Memory Clock:</span> ${gpu.clocks.mem_clock}</div>
<div class="stat"><span>Video Clock:</span> ${gpu.clocks.video_clock}</div>
</div>
<div class="stat-group">
<h2>Memory Usage</h2>
<div class="stat"><span>Total FB Memory:</span> ${gpu.fb_memory_usage.total}</div>
<div class="stat"><span>Used FB Memory:</span> ${gpu.fb_memory_usage.used}</div>
<div class="stat"><span>Free FB Memory:</span> ${gpu.fb_memory_usage.free}</div>
</div>
<div class="stat-group">
<h2>Performance</h2>
<div class="stat"><span>Performance State:</span> ${gpu.performance_state}</div>
<div class="stat"><span>Fan Speed:</span> ${gpu.fan_speed}</div>
<div class="stat"><span>Power Draw:</span> ${gpu.gpu_power_readings.power_draw}</div>
</div>
<div class="stat-group">
<h2>General Information</h2>
<div class="stat"><span>Product Name:</span> ${gpu.product_name}</div>
<div class="stat"><span>Product Brand:</span> ${gpu.product_brand}</div>
<div class="stat"><span>Architecture:</span> ${gpu.product_architecture}</div>
<div class="stat"><span>UUID:</span> ${gpu.uuid}</div>
<div class="stat"><span>VBIOS Version:</span> ${gpu.vbios_version}</div>
</div>
`;
}
window.onload = () => {
fetchGpuStats();
setInterval(fetchGpuStats, 2000);
};
</script>
</body>
</html>