VirtualBox

Changeset 88748 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Apr 28, 2021 2:50:26 PM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: Scaling down the maximum of the vm activity 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

    r88721 r88748  
    632632    , m_fRequiresGuestAdditions(false)
    633633    , m_fIsInitialized(false)
     634    , m_fAutoUpdateMaximum(false)
    634635{
    635636    RT_NOREF(iMaximumQueueSize); /* Unused according to Clang 11. */
     
    673674}
    674675
    675 void UIMetric::addData(int iDataSeriesIndex, quint64 fData)
     676void UIMetric::addData(int iDataSeriesIndex, quint64 iData)
    676677{
    677678    if (iDataSeriesIndex >= DATA_SERIES_SIZE)
    678679        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
    680684    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;
    681689        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    }
    682697}
    683698
     
    764779    }
    765780    stream << "\n";
     781}
     782
     783void UIMetric::setAutoUpdateMaximum(bool fAuto)
     784{
     785    m_fAutoUpdateMaximum = fAuto;
     786}
     787
     788bool UIMetric::autoUpdateMaximum() const
     789{
     790    return m_fAutoUpdateMaximum;
    766791}
    767792
     
    11121137    networkMetric.setDataSeriesName(0, "Receive Rate");
    11131138    networkMetric.setDataSeriesName(1, "Transmit Rate");
     1139    networkMetric.setAutoUpdateMaximum(true);
    11141140    m_metrics.insert(m_strNetworkMetricName, networkMetric);
    11151141
     
    11181144    diskIOMetric.setDataSeriesName(0, "Write Rate");
    11191145    diskIOMetric.setDataSeriesName(1, "Read Rate");
     1146    diskIOMetric.setAutoUpdateMaximum(true);
    11201147    m_metrics.insert(m_strDiskIOMetricName, diskIOMetric);
    11211148
    11221149    /* VM exits metric */
    11231150    UIMetric VMExitsMetric(m_strVMExitMetricName, "times", g_iMaximumQueueSize);
     1151    VMExitsMetric.setAutoUpdateMaximum(true);
    11241152    m_metrics.insert(m_strVMExitMetricName, VMExitsMetric);
    11251153}
     
    12571285    NetMetric.addData(0, iReceiveRate);
    12581286    NetMetric.addData(1, iTransmitRate);
    1259     quint64 iMaximum = qMax(NetMetric.maximum(), qMax(iReceiveRate, iTransmitRate));
    1260     NetMetric.setMaximum(iMaximum);
    12611287
    12621288    if (m_infoLabels.contains(m_strNetworkMetricName)  && m_infoLabels[m_strNetworkMetricName])
     
    13591385    }
    13601386
    1361     quint64 iMaximum = qMax(diskMetric.maximum(), qMax(iWriteRate, iReadRate));
    1362     diskMetric.setMaximum(iMaximum);
    1363 
    13641387    if (m_infoLabels.contains(m_strDiskIOMetricName)  && m_infoLabels[m_strDiskIOMetricName])
    13651388    {
     
    13911414    }
    13921415    VMExitMetric.addData(0, iRate);
    1393     quint64 iMaximum = qMax(VMExitMetric.maximum(), iRate);
    1394     VMExitMetric.setMaximum(iMaximum);
    13951416    if (m_infoLabels.contains(m_strVMExitMetricName)  && m_infoLabels[m_strVMExitMetricName])
    13961417    {
  • trunk/src/VBox/Frontends/VirtualBox/src/activity/vmactivity/UIVMActivityMonitor.h

    r88721 r88748  
    8686    void reset();
    8787    void toFile(QTextStream &stream) const;
     88
     89    void setAutoUpdateMaximum(bool fAuto);
     90    bool autoUpdateMaximum() const;
    8891
    8992private:
     
    104107      * compute time step data from total deltas. m_isInitialised is true if the total has been set first time. */
    105108    bool m_fIsInitialized;
     109    /** Maximum is updated as a new data is added to data queue. */
     110    bool m_fAutoUpdateMaximum;
    106111};
    107112
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