Changeset 10595 in vbox
- Timestamp:
- Jul 14, 2008 12:23:57 PM (17 years ago)
- svn:sync-xref-src-repo-rev:
- 33291
- Location:
- trunk/src/VBox/Main
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/HostImpl.cpp
r10544 r10595 135 135 * Initializes the host object. 136 136 * 137 * @returns COM result indicator 138 * @param parent handle of our parent object 137 * @param aParent VirtualBox parent object. 139 138 */ 140 HRESULT Host::init (VirtualBox * parent)139 HRESULT Host::init (VirtualBox *aParent) 141 140 { 142 141 LogFlowThisFunc (("isReady=%d\n", isReady())); 143 142 144 ComAssertRet ( parent, E_INVALIDARG);143 ComAssertRet (aParent, E_INVALIDARG); 145 144 146 145 AutoWriteLock alock (this); 147 146 ComAssertRet (!isReady(), E_UNEXPECTED); 148 147 149 mParent = parent;148 mParent = aParent; 150 149 151 150 #ifdef VBOX_WITH_USB … … 171 170 172 171 #ifdef VBOX_WITH_RESOURCE_USAGE_API 173 registerMetrics (parent->getCollector());172 registerMetrics (aParent->performanceCollector()); 174 173 #endif /* VBOX_WITH_RESOURCE_USAGE_API */ 175 174 … … 189 188 190 189 #ifdef VBOX_WITH_RESOURCE_USAGE_API 191 unregisterMetrics (mParent->getCollector());190 unregisterMetrics (mParent->performanceCollector()); 192 191 #endif /* VBOX_WITH_RESOURCE_USAGE_API */ 193 192 … … 2693 2692 2694 2693 #ifdef VBOX_WITH_RESOURCE_USAGE_API 2695 void Host::registerMetrics (PerformanceCollector *collector)2696 { 2697 pm::MetricFactory *metricFactory = collector->getMetricFactory();2698 / / Create sub metrics2699 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 metrics2694 void 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 */ 2703 2702 IUnknown *objptr; 2704 ComObjPtr <Host> tmp = this;2705 tmp.queryInterfaceTo (&objptr);2703 ComObjPtr <Host> tmp = this; 2704 tmp.queryInterfaceTo (&objptr); 2706 2705 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())); 2721 2730 }; 2722 2731 2723 void Host::unregisterMetrics (PerformanceCollector *collector)2724 { 2725 collector->unregisterMetricsFor(this);2726 collector->unregisterBaseMetricsFor(this);2732 void Host::unregisterMetrics (PerformanceCollector *aCollector) 2733 { 2734 aCollector->unregisterMetricsFor (this); 2735 aCollector->unregisterBaseMetricsFor (this); 2727 2736 }; 2728 2737 #endif /* VBOX_WITH_RESOURCE_USAGE_API */ -
trunk/src/VBox/Main/MachineImpl.cpp
r10544 r10595 7277 7277 7278 7278 #ifdef VBOX_WITH_RESOURCE_USAGE_API 7279 void Machine::registerMetrics (PerformanceCollector *collector)7280 { 7281 pm::MetricFactory *metricFactory = collector->getMetricFactory();7282 / / Create sub metrics7283 pm::SubMetric *cpuLoadUser = new pm::SubMetric ("CPU/Load/User");7284 pm::SubMetric *cpuLoadKernel = new pm::SubMetric ("CPU/Load/Kernel");7285 / / Create and register base metrics7279 void 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 */ 7286 7286 IUnknown *objptr; 7287 7287 7288 7288 ComObjPtr<Machine> tmp = this; 7289 tmp.queryInterfaceTo (&objptr);7289 tmp.queryInterfaceTo (&objptr); 7290 7290 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())); 7302 7309 }; 7303 7310 7304 void Machine::unregisterMetrics (PerformanceCollector *collector)7305 { 7306 collector->unregisterMetricsFor(this);7307 collector->unregisterBaseMetricsFor(this);7311 void Machine::unregisterMetrics (PerformanceCollector *aCollector) 7312 { 7313 aCollector->unregisterMetricsFor (this); 7314 aCollector->unregisterBaseMetricsFor (this); 7308 7315 }; 7309 7316 #endif /* VBOX_WITH_RESOURCE_USAGE_API */ -
trunk/src/VBox/Main/VirtualBoxImpl.cpp
r10544 r10595 231 231 /* create the performance collector object BEFORE host */ 232 232 unconst (mData.mPerformanceCollector).createObject(); 233 rc = mData.mPerformanceCollector->init 233 rc = mData.mPerformanceCollector->init(); 234 234 ComAssertComRCThrowRC (rc); 235 235 #endif /* VBOX_WITH_RESOURCE_USAGE_API */ … … 570 570 CheckComRCReturnRC (autoCaller.rc()); 571 571 572 /* mHost is const, no need to lock */ 572 573 mData.mHost.queryInterfaceTo (aHost); 573 574 return S_OK; … … 583 584 CheckComRCReturnRC (autoCaller.rc()); 584 585 586 /* mSystemProperties is const, no need to lock */ 585 587 mData.mSystemProperties.queryInterfaceTo (aSystemProperties); 586 588 return S_OK; 589 } 590 591 /** 592 * @note Locks this object for reading. 593 */ 594 STDMETHODIMP 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 */ 615 STDMETHODIMP 616 VirtualBox::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 */ 635 STDMETHODIMP 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 */ 656 STDMETHODIMP 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 */ 677 STDMETHODIMP 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 */ 698 STDMETHODIMP 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 */ 719 STDMETHODIMP 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 737 STDMETHODIMP 738 VirtualBox::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"); 587 747 } 588 748 … … 597 757 CheckComRCReturnRC (autoCaller.rc()); 598 758 759 /* mPerformanceCollector is const, no need to lock */ 599 760 mData.mPerformanceCollector.queryInterfaceTo (aPerformanceCollector); 600 761 … … 603 764 return E_NOTIMPL; 604 765 #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 STDMETHODIMP633 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 STDMETHODIMP755 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");764 766 } 765 767 -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r10544 r10595 1057 1057 </desc> 1058 1058 </attribute> 1059 1059 1060 <attribute name="performanceCollector" type="IPerformanceCollector" readonly="yes"> 1060 1061 <desc> 1061 The only instance of IPerformanceCollector.1062 Associated performance collector object. 1062 1063 </desc> 1063 1064 </attribute> … … 10074 10075 </if> 10075 10076 10077 <!-- 10078 // IPerformanceCollector & friends 10079 ///////////////////////////////////////////////////////////////////////// 10080 --> 10081 10076 10082 <interface 10077 10083 name="IPerformanceMetric" extends="$unknown" 10078 10084 uuid="50831d4c-ed55-4221-836c-87b487d3b44a" wsmap="managed" 10079 10085 > 10080 <desc>Holds metrics parameters.</desc> 10081 10086 <desc> 10087 The IPerformanceMetric interface represents parameters of the given 10088 performance metric. 10089 </desc> 10090 10082 10091 <attribute name="metricName" type="wstring" readonly="yes"> 10083 10092 <desc> … … 10088 10097 <attribute name="object" type="$unknown" readonly="yes"> 10089 10098 <desc> 10090 The object this metric belongs to.10099 Object this metric belongs to. 10091 10100 </desc> 10092 10101 </attribute> … … 10094 10103 <attribute name="period" type="unsigned long" readonly="yes"> 10095 10104 <desc> 10096 T he time interval between samples, measured in seconds.10105 Time interval between samples, measured in seconds. 10097 10106 </desc> 10098 10107 </attribute> … … 10100 10109 <attribute name="count" type="unsigned long" readonly="yes"> 10101 10110 <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 10103 10115 are discarded. 10104 10116 </desc> … … 10107 10119 <attribute name="unit" type="wstring" readonly="yes"> 10108 10120 <desc> 10109 The unit of measurement.10121 Unit of measurement. 10110 10122 </desc> 10111 10123 </attribute> … … 10113 10125 <attribute name="minimumValue" type="long" readonly="yes"> 10114 10126 <desc> 10115 The minimum possible value of this metric.10127 Minimum possible value of this metric. 10116 10128 </desc> 10117 10129 </attribute> … … 10119 10131 <attribute name="maximumValue" type="long" readonly="yes"> 10120 10132 <desc> 10121 The maximum possible value of this metric.10133 Maximum possible value of this metric. 10122 10134 </desc> 10123 10135 </attribute> … … 10130 10142 > 10131 10143 <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"/>. 10136 10150 </desc> 10137 10151 10138 10152 <attribute name="metricNames" type="wstring" readonly="yes" safearray="yes"> 10139 10153 <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 10145 10163 <method name="getMetrics"> 10146 10164 <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 10159 10189 <method name="setupMetrics"> 10160 10190 <desc> 10161 10191 Sets parameters of specified metrics for a set of objects. 10162 10192 <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> 10171 10218 </method> 10172 10219 10173 10220 <method name="enableMetrics"> 10174 10221 <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> 10183 10239 </method> 10184 10240 10185 10241 <method name="disableMetrics"> 10186 10242 <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> 10195 10260 </method> 10196 10261 … … 10198 10263 <desc> 10199 10264 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> 10216 10311 </method> 10217 10312 -
trunk/src/VBox/Main/include/HostImpl.h
r10592 r10595 72 72 73 73 // public initializer/uninitializer for internal purposes only 74 HRESULT init (VirtualBox * parent);74 HRESULT init (VirtualBox *aParent); 75 75 void uninit(); 76 76 … … 164 164 165 165 #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); 168 168 #endif /* VBOX_WITH_RESOURCE_USAGE_API */ 169 169 -
trunk/src/VBox/Main/include/MachineImpl.h
r10544 r10595 712 712 713 713 #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); 716 716 #endif /* VBOX_WITH_RESOURCE_USAGE_API */ 717 717 -
trunk/src/VBox/Main/include/VirtualBoxImpl.h
r10544 r10595 257 257 258 258 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 260 266 261 267 /** Returns the VirtualBox home directory */ … … 350 356 /* for VirtualBoxSupportErrorInfoImpl */ 351 357 static const wchar_t *getComponentName() { return L"VirtualBox"; } 352 353 #ifdef VBOX_WITH_RESOURCE_USAGE_API354 PerformanceCollector *getCollector() { return mData.mPerformanceCollector; };355 #endif /* VBOX_WITH_RESOURCE_USAGE_API */356 358 357 359 private: -
trunk/src/VBox/Main/testcase/tstAPI.cpp
r10589 r10595 922 922 do { 923 923 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]); 926 926 927 927 ComPtr <IHost> host; 928 CHECK_ RC_BREAK (virtualBox->COMGETTER(Host) (host.asOutParam()));928 CHECK_ERROR_BREAK (virtualBox, COMGETTER(Host) (host.asOutParam())); 929 929 ComPtr <IPerformanceCollector> collector; 930 CHECK_RC_BREAK( virtualBox->COMGETTER(PerformanceCollector)(collector.asOutParam()) ); 930 CHECK_ERROR_BREAK (virtualBox, 931 COMGETTER(PerformanceCollector) (collector.asOutParam())); 931 932 932 933 com::SafeIfaceArray<IUnknown> objects(1); 933 934 host.queryInterfaceTo(&objects[0]); 934 CHECK_ RC_BREAK( collector->SetupMetrics(ComSafeArrayAsInParam(metrics),935 CHECK_ERROR_BREAK (collector, SetupMetrics(ComSafeArrayAsInParam(metrics), 935 936 ComSafeArrayAsInParam(objects), 1u, 10u) ); 936 937 RTThreadSleep(3000); /* Sleep 10 seconds. */ … … 940 941 com::SafeArray<ULONG> retLengths; 941 942 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)) ); 949 950 for (unsigned i = 0; i < retNames.size(); i++) 950 951 {
Note:
See TracChangeset
for help on using the changeset viewer.