Changeset 80411 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Aug 25, 2019 7:35:35 AM (5 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/runtime/information
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIInformationRuntime.cpp
r80409 r80411 804 804 , m_strRAMMetricName("RAM Usage") 805 805 , m_strDiskMetricName("Disk Usage") 806 , m_strNetworkMetricName("NetDebugger") 806 , m_strNetworkMetricName("Network") 807 , m_strDiskIOMetricName("DiskIO") 807 808 , m_iTimeStep(0) 808 809 { … … 826 827 foreach (UIChart *pChart, m_charts) 827 828 pChart->setXAxisLabel(QApplication::translate("UIVMInformationDialog", "Seconds")); 829 830 /* Translate the chart info labels: */ 828 831 int iMaximum = 0; 829 832 m_strCPUInfoLabelTitle = QApplication::translate("UIVMInformationDialog", "CPU Load"); 830 833 iMaximum = qMax(iMaximum, m_strCPUInfoLabelTitle.length()); 831 832 834 m_strCPUInfoLabelGuest = QApplication::translate("UIVMInformationDialog", "Guest Load"); 833 835 iMaximum = qMax(iMaximum, m_strCPUInfoLabelGuest.length()); 834 836 m_strCPUInfoLabelVMM = QApplication::translate("UIVMInformationDialog", "VMM Load"); 835 837 iMaximum = qMax(iMaximum, m_strCPUInfoLabelVMM.length()); 836 837 838 m_strRAMInfoLabelTitle = QApplication::translate("UIVMInformationDialog", "RAM Usage"); 838 839 iMaximum = qMax(iMaximum, m_strRAMInfoLabelTitle.length()); … … 843 844 m_strRAMInfoLabelUsed = QApplication::translate("UIVMInformationDialog", "Used"); 844 845 iMaximum = qMax(iMaximum, m_strRAMInfoLabelUsed.length()); 845 m_strNetworkInfoLabelTitle = QApplication::translate("UIVMInformationDialog", "Network ");846 m_strNetworkInfoLabelTitle = QApplication::translate("UIVMInformationDialog", "Network Rate"); 846 847 iMaximum = qMax(iMaximum, m_strNetworkInfoLabelTitle.length()); 847 848 m_strNetworkInfoLabelReceived = QApplication::translate("UIVMInformationDialog", "Receive Rate"); … … 853 854 m_strNetworkInfoLabelTransmittedTotal = QApplication::translate("UIVMInformationDialog", "Total Transmitted"); 854 855 iMaximum = qMax(iMaximum, m_strNetworkInfoLabelReceivedTotal.length()); 856 m_strDiskIOInfoLabelTitle = QApplication::translate("UIVMInformationDialog", "Disk IO Rate"); 857 iMaximum = qMax(iMaximum, m_strDiskIOInfoLabelTitle.length()); 858 m_strDiskIOInfoLabelWritten = QApplication::translate("UIVMInformationDialog", "Write Rate"); 859 iMaximum = qMax(iMaximum, m_strDiskIOInfoLabelWritten.length()); 860 m_strDiskIOInfoLabelRead = QApplication::translate("UIVMInformationDialog", "Read Rate"); 861 iMaximum = qMax(iMaximum, m_strDiskIOInfoLabelRead.length()); 862 m_strDiskIOInfoLabelWrittenTotal = QApplication::translate("UIVMInformationDialog", "Total Writen"); 863 iMaximum = qMax(iMaximum, m_strDiskIOInfoLabelWrittenTotal.length()); 864 m_strDiskIOInfoLabelReadTotal = QApplication::translate("UIVMInformationDialog", "Total Read"); 865 iMaximum = qMax(iMaximum, m_strDiskIOInfoLabelReadTotal.length()); 855 866 856 867 … … 892 903 893 904 QStringList chartOder; 894 chartOder << m_strCPUMetricName << m_strRAMMetricName << m_strDiskMetricName << m_strNetworkMetricName; 905 chartOder << m_strCPUMetricName << m_strRAMMetricName << 906 m_strDiskMetricName << m_strNetworkMetricName << m_strDiskIOMetricName; 895 907 int iRow = 0; 896 908 foreach (const QString &strMetricName, chartOder) … … 916 928 m_charts[m_strNetworkMetricName]->setUseGradientLineColor(false); 917 929 } 918 930 if (m_charts.contains(m_strDiskIOMetricName) && m_charts[m_strDiskIOMetricName]) 931 { 932 m_charts[m_strDiskIOMetricName]->setDrawPieChart(false); 933 m_charts[m_strDiskIOMetricName]->setUseGradientLineColor(false); 934 } 919 935 if (m_charts.contains(m_strCPUMetricName) && m_charts[m_strCPUMetricName]) 920 936 m_charts[m_strCPUMetricName]->setUseGradientLineColor(false); … … 992 1008 qulonglong uNetworkTotalReceive = 0; 993 1009 qulonglong uNetworkTotalTransmit = 0; 1010 1011 qulonglong uDiskIOTotalWritten = 0; 1012 qulonglong uDiskIOTotalRead = 0; 1013 994 1014 QVector<DebuggerMetricData> xmlData = getTotalCounterFromDegugger(m_strQueryString); 995 1015 for (QMap<QString, UISubMetric>::iterator iterator = m_subMetrics.begin(); … … 1011 1031 uNetworkTotalTransmit += data.m_counter; 1012 1032 } 1013 1033 else if (metric.name() == m_strDiskIOMetricName) 1034 { 1035 if (data.m_strName.contains("written", Qt::CaseInsensitive)) 1036 uDiskIOTotalWritten += data.m_counter; 1037 else if (data.m_strName.contains("read", Qt::CaseInsensitive)) 1038 uDiskIOTotalRead += data.m_counter; 1039 } 1014 1040 } 1015 1041 } 1016 1017 1042 } 1018 1043 } 1019 updateNetworkDebuggerGraphsAndMetric(uNetworkTotalReceive, uNetworkTotalTransmit); 1044 updateNetworkGraphsAndMetric(uNetworkTotalReceive, uNetworkTotalTransmit); 1045 updateDiskIOGraphsAndMetric(uDiskIOTotalWritten, uDiskIOTotalRead); 1020 1046 } 1021 1047 … … 1058 1084 1059 1085 m_subMetrics.insert(m_strCPUMetricName, UISubMetric(m_strCPUMetricName, "%", iMaximumQueueSize)); 1060 1061 UISubMetric networkMetric(m_strNetworkMetricName, "B", iMaximumQueueSize); 1062 QStringList networkDeviceList; 1063 networkDeviceList << "E1k" <<"VNet" << "PCNet"; 1064 networkMetric.setDeviceTypeList(networkDeviceList); 1065 QStringList networkMetricDataSubStringList; 1066 networkMetricDataSubStringList << "ReceiveBytes" << "TransmitBytes"; 1067 networkMetric.setMetricDataSubString(networkMetricDataSubStringList); 1068 m_subMetrics.insert(m_strNetworkMetricName, networkMetric); 1069 1086 { 1087 1088 /* Network metric: */ 1089 UISubMetric networkMetric(m_strNetworkMetricName, "B", iMaximumQueueSize); 1090 QStringList networkDeviceList; 1091 networkDeviceList << "E1k" <<"VNet" << "PCNet"; 1092 networkMetric.setDeviceTypeList(networkDeviceList); 1093 QStringList networkMetricDataSubStringList; 1094 networkMetricDataSubStringList << "ReceiveBytes" << "TransmitBytes"; 1095 networkMetric.setMetricDataSubString(networkMetricDataSubStringList); 1096 m_subMetrics.insert(m_strNetworkMetricName, networkMetric); 1097 } 1098 1099 /* Disk IO metric */ 1100 { 1101 UISubMetric diskIOMetric(m_strDiskIOMetricName, "B", iMaximumQueueSize); 1102 QStringList diskTypeList; 1103 diskTypeList << "LSILOGICSCSI" << "BUSLOGIC" 1104 << "AHCI" << "PIIX3IDE" << "I82078" << "LSILOGICSAS" << "MSD" << "NVME"; 1105 diskIOMetric.setDeviceTypeList(diskTypeList); 1106 QStringList diskIODataSubStringList; 1107 diskIODataSubStringList << "WrittenBytes" << "ReadBytes"; 1108 diskIOMetric.setMetricDataSubString(diskIODataSubStringList); 1109 m_subMetrics.insert(m_strDiskIOMetricName, diskIOMetric); 1110 } 1070 1111 for (QMap<QString, UISubMetric>::const_iterator iterator = m_subMetrics.begin(); 1071 1112 iterator != m_subMetrics.end(); ++iterator) … … 1162 1203 } 1163 1204 1164 void UIInformationRuntime::updateNetwork DebuggerGraphsAndMetric(qulonglong iReceiveTotal, qulonglong iTransmitTotal)1205 void UIInformationRuntime::updateNetworkGraphsAndMetric(qulonglong iReceiveTotal, qulonglong iTransmitTotal) 1165 1206 { 1166 1207 UISubMetric &NetMetric = m_subMetrics[m_strNetworkMetricName]; … … 1183 1224 { 1184 1225 QString strInfo; 1185 QString strReceiveColor;1186 1226 if (m_infoLabels[m_strNetworkMetricName]->isEnabled()) 1187 1227 strInfo = QString("<b>%1</b></b><br/><font color=\"%2\">%3: %4<br/>%5 %6</font><br/><font color=\"%7\">%8: %9<br/>%10 %11</font>") … … 1201 1241 if (m_charts.contains(m_strNetworkMetricName)) 1202 1242 m_charts[m_strNetworkMetricName]->update(); 1203 1204 } 1205 1243 } 1244 1245 void UIInformationRuntime::updateDiskIOGraphsAndMetric(qulonglong uDiskIOTotalWritten, qulonglong uDiskIOTotalRead) 1246 { 1247 UISubMetric &NetMetric = m_subMetrics[m_strDiskIOMetricName]; 1248 1249 qulonglong iWriteRate = uDiskIOTotalWritten - NetMetric.total(0); 1250 qulonglong iReadRate = uDiskIOTotalRead - NetMetric.total(1); 1251 1252 NetMetric.setTotal(0, uDiskIOTotalWritten); 1253 NetMetric.setTotal(1, uDiskIOTotalRead); 1254 1255 /* Do not set data and maximum if the timer has just started since we need to initialize totals "(t-1)" first: */ 1256 if (m_iTimeStep <= 1) 1257 return; 1258 NetMetric.addData(0, iWriteRate); 1259 NetMetric.addData(1, iReadRate); 1260 qulonglong iMaximum = qMax(NetMetric.maximum(), qMax(iWriteRate, iReadRate)); 1261 NetMetric.setMaximum(iMaximum); 1262 1263 if (m_infoLabels.contains(m_strDiskIOMetricName) && m_infoLabels[m_strDiskIOMetricName]) 1264 { 1265 QString strInfo; 1266 if (m_infoLabels[m_strDiskIOMetricName]->isEnabled()) 1267 strInfo = QString("<b>%1</b></b><br/><font color=\"%2\">%3: %4<br/>%5 %6</font><br/><font color=\"%7\">%8: %9<br/>%10 %11</font>") 1268 .arg(m_strDiskIOInfoLabelTitle) 1269 .arg(dataColorString(m_strDiskIOMetricName, 0)).arg(m_strDiskIOInfoLabelWritten).arg(uiCommon().formatSize((quint64)iWriteRate, iDecimalCount)) 1270 .arg(m_strDiskIOInfoLabelWrittenTotal).arg(uiCommon().formatSize((quint64)uDiskIOTotalWritten, iDecimalCount)) 1271 .arg(dataColorString(m_strDiskIOMetricName, 1)).arg(m_strDiskIOInfoLabelRead).arg(uiCommon().formatSize((quint64)iReadRate, iDecimalCount)) 1272 .arg(m_strDiskIOInfoLabelReadTotal).arg(uiCommon().formatSize((quint64)uDiskIOTotalRead, iDecimalCount)); 1273 1274 else 1275 strInfo = QString("<b>%1</b><br/>%2: %3<br/>%4: %5"). 1276 arg(m_strDiskIOInfoLabelTitle) 1277 .arg(m_strDiskIOInfoLabelWritten).arg("---") 1278 .arg(m_strDiskIOInfoLabelRead).arg("---"); 1279 m_infoLabels[m_strDiskIOMetricName]->setText(strInfo); 1280 } 1281 if (m_charts.contains(m_strDiskIOMetricName)) 1282 m_charts[m_strDiskIOMetricName]->update(); 1283 1284 } 1206 1285 1207 1286 QString UIInformationRuntime::dataColorString(const QString &strChartName, int iDataIndex) -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIInformationRuntime.h
r80409 r80411 151 151 void updateCPUGraphsAndMetric(ULONG iLoadPercentage, ULONG iOtherPercentage); 152 152 void updateRAMGraphsAndMetric(quint64 iTotalRAM, quint64 iFreeRAM); 153 void updateNetworkDebuggerGraphsAndMetric(qulonglong iReceiveTotal, qulonglong iTransmitTotal); 153 void updateNetworkGraphsAndMetric(qulonglong iReceiveTotal, qulonglong iTransmitTotal); 154 void updateDiskIOGraphsAndMetric(qulonglong uDiskIOTotalWritten, qulonglong uDiskIOTotalRead); 154 155 155 156 QString dataColorString(const QString &strChartName, int iDataIndex); … … 183 184 QString m_strDiskMetricName; 184 185 QString m_strNetworkMetricName; 186 QString m_strDiskIOMetricName; 185 187 /** @} */ 186 188 … … 202 204 QString m_strNetworkInfoLabelReceivedTotal; 203 205 QString m_strNetworkInfoLabelTransmittedTotal; 206 /** Disk IO info label strings. */ 207 QString m_strDiskIOInfoLabelTitle; 208 QString m_strDiskIOInfoLabelWritten; 209 QString m_strDiskIOInfoLabelRead; 210 QString m_strDiskIOInfoLabelWrittenTotal; 211 QString m_strDiskIOInfoLabelReadTotal; 204 212 /** @} */ 205 213 /** The following string is used while querrying CMachineDebugger. */
Note:
See TracChangeset
for help on using the changeset viewer.