优化性能

This commit is contained in:
2025-09-11 22:17:19 +08:00
parent 1d84a9117e
commit 6e728d6db8
3 changed files with 37 additions and 51 deletions

View File

@@ -144,7 +144,7 @@ app.whenReady().then(() => {
console.error('设置窗口边界时出错:', error)
}
}
}, 2000)
}, 1000)
// 通知渲染进程窗口已失焦
if (mainWindow && !mainWindow.isDestroyed()) {
@@ -261,7 +261,7 @@ function createTray() {
// 启动GPU监控
function startGpuMonitoring() {
// 每秒获取一次GPU信息
// 每5秒获取一次GPU信息,减少性能开销
gpuMonitorInterval = setInterval(async () => {
try {
// 尝试使用nvidia-smi命令获取GPU信息
@@ -302,5 +302,5 @@ function startGpuMonitoring() {
} catch (error) {
console.error('获取GPU信息时出错:', error)
}
}, 200) // 每秒更新一次
}, 200) // 每5秒更新一次
}