Changeset 88748 in vbox for trunk/src/VBox
- Timestamp:
- Apr 28, 2021 2:50:26 PM (4 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/activity/vmactivity
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/activity/vmactivity/UIVMActivityMonitor.cpp
r88721 r88748 632 632 , m_fRequiresGuestAdditions(false) 633 633 , m_fIsInitialized(false) 634 , m_fAutoUpdateMaximum(false) 634 635 { 635 636 RT_NOREF(iMaximumQueueSize); /* Unused according to Clang 11. */ … … 673 674 } 674 675 675 void UIMetric::addData(int iDataSeriesIndex, quint64 fData)676 void UIMetric::addData(int iDataSeriesIndex, quint64 iData) 676 677 { 677 678 if (iDataSeriesIndex >= DATA_SERIES_SIZE) 678 679 return; 679 m_data[iDataSeriesIndex].enqueue(fData); 680 m_data[iDataSeriesIndex].enqueue(iData); 681 if (m_fAutoUpdateMaximum) 682 m_iMaximum = qMax(m_iMaximum, iData); 683 680 684 if (m_data[iDataSeriesIndex].size() > g_iMaximumQueueSize) 685 { 686 bool fSearchMax = false; 687 if (m_fAutoUpdateMaximum && m_data[iDataSeriesIndex].head() >= m_iMaximum) 688 fSearchMax = true; 681 689 m_data[iDataSeriesIndex].dequeue(); 690 if (fSearchMax) 691 { 692 m_iMaximum = 0; 693 foreach (quint64 iVal, m_data[iDataSeriesIndex]) 694 m_iMaximum = qMax(m_iMaximum, iVal); 695 } 696 } 682 697 } 683 698 … … 764 779 } 765 780 stream << "\n"; 781 } 782 783 void UIMetric::setAutoUpdateMaximum(bool fAuto) 784 { 785 m_fAutoUpdateMaximum = fAuto; 786 } 787 788 bool UIMetric::autoUpdateMaximum() const 789 { 790 return m_fAutoUpdateMaximum; 766 791 } 767 792 … … 1112 1137 networkMetric.setDataSeriesName(0, "Receive Rate"); 1113 1138 networkMetric.setDataSeriesName(1, "Transmit Rate"); 1139 networkMetric.setAutoUpdateMaximum(true); 1114 1140 m_metrics.insert(m_strNetworkMetricName, networkMetric); 1115 1141 … … 1118 1144 diskIOMetric.setDataSeriesName(0, "Write Rate"); 1119 1145 diskIOMetric.setDataSeriesName(1, "Read Rate"); 1146 diskIOMetric.setAutoUpdateMaximum(true); 1120 1147 m_metrics.insert(m_strDiskIOMetricName, diskIOMetric); 1121 1148 1122 1149 /* VM exits metric */ 1123 1150 UIMetric VMExitsMetric(m_strVMExitMetricName, "times", g_iMaximumQueueSize); 1151 VMExitsMetric.setAutoUpdateMaximum(true); 1124 1152 m_metrics.insert(m_strVMExitMetricName, VMExitsMetric); 1125 1153 } … … 1257 1285 NetMetric.addData(0, iReceiveRate); 1258 1286 NetMetric.addData(1, iTransmitRate); 1259 quint64 iMaximum = qMax(NetMetric.maximum(), qMax(iReceiveRate, iTransmitRate));1260 NetMetric.setMaximum(iMaximum);1261 1287 1262 1288 if (m_infoLabels.contains(m_strNetworkMetricName) && m_infoLabels[m_strNetworkMetricName]) … … 1359 1385 } 1360 1386 1361 quint64 iMaximum = qMax(diskMetric.maximum(), qMax(iWriteRate, iReadRate));1362 diskMetric.setMaximum(iMaximum);1363 1364 1387 if (m_infoLabels.contains(m_strDiskIOMetricName) && m_infoLabels[m_strDiskIOMetricName]) 1365 1388 { … … 1391 1414 } 1392 1415 VMExitMetric.addData(0, iRate); 1393 quint64 iMaximum = qMax(VMExitMetric.maximum(), iRate);1394 VMExitMetric.setMaximum(iMaximum);1395 1416 if (m_infoLabels.contains(m_strVMExitMetricName) && m_infoLabels[m_strVMExitMetricName]) 1396 1417 { -
trunk/src/VBox/Frontends/VirtualBox/src/activity/vmactivity/UIVMActivityMonitor.h
r88721 r88748 86 86 void reset(); 87 87 void toFile(QTextStream &stream) const; 88 89 void setAutoUpdateMaximum(bool fAuto); 90 bool autoUpdateMaximum() const; 88 91 89 92 private: … … 104 107 * compute time step data from total deltas. m_isInitialised is true if the total has been set first time. */ 105 108 bool m_fIsInitialized; 109 /** Maximum is updated as a new data is added to data queue. */ 110 bool m_fAutoUpdateMaximum; 106 111 }; 107 112
Note:
See TracChangeset
for help on using the changeset viewer.