VirtualBox

Changeset 85568 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jul 30, 2020 5:42:51 PM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9686, bugref:9510. Some changes for performance monitor export

Location:
trunk/src/VBox/Frontends/VirtualBox/src/monitor/performance
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/monitor/performance/UIPerformanceMonitor.cpp

    r85493 r85568  
    2828
    2929/* GUI includes: */
     30#include "QIFileDialog.h"
    3031#include "UICommon.h"
    3132#include "UIPerformanceMonitor.h"
     
    719720    }
    720721    m_iMaximum = 0;
     722}
     723
     724void UIMetric::toFile(QFile &file) const
     725{
     726    QTextStream stream(&file);
     727    stream << m_strName << "\n";
     728    foreach (const quint64& data, m_data[0])
     729        stream << data;
    721730}
    722731
     
    978987}
    979988
     989void UIPerformanceMonitor::sltExportMetricsToFile()
     990{
     991    QString strFileName = QIFileDialog::getSaveFileName("","",this, "");
     992
     993    QFile data(strFileName);
     994    if (data.open(QFile::WriteOnly | QFile::Truncate)) {
     995
     996        for (QMap<QString, UIMetric>::const_iterator iterator =  m_metrics.begin();
     997             iterator != m_metrics.end(); ++iterator)
     998        {
     999            iterator.value().toFile(data);
     1000        }
     1001        data.close();
     1002
     1003      //   QTextStream out(&data);
     1004      // out << "Result: " << qSetFieldWidth(10) << left << 3.14 << 2.7;
     1005      // writes "Result: 3.14      2.7       "
     1006  }
     1007
     1008
     1009}
     1010
     1011
    9801012void UIPerformanceMonitor::sltGuestAdditionsStateChange()
    9811013{
     
    10561088#endif
    10571089    }
     1090    // QAction *pAction =
     1091    //     actionPool()->action(UIActionIndex_M_Performance_S_Export);
     1092    // if (pAction)
     1093    //     connect(pAction, &QAction::triggered, this, &UIPerformanceMonitor::sltExportMetricsToFile);
    10581094}
    10591095
  • trunk/src/VBox/Frontends/VirtualBox/src/monitor/performance/UIPerformanceMonitor.h

    r85485 r85568  
    2626#include <QMap>
    2727#include <QQueue>
     28#include <QTextStream>
    2829
    2930/* COM includes: */
     
    8081
    8182    void reset();
     83
     84    void toFile(QFile &file) const;
    8285
    8386private:
     
    137140    /** Stop updating the charts if/when the machine state changes something other than KMachineState_Running. */
    138141    void sltMachineStateChange(const QUuid &uId);
     142    void sltExportMetricsToFile();
    139143
    140144private:
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