VirtualBox

Changeset 10595 in vbox


Ignore:
Timestamp:
Jul 14, 2008 12:23:57 PM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
33291
Message:

Main: Performance: Typos, docs, cosmetics.

Location:
trunk/src/VBox/Main
Files:
8 edited

Legend:

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

    r10544 r10595  
    135135 * Initializes the host object.
    136136 *
    137  * @returns COM result indicator
    138  * @param parent handle of our parent object
     137 * @param aParent   VirtualBox parent object.
    139138 */
    140 HRESULT Host::init (VirtualBox *parent)
     139HRESULT Host::init (VirtualBox *aParent)
    141140{
    142141    LogFlowThisFunc (("isReady=%d\n", isReady()));
    143142
    144     ComAssertRet (parent, E_INVALIDARG);
     143    ComAssertRet (aParent, E_INVALIDARG);
    145144
    146145    AutoWriteLock alock (this);
    147146    ComAssertRet (!isReady(), E_UNEXPECTED);
    148147
    149     mParent = parent;
     148    mParent = aParent;
    150149
    151150#ifdef VBOX_WITH_USB
     
    171170
    172171#ifdef VBOX_WITH_RESOURCE_USAGE_API
    173     registerMetrics(parent->getCollector());
     172    registerMetrics (aParent->performanceCollector());
    174173#endif /* VBOX_WITH_RESOURCE_USAGE_API */
    175174
     
    189188
    190189#ifdef VBOX_WITH_RESOURCE_USAGE_API
    191     unregisterMetrics(mParent->getCollector());
     190    unregisterMetrics (mParent->performanceCollector());
    192191#endif /* VBOX_WITH_RESOURCE_USAGE_API */
    193192
     
    26932692
    26942693#ifdef VBOX_WITH_RESOURCE_USAGE_API
    2695 void Host::registerMetrics(PerformanceCollector *collector)
    2696 {
    2697     pm::MetricFactory *metricFactory = collector->getMetricFactory();
    2698     // Create sub metrics
    2699     pm::SubMetric *cpuLoadUser = new pm::SubMetric("CPU/Load/User");
    2700     pm::SubMetric *cpuLoadKernel = new pm::SubMetric("CPU/Load/Kernel");
    2701     pm::SubMetric *cpuLoadIdle = new pm::SubMetric("CPU/Load/Idle");
    2702     // Create and register base metrics
     2694void Host::registerMetrics (PerformanceCollector *aCollector)
     2695{
     2696    pm::MetricFactory *metricFactory = aCollector->getMetricFactory();
     2697    /* Create sub metrics */
     2698    pm::SubMetric *cpuLoadUser = new pm::SubMetric ("CPU/Load/User");
     2699    pm::SubMetric *cpuLoadKernel = new pm::SubMetric ("CPU/Load/Kernel");
     2700    pm::SubMetric *cpuLoadIdle = new pm::SubMetric ("CPU/Load/Idle");
     2701    /* Create and register base metrics */
    27032702    IUnknown *objptr;
    2704     ComObjPtr<Host> tmp = this;
    2705     tmp.queryInterfaceTo(&objptr);
     2703    ComObjPtr <Host> tmp = this;
     2704    tmp.queryInterfaceTo (&objptr);
    27062705    pm::BaseMetric *cpuLoad =
    2707         metricFactory->createHostCpuLoad(objptr, cpuLoadUser, cpuLoadKernel, cpuLoadIdle);
    2708     collector->registerBaseMetric(cpuLoad);
    2709     collector->registerMetric(new pm::Metric(cpuLoad, cpuLoadUser, 0));
    2710     collector->registerMetric(new pm::Metric(cpuLoad, cpuLoadUser, new pm::AggregateAvg()));
    2711     collector->registerMetric(new pm::Metric(cpuLoad, cpuLoadUser, new pm::AggregateMin()));
    2712     collector->registerMetric(new pm::Metric(cpuLoad, cpuLoadUser, new pm::AggregateMax()));
    2713     collector->registerMetric(new pm::Metric(cpuLoad, cpuLoadKernel, 0));
    2714     collector->registerMetric(new pm::Metric(cpuLoad, cpuLoadKernel, new pm::AggregateAvg()));
    2715     collector->registerMetric(new pm::Metric(cpuLoad, cpuLoadKernel, new pm::AggregateMin()));
    2716     collector->registerMetric(new pm::Metric(cpuLoad, cpuLoadKernel, new pm::AggregateMax()));
    2717     collector->registerMetric(new pm::Metric(cpuLoad, cpuLoadIdle, 0));
    2718     collector->registerMetric(new pm::Metric(cpuLoad, cpuLoadIdle, new pm::AggregateAvg()));
    2719     collector->registerMetric(new pm::Metric(cpuLoad, cpuLoadIdle, new pm::AggregateMin()));
    2720     collector->registerMetric(new pm::Metric(cpuLoad, cpuLoadIdle, new pm::AggregateMax()));
     2706        metricFactory->createHostCpuLoad (objptr, cpuLoadUser, cpuLoadKernel,
     2707                                          cpuLoadIdle);
     2708    aCollector->registerBaseMetric (cpuLoad);
     2709    aCollector->registerMetric (new pm::Metric(cpuLoad, cpuLoadUser, 0));
     2710    aCollector->registerMetric (new pm::Metric(cpuLoad, cpuLoadUser,
     2711                                               new pm::AggregateAvg()));
     2712    aCollector->registerMetric (new pm::Metric(cpuLoad, cpuLoadUser,
     2713                                               new pm::AggregateMin()));
     2714    aCollector->registerMetric (new pm::Metric(cpuLoad, cpuLoadUser,
     2715                                               new pm::AggregateMax()));
     2716    aCollector->registerMetric (new pm::Metric(cpuLoad, cpuLoadKernel, 0));
     2717    aCollector->registerMetric (new pm::Metric(cpuLoad, cpuLoadKernel,
     2718                                               new pm::AggregateAvg()));
     2719    aCollector->registerMetric (new pm::Metric(cpuLoad, cpuLoadKernel,
     2720                                               new pm::AggregateMin()));
     2721    aCollector->registerMetric (new pm::Metric(cpuLoad, cpuLoadKernel,
     2722                                               new pm::AggregateMax()));
     2723    aCollector->registerMetric (new pm::Metric(cpuLoad, cpuLoadIdle, 0));
     2724    aCollector->registerMetric (new pm::Metric(cpuLoad, cpuLoadIdle,
     2725                                               new pm::AggregateAvg()));
     2726    aCollector->registerMetric (new pm::Metric(cpuLoad, cpuLoadIdle,
     2727                                               new pm::AggregateMin()));
     2728    aCollector->registerMetric (new pm::Metric(cpuLoad, cpuLoadIdle,
     2729                                               new pm::AggregateMax()));
    27212730};
    27222731
    2723 void Host::unregisterMetrics(PerformanceCollector *collector)
    2724 {
    2725     collector->unregisterMetricsFor(this);
    2726     collector->unregisterBaseMetricsFor(this);
     2732void Host::unregisterMetrics (PerformanceCollector *aCollector)
     2733{
     2734    aCollector->unregisterMetricsFor (this);
     2735    aCollector->unregisterBaseMetricsFor (this);
    27272736};
    27282737#endif /* VBOX_WITH_RESOURCE_USAGE_API */
  • trunk/src/VBox/Main/MachineImpl.cpp

    r10544 r10595  
    72777277
    72787278#ifdef VBOX_WITH_RESOURCE_USAGE_API
    7279 void Machine::registerMetrics(PerformanceCollector *collector)
    7280 {
    7281     pm::MetricFactory *metricFactory = collector->getMetricFactory();
    7282     // Create sub metrics
    7283     pm::SubMetric *cpuLoadUser = new pm::SubMetric("CPU/Load/User");
    7284     pm::SubMetric *cpuLoadKernel = new pm::SubMetric("CPU/Load/Kernel");
    7285     // Create and register base metrics
     7279void Machine::registerMetrics (PerformanceCollector *aCollector)
     7280{
     7281    pm::MetricFactory *metricFactory = aCollector->getMetricFactory();
     7282    /* Create sub metrics */
     7283    pm::SubMetric *cpuLoadUser = new pm::SubMetric ("CPU/Load/User");
     7284    pm::SubMetric *cpuLoadKernel = new pm::SubMetric ("CPU/Load/Kernel");
     7285    /* Create and register base metrics */
    72867286    IUnknown *objptr;
    72877287
    72887288    ComObjPtr<Machine> tmp = this;
    7289     tmp.queryInterfaceTo(&objptr);
     7289    tmp.queryInterfaceTo (&objptr);
    72907290    pm::BaseMetric *cpuLoad =
    7291         metricFactory->createMachineCpuLoad(objptr, mData->mSession.mPid, cpuLoadUser, cpuLoadKernel);
    7292     collector->registerBaseMetric(cpuLoad);
    7293 
    7294     collector->registerMetric(new pm::Metric(cpuLoad, cpuLoadUser, 0));
    7295     collector->registerMetric(new pm::Metric(cpuLoad, cpuLoadUser, new pm::AggregateAvg()));
    7296     collector->registerMetric(new pm::Metric(cpuLoad, cpuLoadUser, new pm::AggregateMin()));
    7297     collector->registerMetric(new pm::Metric(cpuLoad, cpuLoadUser, new pm::AggregateMax()));
    7298     collector->registerMetric(new pm::Metric(cpuLoad, cpuLoadKernel, 0));
    7299     collector->registerMetric(new pm::Metric(cpuLoad, cpuLoadKernel, new pm::AggregateAvg()));
    7300     collector->registerMetric(new pm::Metric(cpuLoad, cpuLoadKernel, new pm::AggregateMin()));
    7301     collector->registerMetric(new pm::Metric(cpuLoad, cpuLoadKernel, new pm::AggregateMax()));
     7291        metricFactory->createMachineCpuLoad (objptr, mData->mSession.mPid,
     7292                                             cpuLoadUser, cpuLoadKernel);
     7293    aCollector->registerBaseMetric (cpuLoad);
     7294
     7295    aCollector->registerMetric (new pm::Metric(cpuLoad, cpuLoadUser, 0));
     7296    aCollector->registerMetric (new pm::Metric(cpuLoad, cpuLoadUser,
     7297                                                new pm::AggregateAvg()));
     7298    aCollector->registerMetric (new pm::Metric(cpuLoad, cpuLoadUser,
     7299                                                new pm::AggregateMin()));
     7300    aCollector->registerMetric (new pm::Metric(cpuLoad, cpuLoadUser,
     7301                                                new pm::AggregateMax()));
     7302    aCollector->registerMetric (new pm::Metric(cpuLoad, cpuLoadKernel, 0));
     7303    aCollector->registerMetric (new pm::Metric(cpuLoad, cpuLoadKernel,
     7304                                                new pm::AggregateAvg()));
     7305    aCollector->registerMetric (new pm::Metric(cpuLoad, cpuLoadKernel,
     7306                                                new pm::AggregateMin()));
     7307    aCollector->registerMetric (new pm::Metric(cpuLoad, cpuLoadKernel,
     7308                                                new pm::AggregateMax()));
    73027309};
    73037310
    7304 void Machine::unregisterMetrics(PerformanceCollector *collector)
    7305 {
    7306     collector->unregisterMetricsFor(this);
    7307     collector->unregisterBaseMetricsFor(this);
     7311void Machine::unregisterMetrics (PerformanceCollector *aCollector)
     7312{
     7313    aCollector->unregisterMetricsFor (this);
     7314    aCollector->unregisterBaseMetricsFor (this);
    73087315};
    73097316#endif /* VBOX_WITH_RESOURCE_USAGE_API */
  • trunk/src/VBox/Main/VirtualBoxImpl.cpp

    r10544 r10595  
    231231            /* create the performance collector object BEFORE host */
    232232            unconst (mData.mPerformanceCollector).createObject();
    233             rc = mData.mPerformanceCollector->init ();
     233            rc = mData.mPerformanceCollector->init();
    234234            ComAssertComRCThrowRC (rc);
    235235#endif /* VBOX_WITH_RESOURCE_USAGE_API */
     
    570570    CheckComRCReturnRC (autoCaller.rc());
    571571
     572    /* mHost is const, no need to lock */
    572573    mData.mHost.queryInterfaceTo (aHost);
    573574    return S_OK;
     
    583584    CheckComRCReturnRC (autoCaller.rc());
    584585
     586    /* mSystemProperties is const, no need to lock */
    585587    mData.mSystemProperties.queryInterfaceTo (aSystemProperties);
    586588    return S_OK;
     589}
     590
     591/**
     592 * @note Locks this object for reading.
     593 */
     594STDMETHODIMP VirtualBox::COMGETTER(Machines) (IMachineCollection **aMachines)
     595{
     596    if (!aMachines)
     597        return E_POINTER;
     598
     599    AutoCaller autoCaller (this);
     600    CheckComRCReturnRC (autoCaller.rc());
     601
     602    ComObjPtr <MachineCollection> collection;
     603    collection.createObject();
     604
     605    AutoReadLock alock (this);
     606    collection->init (mData.mMachines);
     607    collection.queryInterfaceTo (aMachines);
     608
     609    return S_OK;
     610}
     611
     612/**
     613 * @note Locks this object for reading.
     614 */
     615STDMETHODIMP
     616VirtualBox::COMGETTER(Machines2) (ComSafeArrayOut (IMachine *, aMachines))
     617{
     618    if (ComSafeArrayOutIsNull (aMachines))
     619        return E_POINTER;
     620
     621    AutoCaller autoCaller (this);
     622    CheckComRCReturnRC (autoCaller.rc());
     623
     624    AutoReadLock alock (this);
     625
     626    SafeIfaceArray <IMachine> machines (mData.mMachines);
     627    machines.detachTo (ComSafeArrayOutArg (aMachines));
     628
     629    return S_OK;
     630}
     631
     632/**
     633 * @note Locks this object for reading.
     634 */
     635STDMETHODIMP VirtualBox::COMGETTER(HardDisks) (IHardDiskCollection **aHardDisks)
     636{
     637    if (!aHardDisks)
     638        return E_POINTER;
     639
     640    AutoCaller autoCaller (this);
     641    CheckComRCReturnRC (autoCaller.rc());
     642
     643    ComObjPtr <HardDiskCollection> collection;
     644    collection.createObject();
     645
     646    AutoReadLock alock (this);
     647    collection->init (mData.mHardDisks);
     648    collection.queryInterfaceTo (aHardDisks);
     649
     650    return S_OK;
     651}
     652
     653/**
     654 * @note Locks this object for reading.
     655 */
     656STDMETHODIMP VirtualBox::COMGETTER(DVDImages) (IDVDImageCollection **aDVDImages)
     657{
     658    if (!aDVDImages)
     659        return E_POINTER;
     660
     661    AutoCaller autoCaller (this);
     662    CheckComRCReturnRC (autoCaller.rc());
     663
     664    ComObjPtr <DVDImageCollection> collection;
     665    collection.createObject();
     666
     667    AutoReadLock alock (this);
     668    collection->init (mData.mDVDImages);
     669    collection.queryInterfaceTo (aDVDImages);
     670
     671    return S_OK;
     672}
     673
     674/**
     675 * @note Locks this object for reading.
     676 */
     677STDMETHODIMP VirtualBox::COMGETTER(FloppyImages) (IFloppyImageCollection **aFloppyImages)
     678{
     679    if (!aFloppyImages)
     680        return E_POINTER;
     681
     682    AutoCaller autoCaller (this);
     683    CheckComRCReturnRC (autoCaller.rc());
     684
     685    ComObjPtr <FloppyImageCollection> collection;
     686    collection.createObject();
     687
     688    AutoReadLock alock (this);
     689    collection->init (mData.mFloppyImages);
     690    collection.queryInterfaceTo (aFloppyImages);
     691
     692    return S_OK;
     693}
     694
     695/**
     696 * @note Locks this object for reading.
     697 */
     698STDMETHODIMP VirtualBox::COMGETTER(ProgressOperations) (IProgressCollection **aOperations)
     699{
     700    if (!aOperations)
     701        return E_POINTER;
     702
     703    AutoCaller autoCaller (this);
     704    CheckComRCReturnRC (autoCaller.rc());
     705
     706    ComObjPtr <ProgressCollection> collection;
     707    collection.createObject();
     708
     709    AutoReadLock alock (this);
     710    collection->init (mData.mProgressOperations);
     711    collection.queryInterfaceTo (aOperations);
     712
     713    return S_OK;
     714}
     715
     716/**
     717 * @note Locks this object for reading.
     718 */
     719STDMETHODIMP VirtualBox::COMGETTER(GuestOSTypes) (IGuestOSTypeCollection **aGuestOSTypes)
     720{
     721    if (!aGuestOSTypes)
     722        return E_POINTER;
     723
     724    AutoCaller autoCaller (this);
     725    CheckComRCReturnRC (autoCaller.rc());
     726
     727    ComObjPtr <GuestOSTypeCollection> collection;
     728    collection.createObject();
     729
     730    AutoReadLock alock (this);
     731    collection->init (mData.mGuestOSTypes);
     732    collection.queryInterfaceTo (aGuestOSTypes);
     733
     734    return S_OK;
     735}
     736
     737STDMETHODIMP
     738VirtualBox::COMGETTER(SharedFolders) (ISharedFolderCollection **aSharedFolders)
     739{
     740    if (!aSharedFolders)
     741        return E_POINTER;
     742
     743    AutoCaller autoCaller (this);
     744    CheckComRCReturnRC (autoCaller.rc());
     745
     746    return setError (E_NOTIMPL, "Not yet implemented");
    587747}
    588748
     
    597757    CheckComRCReturnRC (autoCaller.rc());
    598758
     759    /* mPerformanceCollector is const, no need to lock */
    599760    mData.mPerformanceCollector.queryInterfaceTo (aPerformanceCollector);
    600761
     
    603764    return E_NOTIMPL;
    604765#endif /* !VBOX_WITH_RESOURCE_USAGE_API */
    605 }
    606 
    607 
    608 /**
    609  * @note Locks this object for reading.
    610  */
    611 STDMETHODIMP VirtualBox::COMGETTER(Machines) (IMachineCollection **aMachines)
    612 {
    613     if (!aMachines)
    614         return E_POINTER;
    615 
    616     AutoCaller autoCaller (this);
    617     CheckComRCReturnRC (autoCaller.rc());
    618 
    619     ComObjPtr <MachineCollection> collection;
    620     collection.createObject();
    621 
    622     AutoReadLock alock (this);
    623     collection->init (mData.mMachines);
    624     collection.queryInterfaceTo (aMachines);
    625 
    626     return S_OK;
    627 }
    628 
    629 /**
    630  * @note Locks this object for reading.
    631  */
    632 STDMETHODIMP
    633 VirtualBox::COMGETTER(Machines2) (ComSafeArrayOut (IMachine *, aMachines))
    634 {
    635     if (ComSafeArrayOutIsNull (aMachines))
    636         return E_POINTER;
    637 
    638     AutoCaller autoCaller (this);
    639     CheckComRCReturnRC (autoCaller.rc());
    640 
    641     AutoReadLock alock (this);
    642 
    643     SafeIfaceArray <IMachine> machines (mData.mMachines);
    644     machines.detachTo (ComSafeArrayOutArg (aMachines));
    645 
    646     return S_OK;
    647 }
    648 
    649 /**
    650  * @note Locks this object for reading.
    651  */
    652 STDMETHODIMP VirtualBox::COMGETTER(HardDisks) (IHardDiskCollection **aHardDisks)
    653 {
    654     if (!aHardDisks)
    655         return E_POINTER;
    656 
    657     AutoCaller autoCaller (this);
    658     CheckComRCReturnRC (autoCaller.rc());
    659 
    660     ComObjPtr <HardDiskCollection> collection;
    661     collection.createObject();
    662 
    663     AutoReadLock alock (this);
    664     collection->init (mData.mHardDisks);
    665     collection.queryInterfaceTo (aHardDisks);
    666 
    667     return S_OK;
    668 }
    669 
    670 /**
    671  * @note Locks this object for reading.
    672  */
    673 STDMETHODIMP VirtualBox::COMGETTER(DVDImages) (IDVDImageCollection **aDVDImages)
    674 {
    675     if (!aDVDImages)
    676         return E_POINTER;
    677 
    678     AutoCaller autoCaller (this);
    679     CheckComRCReturnRC (autoCaller.rc());
    680 
    681     ComObjPtr <DVDImageCollection> collection;
    682     collection.createObject();
    683 
    684     AutoReadLock alock (this);
    685     collection->init (mData.mDVDImages);
    686     collection.queryInterfaceTo (aDVDImages);
    687 
    688     return S_OK;
    689 }
    690 
    691 /**
    692  * @note Locks this object for reading.
    693  */
    694 STDMETHODIMP VirtualBox::COMGETTER(FloppyImages) (IFloppyImageCollection **aFloppyImages)
    695 {
    696     if (!aFloppyImages)
    697         return E_POINTER;
    698 
    699     AutoCaller autoCaller (this);
    700     CheckComRCReturnRC (autoCaller.rc());
    701 
    702     ComObjPtr <FloppyImageCollection> collection;
    703     collection.createObject();
    704 
    705     AutoReadLock alock (this);
    706     collection->init (mData.mFloppyImages);
    707     collection.queryInterfaceTo (aFloppyImages);
    708 
    709     return S_OK;
    710 }
    711 
    712 /**
    713  * @note Locks this object for reading.
    714  */
    715 STDMETHODIMP VirtualBox::COMGETTER(ProgressOperations) (IProgressCollection **aOperations)
    716 {
    717     if (!aOperations)
    718         return E_POINTER;
    719 
    720     AutoCaller autoCaller (this);
    721     CheckComRCReturnRC (autoCaller.rc());
    722 
    723     ComObjPtr <ProgressCollection> collection;
    724     collection.createObject();
    725 
    726     AutoReadLock alock (this);
    727     collection->init (mData.mProgressOperations);
    728     collection.queryInterfaceTo (aOperations);
    729 
    730     return S_OK;
    731 }
    732 
    733 /**
    734  * @note Locks this object for reading.
    735  */
    736 STDMETHODIMP VirtualBox::COMGETTER(GuestOSTypes) (IGuestOSTypeCollection **aGuestOSTypes)
    737 {
    738     if (!aGuestOSTypes)
    739         return E_POINTER;
    740 
    741     AutoCaller autoCaller (this);
    742     CheckComRCReturnRC (autoCaller.rc());
    743 
    744     ComObjPtr <GuestOSTypeCollection> collection;
    745     collection.createObject();
    746 
    747     AutoReadLock alock (this);
    748     collection->init (mData.mGuestOSTypes);
    749     collection.queryInterfaceTo (aGuestOSTypes);
    750 
    751     return S_OK;
    752 }
    753 
    754 STDMETHODIMP
    755 VirtualBox::COMGETTER(SharedFolders) (ISharedFolderCollection **aSharedFolders)
    756 {
    757     if (!aSharedFolders)
    758         return E_POINTER;
    759 
    760     AutoCaller autoCaller (this);
    761     CheckComRCReturnRC (autoCaller.rc());
    762 
    763     return setError (E_NOTIMPL, "Not yet implemented");
    764766}
    765767
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r10544 r10595  
    10571057      </desc>
    10581058    </attribute>
     1059
    10591060    <attribute name="performanceCollector" type="IPerformanceCollector" readonly="yes">
    10601061      <desc>
    1061         The only instance of IPerformanceCollector.
     1062        Associated performance collector object.
    10621063      </desc>
    10631064    </attribute>
     
    1007410075</if>
    1007510076
     10077  <!--
     10078  // IPerformanceCollector & friends
     10079  /////////////////////////////////////////////////////////////////////////
     10080  -->
     10081
    1007610082  <interface
    1007710083    name="IPerformanceMetric" extends="$unknown"
    1007810084    uuid="50831d4c-ed55-4221-836c-87b487d3b44a" wsmap="managed"
    1007910085  >
    10080     <desc>Holds metrics parameters.</desc>
    10081  
     10086    <desc>
     10087      The IPerformanceMetric interface represents parameters of the given
     10088      performance metric.
     10089    </desc>
     10090
    1008210091    <attribute name="metricName" type="wstring" readonly="yes">
    1008310092      <desc>
     
    1008810097    <attribute name="object" type="$unknown" readonly="yes">
    1008910098      <desc>
    10090         The object this metric belongs to.
     10099        Object this metric belongs to.
    1009110100      </desc>
    1009210101    </attribute>
     
    1009410103    <attribute name="period" type="unsigned long" readonly="yes">
    1009510104      <desc>
    10096         The time interval between samples, measured in seconds.
     10105        Time interval between samples, measured in seconds.
    1009710106      </desc>
    1009810107    </attribute>
     
    1010010109    <attribute name="count" type="unsigned long" readonly="yes">
    1010110110      <desc>
    10102         The number of recent samples retained by the collector. Older samples
     10111        Number of recent samples retained by the performance collector for this
     10112        metric.
     10113
     10114        When the collected sample count exceeds this number, older samples
    1010310115        are discarded.
    1010410116      </desc>
     
    1010710119    <attribute name="unit" type="wstring" readonly="yes">
    1010810120      <desc>
    10109         The unit of measurement.
     10121        Unit of measurement.
    1011010122      </desc>
    1011110123    </attribute>
     
    1011310125    <attribute name="minimumValue" type="long" readonly="yes">
    1011410126      <desc>
    10115         The minimum possible value of this metric.
     10127        Minimum possible value of this metric.
    1011610128      </desc>
    1011710129    </attribute>
     
    1011910131    <attribute name="maximumValue" type="long" readonly="yes">
    1012010132      <desc>
    10121         The maximum possible value of this metric.
     10133        Maximum possible value of this metric.
    1012210134      </desc>
    1012310135    </attribute>
     
    1013010142  >
    1013110143    <desc>
    10132       This object collects and stores performace metrics data. Performance
    10133       metrics are associated with objects like IHost and IMachine. Each object
    10134       has a distict set of performance metrics. It can be obtained with
    10135       <link to="IPerformanceCollector::getMetrics"/>.
     10144      The IPerformanceCollector interfaces represents a service that collects
     10145      and stores performace metrics data.
     10146
     10147      Performance metrics are associated with objects like IHost and IMachine.
     10148      Each object has a distict set of performance metrics. It can be obtained
     10149      with <link to="IPerformanceCollector::getMetrics"/>.
    1013610150    </desc>
    1013710151
    1013810152    <attribute name="metricNames" type="wstring" readonly="yes" safearray="yes">
    1013910153      <desc>
    10140         An array of unique names of metrics regardless of objects they are
    10141         associated with.
    10142       </desc>
    10143     </attribute>
    10144  
     10154        Array of unique names of metrics.
     10155
     10156        This array represents all metrics supported by the performance
     10157        collector. Individual objects do not necessarily support all of them.
     10158        <link to="IPerformanceCollector::getMetrics"/> can be used to get the
     10159        list of supported metrics for a particular object.
     10160      </desc>
     10161    </attribute>
     10162
    1014510163    <method name="getMetrics">
    1014610164      <desc>
    10147         Returns parameters (characteristics?) of specified metrics for a set of
    10148         objects.
    10149         <note>
    10150           Null metrics array means all metrics. Null object array means all
    10151           existing objects.
    10152         </note>
    10153       </desc>
    10154       <param name="metricNames" type="wstring" dir="in" safearray="yes"/>
    10155       <param name="objects" type="$unknown" dir="in" safearray="yes"/>
    10156       <param name="metrics" type="IPerformanceMetric" dir="return" safearray="yes"/>
    10157     </method>
    10158  
     10165        Returns parameters of specified metrics for a set of objects.
     10166        <note>
     10167          @c Null metrics array means all metrics. @c Null object array means
     10168          all existing objects.
     10169        </note>
     10170      </desc>
     10171      <param name="metricNames" type="wstring" dir="in" safearray="yes">
     10172        <desc>
     10173          Metric name filter. Currently, only a comma-separated list of metrics
     10174          is supported.
     10175        </desc>
     10176      </param>
     10177      <param name="objects" type="$unknown" dir="in" safearray="yes">
     10178        <desc>
     10179          Set of objects to return metric parameters for.
     10180        </desc>
     10181      </param>
     10182      <param name="metrics" type="IPerformanceMetric" dir="return" safearray="yes">
     10183        <desc>
     10184          Array of returned metric parameters.
     10185        </desc>
     10186      </param>
     10187    </method>
     10188
    1015910189    <method name="setupMetrics">
    1016010190      <desc>
    1016110191        Sets parameters of specified metrics for a set of objects.
    1016210192        <note>
    10163           Null metrics array means all metrics. Null object array means all
    10164           existing objects.
    10165         </note>
    10166       </desc>
    10167       <param name="metricNames" type="wstring" dir="in" safearray="yes"/>
    10168       <param name="objects" type="$unknown" dir="in" safearray="yes"/>
    10169       <param name="period" type="unsigned long" dir="in"/>
    10170       <param name="count" type="unsigned long" dir="in"/>
     10193          @c Null metrics array means all metrics. @c Null object array means
     10194          all existing objects.
     10195        </note>
     10196      </desc>
     10197      <param name="metricNames" type="wstring" dir="in" safearray="yes">
     10198        <desc>
     10199          Metric name filter. Currently, only a comma-separated list of metrics
     10200          is supported.
     10201        </desc>
     10202      </param>
     10203      <param name="objects" type="$unknown" dir="in" safearray="yes">
     10204        <desc>
     10205          Set of objects to setup metric parameters for.
     10206        </desc>
     10207      </param>
     10208      <param name="period" type="unsigned long" dir="in">
     10209        <desc>
     10210          @todo ???
     10211        </desc>
     10212      </param>
     10213      <param name="count" type="unsigned long" dir="in">
     10214        <desc>
     10215          @todo ???
     10216        </desc>
     10217      </param>
    1017110218    </method>
    1017210219
    1017310220    <method name="enableMetrics">
    1017410221      <desc>
    10175         Turn on collection of specified metrics.
    10176         <note>
    10177           Null metrics array means all metrics. Null object array means all
    10178           existing objects.
    10179         </note>
    10180       </desc>
    10181       <param name="metricNames" type="wstring" dir="in" safearray="yes"/>
    10182       <param name="objects" type="$unknown" dir="in" safearray="yes"/>
     10222        Turns on collecting specified metrics.
     10223        <note>
     10224          @c Null metrics array means all metrics. @c Null object array means
     10225          all existing objects.
     10226        </note>
     10227      </desc>
     10228      <param name="metricNames" type="wstring" dir="in" safearray="yes">
     10229        <desc>
     10230          Metric name filter. Currently, only a comma-separated list of metrics
     10231          is supported.
     10232        </desc>
     10233      </param>
     10234      <param name="objects" type="$unknown" dir="in" safearray="yes">
     10235        <desc>
     10236          Set of objects to enable metrics for.
     10237        </desc>
     10238      </param>
    1018310239    </method>
    1018410240
    1018510241    <method name="disableMetrics">
    1018610242      <desc>
    10187         Turn off collection of specified metrics.
    10188         <note>
    10189           Null metrics array means all metrics. Null object array means all
    10190           existing objects.
    10191         </note>
    10192       </desc>
    10193       <param name="metricNames" type="wstring" dir="in" safearray="yes"/>
    10194       <param name="objects" type="$unknown" dir="in" safearray="yes"/>
     10243        Turns off collecting specified metrics.
     10244        <note>
     10245          @c Null metrics array means all metrics. @c Null object array means
     10246          all existing objects.
     10247        </note>
     10248      </desc>
     10249      <param name="metricNames" type="wstring" dir="in" safearray="yes">
     10250        <desc>
     10251          Metric name filter. Currently, only a comma-separated list of metrics
     10252          is supported.
     10253        </desc>
     10254      </param>
     10255      <param name="objects" type="$unknown" dir="in" safearray="yes">
     10256        <desc>
     10257          Set of objects to disable metrics for.
     10258        </desc>
     10259      </param>
    1019510260    </method>
    1019610261
     
    1019810263      <desc>
    1019910264        Queries collected metrics data for a set of objects.
    10200         <note>
    10201           Null metrics array means all applicable metrics. Null object array
    10202           means all existing objects. The @a returnData parameter is a
    10203           flattened array of arrays. Each start and length of a sub-array is
    10204           indicated by @a returnDataIndices and @a returnDataLengths. The
    10205           rationale behind this API style is that it doesn't require objects
    10206           to be returned, and thus eliminates all but the unavoidable IPC.
    10207         </note>
    10208       </desc>
    10209       <param name="metricNames" type="wstring" dir="in" safearray="yes"/>
    10210       <param name="objects" type="$unknown" dir="in" safearray="yes"/>
    10211       <param name="returnMetricNames" type="wstring" dir="out" safearray="yes"/>
    10212       <param name="returnObjects" type="$unknown" dir="out" safearray="yes"/>
    10213       <param name="returnDataIndices" type="unsigned long" dir="out" safearray="yes"/>
    10214       <param name="returnDataLengths" type="unsigned long" dir="out" safearray="yes"/>
    10215       <param name="returnData" type="long" dir="return" safearray="yes"/>
     10265
     10266        The @a returnData parameter is a flattened array of arrays. Each start
     10267        and length of a sub-array is indicated by @a returnDataIndices and @a
     10268        returnDataLengths.
     10269
     10270        <note>
     10271          @c Null metrics array means all applicable metrics. @c Null object
     10272          array means all existing objects.
     10273        </note>
     10274      </desc>
     10275      <param name="metricNames" type="wstring" dir="in" safearray="yes">
     10276        <desc>
     10277          Metric name filter. Currently, only a comma-separated list of metrics
     10278          is supported.
     10279        </desc>
     10280      </param>
     10281      <param name="objects" type="$unknown" dir="in" safearray="yes">
     10282        <desc>
     10283          Set of objects to query metrics for.
     10284        </desc>
     10285      </param>
     10286      <param name="returnMetricNames" type="wstring" dir="out" safearray="yes">
     10287        <desc>
     10288          @todo ???
     10289        </desc>
     10290      </param>
     10291      <param name="returnObjects" type="$unknown" dir="out" safearray="yes">
     10292        <desc>
     10293          @todo ???
     10294        </desc>
     10295      </param>
     10296      <param name="returnDataIndices" type="unsigned long" dir="out" safearray="yes">
     10297        <desc>
     10298          @todo ???
     10299        </desc>
     10300      </param>
     10301      <param name="returnDataLengths" type="unsigned long" dir="out" safearray="yes">
     10302        <desc>
     10303          @todo ???
     10304        </desc>
     10305      </param>
     10306      <param name="returnData" type="long" dir="return" safearray="yes">
     10307        <desc>
     10308          @todo ???
     10309        </desc>
     10310      </param>
    1021610311    </method>
    1021710312
  • trunk/src/VBox/Main/include/HostImpl.h

    r10592 r10595  
    7272
    7373    // public initializer/uninitializer for internal purposes only
    74     HRESULT init (VirtualBox *parent);
     74    HRESULT init (VirtualBox *aParent);
    7575    void uninit();
    7676
     
    164164
    165165#ifdef VBOX_WITH_RESOURCE_USAGE_API
    166     void registerMetrics(PerformanceCollector *collector);
    167     void unregisterMetrics(PerformanceCollector *collector);
     166    void registerMetrics (PerformanceCollector *aCollector);
     167    void unregisterMetrics (PerformanceCollector *aCollector);
    168168#endif /* VBOX_WITH_RESOURCE_USAGE_API */
    169169
  • trunk/src/VBox/Main/include/MachineImpl.h

    r10544 r10595  
    712712
    713713#ifdef VBOX_WITH_RESOURCE_USAGE_API
    714     void registerMetrics(PerformanceCollector *collector);
    715     void unregisterMetrics(PerformanceCollector *collector);
     714    void registerMetrics (PerformanceCollector *aCollector);
     715    void unregisterMetrics (PerformanceCollector *aCollector);
    716716#endif /* VBOX_WITH_RESOURCE_USAGE_API */
    717717
  • trunk/src/VBox/Main/include/VirtualBoxImpl.h

    r10544 r10595  
    257257
    258258    const ComObjPtr <Host> &host() { return mData.mHost; }
    259     const ComObjPtr <SystemProperties> &systemProperties() { return mData.mSystemProperties; }
     259    const ComObjPtr <SystemProperties> &systemProperties()
     260        { return mData.mSystemProperties; }
     261#ifdef VBOX_WITH_RESOURCE_USAGE_API
     262    const ComObjPtr <PerformanceCollector> &performanceCollector()
     263        { return mData.mPerformanceCollector; }
     264#endif /* VBOX_WITH_RESOURCE_USAGE_API */
     265
    260266
    261267    /** Returns the VirtualBox home directory */
     
    350356    /* for VirtualBoxSupportErrorInfoImpl */
    351357    static const wchar_t *getComponentName() { return L"VirtualBox"; }
    352 
    353 #ifdef VBOX_WITH_RESOURCE_USAGE_API
    354     PerformanceCollector *getCollector() { return mData.mPerformanceCollector; };
    355 #endif /* VBOX_WITH_RESOURCE_USAGE_API */
    356358
    357359private:
  • trunk/src/VBox/Main/testcase/tstAPI.cpp

    r10589 r10595  
    922922    do {
    923923        Bstr metricNames[] = { L"CPU/User:avg,CPU/System:avg,CPU/Idle:avg" };
    924         com::SafeArray<BSTR> metrics(1);
    925         metricNames[0].detachTo(&metrics[0]);
     924        com::SafeArray<BSTR> metrics (1);
     925        metricNames[0].cloneTo (&metrics [0]);
    926926
    927927        ComPtr <IHost> host;
    928         CHECK_RC_BREAK (virtualBox->COMGETTER(Host) (host.asOutParam()));
     928        CHECK_ERROR_BREAK (virtualBox, COMGETTER(Host) (host.asOutParam()));
    929929        ComPtr <IPerformanceCollector> collector;
    930         CHECK_RC_BREAK( virtualBox->COMGETTER(PerformanceCollector)(collector.asOutParam()) );
     930        CHECK_ERROR_BREAK (virtualBox,
     931                           COMGETTER(PerformanceCollector) (collector.asOutParam()));
    931932
    932933        com::SafeIfaceArray<IUnknown> objects(1);
    933934        host.queryInterfaceTo(&objects[0]);
    934         CHECK_RC_BREAK( collector->SetupMetrics(ComSafeArrayAsInParam(metrics),
     935        CHECK_ERROR_BREAK (collector, SetupMetrics(ComSafeArrayAsInParam(metrics),
    935936                                                ComSafeArrayAsInParam(objects), 1u, 10u) );
    936937        RTThreadSleep(3000); /* Sleep 10 seconds. */
     
    940941        com::SafeArray<ULONG>         retLengths;
    941942        com::SafeArray<LONG>          retData;
    942         CHECK_RC_BREAK( collector->QueryMetricsData(ComSafeArrayAsInParam(metrics),
    943                                                     ComSafeArrayAsInParam(objects),
    944                                                     ComSafeArrayAsOutParam(retNames),
    945                                                     ComSafeArrayAsOutParam(retObjects),
    946                                                     ComSafeArrayAsOutParam(retIndices),
    947                                                     ComSafeArrayAsOutParam(retLengths),
    948                                                     ComSafeArrayAsOutParam(retData)) );
     943        CHECK_ERROR_BREAK (collector, QueryMetricsData(ComSafeArrayAsInParam(metrics),
     944                                                       ComSafeArrayAsInParam(objects),
     945                                                       ComSafeArrayAsOutParam(retNames),
     946                                                       ComSafeArrayAsOutParam(retObjects),
     947                                                       ComSafeArrayAsOutParam(retIndices),
     948                                                       ComSafeArrayAsOutParam(retLengths),
     949                                                       ComSafeArrayAsOutParam(retData)) );
    949950        for (unsigned i = 0; i < retNames.size(); i++)
    950951        {
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