VirtualBox

Changeset 103166 in vbox


Ignore:
Timestamp:
Feb 1, 2024 4:37:54 PM (12 months ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10501. Adding ram usage and using corrct decimal separator.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/activity
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/activity/overview/UIVMActivityOverviewWidget.cpp

    r103163 r103166  
    10001000
    10011001    int iDecimalCount = 2;
    1002 
     1002    QLocale locale;
    10031003    if (enmMetricType == KMetricType_CpuUtilization)
     1004    {
     1005        //QString QLocale::toString(double i, char f = 'g', int prec = 6) const
     1006
     1007        // m_columnData[VMActivityOverviewColumn_CPUGuestLoad] =
     1008        //     QString("%1%").arg(QString::number(data[0].toFloat(), 'f', iDecimalCount));
     1009
    10041010        m_columnData[VMActivityOverviewColumn_CPUGuestLoad] =
    1005             QString::number(data[0].toFloat(), 'f', iDecimalCount);
     1011            QString("%1%").arg(locale.toString(data[0].toFloat(), 'f', iDecimalCount));
     1012}
    10061013    else if (enmMetricType == KMetricType_MemoryUtilization)
    1007         m_columnData[VMActivityOverviewColumn_RAMUsedPercentage] =
    1008             QString::number(data[0].toFloat(), 'f', iDecimalCount);
     1014    {
     1015         if (m_uTotalRAM != 0)
     1016         {
     1017             quint64 uUsedRAM = (quint64)data[0].toFloat() * (m_uTotalRAM / 100.f);
     1018             m_columnData[VMActivityOverviewColumn_RAMUsedAndTotal] =
     1019                 QString("%1/%2").arg(UITranslator::formatSize(_1K * uUsedRAM, iDecimalCount)).
     1020                 arg(UITranslator::formatSize(_1K * m_uTotalRAM, iDecimalCount));
     1021         }
     1022         m_columnData[VMActivityOverviewColumn_RAMUsedPercentage] =
     1023             QString("%1%").arg(QString::number(data[0].toFloat(), 'f', iDecimalCount));
     1024    }
    10091025    else if (enmMetricType == KMetricType_NetworksBytesOut)
    10101026        m_columnData[VMActivityOverviewColumn_NetworkUpRate] =
     
    10321048    m_enmMachineState = enmState;
    10331049    if (isRunning())
     1050    {
    10341051        getMetricList();
     1052        if (m_uTotalRAM == 0)
     1053            m_uTotalRAM = UIMonitorCommon::determineTotalRAMAmount(m_comCloudMachine);
     1054    }
    10351055    else
    10361056    {
  • trunk/src/VBox/Frontends/VirtualBox/src/activity/vmactivity/UIVMActivityMonitor.cpp

    r103164 r103166  
    18101810
    18111811    setMachine(machine);
    1812     m_iTotalRAM = UIMonitorCommon::determineTotalRAMAmount(m_comMachine);
     1812    m_uTotalRAM = UIMonitorCommon::determineTotalRAMAmount(m_comMachine);
    18131813
    18141814    m_pMachineStateUpdateTimer = new QTimer(this);
     
    19611961        else if (enmMetricType == KMetricType_MemoryUtilization)
    19621962        {
    1963             if (m_iTotalRAM != 0)
     1963            if (m_uTotalRAM != 0)
    19641964            {
    19651965                /* calculate used RAM amount in kb: */
    19661966                if (newData[i] != uInvalidValueSentinel)
    19671967                {
    1968                     quint64 iUsedRAM = newData[i] * (m_iTotalRAM / 100.f);
     1968                    quint64 iUsedRAM = newData[i] * (m_uTotalRAM / 100.f);
    19691969                    updateRAMChart(iUsedRAM, newTimeStamps[i]);
    19701970                }
     
    21742174{
    21752175    UIMetric &RAMMetric = m_metrics[Metric_Type_RAM];
    2176     RAMMetric.setMaximum(m_iTotalRAM);
     2176    RAMMetric.setMaximum(m_uTotalRAM);
    21772177    RAMMetric.addData(0, iUsedRAM, strLabel);
    21782178
     
    21822182        strInfo = QString("<b>%1</b><br/>%2: %3<br/><font color=\"%4\">%5: %6</font><br/><font color=\"%7\">%8: %9</font>")
    21832183            .arg(m_strRAMInfoLabelTitle)
    2184             .arg(m_strRAMInfoLabelTotal).arg(UITranslator::formatSize(_1K * m_iTotalRAM, g_iDecimalCount))
    2185             .arg(dataColorString(Metric_Type_RAM, 1)).arg(m_strRAMInfoLabelFree).arg(UITranslator::formatSize(_1K * (m_iTotalRAM - iUsedRAM), g_iDecimalCount))
     2184            .arg(m_strRAMInfoLabelTotal).arg(UITranslator::formatSize(_1K * m_uTotalRAM, g_iDecimalCount))
     2185            .arg(dataColorString(Metric_Type_RAM, 1)).arg(m_strRAMInfoLabelFree).arg(UITranslator::formatSize(_1K * (m_uTotalRAM - iUsedRAM), g_iDecimalCount))
    21862186            .arg(dataColorString(Metric_Type_RAM, 0)).arg(m_strRAMInfoLabelUsed).arg(UITranslator::formatSize(_1K * iUsedRAM, g_iDecimalCount));
    21872187        m_infoLabels[Metric_Type_RAM]->setText(strInfo);
     
    22132213{
    22142214    /* RAM Metric: */
    2215     if (m_iTotalRAM != 0)
     2215    if (m_uTotalRAM != 0)
    22162216    {
    22172217        UIMetric ramMetric("kb", m_iMaximumQueueSize);
  • trunk/src/VBox/Frontends/VirtualBox/src/activity/vmactivity/UIVMActivityMonitor.h

    r103164 r103166  
    362362
    363363    /** Total amount of RAM in kb. */
    364     quint64 m_iTotalRAM;
     364    quint64 m_uTotalRAM;
    365365    QTimer *m_pMachineStateUpdateTimer;
    366366    KCloudMachineState m_enmMachineState;
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