better monitor: fix excessive VRAM rounding

This commit is contained in:
Egor 2025-09-10 18:49:49 -07:00
parent 6de8417b5d
commit dc922b333d
4 changed files with 11 additions and 15 deletions

View file

@ -1,7 +1,7 @@
{
"name": "gerbil",
"productName": "Gerbil",
"version": "1.1.1",
"version": "1.1.2",
"description": "Run Large Language Models locally",
"main": "out/main/index.js",
"homepage": "./",

View file

@ -117,8 +117,7 @@ const checkVramWarnings = async (backend: string): Promise<Warning[]> => {
if (gpuMemoryInfo) {
const lowVramGpus = gpuMemoryInfo.filter(
(gpu) =>
typeof gpu.totalMemoryGB === 'number' && gpu.totalMemoryGB < 8
(gpu) => typeof gpu.totalMemoryGB === 'number' && gpu.totalMemoryGB < 8
);
if (lowVramGpus.length > 0) {
@ -126,8 +125,7 @@ const checkVramWarnings = async (backend: string): Promise<Warning[]> => {
type: 'warning',
message: `Low VRAM detected (${lowVramGpus
.map(
(gpu) =>
`${gpu.deviceName}: ${gpu.totalMemoryGB!.toFixed(1)}GB`
(gpu) => `${gpu.deviceName}: ${gpu.totalMemoryGB!.toFixed(1)}GB`
)
.join(
', '

View file

@ -1,3 +1,4 @@
import { platform } from 'process';
import si from 'systeminformation';
import { BrowserWindow } from 'electron';
import { logError } from '@/main/modules/logging';
@ -45,7 +46,7 @@ let cpuInterval: ReturnType<typeof setInterval> | null = null;
let memoryInterval: ReturnType<typeof setInterval> | null = null;
let gpuInterval: ReturnType<typeof setInterval> | null = null;
let isRunning = false;
const updateFrequency = 2000;
const updateFrequency = platform === 'win32' ? 2000 : 1000;
let mainWindow: BrowserWindow | null = null;
export function startMonitoring(window: BrowserWindow) {

View file

@ -167,9 +167,8 @@ foreach ($gpu in $gpus) {
gpus.push({
deviceName: name,
usage: Math.round(utilization * 100) / 100,
memoryUsed: usedRAM > 0 ? Math.round(usedRAM / (1024 * 1024 * 1024)) : 0,
memoryTotal:
totalRAM > 0 ? Math.round(totalRAM / (1024 * 1024 * 1024)) : 0,
memoryUsed: usedRAM > 0 ? usedRAM / (1024 * 1024 * 1024) : 0,
memoryTotal: totalRAM > 0 ? totalRAM / (1024 * 1024 * 1024) : 0,
});
}
}
@ -214,12 +213,10 @@ async function getLinuxGPUData() {
);
const usage = parseInt(usageData.trim(), 10) || 0;
const memoryUsed = Math.round(
(parseInt(memUsedData.trim(), 10) || 0) / (1024 * 1024 * 1024)
);
const memoryTotal = Math.round(
(parseInt(memTotalData.trim(), 10) || 0) / (1024 * 1024 * 1024)
);
const memoryUsed =
(parseInt(memUsedData.trim(), 10) || 0) / (1024 * 1024 * 1024);
const memoryTotal =
(parseInt(memTotalData.trim(), 10) || 0) / (1024 * 1024 * 1024);
gpus.push({
deviceName: 'GPU',