VirtualBox

Changeset 102893 in vbox for trunk/src


Ignore:
Timestamp:
Jan 16, 2024 11:56:05 AM (13 months ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10501. Splitting disk IO charts.

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

    r102888 r102893  
    11901190    , m_strCPUMetricName("CPU Load")
    11911191    , m_strRAMMetricName("RAM Usage")
    1192     , m_strDiskIOMetricName("DiskIO")
    11931192    , m_iMaximumQueueSize(iMaximumQueueSize)
    11941193    , m_pMainLayout(0)
     
    13741373    , m_strVMExitMetricName("VMExits")
    13751374    , m_strNetworkMetricName("Network")
     1375    , m_strDiskIOMetricName("DiskIO")
    13761376    , m_fGuestAdditionsAvailable(false)
    13771377{
     
    19351935    , m_strNetworkInMetricName("Network Receive")
    19361936    , m_strNetworkOutMetricName("Network Transmit")
     1937    , m_strDiskIOReadMetricName("Disk Written")
     1938    , m_strDiskIOWrittenMetricName("Disk Read")
    19371939    , m_pMachineStateUpdateTimer(0)
    19381940    , m_enmMachineState(KCloudMachineState_Invalid)
     
    19401942    m_metricTypeNames[KMetricType_CpuUtilization] = m_strCPUMetricName;
    19411943    m_metricTypeNames[KMetricType_MemoryUtilization] = m_strRAMMetricName;
    1942     m_metricTypeNames[KMetricType_DiskBytesRead] = m_strDiskIOMetricName;
    1943     m_metricTypeNames[KMetricType_DiskBytesWritten] = m_strDiskIOMetricName;
     1944    m_metricTypeNames[KMetricType_DiskBytesRead] = m_strDiskIOReadMetricName;
     1945    m_metricTypeNames[KMetricType_DiskBytesWritten] = m_strDiskIOWrittenMetricName;
    19441946    m_metricTypeNames[KMetricType_NetworksBytesIn] = m_strNetworkInMetricName;
    19451947    m_metricTypeNames[KMetricType_NetworksBytesOut] = m_strNetworkOutMetricName;
     
    19591961    resetNetworkInInfoLabel();
    19601962    resetNetworkOutInfoLabel();
    1961     resetDiskIOInfoLabel();
     1963    resetDiskIOWrittenInfoLabel();
     1964    resetDiskIOReadInfoLabel();
    19621965    resetRAMInfoLabel();
    19631966
     
    21062109
    21072110    if (enmMetricType == KMetricType_NetworksBytesIn)
    2108     {
    2109         m_networkReceiveCache.clear();
    21102111        m_metrics[m_strNetworkInMetricName].reset();
    2111     }
    21122112    else if (enmMetricType == KMetricType_NetworksBytesOut)
    2113     {
    2114         m_networkTransmitCache.clear();
    21152113        m_metrics[m_strNetworkOutMetricName].reset();
    2116     }
    21172114    else if (enmMetricType == KMetricType_DiskBytesRead)
    2118     {
    2119         m_diskReadCache.clear();
    2120         m_metrics[m_strDiskIOMetricName].reset();
    2121     }
     2115        m_metrics[m_strDiskIOReadMetricName].reset();
    21222116    else if (enmMetricType == KMetricType_DiskBytesWritten)
    2123     {
    2124         m_diskWriteCache.clear();
    2125         m_metrics[m_strDiskIOMetricName].reset();
    2126 
    2127     }
     2117        m_metrics[m_strDiskIOWrittenMetricName].reset();
    21282118    else if (enmMetricType == KMetricType_CpuUtilization)
    21292119        m_metrics[m_strCPUMetricName].reset();
     
    21422132        else if (enmMetricType == KMetricType_NetworksBytesIn)
    21432133            updateNetworkInChart(newData[i], newTimeStamps[i]);
    2144         // else if (enmMetricType == KMetricType_DiskBytesRead)
    2145 
    2146         // else if (enmMetricType == KMetricType_DiskBytesWritten)
    2147         //     cacheDiskWrite(newTimeStamps[i], newData[i]);
     2134        else if (enmMetricType == KMetricType_DiskBytesRead)
     2135            updateDiskIOReadChart(newData[i], newTimeStamps[i]);
     2136        else if (enmMetricType == KMetricType_DiskBytesWritten)
     2137            updateDiskIOWrittenChart(newData[i], newTimeStamps[i]);
    21482138        else if (enmMetricType == KMetricType_MemoryUtilization)
    21492139        {
     
    22452235    resetNetworkInInfoLabel();
    22462236    resetNetworkOutInfoLabel();
    2247     resetDiskIOInfoLabel();
    2248 
    2249     m_diskWriteCache.clear();
    2250     m_diskReadCache.clear();
    2251 
    2252     m_networkReceiveCache.clear();
    2253     m_networkTransmitCache.clear();
     2237    resetDiskIOWrittenInfoLabel();
     2238    resetDiskIOReadInfoLabel();
    22542239
    22552240    update();
     
    23222307}
    23232308
    2324 void UIVMActivityMonitorCloud::updateDiskIOChart(quint64 uWriteRate, quint64 uReadRate, const QString &strLabel)
    2325 {
    2326     UIMetric &diskMetric = m_metrics[m_strDiskIOMetricName];
     2309void UIVMActivityMonitorCloud::updateDiskIOWrittenChart(quint64 uWriteRate, const QString &strLabel)
     2310{
     2311    UIMetric &diskMetric = m_metrics[m_strDiskIOWrittenMetricName];
    23272312
    23282313    diskMetric.addData(0, uWriteRate, strLabel);
    2329     diskMetric.addData(1, uReadRate);
    2330 
    2331     if (m_infoLabels.contains(m_strDiskIOMetricName)  && m_infoLabels[m_strDiskIOMetricName])
    2332     {
    2333         QString strInfo = QString("<b>%1</b></b><br/> <font color=\"%2\">%3: %4</font><br/> <font color=\"%5\">%6: %7</font>")
     2314
     2315
     2316    if (m_infoLabels.contains(m_strDiskIOWrittenMetricName)  && m_infoLabels[m_strDiskIOWrittenMetricName])
     2317    {
     2318        QString strInfo = QString("<b>%1</b></b><br/> <font color=\"%2\">%3: %4</font>")
    23342319            .arg(m_strDiskIOInfoLabelTitle)
    2335             .arg(dataColorString(m_strDiskIOMetricName, 0)).arg(m_strDiskIOInfoLabelWritten).arg(UITranslator::formatSize(uWriteRate, g_iDecimalCount))
    2336             .arg(dataColorString(m_strDiskIOMetricName, 1)).arg(m_strDiskIOInfoLabelRead).arg(UITranslator::formatSize(uReadRate, g_iDecimalCount));
    2337 
    2338         m_infoLabels[m_strDiskIOMetricName]->setText(strInfo);
    2339     }
    2340 
    2341     if (m_charts.contains(m_strDiskIOMetricName))
    2342         m_charts[m_strDiskIOMetricName]->update();
    2343 }
     2320            .arg(dataColorString(m_strDiskIOWrittenMetricName, 0)).arg(m_strDiskIOInfoLabelWritten).arg(UITranslator::formatSize(uWriteRate, g_iDecimalCount));
     2321
     2322        m_infoLabels[m_strDiskIOWrittenMetricName]->setText(strInfo);
     2323    }
     2324
     2325    if (m_charts.contains(m_strDiskIOWrittenMetricName))
     2326        m_charts[m_strDiskIOWrittenMetricName]->update();
     2327}
     2328
     2329void UIVMActivityMonitorCloud::updateDiskIOReadChart(quint64 uReadRate, const QString &strLabel)
     2330{
     2331    UIMetric &diskMetric = m_metrics[m_strDiskIOReadMetricName];
     2332
     2333    diskMetric.addData(0, uReadRate, strLabel);
     2334
     2335
     2336    if (m_infoLabels.contains(m_strDiskIOReadMetricName)  && m_infoLabels[m_strDiskIOReadMetricName])
     2337    {
     2338        QString strInfo = QString("<b>%1</b></b><br/> <font color=\"%2\">%3: %4</font>")
     2339            .arg(m_strDiskIOInfoLabelTitle)
     2340            .arg(dataColorString(m_strDiskIOReadMetricName, 1)).arg(m_strDiskIOInfoLabelRead).arg(UITranslator::formatSize(uReadRate, g_iDecimalCount));
     2341
     2342        m_infoLabels[m_strDiskIOReadMetricName]->setText(strInfo);
     2343    }
     2344
     2345    if (m_charts.contains(m_strDiskIOReadMetricName))
     2346        m_charts[m_strDiskIOReadMetricName]->update();
     2347}
     2348
    23442349
    23452350void UIVMActivityMonitorCloud::updateRAMChart(quint64 iUsedRAM, const QString &strLabel)
     
    24092414    m_metrics.insert(m_strNetworkOutMetricName, networkOutMetric);
    24102415
    2411     /* Disk IO metric */
    2412     UIMetric diskIOMetric(m_strDiskIOMetricName, "B", m_iMaximumQueueSize);
    2413     diskIOMetric.setDataSeriesName(0, "Write Rate");
    2414     diskIOMetric.setDataSeriesName(1, "Read Rate");
    2415     diskIOMetric.setAutoUpdateMaximum(true);
    2416     m_metrics.insert(m_strDiskIOMetricName, diskIOMetric);
     2416    /* Disk write metric */
     2417    UIMetric diskIOWrittenMetric(m_strDiskIOWrittenMetricName, "B", m_iMaximumQueueSize);
     2418    diskIOWrittenMetric.setDataSeriesName(0, "Write Rate");
     2419    diskIOWrittenMetric.setAutoUpdateMaximum(true);
     2420    m_metrics.insert(m_strDiskIOWrittenMetricName, diskIOWrittenMetric);
     2421
     2422    /* Disk read metric */
     2423    UIMetric diskIOReadMetric(m_strDiskIOReadMetricName, "B", m_iMaximumQueueSize);
     2424    diskIOReadMetric.setDataSeriesName(0, "Read Rate");
     2425    diskIOReadMetric.setAutoUpdateMaximum(true);
     2426    m_metrics.insert(m_strDiskIOReadMetricName, diskIOReadMetric);
    24172427
    24182428}
     
    24242434    QStringList chartOrder;
    24252435    chartOrder << m_strCPUMetricName << m_strRAMMetricName <<
    2426         m_strNetworkInMetricName << m_strNetworkOutMetricName << m_strDiskIOMetricName;
     2436        m_strNetworkInMetricName << m_strNetworkOutMetricName << m_strDiskIOWrittenMetricName << m_strDiskIOReadMetricName;
    24272437    int iRow = 0;
    24282438    foreach (const QString &strMetricName, chartOrder)
     
    25022512}
    25032513
    2504 void UIVMActivityMonitorCloud::resetDiskIOInfoLabel()
    2505 {
    2506     if (m_infoLabels.contains(m_strDiskIOMetricName)  && m_infoLabels[m_strDiskIOMetricName])
    2507     {
    2508         QString strInfo = QString("<b>%1</b></b><br/>%2: %3<br/>%4: %5")
     2514void UIVMActivityMonitorCloud::resetDiskIOWrittenInfoLabel()
     2515{
     2516    if (m_infoLabels.contains(m_strDiskIOWrittenMetricName)  && m_infoLabels[m_strDiskIOWrittenMetricName])
     2517    {
     2518        QString strInfo = QString("<b>%1</b></b><br/>%2: %3")
    25092519            .arg(m_strDiskIOInfoLabelTitle)
    2510             .arg(m_strDiskIOInfoLabelWritten).arg("--")
    2511             .arg(m_strDiskIOInfoLabelRead).arg("--");
    2512         m_infoLabels[m_strDiskIOMetricName]->setText(strInfo);
    2513     }
    2514 }
    2515 
    2516 void UIVMActivityMonitorCloud::cacheDiskWrite(const QString &strTimeStamp, quint64 iValue)
    2517 {
    2518     /* Make sure this is the first time we receieve write for this time stap: */
    2519     AssertReturnVoid(!m_diskWriteCache.contains(strTimeStamp));
    2520     /* If we have read rate for this time stamp just update the chart and remove related data from the cache: */
    2521     if (m_diskReadCache.contains(strTimeStamp))
    2522     {
    2523         updateDiskIOChart((quint64) iValue, (quint64) m_diskReadCache[strTimeStamp], strTimeStamp);
    2524         m_diskReadCache[strTimeStamp];
    2525     }
    2526     else
    2527         m_diskWriteCache[strTimeStamp] = iValue;
    2528 }
    2529 
    2530 void UIVMActivityMonitorCloud::cacheDiskRead(const QString &strTimeStamp, quint64 iValue)
    2531 {
    2532     /* Make sure this is the first time we receieve read for this time stap: */
    2533     AssertReturnVoid(!m_diskReadCache.contains(strTimeStamp));
    2534     /* If we have write rate for this time stamp just update the chart and remove related data from the cache: */
    2535     if (m_diskWriteCache.contains(strTimeStamp))
    2536     {
    2537         updateDiskIOChart((quint64) m_diskWriteCache[strTimeStamp], (quint64) iValue, strTimeStamp);
    2538         m_diskWriteCache.remove(strTimeStamp);
    2539     }
    2540     else
    2541         m_diskReadCache[strTimeStamp] = iValue;
    2542 }
    2543 
    2544 void UIVMActivityMonitorCloud::cacheNetworkReceive(const QString &, quint64 )
    2545 {
    2546     // AssertReturnVoid(!m_networkReceiveCache.contains(strTimeStamp));
    2547 
    2548     // if (m_networkTransmitCache.contains(strTimeStamp))
     2520            .arg(m_strDiskIOInfoLabelWritten).arg("--");
     2521        m_infoLabels[m_strDiskIOWrittenMetricName]->setText(strInfo);
     2522    }
     2523}
     2524
     2525void UIVMActivityMonitorCloud::resetDiskIOReadInfoLabel()
     2526{
     2527    // if (m_infoLabels.contains(m_strDiskIOMetricName)  && m_infoLabels[m_strDiskIOMetricName])
    25492528    // {
    2550     //     updateNetworkChart((quint64) iValue, (quint64) m_networkTransmitCache[strTimeStamp], strTimeStamp);
    2551     //     m_networkTransmitCache.remove(strTimeStamp);
     2529    //     QString strInfo = QString("<b>%1</b></b><br/>%2: %3<br/>%4: %5")
     2530    //         .arg(m_strDiskIOInfoLabelTitle)
     2531    //         .arg(m_strDiskIOInfoLabelWritten).arg("--")
     2532    //         .arg(m_strDiskIOInfoLabelRead).arg("--");
     2533    //     m_infoLabels[m_strDiskIOMetricName]->setText(strInfo);
    25522534    // }
    2553     // else
    2554     //     m_networkReceiveCache[strTimeStamp] = iValue;
    2555 }
    2556 
    2557 void UIVMActivityMonitorCloud::cacheNetworkTransmit(const QString &, quint64 )
    2558 {
    2559     // AssertReturnVoid(!m_networkTransmitCache.contains(strTimeStamp));
    2560 
    2561     // if (m_networkReceiveCache.contains(strTimeStamp))
    2562     // {
    2563     //     updateNetworkChart((quint64)  m_networkReceiveCache[strTimeStamp], (quint64) iValue, strTimeStamp);
    2564     //     m_networkReceiveCache.remove(strTimeStamp);
    2565     // }
    2566     // else
    2567     //     m_networkTransmitCache[strTimeStamp] = iValue;
    25682535}
    25692536
  • trunk/src/VBox/Frontends/VirtualBox/src/activity/vmactivity/UIVMActivityMonitor.h

    r102888 r102893  
    174174      * @{ */
    175175        virtual void resetCPUInfoLabel() = 0;
    176         virtual void resetDiskIOInfoLabel() = 0;
    177176        void resetRAMInfoLabel();
    178177    /** @} */
     
    190189        QString m_strCPUMetricName;
    191190        QString m_strRAMMetricName;
    192         QString m_strDiskIOMetricName;
    193191    /** @} */
    194192
     
    294292    virtual void resetCPUInfoLabel();
    295293    void resetNetworkInfoLabel();
    296     virtual void resetDiskIOInfoLabel();
     294    void resetDiskIOInfoLabel();
    297295    virtual void prepareWidgets() RT_OVERRIDE;
    298296
    299297    QString m_strVMExitMetricName;
    300298    QString m_strNetworkMetricName;
     299    QString m_strDiskIOMetricName;
    301300
    302301    bool m_fGuestAdditionsAvailable;
     
    348347        void updateNetworkInChart(quint64 uReceive, const QString &strLabel);
    349348        void updateNetworkOutChart(quint64 uTransmit, const QString &strLabel);
    350         void updateDiskIOChart(quint64 uWriteRate, quint64 uReadRate, const QString &strLabel);
     349        void updateDiskIOReadChart(quint64 uReadRate, const QString &strLabel);
     350        void updateDiskIOWrittenChart(quint64 uWriteRate, const QString &strLabel);
    351351        void updateRAMChart(quint64 iUsagePercentage, const QString &strLabel);
    352352    /** @} */
     
    354354    void resetNetworkInInfoLabel();
    355355    void resetNetworkOutInfoLabel();
    356     virtual void resetDiskIOInfoLabel();
    357 
    358     /* Since we have a single UIMetric instance for disk IO we cache write and/or read until the other value arrives. Then update
    359      * the corresponding chart. */
    360     void cacheDiskWrite(const QString &strTimeStamp, quint64 iValue);
    361     void cacheDiskRead(const QString &strTimeStamp, quint64 iValue);
    362 
    363     void cacheNetworkReceive(const QString &strTimeStamp, quint64 iValue);
    364     void cacheNetworkTransmit(const QString &strTimeStamp, quint64 iValue);
     356    void resetDiskIOWrittenInfoLabel();
     357    void resetDiskIOReadInfoLabel();
    365358
    366359    bool findMetric(KMetricType enmMetricType, UIMetric &metric, int &iDataSeriesIndex) const;
     
    370363    QString m_strNetworkInMetricName;
    371364    QString m_strNetworkOutMetricName;
     365    QString m_strDiskIOReadMetricName;
     366    QString m_strDiskIOWrittenMetricName;
    372367
    373368    CCloudMachine m_comMachine;
     
    378373    QHash<KMetricType, QString> m_metricTypeNames;
    379374
    380     /* Key is time stamp we get from our Main API, value is disk write or read values. */
    381     QMap<QString, quint64> m_diskWriteCache;
    382     QMap<QString, quint64> m_diskReadCache;
    383 
    384     QMap<QString, quint64> m_networkReceiveCache;
    385     QMap<QString, quint64> m_networkTransmitCache;
    386375    /** Total amount of RAM in kb. */
    387376    quint64 m_iTotalRAM;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette