VirtualBox

Ignore:
Timestamp:
Jul 15, 2008 6:59:56 PM (16 years ago)
Author:
vboxsync
Message:

Filtering sketched. There is a crash in VirtualBox::uninit on Windows.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/Performance.cpp

    r10641 r10679  
    2222 */
    2323
     24#include <VBox/com/array.h>
    2425#include <VBox/com/ptr.h>
     26#include <VBox/com/string.h>
    2527#include <VBox/err.h>
    2628#include <iprt/string.h>
     
    219221}
    220222
     223void HostCpuMhz::init(unsigned long period, unsigned long length)
     224{
     225    mPeriod = period;
     226    mLength = length;
     227    mMHz->init(mLength);
     228}
     229
    221230void HostCpuMhz::collect()
    222231{
     
    224233    mHAL->getHostCpuMHz(&mhz);
    225234    mMHz->put(mhz);
     235}
     236
     237void HostRamUsage::init(unsigned long period, unsigned long length)
     238{
     239    mPeriod = period;
     240    mLength = length;
     241    mTotal->init(mLength);
     242    mUsed->init(mLength);
     243    mAvailable->init(mLength);
    226244}
    227245
     
    236254
    237255
     256
     257void MachineCpuLoad::init(unsigned long period, unsigned long length)
     258{
     259    mPeriod = period;
     260    mLength = length;
     261    mUser->init(mLength);
     262    mKernel->init(mLength);
     263}
     264
    238265void MachineCpuLoad::collect()
    239266{
     
    259286    mProcessUserPrev   = processUser;
    260287    mProcessKernelPrev = processKernel;
     288}
     289
     290void MachineRamUsage::init(unsigned long period, unsigned long length)
     291{
     292    mPeriod = period;
     293    mLength = length;
     294    mUsed->init(mLength);
    261295}
    262296
     
    361395}
    362396
     397Filter::Filter(ComSafeArrayIn(const BSTR, metricNames),
     398               ComSafeArrayIn(IUnknown *, objects))
     399{
     400    com::SafeIfaceArray <IUnknown> objectArray(ComSafeArrayInArg(objects));
     401    com::SafeArray <BSTR> nameArray(ComSafeArrayInArg(metricNames));
     402    for (size_t i = 0; i < objectArray.size(); ++i)
     403        processMetricList(std::string(com::Utf8Str(nameArray[i])), objectArray[i]);
     404}
     405
     406void Filter::processMetricList(const std::string &name, const IUnknown *object)
     407{
     408    std::string::size_type startPos = 0;
     409
     410    for (std::string::size_type pos = name.find(",");
     411         pos != std::string::npos;
     412         pos = name.find(",", startPos))
     413    {
     414        mElements.push_back(std::make_pair(object, name.substr(startPos, pos - startPos)));
     415        startPos = pos + 1;
     416    }
     417    mElements.push_back(std::make_pair(object, name.substr(startPos)));
     418}
     419
     420bool Filter::match(const IUnknown *object, const std::string &name) const
     421{
     422    return true;
     423}
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