@@ -1079,6 +1079,34 @@ function updateChartStats(gpuId, chartType, stats, unit) {
10791079 if ( avgEl ) avgEl . textContent = `${ formatter ( stats . avg ) } ${ unit } ` ;
10801080}
10811081
1082+ // Update statistics display for PCIe chart (RX and TX separately)
1083+ function updatePCIeChartStats ( gpuId , statsRX , statsTX ) {
1084+ const unit = ' KB/s' ;
1085+ const formatter = ( value ) => Math . round ( value ) ;
1086+
1087+ // Update RX stats
1088+ const rxCurrentEl = document . getElementById ( `stat-pcie-rx-current-${ gpuId } ` ) ;
1089+ const rxMinEl = document . getElementById ( `stat-pcie-rx-min-${ gpuId } ` ) ;
1090+ const rxMaxEl = document . getElementById ( `stat-pcie-rx-max-${ gpuId } ` ) ;
1091+ const rxAvgEl = document . getElementById ( `stat-pcie-rx-avg-${ gpuId } ` ) ;
1092+
1093+ if ( rxCurrentEl ) rxCurrentEl . textContent = `${ formatter ( statsRX . current ) } ${ unit } ` ;
1094+ if ( rxMinEl ) rxMinEl . textContent = `${ formatter ( statsRX . min ) } ${ unit } ` ;
1095+ if ( rxMaxEl ) rxMaxEl . textContent = `${ formatter ( statsRX . max ) } ${ unit } ` ;
1096+ if ( rxAvgEl ) rxAvgEl . textContent = `${ formatter ( statsRX . avg ) } ${ unit } ` ;
1097+
1098+ // Update TX stats
1099+ const txCurrentEl = document . getElementById ( `stat-pcie-tx-current-${ gpuId } ` ) ;
1100+ const txMinEl = document . getElementById ( `stat-pcie-tx-min-${ gpuId } ` ) ;
1101+ const txMaxEl = document . getElementById ( `stat-pcie-tx-max-${ gpuId } ` ) ;
1102+ const txAvgEl = document . getElementById ( `stat-pcie-tx-avg-${ gpuId } ` ) ;
1103+
1104+ if ( txCurrentEl ) txCurrentEl . textContent = `${ formatter ( statsTX . current ) } ${ unit } ` ;
1105+ if ( txMinEl ) txMinEl . textContent = `${ formatter ( statsTX . min ) } ${ unit } ` ;
1106+ if ( txMaxEl ) txMaxEl . textContent = `${ formatter ( statsTX . max ) } ${ unit } ` ;
1107+ if ( txAvgEl ) txAvgEl . textContent = `${ formatter ( statsTX . avg ) } ${ unit } ` ;
1108+ }
1109+
10821110// Update chart data
10831111function updateChart ( gpuId , chartType , value , value2 , value3 , value4 ) {
10841112 if ( ! chartData [ gpuId ] ) initGPUData ( gpuId ) ;
@@ -1134,27 +1162,32 @@ function updateChart(gpuId, chartType, value, value2, value3, value4) {
11341162 }
11351163
11361164 // Calculate and update statistics
1137- let statsData = data . data ;
1138- if ( chartType === 'clocks' ) statsData = data . graphicsData ;
1139- else if ( chartType === 'pcie' ) statsData = data . dataRX ;
1140- else if ( chartType === 'appclocks' ) statsData = data . dataGr ;
1141-
1142- const stats = calculateStats ( statsData ) ;
1143- const unitMap = {
1144- 'utilization' : '%' ,
1145- 'util' : '%' ,
1146- 'temperature' : '°C' ,
1147- 'temp' : '°C' ,
1148- 'memory' : '%' ,
1149- 'power' : 'W' ,
1150- 'fanSpeed' : '%' ,
1151- 'clocks' : ' MHz' ,
1152- 'efficiency' : ' %/W' ,
1153- 'pcie' : ' KB/s' ,
1154- 'appclocks' : ' MHz'
1155- } ;
1156- const unit = unitMap [ chartType ] || '' ;
1157- updateChartStats ( gpuId , chartType , stats , unit ) ;
1165+ if ( chartType === 'pcie' ) {
1166+ // Handle PCIe separately - need stats for both RX and TX
1167+ const statsRX = calculateStats ( data . dataRX ) ;
1168+ const statsTX = calculateStats ( data . dataTX ) ;
1169+ updatePCIeChartStats ( gpuId , statsRX , statsTX ) ;
1170+ } else {
1171+ let statsData = data . data ;
1172+ if ( chartType === 'clocks' ) statsData = data . graphicsData ;
1173+ else if ( chartType === 'appclocks' ) statsData = data . dataGr ;
1174+
1175+ const stats = calculateStats ( statsData ) ;
1176+ const unitMap = {
1177+ 'utilization' : '%' ,
1178+ 'util' : '%' ,
1179+ 'temperature' : '°C' ,
1180+ 'temp' : '°C' ,
1181+ 'memory' : '%' ,
1182+ 'power' : 'W' ,
1183+ 'fanSpeed' : '%' ,
1184+ 'clocks' : ' MHz' ,
1185+ 'efficiency' : ' %/W' ,
1186+ 'appclocks' : ' MHz'
1187+ } ;
1188+ const unit = unitMap [ chartType ] || '' ;
1189+ updateChartStats ( gpuId , chartType , stats , unit ) ;
1190+ }
11581191
11591192 // Update chart if it exists
11601193 if ( charts [ gpuId ] && charts [ gpuId ] [ chartType ] ) {
0 commit comments