VirtualBox

Changeset 102888 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Jan 16, 2024 10:58:24 AM (16 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
161110
Message:

FE/Qt: bugref:10501. Splitting network receive and transmit 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

    r102860 r102888  
    11851185UIVMActivityMonitor::UIVMActivityMonitor(EmbedTo enmEmbedding, QWidget *pParent, int iMaximumQueueSize)
    11861186    : QIWithRetranslateUI<QWidget>(pParent)
     1187    , m_pContainerLayout(0)
    11871188    , m_pTimer(0)
    11881189    , m_iTimeStep(0)
    11891190    , m_strCPUMetricName("CPU Load")
    11901191    , m_strRAMMetricName("RAM Usage")
    1191     , m_strNetworkMetricName("Network")
    11921192    , m_strDiskIOMetricName("DiskIO")
    1193     , m_strVMExitMetricName("VMExits")
    11941193    , m_iMaximumQueueSize(iMaximumQueueSize)
    11951194    , m_pMainLayout(0)
     
    12201219    m_strRAMInfoLabelUsed = QApplication::translate("UIVMInformationDialog", "Used");
    12211220    m_iMaximumLabelLength = qMax(m_iMaximumLabelLength, m_strRAMInfoLabelUsed.length());
    1222     m_strNetworkInfoLabelTitle = QApplication::translate("UIVMInformationDialog", "Network Rate");
    1223     m_iMaximumLabelLength = qMax(m_iMaximumLabelLength, m_strNetworkInfoLabelTitle.length());
    12241221    m_strNetworkInfoLabelReceived = QApplication::translate("UIVMInformationDialog", "Receive Rate");
    12251222    m_iMaximumLabelLength = qMax(m_iMaximumLabelLength, m_strNetworkInfoLabelReceived.length());
     
    12421239}
    12431240
    1244 // bool UIVMActivityMonitor::eventFilter(QObject *pObj, QEvent *pEvent)
    1245 // {
    1246 //     if (pEvent-> type() == QEvent::Enter ||
    1247 //         pEvent-> type() == QEvent::Leave)
    1248 //     {
    1249 //         UIChart *pChart = qobject_cast<UIChart*>(pObj);
    1250 //         if (pChart)
    1251 //             pChart->setMouseOver(pEvent-> type() == QEvent::Enter);
    1252 //     }
    1253 //     return false;
    1254 // }
    1255 
    12561241void UIVMActivityMonitor::prepareWidgets()
    12571242{
     
    12751260
    12761261    QWidget *pContainerWidget = new QWidget(pScrollArea);
    1277     QGridLayout *pContainerLayout = new QGridLayout(pContainerWidget);
    1278     pContainerWidget->setLayout(pContainerLayout);
    1279     pContainerLayout->setSpacing(10);
     1262    m_pContainerLayout = new QGridLayout(pContainerWidget);
     1263    pContainerWidget->setLayout(m_pContainerLayout);
     1264    m_pContainerLayout->setSpacing(10);
    12801265    pContainerWidget->show();
    12811266    pScrollArea->setWidget(pContainerWidget);
    12821267    pScrollArea->setWidgetResizable(true);
    1283 
    1284     QStringList chartOrder;
    1285     chartOrder << m_strCPUMetricName << m_strRAMMetricName <<
    1286         m_strNetworkMetricName << m_strDiskIOMetricName << m_strVMExitMetricName;
    1287     int iRow = 0;
    1288     foreach (const QString &strMetricName, chartOrder)
    1289     {
    1290         if (!m_metrics.contains(strMetricName))
    1291             continue;
    1292 
    1293         QHBoxLayout *pChartLayout = new QHBoxLayout;
    1294         pChartLayout->setSpacing(0);
    1295 
    1296         QLabel *pLabel = new QLabel(this);
    1297 
    1298         QPalette tempPal = pLabel->palette();
    1299         tempPal.setColor(QPalette::Window, tempPal.color(QPalette::Window).lighter(g_iBackgroundTint));
    1300         pLabel->setPalette(tempPal);
    1301         pLabel->setAutoFillBackground(true);
    1302 
    1303         pLabel->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
    1304         pChartLayout->addWidget(pLabel);
    1305         m_infoLabels.insert(strMetricName, pLabel);
    1306 
    1307         UIChart *pChart = new UIChart(this, &(m_metrics[strMetricName]), m_iMaximumQueueSize);
    1308         connect(pChart, &UIChart::sigExportMetricsToFile,
    1309                 this, &UIVMActivityMonitor::sltExportMetricsToFile);
    1310         connect(pChart, &UIChart::sigDataIndexUnderCursor,
    1311                 this, &UIVMActivityMonitor::sltChatDataIndexUnderCursorChanged);
    1312         m_charts.insert(strMetricName, pChart);
    1313         pChart->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
    1314         pChartLayout->addWidget(pChart);
    1315         pContainerLayout->addLayout(pChartLayout, iRow, 0, 1, 2);
    1316         ++iRow;
    1317     }
    1318 
    1319     QWidget *bottomSpacerWidget = new QWidget(this);
    1320     bottomSpacerWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
    1321     bottomSpacerWidget->setVisible(true);
    1322     pContainerLayout->addWidget(bottomSpacerWidget, iRow, 0, 1, 2);
    13231268}
    13241269
     
    13581303}
    13591304
    1360 void UIVMActivityMonitor::sltChatDataIndexUnderCursorChanged(int iIndex)
     1305void UIVMActivityMonitor::sltChartDataIndexUnderCursorChanged(int iIndex)
    13611306{
    13621307    Q_UNUSED(iIndex);
     
    14271372UIVMActivityMonitorLocal::UIVMActivityMonitorLocal(EmbedTo enmEmbedding, QWidget *pParent, const CMachine &machine)
    14281373    :UIVMActivityMonitor(enmEmbedding, pParent, 120 /* iMaximumQueueSize */)
     1374    , m_strVMExitMetricName("VMExits")
     1375    , m_strNetworkMetricName("Network")
    14291376    , m_fGuestAdditionsAvailable(false)
    14301377{
     
    14811428    m_strVMExitLabelTotal = QApplication::translate("UIVMInformationDialog", "Total");
    14821429    m_iMaximumLabelLength = qMax(m_iMaximumLabelLength, m_strVMExitLabelTotal.length());
    1483 
     1430    m_strNetworkInfoLabelTitle = QApplication::translate("UIVMInformationDialog", "Network Rate");
     1431    m_iMaximumLabelLength = qMax(m_iMaximumLabelLength, m_strNetworkInfoLabelTitle.length());
    14841432    setInfoLabelWidth();
    14851433}
     
    16461594}
    16471595
     1596void UIVMActivityMonitorLocal::prepareWidgets()
     1597{
     1598    UIVMActivityMonitor::prepareWidgets();
     1599
     1600    QStringList chartOrder;
     1601    chartOrder << m_strCPUMetricName << m_strRAMMetricName <<
     1602        m_strNetworkMetricName << m_strDiskIOMetricName << m_strVMExitMetricName;
     1603    int iRow = 0;
     1604    foreach (const QString &strMetricName, chartOrder)
     1605    {
     1606        if (!m_metrics.contains(strMetricName))
     1607            continue;
     1608
     1609        QHBoxLayout *pChartLayout = new QHBoxLayout;
     1610        pChartLayout->setSpacing(0);
     1611
     1612        QLabel *pLabel = new QLabel(this);
     1613
     1614        QPalette tempPal = pLabel->palette();
     1615        tempPal.setColor(QPalette::Window, tempPal.color(QPalette::Window).lighter(g_iBackgroundTint));
     1616        pLabel->setPalette(tempPal);
     1617        pLabel->setAutoFillBackground(true);
     1618
     1619        pLabel->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
     1620        pChartLayout->addWidget(pLabel);
     1621        m_infoLabels.insert(strMetricName, pLabel);
     1622
     1623        UIChart *pChart = new UIChart(this, &(m_metrics[strMetricName]), m_iMaximumQueueSize);
     1624        connect(pChart, &UIChart::sigExportMetricsToFile,
     1625                this, &UIVMActivityMonitor::sltExportMetricsToFile);
     1626        connect(pChart, &UIChart::sigDataIndexUnderCursor,
     1627                this, &UIVMActivityMonitor::sltChartDataIndexUnderCursorChanged);
     1628        m_charts.insert(strMetricName, pChart);
     1629        pChart->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
     1630        pChartLayout->addWidget(pChart);
     1631        m_pContainerLayout->addLayout(pChartLayout, iRow, 0, 1, 2);
     1632        ++iRow;
     1633    }
     1634
     1635    QWidget *bottomSpacerWidget = new QWidget(this);
     1636    bottomSpacerWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
     1637    bottomSpacerWidget->setVisible(true);
     1638    m_pContainerLayout->addWidget(bottomSpacerWidget, iRow, 0, 1, 2);
     1639}
     1640
    16481641void UIVMActivityMonitorLocal::prepareMetrics()
    16491642{
     
    19401933UIVMActivityMonitorCloud::UIVMActivityMonitorCloud(EmbedTo enmEmbedding, QWidget *pParent, const CCloudMachine &machine)
    19411934    :UIVMActivityMonitor(enmEmbedding, pParent, 60 /* iMaximumQueueSize */)
     1935    , m_strNetworkInMetricName("Network Receive")
     1936    , m_strNetworkOutMetricName("Network Transmit")
    19421937    , m_pMachineStateUpdateTimer(0)
    19431938    , m_enmMachineState(KCloudMachineState_Invalid)
     
    19471942    m_metricTypeNames[KMetricType_DiskBytesRead] = m_strDiskIOMetricName;
    19481943    m_metricTypeNames[KMetricType_DiskBytesWritten] = m_strDiskIOMetricName;
    1949     m_metricTypeNames[KMetricType_NetworksBytesIn] = m_strNetworkMetricName;
    1950     m_metricTypeNames[KMetricType_NetworksBytesOut] = m_strNetworkMetricName;
     1944    m_metricTypeNames[KMetricType_NetworksBytesIn] = m_strNetworkInMetricName;
     1945    m_metricTypeNames[KMetricType_NetworksBytesOut] = m_strNetworkOutMetricName;
    19511946
    19521947    setMachine(machine);
     
    19621957    prepareActions();
    19631958    resetCPUInfoLabel();
    1964     resetNetworkInfoLabel();
     1959    resetNetworkInInfoLabel();
     1960    resetNetworkOutInfoLabel();
    19651961    resetDiskIOInfoLabel();
    19661962    resetRAMInfoLabel();
     
    21122108    {
    21132109        m_networkReceiveCache.clear();
    2114         m_metrics[m_strNetworkMetricName].reset();
     2110        m_metrics[m_strNetworkInMetricName].reset();
    21152111    }
    21162112    else if (enmMetricType == KMetricType_NetworksBytesOut)
    21172113    {
    21182114        m_networkTransmitCache.clear();
    2119         m_metrics[m_strNetworkMetricName].reset();
     2115        m_metrics[m_strNetworkOutMetricName].reset();
    21202116    }
    21212117    else if (enmMetricType == KMetricType_DiskBytesRead)
     
    21432139        }
    21442140        else if (enmMetricType == KMetricType_NetworksBytesOut)
    2145             cacheNetworkTransmit(newTimeStamps[i], newData[i]);
     2141            updateNetworkOutChart(newData[i], newTimeStamps[i]);
    21462142        else if (enmMetricType == KMetricType_NetworksBytesIn)
    2147             cacheNetworkReceive(newTimeStamps[i], newData[i]);
    2148         else if (enmMetricType == KMetricType_DiskBytesRead)
    2149             cacheDiskRead(newTimeStamps[i], newData[i]);
    2150         else if (enmMetricType == KMetricType_DiskBytesWritten)
    2151             cacheDiskWrite(newTimeStamps[i], newData[i]);
     2143            updateNetworkInChart(newData[i], newTimeStamps[i]);
     2144        // else if (enmMetricType == KMetricType_DiskBytesRead)
     2145
     2146        // else if (enmMetricType == KMetricType_DiskBytesWritten)
     2147        //     cacheDiskWrite(newTimeStamps[i], newData[i]);
    21522148        else if (enmMetricType == KMetricType_MemoryUtilization)
    21532149        {
     
    21872183    foreach (UIChart *pChart, m_charts)
    21882184        pChart->setXAxisLabel(QApplication::translate("UIVMInformationDialog", "Min."));
     2185
     2186    m_strNetworkInInfoLabelTitle = QApplication::translate("UIVMInformationDialog", "Network Receive Rate");
     2187    m_iMaximumLabelLength = qMax(m_iMaximumLabelLength, m_strNetworkInInfoLabelTitle.length());
     2188
     2189    m_strNetworkOutInfoLabelTitle = QApplication::translate("UIVMInformationDialog", "Network Transmit Rate");
     2190    m_iMaximumLabelLength = qMax(m_iMaximumLabelLength, m_strNetworkOutInfoLabelTitle.length());
     2191
    21892192    setInfoLabelWidth();
    21902193}
     
    22402243    resetCPUInfoLabel();
    22412244    resetRAMInfoLabel();
    2242     resetNetworkInfoLabel();
     2245    resetNetworkInInfoLabel();
     2246    resetNetworkOutInfoLabel();
    22432247    resetDiskIOInfoLabel();
    22442248
     
    22812285}
    22822286
    2283 void UIVMActivityMonitorCloud::updateNetworkChart(quint64 uReceiveRate, quint64 uTransmitRate, const QString &strLabel)
    2284 {
    2285     UIMetric &networkMetric = m_metrics[m_strNetworkMetricName];
     2287void UIVMActivityMonitorCloud::updateNetworkInChart(quint64 uReceiveRate, const QString &strLabel)
     2288{
     2289    UIMetric &networkMetric = m_metrics[m_strNetworkInMetricName];
    22862290    networkMetric.addData(0, uReceiveRate, strLabel);
    2287     networkMetric.addData(1, uTransmitRate);
    2288 
    2289     if (m_infoLabels.contains(m_strNetworkMetricName)  && m_infoLabels[m_strNetworkMetricName])
     2291
     2292
     2293    if (m_infoLabels.contains(m_strNetworkInMetricName)  && m_infoLabels[m_strNetworkInMetricName])
    22902294    {
    22912295        QString strInfo;
    2292         strInfo = QString("<b>%1</b></b><br/><font color=\"%2\">%3: %4</font><br/><font color=\"%5\">%6: %7<br/></font>")
    2293             .arg(m_strNetworkInfoLabelTitle)
    2294             .arg(dataColorString(m_strNetworkMetricName, 0)).arg(m_strNetworkInfoLabelReceived).arg(UITranslator::formatSize(uReceiveRate, g_iDecimalCount))
    2295             .arg(dataColorString(m_strNetworkMetricName, 1)).arg(m_strNetworkInfoLabelTransmitted).arg(UITranslator::formatSize(uTransmitRate, g_iDecimalCount));
    2296 
    2297         m_infoLabels[m_strNetworkMetricName]->setText(strInfo);
    2298     }
    2299     if (m_charts.contains(m_strNetworkMetricName))
    2300         m_charts[m_strNetworkMetricName]->update();
     2296        strInfo = QString("<b>%1</b></b><br/><font color=\"%2\">%3: %4</font><br/>")
     2297            .arg(m_strNetworkInInfoLabelTitle)
     2298            .arg(dataColorString(m_strNetworkInMetricName, 0)).arg(m_strNetworkInfoLabelReceived).arg(UITranslator::formatSize(uReceiveRate, g_iDecimalCount));
     2299
     2300        m_infoLabels[m_strNetworkInMetricName]->setText(strInfo);
     2301    }
     2302    if (m_charts.contains(m_strNetworkInMetricName))
     2303        m_charts[m_strNetworkInMetricName]->update();
     2304}
     2305
     2306void UIVMActivityMonitorCloud::updateNetworkOutChart(quint64 uTransmitRate, const QString &strLabel)
     2307{
     2308    UIMetric &networkMetric = m_metrics[m_strNetworkOutMetricName];
     2309    networkMetric.addData(0, uTransmitRate, strLabel);
     2310
     2311    if (m_infoLabels.contains(m_strNetworkOutMetricName)  && m_infoLabels[m_strNetworkOutMetricName])
     2312    {
     2313        QString strInfo;
     2314        strInfo = QString("<b>%1</b></b><br/><font color=\"%5\">%6: %7<br/></font>")
     2315            .arg(m_strNetworkOutInfoLabelTitle)
     2316            .arg(dataColorString(m_strNetworkOutMetricName, 1)).arg(m_strNetworkInfoLabelTransmitted).arg(UITranslator::formatSize(uTransmitRate, g_iDecimalCount));
     2317
     2318        m_infoLabels[m_strNetworkOutMetricName]->setText(strInfo);
     2319    }
     2320    if (m_charts.contains(m_strNetworkOutMetricName))
     2321        m_charts[m_strNetworkOutMetricName]->update();
    23012322}
    23022323
     
    23762397    m_metrics.insert(m_strCPUMetricName, cpuMetric);
    23772398
    2378     /* Network metric: */
    2379     UIMetric networkMetric(m_strNetworkMetricName, "B", m_iMaximumQueueSize);
    2380     networkMetric.setDataSeriesName(0, "Receive Rate");
    2381     networkMetric.setDataSeriesName(1, "Transmit Rate");
    2382     networkMetric.setAutoUpdateMaximum(true);
    2383     m_metrics.insert(m_strNetworkMetricName, networkMetric);
     2399    /* Network in metric: */
     2400    UIMetric networkInMetric(m_strNetworkInMetricName, "B", m_iMaximumQueueSize);
     2401    networkInMetric.setDataSeriesName(0, "Receive Rate");
     2402    networkInMetric.setAutoUpdateMaximum(true);
     2403    m_metrics.insert(m_strNetworkInMetricName, networkInMetric);
     2404
     2405    /* Network out metric: */
     2406    UIMetric networkOutMetric(m_strNetworkInMetricName, "B", m_iMaximumQueueSize);
     2407    networkOutMetric.setDataSeriesName(0, "Transmit Rate");
     2408    networkOutMetric.setAutoUpdateMaximum(true);
     2409    m_metrics.insert(m_strNetworkOutMetricName, networkOutMetric);
    23842410
    23852411    /* Disk IO metric */
     
    23912417
    23922418}
     2419
    23932420void UIVMActivityMonitorCloud::prepareWidgets()
    23942421{
    23952422    UIVMActivityMonitor::prepareWidgets();
     2423
     2424    QStringList chartOrder;
     2425    chartOrder << m_strCPUMetricName << m_strRAMMetricName <<
     2426        m_strNetworkInMetricName << m_strNetworkOutMetricName << m_strDiskIOMetricName;
     2427    int iRow = 0;
     2428    foreach (const QString &strMetricName, chartOrder)
     2429    {
     2430        if (!m_metrics.contains(strMetricName))
     2431            continue;
     2432
     2433        QHBoxLayout *pChartLayout = new QHBoxLayout;
     2434        pChartLayout->setSpacing(0);
     2435
     2436        QLabel *pLabel = new QLabel(this);
     2437
     2438        QPalette tempPal = pLabel->palette();
     2439        tempPal.setColor(QPalette::Window, tempPal.color(QPalette::Window).lighter(g_iBackgroundTint));
     2440        pLabel->setPalette(tempPal);
     2441        pLabel->setAutoFillBackground(true);
     2442
     2443        pLabel->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
     2444        pChartLayout->addWidget(pLabel);
     2445        m_infoLabels.insert(strMetricName, pLabel);
     2446
     2447        UIChart *pChart = new UIChart(this, &(m_metrics[strMetricName]), m_iMaximumQueueSize);
     2448        connect(pChart, &UIChart::sigExportMetricsToFile,
     2449                this, &UIVMActivityMonitor::sltExportMetricsToFile);
     2450        connect(pChart, &UIChart::sigDataIndexUnderCursor,
     2451                this, &UIVMActivityMonitor::sltChartDataIndexUnderCursorChanged);
     2452        m_charts.insert(strMetricName, pChart);
     2453        pChart->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
     2454        pChartLayout->addWidget(pChart);
     2455        m_pContainerLayout->addLayout(pChartLayout, iRow, 0, 1, 2);
     2456        ++iRow;
     2457    }
     2458
     2459    QWidget *bottomSpacerWidget = new QWidget(this);
     2460    bottomSpacerWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
     2461    bottomSpacerWidget->setVisible(true);
     2462    m_pContainerLayout->addWidget(bottomSpacerWidget, iRow, 0, 1, 2);
    23962463    m_charts[m_strCPUMetricName]->setShowPieChart(false);
    23972464}
     
    24112478}
    24122479
    2413 void UIVMActivityMonitorCloud::resetNetworkInfoLabel()
    2414 {
    2415     if (m_infoLabels.contains(m_strNetworkMetricName)  && m_infoLabels[m_strNetworkMetricName])
    2416     {
    2417         QString strInfo = QString("<b>%1</b></b><br/>%2: %3<br/>%4 %5")
    2418             .arg(m_strNetworkInfoLabelTitle)
    2419             .arg(m_strNetworkInfoLabelReceived).arg("--")
     2480void UIVMActivityMonitorCloud::resetNetworkInInfoLabel()
     2481{
     2482    if (m_infoLabels.contains(m_strNetworkInMetricName)  && m_infoLabels[m_strNetworkInMetricName])
     2483    {
     2484        QString strInfo = QString("<b>%1</b></b><br/>%2: %3")
     2485            .arg(m_strNetworkInInfoLabelTitle)
     2486            .arg(m_strNetworkInfoLabelReceived).arg("--");
     2487
     2488        m_infoLabels[m_strNetworkInMetricName]->setText(strInfo);
     2489    }
     2490}
     2491
     2492void UIVMActivityMonitorCloud::resetNetworkOutInfoLabel()
     2493{
     2494    if (m_infoLabels.contains(m_strNetworkOutMetricName)  && m_infoLabels[m_strNetworkOutMetricName])
     2495    {
     2496        QString strInfo = QString("<b>%1</b></b><br/>%2: %3")
     2497            .arg(m_strNetworkOutInfoLabelTitle)
    24202498            .arg(m_strNetworkInfoLabelTransmitted).arg("--");
    24212499
    2422         m_infoLabels[m_strNetworkMetricName]->setText(strInfo);
     2500        m_infoLabels[m_strNetworkOutMetricName]->setText(strInfo);
    24232501    }
    24242502}
     
    24642542}
    24652543
    2466 void UIVMActivityMonitorCloud::cacheNetworkReceive(const QString &strTimeStamp, quint64 iValue)
    2467 {
    2468     AssertReturnVoid(!m_networkReceiveCache.contains(strTimeStamp));
    2469 
    2470     if (m_networkTransmitCache.contains(strTimeStamp))
    2471     {
    2472         updateNetworkChart((quint64) iValue, (quint64) m_networkTransmitCache[strTimeStamp], strTimeStamp);
    2473         m_networkTransmitCache.remove(strTimeStamp);
    2474     }
    2475     else
    2476         m_networkReceiveCache[strTimeStamp] = iValue;
    2477 }
    2478 
    2479 
    2480 void UIVMActivityMonitorCloud::cacheNetworkTransmit(const QString &strTimeStamp, quint64 iValue)
    2481 {
    2482     AssertReturnVoid(!m_networkTransmitCache.contains(strTimeStamp));
    2483 
    2484     if (m_networkReceiveCache.contains(strTimeStamp))
    2485     {
    2486         updateNetworkChart((quint64)  m_networkReceiveCache[strTimeStamp], (quint64) iValue, strTimeStamp);
    2487         m_networkReceiveCache.remove(strTimeStamp);
    2488     }
    2489     else
    2490         m_networkTransmitCache[strTimeStamp] = iValue;
     2544void UIVMActivityMonitorCloud::cacheNetworkReceive(const QString &, quint64 )
     2545{
     2546    // AssertReturnVoid(!m_networkReceiveCache.contains(strTimeStamp));
     2547
     2548    // if (m_networkTransmitCache.contains(strTimeStamp))
     2549    // {
     2550    //     updateNetworkChart((quint64) iValue, (quint64) m_networkTransmitCache[strTimeStamp], strTimeStamp);
     2551    //     m_networkTransmitCache.remove(strTimeStamp);
     2552    // }
     2553    // else
     2554    //     m_networkReceiveCache[strTimeStamp] = iValue;
     2555}
     2556
     2557void 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;
    24912568}
    24922569
  • trunk/src/VBox/Frontends/VirtualBox/src/activity/vmactivity/UIVMActivityMonitor.h

    r102858 r102888  
    5454
    5555/* Forward declarations: */
     56class QGridLayout;
    5657class QTimer;
    5758class QVBoxLayout;
     
    156157
    157158        void sltExportMetricsToFile();
     159        void sltChartDataIndexUnderCursorChanged(int iIndex);
    158160
    159161protected:
     
    172174      * @{ */
    173175        virtual void resetCPUInfoLabel() = 0;
    174         virtual void resetNetworkInfoLabel() = 0;
    175176        virtual void resetDiskIOInfoLabel() = 0;
    176177        void resetRAMInfoLabel();
     
    180181    void prepareActions();
    181182    void setInfoLabelWidth();
     183    QGridLayout            *m_pContainerLayout;
    182184    QTimer                 *m_pTimer;
    183185    quint64                 m_iTimeStep;
     
    188190        QString m_strCPUMetricName;
    189191        QString m_strRAMMetricName;
    190         QString m_strNetworkMetricName;
    191192        QString m_strDiskIOMetricName;
    192         QString m_strVMExitMetricName;
    193193    /** @} */
    194194
     
    214214        QString m_strRAMInfoLabelUsed;
    215215        /** Net traffic info label strings. */
    216         QString m_strNetworkInfoLabelTitle;
    217216        QString m_strNetworkInfoLabelReceived;
    218217        QString m_strNetworkInfoLabelTransmitted;
     
    234233    void sltTimeout();
    235234    void sltCreateContextMenu(const QPoint &point);
    236     void sltChatDataIndexUnderCursorChanged(int iIndex);
    237235
    238236private:
     
    295293    void resetVMExitInfoLabel();
    296294    virtual void resetCPUInfoLabel();
    297     virtual void resetNetworkInfoLabel();
     295    void resetNetworkInfoLabel();
    298296    virtual void resetDiskIOInfoLabel();
     297    virtual void prepareWidgets() RT_OVERRIDE;
     298
     299    QString m_strVMExitMetricName;
     300    QString m_strNetworkMetricName;
     301
    299302    bool m_fGuestAdditionsAvailable;
    300303    CMachine m_comMachine;
     
    308311    QString m_strVMExitLabelCurrent;
    309312    QString m_strVMExitLabelTotal;
     313    QString m_strNetworkInfoLabelTitle;
    310314};
    311315
     
    338342    virtual void reset() RT_OVERRIDE;
    339343    virtual void start() RT_OVERRIDE;
    340     virtual void prepareWidgets();
     344    virtual void prepareWidgets() RT_OVERRIDE;
    341345    /** @name The following functions update corresponding metric charts and labels with new values
    342346      * @{ */
    343347        void updateCPUChart(quint64 iLoadPercentage, const QString &strLabel);
    344         void updateNetworkChart(quint64 uReceive, quint64 uTransmit, const QString &strLabel);
     348        void updateNetworkInChart(quint64 uReceive, const QString &strLabel);
     349        void updateNetworkOutChart(quint64 uTransmit, const QString &strLabel);
    345350        void updateDiskIOChart(quint64 uWriteRate, quint64 uReadRate, const QString &strLabel);
    346351        void updateRAMChart(quint64 iUsagePercentage, const QString &strLabel);
    347352    /** @} */
    348353    virtual void resetCPUInfoLabel();
    349     virtual void resetNetworkInfoLabel();
     354    void resetNetworkInInfoLabel();
     355    void resetNetworkOutInfoLabel();
    350356    virtual void resetDiskIOInfoLabel();
    351357
     
    361367    void prepareMetrics();
    362368    void determineTotalRAMAmount();
     369
     370    QString m_strNetworkInMetricName;
     371    QString m_strNetworkOutMetricName;
    363372
    364373    CCloudMachine m_comMachine;
     
    379388    QTimer *m_pMachineStateUpdateTimer;
    380389    KCloudMachineState m_enmMachineState;
     390
     391    QString m_strNetworkInInfoLabelTitle;
     392    QString m_strNetworkOutInfoLabelTitle;
    381393};
    382394#endif /* !FEQT_INCLUDED_SRC_activity_vmactivity_UIVMActivityMonitor_h */
Note: See TracChangeset for help on using the changeset viewer.

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