@@ -5,32 +5,37 @@ let gpuUsageHistory = [];
55const maxHistory = 30 ;
66
77ipcRenderer . on ( 'update-stats' , ( event , stats ) => {
8- document . getElementById ( 'cpu-temp' ) . textContent = stats . cpuTemp || 'N/A' ;
9- document . getElementById ( 'cpu-usage' ) . textContent = stats . cpuUsage || 'N/A' ;
10- document . getElementById ( 'cpu-freq' ) . textContent = stats . cpuFreq || 'N/A' ;
11- document . getElementById ( 'cpu-fan' ) . textContent = stats . cpuFan || 'N/A' ;
12- document . getElementById ( 'gpu-temp' ) . textContent = stats . gpuTemp || 'N/A' ;
13- document . getElementById ( 'gpu-usage' ) . textContent = stats . gpuUsage || 'N/A' ;
14- document . getElementById ( 'gpu-fan' ) . textContent = stats . gpuFan || 'N/A' ;
15- document . getElementById ( 'gpu-mem' ) . textContent = stats . gpuMem || 'N/A' ;
16- document . getElementById ( 'ram-usage' ) . textContent = stats . ramUsage || 'N/A' ;
17- document . getElementById ( 'disk-usage' ) . textContent = stats . diskUsage || 'N/A' ;
18- document . getElementById ( 'battery-level' ) . textContent = stats . batteryLevel || 'N/A' ;
19- document . getElementById ( 'uptime' ) . textContent = stats . uptime || 'N/A' ;
20- document . getElementById ( 'net-download' ) . textContent = stats . netDownload || 'N/A' ;
21- document . getElementById ( 'net-upload' ) . textContent = stats . netUpload || 'N/A' ;
22- document . getElementById ( 'fps' ) . textContent = stats . fps || 'N/A' ;
8+ document . getElementById ( 'cpu-temp' ) . textContent = stats . cpuTemp ;
9+ document . getElementById ( 'cpu-usage' ) . textContent = stats . cpuUsage ;
10+ document . getElementById ( 'cpu-freq' ) . textContent = stats . cpuFreq ;
11+ document . getElementById ( 'cpu-voltage' ) . textContent = stats . cpuVoltage ;
12+ document . getElementById ( 'cpu-fan' ) . textContent = stats . cpuFan ;
13+ document . getElementById ( 'gpu-temp' ) . textContent = stats . gpuTemp ;
14+ document . getElementById ( 'gpu-usage' ) . textContent = stats . gpuUsage ;
15+ document . getElementById ( 'gpu-fan' ) . textContent = stats . gpuFan ;
16+ document . getElementById ( 'gpu-mem' ) . textContent = stats . gpuMem ;
17+ document . getElementById ( 'gpu-power' ) . textContent = stats . gpuPower ;
18+ document . getElementById ( 'ram-usage' ) . textContent = stats . ramUsage ;
19+ document . getElementById ( 'disk-usage' ) . textContent = stats . diskUsage ;
20+ document . getElementById ( 'battery-level' ) . textContent = stats . batteryLevel ;
21+ document . getElementById ( 'uptime' ) . textContent = stats . uptime ;
22+ document . getElementById ( 'net-download' ) . textContent = stats . netDownload ;
23+ document . getElementById ( 'net-upload' ) . textContent = stats . netUpload ;
24+ document . getElementById ( 'fps' ) . textContent = stats . fps ;
25+ document . getElementById ( 'load-avg' ) . textContent = stats . loadAvg ;
2326
2427 if ( stats . cpuUsage !== 'N/A' ) {
2528 cpuUsageHistory . push ( parseFloat ( stats . cpuUsage ) ) ;
2629 if ( cpuUsageHistory . length > maxHistory ) cpuUsageHistory . shift ( ) ;
2730 drawCpuChart ( ) ;
31+ drawCpuGauge ( parseFloat ( stats . cpuUsage ) || 0 ) ;
2832 }
2933
3034 if ( stats . gpuUsage !== 'N/A' ) {
3135 gpuUsageHistory . push ( parseFloat ( stats . gpuUsage ) ) ;
3236 if ( gpuUsageHistory . length > maxHistory ) gpuUsageHistory . shift ( ) ;
3337 drawGpuChart ( ) ;
38+ drawGpuGauge ( parseFloat ( stats . gpuUsage ) || 0 ) ;
3439 }
3540} ) ;
3641
@@ -58,3 +63,43 @@ function drawLineChart(ctx, data, color) {
5863 } ) ;
5964 ctx . stroke ( ) ;
6065}
66+
67+ function drawCpuGauge ( value ) {
68+ const ctx = document . getElementById ( 'cpu-gauge' ) . getContext ( '2d' ) ;
69+ drawGauge ( ctx , value / 100 , '#00BFFF' , 'CPU Usage' ) ;
70+ }
71+
72+ function drawGpuGauge ( value ) {
73+ const ctx = document . getElementById ( 'gpu-gauge' ) . getContext ( '2d' ) ;
74+ drawGauge ( ctx , value / 100 , '#FF4500' , 'GPU Usage' ) ;
75+ }
76+
77+ function drawGauge ( ctx , percent , color , label ) {
78+ const width = ctx . canvas . width ;
79+ const height = ctx . canvas . height ;
80+ const radius = Math . min ( width , height ) / 2 - 10 ;
81+ const centerX = width / 2 ;
82+ const centerY = height / 2 ;
83+
84+ ctx . clearRect ( 0 , 0 , width , height ) ;
85+
86+ // Background arc
87+ ctx . beginPath ( ) ;
88+ ctx . arc ( centerX , centerY , radius , Math . PI * 0.75 , Math . PI * 2.25 ) ;
89+ ctx . lineWidth = 10 ;
90+ ctx . strokeStyle = 'rgba(255,255,255,0.2)' ;
91+ ctx . stroke ( ) ;
92+
93+ // Value arc
94+ ctx . beginPath ( ) ;
95+ ctx . arc ( centerX , centerY , radius , Math . PI * 0.75 , Math . PI * 0.75 + ( Math . PI * 1.5 * percent ) ) ;
96+ ctx . strokeStyle = color ;
97+ ctx . stroke ( ) ;
98+
99+ // Text
100+ ctx . font = '16px Arial' ;
101+ ctx . fillStyle = '#FFF' ;
102+ ctx . textAlign = 'center' ;
103+ ctx . fillText ( label , centerX , centerY - 10 ) ;
104+ ctx . fillText ( ( percent * 100 ) . toFixed ( 0 ) + '%' , centerX , centerY + 10 ) ;
105+ }
0 commit comments