新增 显存占用显示功能;
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -1 +1,3 @@
|
|||||||
node_modules
|
node_modules
|
||||||
|
*.log
|
||||||
|
dist
|
||||||
11
index.html
11
index.html
@@ -213,8 +213,15 @@
|
|||||||
})
|
})
|
||||||
|
|
||||||
if (physicalGpus && physicalGpus.length > 0) {
|
if (physicalGpus && physicalGpus.length > 0) {
|
||||||
// 显示第一个物理GPU的显存使用情况
|
// 显示第一个物理GPU的信息
|
||||||
const gpu = physicalGpus[0]
|
const gpu = physicalGpus[0]
|
||||||
|
|
||||||
|
// 显示GPU使用率(如果可用)
|
||||||
|
if (gpu.utilizationGpu !== undefined) {
|
||||||
|
gpuEl.textContent = Math.round(gpu.utilizationGpu) + '%'
|
||||||
|
}
|
||||||
|
|
||||||
|
// 显示显存使用情况
|
||||||
// 优先使用memoryUsed和memoryTotal,如果没有则使用vram
|
// 优先使用memoryUsed和memoryTotal,如果没有则使用vram
|
||||||
if (gpu.memoryUsed !== undefined && gpu.memoryTotal !== undefined) {
|
if (gpu.memoryUsed !== undefined && gpu.memoryTotal !== undefined) {
|
||||||
// 转换为MB单位
|
// 转换为MB单位
|
||||||
@@ -266,7 +273,7 @@
|
|||||||
let gpuUsage = 0;
|
let gpuUsage = 0;
|
||||||
if (gpuData.controllers && gpuData.controllers.length > 0) {
|
if (gpuData.controllers && gpuData.controllers.length > 0) {
|
||||||
// 尝试获取GPU使用率,如果没有则使用默认值
|
// 尝试获取GPU使用率,如果没有则使用默认值
|
||||||
gpuUsage = gpuData.controllers[0].utilizationMemory || gpuData.controllers[0].fanSpeed || 0;
|
gpuUsage = gpuData.controllers[0].utilizationGpu || gpuData.controllers[0].utilizationMemory || 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 更新UI
|
// 更新UI
|
||||||
|
|||||||
60
main.js
60
main.js
@@ -44,7 +44,7 @@ function createWindow() {
|
|||||||
// 隐藏窗口标题栏和任务栏显示
|
// 隐藏窗口标题栏和任务栏显示
|
||||||
titleBarStyle: 'hidden',
|
titleBarStyle: 'hidden',
|
||||||
// 隐藏窗口在Alt+Tab切换中显示
|
// 隐藏窗口在Alt+Tab切换中显示
|
||||||
hiddenInMissionControl: true
|
hiddenInMissionControl: true,
|
||||||
})
|
})
|
||||||
|
|
||||||
// 加载应用的index.html
|
// 加载应用的index.html
|
||||||
@@ -264,33 +264,43 @@ function startGpuMonitoring() {
|
|||||||
// 每秒获取一次GPU信息
|
// 每秒获取一次GPU信息
|
||||||
gpuMonitorInterval = setInterval(async () => {
|
gpuMonitorInterval = setInterval(async () => {
|
||||||
try {
|
try {
|
||||||
// 获取GPU信息
|
// 尝试使用nvidia-smi命令获取GPU信息
|
||||||
const graphicsData = await si.graphics()
|
const { exec } = require('child_process')
|
||||||
|
exec('nvidia-smi --query-gpu=utilization.gpu,memory.used,memory.total --format=csv,noheader,nounits', (error, stdout, stderr) => {
|
||||||
|
if (error) {
|
||||||
|
console.error('执行nvidia-smi时出错:', error)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// 过滤掉虚拟GPU设备(如OrayIddDriver等)
|
if (stderr) {
|
||||||
const physicalGpus = graphicsData.controllers.filter(controller => {
|
console.error('nvidia-smi stderr:', stderr)
|
||||||
// 忽略虚拟GPU和软件渲染器
|
return
|
||||||
const isVirtual = controller.model.includes('Oray') || controller.model.includes('Virtual') || controller.model.includes('Software') || controller.vendor.includes('Oray') || (controller.vram === 0 && !controller.memoryTotal)
|
}
|
||||||
return !isVirtual
|
|
||||||
|
// 解析输出
|
||||||
|
const data = stdout
|
||||||
|
.trim()
|
||||||
|
.split(',')
|
||||||
|
.map(item => parseInt(item.trim()))
|
||||||
|
if (data.length >= 3) {
|
||||||
|
const gpuInfo = [
|
||||||
|
{
|
||||||
|
name: 'NVIDIA GPU',
|
||||||
|
utilizationGpu: data[0],
|
||||||
|
memoryUsed: data[1],
|
||||||
|
memoryTotal: data[2],
|
||||||
|
vram: data[2],
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
// 发送GPU信息到渲染进程
|
||||||
|
if (mainWindow && !mainWindow.isDestroyed()) {
|
||||||
|
mainWindow.webContents.send('gpu-info', gpuInfo)
|
||||||
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// 提取显存信息
|
|
||||||
const gpuInfo = physicalGpus.map(controller => ({
|
|
||||||
name: controller.model,
|
|
||||||
memoryUsed: controller.memoryUsed,
|
|
||||||
memoryTotal: controller.memoryTotal,
|
|
||||||
memoryFree: controller.memoryFree,
|
|
||||||
utilizationGpu: controller.utilizationGpu,
|
|
||||||
temperature: controller.temperatureGpu,
|
|
||||||
vram: controller.vram,
|
|
||||||
}))
|
|
||||||
|
|
||||||
// 发送GPU信息到渲染进程
|
|
||||||
if (mainWindow && !mainWindow.isDestroyed()) {
|
|
||||||
mainWindow.webContents.send('gpu-info', gpuInfo)
|
|
||||||
}
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('获取GPU信息时出错:', error)
|
console.error('获取GPU信息时出错:', error)
|
||||||
}
|
}
|
||||||
}, 1000) // 每秒更新一次
|
}, 200) // 每秒更新一次
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,206 +0,0 @@
|
|||||||
{
|
|
||||||
root: 'E:\\yuantao\\motioner',
|
|
||||||
registry: 'https://registry.npmmirror.com',
|
|
||||||
pkgs: [],
|
|
||||||
production: false,
|
|
||||||
cacheStrict: false,
|
|
||||||
cacheDir: 'C:\\Users\\MSI\\.npminstall_tarball',
|
|
||||||
env: {
|
|
||||||
npm_config_registry: 'https://registry.npmmirror.com',
|
|
||||||
npm_config_argv: '{"remain":[],"cooked":["--fix-bug-versions","--china","--userconfig=C:\\\\Users\\\\MSI\\\\.cnpmrc","--disturl=https://cdn.npmmirror.com/binaries/node","--registry=https://registry.npmmirror.com"],"original":["--fix-bug-versions","--china","--userconfig=C:\\\\Users\\\\MSI\\\\.cnpmrc","--disturl=https://cdn.npmmirror.com/binaries/node","--registry=https://registry.npmmirror.com"]}',
|
|
||||||
npm_config_user_agent: 'npminstall/7.12.0 npm/? node/v24.0.1 win32 x64',
|
|
||||||
npm_config_cache: 'C:\\Users\\MSI\\.npminstall_tarball',
|
|
||||||
NODE: 'C:\\Users\\MSI\\.nvmd\\versions\\24.0.1\\node.exe',
|
|
||||||
npm_node_execpath: 'C:\\Users\\MSI\\.nvmd\\versions\\24.0.1\\node.exe',
|
|
||||||
npm_execpath: 'C:\\Users\\MSI\\.nvmd\\versions\\24.0.1\\node_modules\\cnpm\\node_modules\\npminstall\\bin\\install.js',
|
|
||||||
npm_config_userconfig: 'C:\\Users\\MSI\\.cnpmrc',
|
|
||||||
npm_config_disturl: 'https://cdn.npmmirror.com/binaries/node',
|
|
||||||
npm_config_r: 'https://registry.npmmirror.com',
|
|
||||||
COREPACK_NPM_REGISTRY: 'https://registry.npmmirror.com',
|
|
||||||
EDGEDRIVER_CDNURL: 'https://npmmirror.com/mirrors/edgedriver',
|
|
||||||
NODEJS_ORG_MIRROR: 'https://cdn.npmmirror.com/binaries/node',
|
|
||||||
NVM_NODEJS_ORG_MIRROR: 'https://cdn.npmmirror.com/binaries/node',
|
|
||||||
PHANTOMJS_CDNURL: 'https://cdn.npmmirror.com/binaries/phantomjs',
|
|
||||||
CHROMEDRIVER_CDNURL: 'https://cdn.npmmirror.com/binaries/chromedriver',
|
|
||||||
OPERADRIVER_CDNURL: 'https://cdn.npmmirror.com/binaries/operadriver',
|
|
||||||
CYPRESS_DOWNLOAD_PATH_TEMPLATE: 'https://cdn.npmmirror.com/binaries/cypress/${version}/${platform}-${arch}/cypress.zip',
|
|
||||||
ELECTRON_MIRROR: 'https://cdn.npmmirror.com/binaries/electron/',
|
|
||||||
ELECTRON_BUILDER_BINARIES_MIRROR: 'https://cdn.npmmirror.com/binaries/electron-builder-binaries/',
|
|
||||||
SASS_BINARY_SITE: 'https://cdn.npmmirror.com/binaries/node-sass',
|
|
||||||
SWC_BINARY_SITE: 'https://cdn.npmmirror.com/binaries/node-swc',
|
|
||||||
NWJS_URLBASE: 'https://cdn.npmmirror.com/binaries/nwjs/v',
|
|
||||||
PUPPETEER_DOWNLOAD_HOST: 'https://cdn.npmmirror.com/binaries/chrome-for-testing',
|
|
||||||
PUPPETEER_DOWNLOAD_BASE_URL: 'https://cdn.npmmirror.com/binaries/chrome-for-testing',
|
|
||||||
PUPPETEER_CHROME_DOWNLOAD_BASE_URL: 'https://cdn.npmmirror.com/binaries/chrome-for-testing',
|
|
||||||
PUPPETEER_CHROME_HEADLESS_SHELL_DOWNLOAD_BASE_URL: 'https://cdn.npmmirror.com/binaries/chrome-for-testing',
|
|
||||||
PLAYWRIGHT_DOWNLOAD_HOST: 'https://cdn.npmmirror.com/binaries/playwright',
|
|
||||||
SENTRYCLI_CDNURL: 'https://cdn.npmmirror.com/binaries/sentry-cli',
|
|
||||||
SAUCECTL_INSTALL_BINARY_MIRROR: 'https://cdn.npmmirror.com/binaries/saucectl',
|
|
||||||
RE2_DOWNLOAD_MIRROR: 'https://cdn.npmmirror.com/binaries/node-re2',
|
|
||||||
RE2_DOWNLOAD_SKIP_PATH: 'true',
|
|
||||||
PRISMA_ENGINES_MIRROR: 'https://cdn.npmmirror.com/binaries/prisma',
|
|
||||||
npm_config_better_sqlite3_binary_host: 'https://cdn.npmmirror.com/binaries/better-sqlite3',
|
|
||||||
npm_config_keytar_binary_host: 'https://cdn.npmmirror.com/binaries/keytar',
|
|
||||||
npm_config_sharp_binary_host: 'https://cdn.npmmirror.com/binaries/sharp',
|
|
||||||
npm_config_sharp_libvips_binary_host: 'https://cdn.npmmirror.com/binaries/sharp-libvips',
|
|
||||||
npm_config_robotjs_binary_host: 'https://cdn.npmmirror.com/binaries/robotjs',
|
|
||||||
npm_config_gl_binary_host: 'https://cdn.npmmirror.com/binaries/gl',
|
|
||||||
npm_rootpath: 'E:\\yuantao\\motioner',
|
|
||||||
INIT_CWD: 'E:\\yuantao\\motioner'
|
|
||||||
},
|
|
||||||
binaryMirrors: {
|
|
||||||
ENVS: {
|
|
||||||
COREPACK_NPM_REGISTRY: 'https://registry.npmmirror.com',
|
|
||||||
EDGEDRIVER_CDNURL: 'https://npmmirror.com/mirrors/edgedriver',
|
|
||||||
NODEJS_ORG_MIRROR: 'https://cdn.npmmirror.com/binaries/node',
|
|
||||||
NVM_NODEJS_ORG_MIRROR: 'https://cdn.npmmirror.com/binaries/node',
|
|
||||||
PHANTOMJS_CDNURL: 'https://cdn.npmmirror.com/binaries/phantomjs',
|
|
||||||
CHROMEDRIVER_CDNURL: 'https://cdn.npmmirror.com/binaries/chromedriver',
|
|
||||||
OPERADRIVER_CDNURL: 'https://cdn.npmmirror.com/binaries/operadriver',
|
|
||||||
CYPRESS_DOWNLOAD_PATH_TEMPLATE: 'https://cdn.npmmirror.com/binaries/cypress/${version}/${platform}-${arch}/cypress.zip',
|
|
||||||
ELECTRON_MIRROR: 'https://cdn.npmmirror.com/binaries/electron/',
|
|
||||||
ELECTRON_BUILDER_BINARIES_MIRROR: 'https://cdn.npmmirror.com/binaries/electron-builder-binaries/',
|
|
||||||
SASS_BINARY_SITE: 'https://cdn.npmmirror.com/binaries/node-sass',
|
|
||||||
SWC_BINARY_SITE: 'https://cdn.npmmirror.com/binaries/node-swc',
|
|
||||||
NWJS_URLBASE: 'https://cdn.npmmirror.com/binaries/nwjs/v',
|
|
||||||
PUPPETEER_DOWNLOAD_HOST: 'https://cdn.npmmirror.com/binaries/chrome-for-testing',
|
|
||||||
PUPPETEER_DOWNLOAD_BASE_URL: 'https://cdn.npmmirror.com/binaries/chrome-for-testing',
|
|
||||||
PUPPETEER_CHROME_DOWNLOAD_BASE_URL: 'https://cdn.npmmirror.com/binaries/chrome-for-testing',
|
|
||||||
PUPPETEER_CHROME_HEADLESS_SHELL_DOWNLOAD_BASE_URL: 'https://cdn.npmmirror.com/binaries/chrome-for-testing',
|
|
||||||
PLAYWRIGHT_DOWNLOAD_HOST: 'https://cdn.npmmirror.com/binaries/playwright',
|
|
||||||
SENTRYCLI_CDNURL: 'https://cdn.npmmirror.com/binaries/sentry-cli',
|
|
||||||
SAUCECTL_INSTALL_BINARY_MIRROR: 'https://cdn.npmmirror.com/binaries/saucectl',
|
|
||||||
RE2_DOWNLOAD_MIRROR: 'https://cdn.npmmirror.com/binaries/node-re2',
|
|
||||||
RE2_DOWNLOAD_SKIP_PATH: 'true',
|
|
||||||
PRISMA_ENGINES_MIRROR: 'https://cdn.npmmirror.com/binaries/prisma',
|
|
||||||
npm_config_better_sqlite3_binary_host: 'https://cdn.npmmirror.com/binaries/better-sqlite3',
|
|
||||||
npm_config_keytar_binary_host: 'https://cdn.npmmirror.com/binaries/keytar',
|
|
||||||
npm_config_sharp_binary_host: 'https://cdn.npmmirror.com/binaries/sharp',
|
|
||||||
npm_config_sharp_libvips_binary_host: 'https://cdn.npmmirror.com/binaries/sharp-libvips',
|
|
||||||
npm_config_robotjs_binary_host: 'https://cdn.npmmirror.com/binaries/robotjs',
|
|
||||||
npm_config_gl_binary_host: 'https://cdn.npmmirror.com/binaries/gl'
|
|
||||||
},
|
|
||||||
'@ali/s2': { host: 'https://cdn.npmmirror.com/binaries/looksgood-s2' },
|
|
||||||
sharp: { replaceHostFiles: [Array], replaceHostMap: [Object] },
|
|
||||||
'@tensorflow/tfjs-node': {
|
|
||||||
replaceHostFiles: [Array],
|
|
||||||
replaceHostRegExpMap: [Object],
|
|
||||||
replaceHostMap: [Object]
|
|
||||||
},
|
|
||||||
cypress: {
|
|
||||||
host: 'https://cdn.npmmirror.com/binaries/cypress',
|
|
||||||
newPlatforms: [Object]
|
|
||||||
},
|
|
||||||
'utf-8-validate': {
|
|
||||||
host: 'https://cdn.npmmirror.com/binaries/utf-8-validate/v{version}'
|
|
||||||
},
|
|
||||||
xprofiler: {
|
|
||||||
remote_path: './xprofiler/v{version}/',
|
|
||||||
host: 'https://cdn.npmmirror.com/binaries'
|
|
||||||
},
|
|
||||||
leveldown: { host: 'https://cdn.npmmirror.com/binaries/leveldown/v{version}' },
|
|
||||||
couchbase: { host: 'https://cdn.npmmirror.com/binaries/couchbase/v{version}' },
|
|
||||||
gl: { host: 'https://cdn.npmmirror.com/binaries/gl/v{version}' },
|
|
||||||
sqlite3: {
|
|
||||||
host: 'https://cdn.npmmirror.com/binaries/sqlite3',
|
|
||||||
remote_path: 'v{version}'
|
|
||||||
},
|
|
||||||
'@journeyapps/sqlcipher': { host: 'https://cdn.npmmirror.com/binaries' },
|
|
||||||
grpc: {
|
|
||||||
host: 'https://cdn.npmmirror.com/binaries',
|
|
||||||
remote_path: '{name}/v{version}'
|
|
||||||
},
|
|
||||||
'grpc-tools': { host: 'https://cdn.npmmirror.com/binaries' },
|
|
||||||
wrtc: {
|
|
||||||
host: 'https://cdn.npmmirror.com/binaries',
|
|
||||||
remote_path: '{name}/v{version}'
|
|
||||||
},
|
|
||||||
fsevents: { host: 'https://cdn.npmmirror.com/binaries/fsevents' },
|
|
||||||
nodejieba: { host: 'https://cdn.npmmirror.com/binaries/nodejieba' },
|
|
||||||
canvas: {
|
|
||||||
host: 'https://cdn.npmmirror.com/binaries/canvas',
|
|
||||||
remote_path: 'v{version}'
|
|
||||||
},
|
|
||||||
'skia-canvas': { host: 'https://cdn.npmmirror.com/binaries/skia-canvas' },
|
|
||||||
'flow-bin': {
|
|
||||||
replaceHost: 'https://github.com/facebook/flow/releases/download/v',
|
|
||||||
host: 'https://cdn.npmmirror.com/binaries/flow/v'
|
|
||||||
},
|
|
||||||
'jpegtran-bin': {
|
|
||||||
replaceHost: [Array],
|
|
||||||
host: 'https://cdn.npmmirror.com/binaries/jpegtran-bin'
|
|
||||||
},
|
|
||||||
'cwebp-bin': {
|
|
||||||
replaceHost: [Array],
|
|
||||||
host: 'https://cdn.npmmirror.com/binaries/cwebp-bin'
|
|
||||||
},
|
|
||||||
'zopflipng-bin': {
|
|
||||||
replaceHost: [Array],
|
|
||||||
host: 'https://cdn.npmmirror.com/binaries/zopflipng-bin'
|
|
||||||
},
|
|
||||||
'optipng-bin': {
|
|
||||||
replaceHost: [Array],
|
|
||||||
host: 'https://cdn.npmmirror.com/binaries/optipng-bin'
|
|
||||||
},
|
|
||||||
mozjpeg: {
|
|
||||||
replaceHost: [Array],
|
|
||||||
host: 'https://cdn.npmmirror.com/binaries/mozjpeg-bin'
|
|
||||||
},
|
|
||||||
gifsicle: {
|
|
||||||
replaceHost: [Array],
|
|
||||||
host: 'https://cdn.npmmirror.com/binaries/gifsicle-bin'
|
|
||||||
},
|
|
||||||
'pngquant-bin': {
|
|
||||||
replaceHost: [Array],
|
|
||||||
host: 'https://cdn.npmmirror.com/binaries/pngquant-bin',
|
|
||||||
replaceHostMap: [Object]
|
|
||||||
},
|
|
||||||
'pngcrush-bin': {
|
|
||||||
replaceHost: [Array],
|
|
||||||
host: 'https://cdn.npmmirror.com/binaries/pngcrush-bin'
|
|
||||||
},
|
|
||||||
'jpeg-recompress-bin': {
|
|
||||||
replaceHost: [Array],
|
|
||||||
host: 'https://cdn.npmmirror.com/binaries/jpeg-recompress-bin'
|
|
||||||
},
|
|
||||||
'advpng-bin': {
|
|
||||||
replaceHost: [Array],
|
|
||||||
host: 'https://cdn.npmmirror.com/binaries/advpng-bin'
|
|
||||||
},
|
|
||||||
'pngout-bin': {
|
|
||||||
replaceHost: [Array],
|
|
||||||
host: 'https://cdn.npmmirror.com/binaries/pngout-bin'
|
|
||||||
},
|
|
||||||
'jpegoptim-bin': {
|
|
||||||
replaceHost: [Array],
|
|
||||||
host: 'https://cdn.npmmirror.com/binaries/jpegoptim-bin'
|
|
||||||
},
|
|
||||||
argon2: { host: 'https://cdn.npmmirror.com/binaries/argon2' },
|
|
||||||
'ali-zeromq': { host: 'https://cdn.npmmirror.com/binaries/ali-zeromq' },
|
|
||||||
'ali-usb_ctl': { host: 'https://cdn.npmmirror.com/binaries/ali-usb_ctl' },
|
|
||||||
'gdal-async': { host: 'https://cdn.npmmirror.com/binaries/node-gdal-async' },
|
|
||||||
'libpg-query': { host: 'https://cdn.npmmirror.com/binaries' }
|
|
||||||
},
|
|
||||||
forbiddenLicenses: null,
|
|
||||||
flatten: false,
|
|
||||||
proxy: undefined,
|
|
||||||
prune: false,
|
|
||||||
disableFallbackStore: false,
|
|
||||||
workspacesMap: Map(0) {},
|
|
||||||
enableWorkspace: false,
|
|
||||||
workspaceRoot: 'E:\\yuantao\\motioner',
|
|
||||||
isWorkspaceRoot: true,
|
|
||||||
isWorkspacePackage: false,
|
|
||||||
offline: false,
|
|
||||||
strictSSL: true,
|
|
||||||
ignoreScripts: false,
|
|
||||||
foregroundScripts: false,
|
|
||||||
ignoreOptionalDependencies: false,
|
|
||||||
detail: false,
|
|
||||||
forceLinkLatest: false,
|
|
||||||
trace: false,
|
|
||||||
engineStrict: false,
|
|
||||||
registryOnly: false,
|
|
||||||
client: false,
|
|
||||||
autoFixVersion: [Function: autoFixVersion]
|
|
||||||
}
|
|
||||||
5106
package-lock.json
generated
5106
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -5,7 +5,6 @@
|
|||||||
"main": "main.js",
|
"main": "main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "electron .",
|
"start": "electron .",
|
||||||
"test": "echo \"Error: no test specified\" && exit 1",
|
|
||||||
"postinstall": "electron-builder install-app-deps",
|
"postinstall": "electron-builder install-app-deps",
|
||||||
"pack": "electron-builder --dir",
|
"pack": "electron-builder --dir",
|
||||||
"dist": "electron-builder"
|
"dist": "electron-builder"
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
const si = require('systeminformation');
|
|
||||||
|
|
||||||
si.graphics().then(data => {
|
|
||||||
console.log(JSON.stringify(data, null, 2));
|
|
||||||
}).catch(error => {
|
|
||||||
console.error('Error:', error);
|
|
||||||
});
|
|
||||||
Reference in New Issue
Block a user