Changeset 103164 in vbox
- Timestamp:
- Feb 1, 2024 4:14:28 PM (10 months ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/activity
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/activity/UIMonitorCommon.cpp
r103131 r103164 38 38 39 39 /* COM includes: */ 40 #include "CForm.h" 41 #include "CFormValue.h" 42 #include "CRangedIntegerFormValue.h" 40 43 #include "CMachineDebugger.h" 41 44 #include "CPerformanceCollector.h" 42 45 #include <VBox/com/VirtualBox.h> 43 46 44 47 … … 309 312 painter.drawPath(UIMonitorCommon::doughnutSlice(chartRect, innerRect, 90, fAngle)); 310 313 } 314 315 /* static */ 316 quint64 UIMonitorCommon::determineTotalRAMAmount(CCloudMachine &comCloudMachine) 317 { 318 quint64 iTotalRAM = 0; 319 CForm comForm = comCloudMachine.GetDetailsForm(); 320 /* Ignore cloud machine errors: */ 321 if (comCloudMachine.isOk()) 322 { 323 /* Common anchor for all fields: */ 324 const QString strAnchorType = "cloud"; 325 326 /* For each form value: */ 327 const QVector<CFormValue> values = comForm.GetValues(); 328 foreach (const CFormValue &comIteratedValue, values) 329 { 330 /* Ignore invisible values: */ 331 if (!comIteratedValue.GetVisible()) 332 continue; 333 334 /* Acquire label: */ 335 const QString strLabel = comIteratedValue.GetLabel(); 336 if (strLabel != "RAM") 337 continue; 338 339 AssertReturn((comIteratedValue.GetType() == KFormValueType_RangedInteger), 0); 340 341 CRangedIntegerFormValue comValue(comIteratedValue); 342 iTotalRAM = comValue.GetInteger(); 343 QString strRAMUnit = comValue.GetSuffix(); 344 if (strRAMUnit.compare("gb", Qt::CaseInsensitive) == 0) 345 iTotalRAM *= _1G / _1K; 346 else if (strRAMUnit.compare("mb", Qt::CaseInsensitive) == 0) 347 iTotalRAM *= _1M / _1K; 348 if (!comValue.isOk()) 349 iTotalRAM = 0; 350 } 351 } 352 return iTotalRAM; 353 } -
trunk/src/VBox/Frontends/VirtualBox/src/activity/UIMonitorCommon.h
r103131 r103164 131 131 const QRectF &chartRect, const QRectF &innerRect, int iOverlayAlpha, const QColor &color); 132 132 133 static quint64 determineTotalRAMAmount(CCloudMachine &comCloudMachine); 134 133 135 private: 134 136 -
trunk/src/VBox/Frontends/VirtualBox/src/activity/vmactivity/UIVMActivityMonitor.cpp
r103133 r103164 50 50 /* COM includes: */ 51 51 #include "CConsole.h" 52 #include "CForm.h"53 #include "CFormValue.h"54 52 #include "CGuest.h" 55 53 #include "CPerformanceCollector.h" 56 54 #include "CPerformanceMetric.h" 57 #include "CRangedIntegerFormValue.h"58 55 #include <iprt/string.h> 59 #include <VBox/com/VirtualBox.h>60 56 61 57 /* External includes: */ … … 1814 1810 1815 1811 setMachine(machine); 1816 determineTotalRAMAmount();1812 m_iTotalRAM = UIMonitorCommon::determineTotalRAMAmount(m_comMachine); 1817 1813 1818 1814 m_pMachineStateUpdateTimer = new QTimer(this); … … 1833 1829 /* Start the timer: */ 1834 1830 start(); 1835 }1836 1837 void UIVMActivityMonitorCloud::determineTotalRAMAmount()1838 {1839 CForm comForm = m_comMachine.GetDetailsForm();1840 /* Ignore cloud machine errors: */1841 if (m_comMachine.isOk())1842 {1843 /* Common anchor for all fields: */1844 const QString strAnchorType = "cloud";1845 1846 /* For each form value: */1847 const QVector<CFormValue> values = comForm.GetValues();1848 foreach (const CFormValue &comIteratedValue, values)1849 {1850 /* Ignore invisible values: */1851 if (!comIteratedValue.GetVisible())1852 continue;1853 1854 /* Acquire label: */1855 const QString strLabel = comIteratedValue.GetLabel();1856 if (strLabel != "RAM")1857 continue;1858 1859 AssertReturnVoid((comIteratedValue.GetType() == KFormValueType_RangedInteger));1860 1861 CRangedIntegerFormValue comValue(comIteratedValue);1862 m_iTotalRAM = comValue.GetInteger();1863 QString strRAMUnit = comValue.GetSuffix();1864 if (strRAMUnit.compare("gb", Qt::CaseInsensitive) == 0)1865 m_iTotalRAM *= _1G / _1K;1866 else if (strRAMUnit.compare("mb", Qt::CaseInsensitive) == 0)1867 m_iTotalRAM *= _1M / _1K;1868 if (!comValue.isOk())1869 m_iTotalRAM = 0;1870 }1871 }1872 1831 } 1873 1832 -
trunk/src/VBox/Frontends/VirtualBox/src/activity/vmactivity/UIVMActivityMonitor.h
r102903 r103164 353 353 bool findMetric(KMetricType enmMetricType, UIMetric &metric, int &iDataSeriesIndex) const; 354 354 void prepareMetrics(); 355 void determineTotalRAMAmount();356 355 357 356 CCloudMachine m_comMachine;
Note:
See TracChangeset
for help on using the changeset viewer.