chore: add back GPU information to system monitoring bar (#3350)
* chore: add back GPU information to system monitoring bar * update template name * Update bug_report.md --------- Co-authored-by: Van Pham <64197333+Van-QA@users.noreply.github.com>
This commit is contained in:
parent
9e29fcd69e
commit
03455a9180
4
.github/ISSUE_TEMPLATE/bug_report.md
vendored
4
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
name: _Bug report
|
name: Report
|
||||||
about: Create a report to help us improve Jan
|
about: Create a report to help us improve Jan
|
||||||
title: 'bug: [DESCRIPTION]'
|
title: 'bug: '
|
||||||
labels: 'type: bug'
|
labels: 'type: bug'
|
||||||
assignees: ''
|
assignees: ''
|
||||||
|
|
||||||
|
|||||||
@ -7,9 +7,15 @@ export interface ResourceStatus {
|
|||||||
cpu: {
|
cpu: {
|
||||||
usage: number
|
usage: number
|
||||||
}
|
}
|
||||||
|
gpus: GpuInfo[]
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface UsedMemInfo {
|
export interface UsedMemInfo {
|
||||||
total: number
|
total: number
|
||||||
used: number
|
used: number
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface GpuInfo {
|
||||||
|
name: string | undefined
|
||||||
|
vram: UsedMemInfo
|
||||||
|
}
|
||||||
|
|||||||
@ -123,7 +123,7 @@
|
|||||||
"request": "^2.88.2",
|
"request": "^2.88.2",
|
||||||
"request-progress": "^3.0.0",
|
"request-progress": "^3.0.0",
|
||||||
"@kirillvakalov/nut-tree__nut-js": "4.2.1-2",
|
"@kirillvakalov/nut-tree__nut-js": "4.2.1-2",
|
||||||
"cortexso": "v0.5.0-40"
|
"cortexso": "v0.5.0-43"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/js-yaml": "4.0.9",
|
"@types/js-yaml": "4.0.9",
|
||||||
|
|||||||
@ -35,7 +35,7 @@ const SystemMonitor: React.FC = () => {
|
|||||||
const [usedRam, setUsedRam] = useAtom(usedRamAtom)
|
const [usedRam, setUsedRam] = useAtom(usedRamAtom)
|
||||||
const [totalRam, setTotalRam] = useAtom(totalRamAtom)
|
const [totalRam, setTotalRam] = useAtom(totalRamAtom)
|
||||||
const [cpuUsage, setCpuUsage] = useAtom(cpuUsageAtom)
|
const [cpuUsage, setCpuUsage] = useAtom(cpuUsageAtom)
|
||||||
const gpus = useAtomValue(gpusAtom)
|
const [gpus, setGpus] = useAtom(gpusAtom)
|
||||||
|
|
||||||
const [showFullScreen, setShowFullScreen] = useState(false)
|
const [showFullScreen, setShowFullScreen] = useState(false)
|
||||||
const [showSystemMonitorPanel, setShowSystemMonitorPanel] = useAtom(
|
const [showSystemMonitorPanel, setShowSystemMonitorPanel] = useAtom(
|
||||||
@ -63,13 +63,18 @@ const SystemMonitor: React.FC = () => {
|
|||||||
setUsedRam(resourceEvent.mem.used)
|
setUsedRam(resourceEvent.mem.used)
|
||||||
setTotalRam(resourceEvent.mem.total)
|
setTotalRam(resourceEvent.mem.total)
|
||||||
setCpuUsage(resourceEvent.cpu.usage)
|
setCpuUsage(resourceEvent.cpu.usage)
|
||||||
|
setGpus(
|
||||||
|
resourceEvent.gpus?.filter(
|
||||||
|
(gpu) => gpu.name && gpu.vram.used && gpu.vram.total
|
||||||
|
) ?? []
|
||||||
|
)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err)
|
console.error(err)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
signal: abortControllerRef.current.signal,
|
signal: abortControllerRef.current.signal,
|
||||||
})
|
})
|
||||||
}, [host, setTotalRam, setUsedRam, setCpuUsage])
|
}, [host, setTotalRam, setUsedRam, setCpuUsage, setGpus])
|
||||||
|
|
||||||
const unregister = useCallback(() => {
|
const unregister = useCallback(() => {
|
||||||
if (!abortControllerRef.current) return
|
if (!abortControllerRef.current) return
|
||||||
@ -195,8 +200,7 @@ const SystemMonitor: React.FC = () => {
|
|||||||
<div className="flex gap-x-2">
|
<div className="flex gap-x-2">
|
||||||
<div className="">
|
<div className="">
|
||||||
<span>
|
<span>
|
||||||
{gpu.memoryTotal - gpu.memoryFree}/
|
{gpu.vram.used}/{gpu.vram.total}
|
||||||
{gpu.memoryTotal}
|
|
||||||
</span>
|
</span>
|
||||||
<span> MB</span>
|
<span> MB</span>
|
||||||
</div>
|
</div>
|
||||||
@ -205,12 +209,17 @@ const SystemMonitor: React.FC = () => {
|
|||||||
|
|
||||||
<div className="flex items-center gap-x-4">
|
<div className="flex items-center gap-x-4">
|
||||||
<Progress
|
<Progress
|
||||||
value={gpu.utilization}
|
value={Math.round(
|
||||||
|
(gpu.vram.used / Math.max(gpu.vram.total, 1)) * 100
|
||||||
|
)}
|
||||||
className="w-full"
|
className="w-full"
|
||||||
size="small"
|
size="small"
|
||||||
/>
|
/>
|
||||||
<span className="flex-shrink-0 ">
|
<span className="flex-shrink-0 ">
|
||||||
{gpu.utilization}%
|
{Math.round(
|
||||||
|
(gpu.vram.used / Math.max(gpu.vram.total, 1)) * 100
|
||||||
|
)}
|
||||||
|
%
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
import { GpuInfo } from '@janhq/core/.'
|
||||||
import { atom } from 'jotai'
|
import { atom } from 'jotai'
|
||||||
|
|
||||||
export const totalRamAtom = atom<number>(0)
|
export const totalRamAtom = atom<number>(0)
|
||||||
@ -5,7 +6,7 @@ export const usedRamAtom = atom<number>(0)
|
|||||||
|
|
||||||
export const cpuUsageAtom = atom<number>(0)
|
export const cpuUsageAtom = atom<number>(0)
|
||||||
|
|
||||||
export const gpusAtom = atom<Record<string, never>[]>([])
|
export const gpusAtom = atom<GpuInfo[]>([])
|
||||||
|
|
||||||
export const nvidiaTotalVramAtom = atom<number>(0)
|
export const nvidiaTotalVramAtom = atom<number>(0)
|
||||||
export const availableVramAtom = atom<number>(0)
|
export const availableVramAtom = atom<number>(0)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user