VirtualBox

Changeset 82620 in vbox for trunk/src


Ignore:
Timestamp:
Dec 18, 2019 5:33:56 PM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
135507
Message:

FE/Qt: bugref:9510. Cleaning up some code as follow up of r134941.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIInformationPerformanceMonitor.cpp

    r82131 r82620  
    773773}
    774774
    775 const QStringList &UIMetric::deviceTypeList() const
    776 {
    777     return m_deviceTypeList;
    778 }
    779 
    780 void UIMetric::setDeviceTypeList(const QStringList &list)
    781 {
    782     m_deviceTypeList = list;
    783     composeQueryString();
    784 }
    785 
    786 const QStringList &UIMetric::metricDataSubString() const
    787 {
    788     return m_metricDataSubString;
    789 }
    790 
    791 void UIMetric::setQueryPrefix(const QString &strPrefix)
    792 {
    793     m_strQueryPrefix = strPrefix;
    794     composeQueryString();
    795 
    796 }
    797 
    798 void UIMetric::setMetricDataSubString(const QStringList &list)
    799 {
    800     m_metricDataSubString = list;
    801     composeQueryString();
    802 }
    803 
    804 const QString &UIMetric::queryString() const
    805 {
    806     return m_strQueryString;
    807 }
    808 
    809775bool UIMetric::isInitialized() const
    810776{
     
    826792    }
    827793    m_iMaximum = 0;
    828 }
    829 
    830 void UIMetric::composeQueryString()
    831 {
    832     /* Compose of if both m_metricDataSubString and m_deviceTypeList are not empty: */
    833     if (m_deviceTypeList.isEmpty() || m_metricDataSubString.isEmpty())
    834         return;
    835     m_strQueryString.clear();
    836     foreach (const QString &strDeviceName, m_deviceTypeList)
    837     {
    838         foreach (const QString &strSubString, m_metricDataSubString)
    839         {
    840             /** @todo r=bird: It is much more efficient to (1) start a query with '/' and
    841              *        (2) not use multiple expressions.  If you don't start with '/',
    842              *        STAM must search all the statistics.  If you have multiple
    843              *        expressions it is not yet clever enough to optimize the search and
    844              *        will search all the statistics.  There are several thousand in a
    845              *        debug builds, some 400-600 in a typical release build (config dep). */
    846             m_strQueryString += QString("*%1*%2*%3*|").arg(m_strQueryPrefix).arg(strDeviceName).arg(strSubString);
    847         }
    848     }
    849794}
    850795
     
    11591104
    11601105    m_metrics.insert(m_strCPUMetricName, UIMetric(m_strCPUMetricName, "%", iMaximumQueueSize));
    1161 /** @todo r=bird: This way of constructing queries is inefficient, see
    1162  *        comment in query composer.  Also, both the network and disk bits
    1163  *        have moved now.  The update timer method has been updated and no
    1164  *        longer makes use of this for the statistics querying. */
    11651106    {
    11661107        /* Network metric: */
    11671108        UIMetric networkMetric(m_strNetworkMetricName, "B", iMaximumQueueSize);
    1168         networkMetric.setQueryPrefix("Public");
    1169         QStringList networkDeviceList;
    1170         networkDeviceList << "E1k" << "VNet" << "PCNet";
    1171         networkMetric.setDeviceTypeList(networkDeviceList);
    1172         QStringList networkMetricDataSubStringList;
    1173         networkMetricDataSubStringList << "BytesReceived" << "BytesTransmitted";
    1174         networkMetric.setMetricDataSubString(networkMetricDataSubStringList);
    11751109        m_metrics.insert(m_strNetworkMetricName, networkMetric);
    11761110    }
     
    11791113    {
    11801114        UIMetric diskIOMetric(m_strDiskIOMetricName, "B", iMaximumQueueSize);
    1181         diskIOMetric.setQueryPrefix("Devices");
    1182         QStringList diskTypeList;
    1183         diskTypeList << "LSILOGICSCSI" << "BUSLOGIC"
    1184                      << "AHCI" <<  "PIIX3IDE" << "I82078" << "LSILOGICSAS" << "MSD" << "NVME";
    1185         diskIOMetric.setDeviceTypeList(diskTypeList);
    1186         QStringList diskIODataSubStringList;
    1187         diskIODataSubStringList << "WrittenBytes" << "ReadBytes";
    1188         diskIOMetric.setMetricDataSubString(diskIODataSubStringList);
    11891115        m_metrics.insert(m_strDiskIOMetricName, diskIOMetric);
    11901116    }
     
    11931119    {
    11941120        UIMetric VMExitsMetric(m_strVMExitMetricName, "times", iMaximumQueueSize);
    1195         VMExitsMetric.setQueryPrefix("PROF");
    1196         QStringList typeList;
    1197         typeList << "CPU";
    1198         VMExitsMetric.setDeviceTypeList(typeList);
    1199         QStringList subStringList;
    1200         subStringList << "RecordedExits";
    1201         VMExitsMetric.setMetricDataSubString(subStringList);
    12021121        m_metrics.insert(m_strVMExitMetricName, VMExitsMetric);
    12031122    }
    1204 
    1205     for (QMap<QString, UIMetric>::const_iterator iterator =  m_metrics.begin();
    1206          iterator != m_metrics.end(); ++iterator)
    1207     {
    1208         if (iterator.value().queryString().isEmpty())
    1209             continue;
    1210         m_strQueryString += iterator.value().queryString();
    1211     }
    1212 }
    1213 
     1123}
    12141124
    12151125bool UIInformationPerformanceMonitor::guestAdditionsAvailable(int iMinimumMajorVersion)
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIInformationPerformanceMonitor.h

    r82131 r82620  
    8585    void setRequiresGuestAdditions(bool fRequiresGAs);
    8686
    87     const QStringList &deviceTypeList() const;
    88     void setDeviceTypeList(const QStringList &list);
    89 
    90     void setQueryPrefix(const QString &strPrefix);
    91 
    92     const QStringList &metricDataSubString() const;
    93     void setMetricDataSubString(const QStringList &list);
    94 
    95     const QString &queryString() const;
    96 
    9787    void setIsInitialized(bool fIsInitialized);
    9888    bool isInitialized() const;
     
    10191
    10292private:
    103 
    104     void composeQueryString();
    105 
    106     /** @name The following strings are string list are used while making IMachineDebugger::getStats calls and parsing the resultin
    107       * xml stream.
    108       * @{ */
    109         /** This string is used while calling IMachineDebugger::getStats(..). It is composed of
    110         * m_strQueryPrefix, m_deviceTypeList, and  m_metricDataSubString. */
    111         QString m_strQueryString;
    112         /** This list is used to differentiate xml data we get from the IMachineDebugger. */
    113         QStringList m_deviceTypeList;
    114         /** This is used to select data series of the metric. For example, for network metric
    115          * it is ReceiveBytes/TransmitBytes */
    116         QStringList m_metricDataSubString;
    117         QString m_strQueryPrefix;
    118     /** @} */
    11993
    12094    QString m_strName;
     
    243217        QString m_strVMExitLabelTotal;
    244218    /** @} */
    245     /** The following string is used while querrying CMachineDebugger. */
    246     QString m_strQueryString;
    247219    quint64 m_iTimeStep;
    248220};
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageExpert.cpp

    r79365 r82620  
    178178    m_strDefaultExtension = defaultExtension(mediumFormat());
    179179    if (m_pLocationEditor)
     180    {
    180181        m_pLocationEditor->setText(absoluteFilePath(m_strDefaultName, m_strDefaultPath, m_strDefaultExtension));
     182        printf("%s\n", qPrintable(absoluteFilePath(m_strDefaultName, m_strDefaultPath, m_strDefaultExtension)));
     183    }
    181184}
    182185
     
    213216        if (fileInfo.completeSuffix() != m_strDefaultExtension)
    214217        {
    215             QString strNewFilePath = QString("%1/%2.%3").arg(fileInfo.absoluteDir().absolutePath()).arg(fileInfo.baseName()).arg(m_strDefaultExtension);
     218            QString strNewFilePath = QString("%1/%2.%3").arg(fileInfo.absoluteDir().absolutePath()).arg(fileInfo.fileName()).arg(m_strDefaultExtension);
    216219            m_pLocationEditor->setText(strNewFilePath);
     220            printf("%s %s\n", qPrintable(fileInfo.absoluteDir().absolutePath()), qPrintable(fileInfo.baseName()));
    217221        }
    218222    }
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