Changeset 12973 in vbox for trunk/src/VBox
- Timestamp:
- Oct 3, 2008 5:46:19 PM (16 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/Performance.cpp
r12942 r12973 305 305 mWrapped = false; 306 306 mEnd = 0; 307 mSequenceNumber = 0; 307 308 } 308 309 … … 322 323 mWrapped = true; 323 324 } 325 ++mSequenceNumber; 324 326 } 325 327 } … … 343 345 } 344 346 345 void Metric::query(ULONG **data, ULONG *count )347 void Metric::query(ULONG **data, ULONG *count, ULONG *sequenceNumber) 346 348 { 347 349 ULONG length; … … 349 351 350 352 length = mSubMetric->length(); 353 *sequenceNumber = mSubMetric->getSequenceNumber() - length; 351 354 if (length) 352 355 { -
trunk/src/VBox/Main/PerformanceImpl.cpp
r12668 r12973 474 474 ComSafeArrayOut (LONG, outData)) 475 475 { 476 com::SafeArray <BSTR> tmpUnits; 477 com::SafeArray <ULONG> tmpScales; 478 com::SafeArray <ULONG> tmpSequenceNumbers; 479 return QueryMetricsDataEx(ComSafeArrayInArg(metricNames), 480 ComSafeArrayInArg(objects), 481 ComSafeArrayOutArg(outMetricNames), 482 ComSafeArrayOutArg(outObjects), 483 ComSafeArrayAsOutParam(tmpUnits), 484 ComSafeArrayAsOutParam(tmpScales), 485 ComSafeArrayAsOutParam(tmpSequenceNumbers), 486 ComSafeArrayOutArg(outDataIndices), 487 ComSafeArrayOutArg(outDataLengths), 488 ComSafeArrayOutArg(outData)); 489 } 490 491 STDMETHODIMP 492 PerformanceCollector::QueryMetricsDataEx (ComSafeArrayIn (INPTR BSTR, metricNames), 493 ComSafeArrayIn (IUnknown *, objects), 494 ComSafeArrayOut (BSTR, outMetricNames), 495 ComSafeArrayOut (IUnknown *, outObjects), 496 ComSafeArrayOut (BSTR, outUnits), 497 ComSafeArrayOut (ULONG, outScales), 498 ComSafeArrayOut (ULONG, outSequenceNumbers), 499 ComSafeArrayOut (ULONG, outDataIndices), 500 ComSafeArrayOut (ULONG, outDataLengths), 501 ComSafeArrayOut (LONG, outData)) 502 { 476 503 AutoCaller autoCaller (this); 477 504 CheckComRCReturnRC (autoCaller.rc()); … … 498 525 com::SafeArray <BSTR> retNames (numberOfMetrics); 499 526 com::SafeIfaceArray <IUnknown> retObjects (numberOfMetrics); 527 com::SafeArray <BSTR> retUnits (numberOfMetrics); 528 com::SafeArray <ULONG> retScales (numberOfMetrics); 529 com::SafeArray <ULONG> retSequenceNumbers (numberOfMetrics); 500 530 com::SafeArray <ULONG> retIndices (numberOfMetrics); 501 531 com::SafeArray <ULONG> retLengths (numberOfMetrics); … … 504 534 for (it = filteredMetrics.begin(); it != filteredMetrics.end(); ++it, ++i) 505 535 { 506 /* @todo Filtering goes here! */ 507 ULONG *values, length; 536 ULONG *values, length, sequenceNumber; 508 537 /* @todo We may want to revise the query method to get rid of excessive alloc/memcpy calls. */ 509 (*it)->query(&values, &length );538 (*it)->query(&values, &length, &sequenceNumber); 510 539 LogFlow (("PerformanceCollector::QueryMetricsData() querying metric %s " 511 540 "returned %d values.\n", (*it)->getName(), length)); … … 514 543 tmp.detachTo(&retNames[i]); 515 544 (*it)->getObject().queryInterfaceTo (&retObjects[i]); 545 tmp = (*it)->getUnit(); 546 tmp.detachTo(&retUnits[i]); 547 retScales[i] = (*it)->getScale(); 548 retSequenceNumbers[i] = sequenceNumber; 516 549 retLengths[i] = length; 517 550 retIndices[i] = flatIndex; … … 521 554 retNames.detachTo (ComSafeArrayOutArg (outMetricNames)); 522 555 retObjects.detachTo (ComSafeArrayOutArg (outObjects)); 556 retUnits.detachTo (ComSafeArrayOutArg (outUnits)); 557 retScales.detachTo (ComSafeArrayOutArg (outScales)); 558 retSequenceNumbers.detachTo (ComSafeArrayOutArg (outSequenceNumbers)); 523 559 retIndices.detachTo (ComSafeArrayOutArg (outDataIndices)); 524 560 retLengths.detachTo (ComSafeArrayOutArg (outDataLengths)); -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r12942 r12973 10415 10415 <interface 10416 10416 name="IPerformanceCollector" extends="$unknown" 10417 uuid=" 840f887a-18b4-4af9-9608-d6a1813fe6ac"10417 uuid="4cbdd29e-e801-4fd1-b721-42a1c22b2d95" 10418 10418 wsmap="managed" 10419 10419 > … … 10783 10783 </method> 10784 10784 10785 <method name="queryMetricsDataEx"> 10786 <desc> 10787 Queries collected metrics data for a set of objects. 10788 10789 Indentical to <link to="IPerformanceCollector::queryMetricsData" /> except 10790 that it returns three additional arrays: <tt>returnUnits</tt>, 10791 <tt>returnScales</tt>, <tt>returnSequenceNumbers</tt>. All additional 10792 arrays have the same size as <tt>returnMetricNames</tt>. 10793 <note> 10794 @c Null metrics array means all applicable metrics. @c Null object 10795 array means all existing objects. 10796 </note> 10797 </desc> 10798 <param name="metricNames" type="wstring" dir="in" safearray="yes"> 10799 <desc> 10800 Metric name filter. Currently, only a comma-separated list of metrics 10801 is supported. 10802 </desc> 10803 </param> 10804 <param name="objects" type="$unknown" dir="in" safearray="yes"> 10805 <desc> 10806 Set of objects to query metrics for. 10807 </desc> 10808 </param> 10809 <param name="returnMetricNames" type="wstring" dir="out" safearray="yes"> 10810 <desc> 10811 Names of metrics returned in @c returnData. 10812 </desc> 10813 </param> 10814 <param name="returnObjects" type="$unknown" dir="out" safearray="yes"> 10815 <desc> 10816 Objects associated with metrics returned in @c returnData. 10817 </desc> 10818 </param> 10819 <param name="returnUnits" type="wstring" dir="out" safearray="yes"> 10820 <desc> 10821 Units of measurement for each returned metric. 10822 </desc> 10823 </param> 10824 <param name="returnScales" type="unsigned long" dir="out" safearray="yes"> 10825 <desc> 10826 Divisor that should be applied to return values in order to get 10827 floating point values. For example: 10828 <tt>(double)returnData[returnDataIndices[0]+i] / returnScales[0]</tt> 10829 will retrieve the floating point value of i-th sample of the first 10830 metric. 10831 </desc> 10832 </param> 10833 <param name="returnSequenceNumbers" type="unsigned long" dir="out" safearray="yes"> 10834 <desc> 10835 Sequence numbers of the first elements of value sequences of particular metrics 10836 returned in @c returnData. For aggregate metrics it is the sequence number of 10837 the sample the aggregate started calculation from. 10838 </desc> 10839 </param> 10840 <param name="returnDataIndices" type="unsigned long" dir="out" safearray="yes"> 10841 <desc> 10842 Indices of the first elements of value sequences of particular metrics 10843 returned in @c returnData. 10844 </desc> 10845 </param> 10846 <param name="returnDataLengths" type="unsigned long" dir="out" safearray="yes"> 10847 <desc> 10848 Lengths of value sequences of particular metrics. 10849 </desc> 10850 </param> 10851 <param name="returnData" type="long" dir="return" safearray="yes"> 10852 <desc> 10853 Flattened array of all metric data containing sequences of values for 10854 each metric. 10855 </desc> 10856 </param> 10857 </method> 10858 10859 10785 10860 </interface> 10786 10861 -
trunk/src/VBox/Main/include/Performance.h
r12942 r12973 43 43 void init(ULONG length); 44 44 ULONG length(); 45 ULONG getSequenceNumber() { return mSequenceNumber; } 45 46 void put(ULONG value); 46 47 void copyTo(ULONG *data); … … 49 50 ULONG mLength; 50 51 ULONG mEnd; 51 bool mWrapped; 52 ULONG mSequenceNumber; 53 bool mWrapped; 52 54 }; 53 55 … … 164 166 virtual ULONG getMinValue() = 0; 165 167 virtual ULONG getMaxValue() = 0; 168 virtual ULONG getScale() = 0; 166 169 167 170 bool collectorBeat(uint64_t nowAt); … … 198 201 ULONG getMinValue() { return 0; }; 199 202 ULONG getMaxValue() { return PM_CPU_LOAD_MULTIPLIER; }; 203 ULONG getScale() { return PM_CPU_LOAD_MULTIPLIER / 100; } 200 204 201 205 protected: … … 231 235 ULONG getMinValue() { return 0; }; 232 236 ULONG getMaxValue() { return INT32_MAX; }; 237 ULONG getScale() { return 1; } 233 238 private: 234 239 SubMetric *mMHz; … … 247 252 ULONG getMinValue() { return 0; }; 248 253 ULONG getMaxValue() { return INT32_MAX; }; 254 ULONG getScale() { return 1; } 249 255 private: 250 256 SubMetric *mTotal; … … 264 270 ULONG getMinValue() { return 0; }; 265 271 ULONG getMaxValue() { return PM_CPU_LOAD_MULTIPLIER; }; 272 ULONG getScale() { return PM_CPU_LOAD_MULTIPLIER / 100; } 266 273 protected: 267 274 RTPROCESS mProcess; … … 296 303 ULONG getMinValue() { return 0; }; 297 304 ULONG getMaxValue() { return INT32_MAX; }; 305 ULONG getScale() { return 1; } 298 306 private: 299 307 RTPROCESS mProcess; … … 360 368 ULONG getLength() 361 369 { return mAggregate ? 1 : mBaseMetric->getLength(); }; 362 void query(ULONG **data, ULONG *count); 370 ULONG getScale() { return mBaseMetric->getScale(); } 371 void query(ULONG **data, ULONG *count, ULONG *sequenceNumber); 363 372 364 373 private: -
trunk/src/VBox/Main/include/PerformanceImpl.h
r12668 r12973 153 153 STDMETHOD(DisableMetrics) (ComSafeArrayIn (INPTR BSTR, metricNames), 154 154 ComSafeArrayIn (IUnknown *, objects)); 155 STDMETHOD(QueryMetricsData) (ComSafeArrayIn (INPTR BSTR, metricNames), 156 ComSafeArrayIn (IUnknown *, objects), 157 ComSafeArrayOut (BSTR, outMetricNames), 158 ComSafeArrayOut (IUnknown *, outObjects), 159 ComSafeArrayOut (ULONG, outDataIndices), 160 ComSafeArrayOut (ULONG, outDataLengths), 161 ComSafeArrayOut (LONG, outData)); 162 155 163 STDMETHOD(SetupMetricsEx) (ComSafeArrayIn (INPTR BSTR, metricNames), 156 164 ComSafeArrayIn (IUnknown *, objects), … … 166 174 ComSafeArrayOut (IPerformanceMetric *, 167 175 outMetrics)); 168 STDMETHOD(QueryMetricsData) (ComSafeArrayIn (INPTR BSTR, metricNames), 169 ComSafeArrayIn (IUnknown *, objects), 170 ComSafeArrayOut (BSTR, outMetricNames), 171 ComSafeArrayOut (IUnknown *, outObjects), 172 ComSafeArrayOut (ULONG, outDataIndices), 173 ComSafeArrayOut (ULONG, outDataLengths), 174 ComSafeArrayOut (LONG, outData)); 176 STDMETHOD(QueryMetricsDataEx) (ComSafeArrayIn (INPTR BSTR, metricNames), 177 ComSafeArrayIn (IUnknown *, objects), 178 ComSafeArrayOut (BSTR, outMetricNames), 179 ComSafeArrayOut (IUnknown *, outObjects), 180 ComSafeArrayOut (BSTR, outUnits), 181 ComSafeArrayOut (ULONG, outScales), 182 ComSafeArrayOut (ULONG, outSequenceNumbers), 183 ComSafeArrayOut (ULONG, outDataIndices), 184 ComSafeArrayOut (ULONG, outDataLengths), 185 ComSafeArrayOut (LONG, outData)); 175 186 176 187 // public methods only for internal purposes
Note:
See TracChangeset
for help on using the changeset viewer.