VirtualBox

source: vbox/trunk/src/VBox/Main/PerformanceImpl.cpp@ 16560

Last change on this file since 16560 was 16560, checked in by vboxsync, 15 years ago

Main: do not include include/VBox/settings.h from other header files but only from implementations that need it (save compile time)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 21.2 KB
Line 
1/* $Id: PerformanceImpl.cpp 16560 2009-02-06 18:06:04Z vboxsync $ */
2
3/** @file
4 *
5 * VBox Performance API COM Classes implementation
6 */
7
8/*
9 * Copyright (C) 2008 Sun Microsystems, Inc.
10 *
11 * This file is part of VirtualBox Open Source Edition (OSE), as
12 * available from http://www.virtualbox.org. This file is free software;
13 * you can redistribute it and/or modify it under the terms of the GNU
14 * General Public License (GPL) as published by the Free Software
15 * Foundation, in version 2 as it comes in the "COPYING" file of the
16 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
17 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
18 *
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
20 * Clara, CA 95054 USA or visit http://www.sun.com if you need
21 * additional information or have any questions.
22 */
23
24#include "PerformanceImpl.h"
25
26#include "Logging.h"
27
28#include <iprt/process.h>
29
30#include <VBox/err.h>
31#include <VBox/settings.h>
32
33#include <vector>
34#include <algorithm>
35#include <functional>
36
37static Bstr gMetricNames[] =
38{
39 "CPU/Load/User",
40 "CPU/Load/User:avg",
41 "CPU/Load/User:min",
42 "CPU/Load/User:max",
43 "CPU/Load/Kernel",
44 "CPU/Load/Kernel:avg",
45 "CPU/Load/Kernel:min",
46 "CPU/Load/Kernel:max",
47 "CPU/Load/Idle",
48 "CPU/Load/Idle:avg",
49 "CPU/Load/Idle:min",
50 "CPU/Load/Idle:max",
51 "CPU/MHz",
52 "CPU/MHz:avg",
53 "CPU/MHz:min",
54 "CPU/MHz:max",
55 "RAM/Usage/Total",
56 "RAM/Usage/Total:avg",
57 "RAM/Usage/Total:min",
58 "RAM/Usage/Total:max",
59 "RAM/Usage/Used",
60 "RAM/Usage/Used:avg",
61 "RAM/Usage/Used:min",
62 "RAM/Usage/Used:max",
63 "RAM/Usage/Free",
64 "RAM/Usage/Free:avg",
65 "RAM/Usage/Free:min",
66 "RAM/Usage/Free:max",
67};
68
69////////////////////////////////////////////////////////////////////////////////
70// PerformanceCollector class
71////////////////////////////////////////////////////////////////////////////////
72
73// constructor / destructor
74////////////////////////////////////////////////////////////////////////////////
75
76PerformanceCollector::PerformanceCollector() : mMagic(0) {}
77
78PerformanceCollector::~PerformanceCollector() {}
79
80HRESULT PerformanceCollector::FinalConstruct()
81{
82 LogFlowThisFunc (("\n"));
83
84 return S_OK;
85}
86
87void PerformanceCollector::FinalRelease()
88{
89 LogFlowThisFunc (("\n"));
90}
91
92// public initializer/uninitializer for internal purposes only
93////////////////////////////////////////////////////////////////////////////////
94
95/**
96 * Initializes the PerformanceCollector object.
97 */
98HRESULT PerformanceCollector::init()
99{
100 /* Enclose the state transition NotReady->InInit->Ready */
101 AutoInitSpan autoInitSpan (this);
102 AssertReturn (autoInitSpan.isOk(), E_FAIL);
103
104 LogFlowThisFuncEnter();
105
106 HRESULT rc = S_OK;
107
108 m.hal = pm::createHAL();
109
110 /* Let the sampler know it gets a valid collector. */
111 mMagic = MAGIC;
112
113 /* Start resource usage sampler */
114 int vrc = RTTimerLRCreate (&m.sampler, VBOX_USAGE_SAMPLER_MIN_INTERVAL,
115 &PerformanceCollector::staticSamplerCallback, this);
116 AssertMsgRC (vrc, ("Failed to create resource usage "
117 "sampling timer(%Rra)\n", vrc));
118 if (RT_FAILURE (vrc))
119 rc = E_FAIL;
120
121 if (SUCCEEDED (rc))
122 autoInitSpan.setSucceeded();
123
124 LogFlowThisFuncLeave();
125
126 return rc;
127}
128
129/**
130 * Uninitializes the PerformanceCollector object.
131 *
132 * Called either from FinalRelease() or by the parent when it gets destroyed.
133 */
134void PerformanceCollector::uninit()
135{
136 LogFlowThisFuncEnter();
137
138 /* Enclose the state transition Ready->InUninit->NotReady */
139 AutoUninitSpan autoUninitSpan (this);
140 if (autoUninitSpan.uninitDone())
141 {
142 LogFlowThisFunc (("Already uninitialized.\n"));
143 LogFlowThisFuncLeave();
144 return;
145 }
146
147 mMagic = 0;
148
149 /* Destroy resource usage sampler */
150 int vrc = RTTimerLRDestroy (m.sampler);
151 AssertMsgRC (vrc, ("Failed to destroy resource usage "
152 "sampling timer (%Rra)\n", vrc));
153 m.sampler = NULL;
154
155 //delete m.factory;
156 //m.factory = NULL;
157
158 delete m.hal;
159 m.hal = NULL;
160
161 LogFlowThisFuncLeave();
162}
163
164// IPerformanceCollector properties
165////////////////////////////////////////////////////////////////////////////////
166
167STDMETHODIMP
168PerformanceCollector::COMGETTER(MetricNames) (ComSafeArrayOut (BSTR, theMetricNames))
169{
170 if (ComSafeArrayOutIsNull (theMetricNames))
171 return E_POINTER;
172
173 AutoCaller autoCaller (this);
174 CheckComRCReturnRC (autoCaller.rc());
175
176 AutoReadLock alock (this);
177
178 com::SafeArray <BSTR> metricNames(RT_ELEMENTS(gMetricNames));
179 for (size_t i = 0; i < RT_ELEMENTS(gMetricNames); i++)
180 {
181 gMetricNames[i].detachTo(&metricNames[i]);
182 }
183 //gMetricNames.detachTo(ComSafeArrayOutArg (theMetricNames));
184 metricNames.detachTo (ComSafeArrayOutArg (theMetricNames));
185
186 return S_OK;
187}
188
189// IPerformanceCollector methods
190////////////////////////////////////////////////////////////////////////////////
191
192HRESULT PerformanceCollector::toIPerformanceMetric(pm::Metric *src, IPerformanceMetric **dst)
193{
194 ComObjPtr <PerformanceMetric> metric;
195 HRESULT rc = metric.createObject();
196 if (SUCCEEDED (rc))
197 rc = metric->init (src);
198 AssertComRCReturnRC (rc);
199 metric.queryInterfaceTo (dst);
200 return rc;
201}
202
203HRESULT PerformanceCollector::toIPerformanceMetric(pm::BaseMetric *src, IPerformanceMetric **dst)
204{
205 ComObjPtr <PerformanceMetric> metric;
206 HRESULT rc = metric.createObject();
207 if (SUCCEEDED (rc))
208 rc = metric->init (src);
209 AssertComRCReturnRC (rc);
210 metric.queryInterfaceTo (dst);
211 return rc;
212}
213
214STDMETHODIMP
215PerformanceCollector::GetMetrics (ComSafeArrayIn (IN_BSTR, metricNames),
216 ComSafeArrayIn (IUnknown *, objects),
217 ComSafeArrayOut (IPerformanceMetric *, outMetrics))
218{
219 LogFlowThisFuncEnter();
220 //LogFlowThisFunc (("mState=%d, mType=%d\n", mState, mType));
221
222 HRESULT rc = S_OK;
223
224 AutoCaller autoCaller (this);
225 CheckComRCReturnRC (autoCaller.rc());
226
227 pm::Filter filter (ComSafeArrayInArg (metricNames),
228 ComSafeArrayInArg (objects));
229
230 AutoReadLock alock (this);
231
232 MetricList filteredMetrics;
233 MetricList::iterator it;
234 for (it = m.metrics.begin(); it != m.metrics.end(); ++it)
235 if (filter.match ((*it)->getObject(), (*it)->getName()))
236 filteredMetrics.push_back (*it);
237
238 com::SafeIfaceArray<IPerformanceMetric> retMetrics (filteredMetrics.size());
239 int i = 0;
240 for (it = filteredMetrics.begin(); it != filteredMetrics.end(); ++it)
241 {
242 ComObjPtr <PerformanceMetric> metric;
243 rc = metric.createObject();
244 if (SUCCEEDED (rc))
245 rc = metric->init (*it);
246 AssertComRCReturnRC (rc);
247 LogFlow (("PerformanceCollector::GetMetrics() store a metric at "
248 "retMetrics[%d]...\n", i));
249 metric.queryInterfaceTo (&retMetrics [i++]);
250 }
251 retMetrics.detachTo (ComSafeArrayOutArg(outMetrics));
252 LogFlowThisFuncLeave();
253 return rc;
254}
255
256STDMETHODIMP
257PerformanceCollector::SetupMetrics (ComSafeArrayIn (IN_BSTR, metricNames),
258 ComSafeArrayIn (IUnknown *, objects),
259 ULONG aPeriod, ULONG aCount,
260 ComSafeArrayOut (IPerformanceMetric *,
261 outMetrics))
262{
263 AutoCaller autoCaller (this);
264 CheckComRCReturnRC (autoCaller.rc());
265
266 pm::Filter filter (ComSafeArrayInArg (metricNames),
267 ComSafeArrayInArg (objects));
268
269 AutoWriteLock alock (this);
270
271 HRESULT rc = S_OK;
272 BaseMetricList filteredMetrics;
273 BaseMetricList::iterator it;
274 for (it = m.baseMetrics.begin(); it != m.baseMetrics.end(); ++it)
275 if (filter.match((*it)->getObject(), (*it)->getName()))
276 {
277 LogFlow (("PerformanceCollector::SetupMetrics() setting period to %u,"
278 " count to %u for %s\n", aPeriod, aCount, (*it)->getName()));
279 (*it)->init(aPeriod, aCount);
280 if (aPeriod == 0 || aCount == 0)
281 {
282 LogFlow (("PerformanceCollector::SetupMetrics() disabling %s\n",
283 (*it)->getName()));
284 (*it)->disable();
285 }
286 else
287 {
288 LogFlow (("PerformanceCollector::SetupMetrics() enabling %s\n",
289 (*it)->getName()));
290 (*it)->enable();
291 }
292 filteredMetrics.push_back(*it);
293 }
294
295 com::SafeIfaceArray<IPerformanceMetric> retMetrics (filteredMetrics.size());
296 int i = 0;
297 for (it = filteredMetrics.begin();
298 it != filteredMetrics.end() && SUCCEEDED (rc); ++it)
299 rc = toIPerformanceMetric(*it, &retMetrics [i++]);
300 retMetrics.detachTo (ComSafeArrayOutArg(outMetrics));
301
302 LogFlowThisFuncLeave();
303 return rc;
304}
305
306STDMETHODIMP
307PerformanceCollector::EnableMetrics (ComSafeArrayIn (IN_BSTR, metricNames),
308 ComSafeArrayIn (IUnknown *, objects),
309 ComSafeArrayOut (IPerformanceMetric *,
310 outMetrics))
311{
312 AutoCaller autoCaller (this);
313 CheckComRCReturnRC (autoCaller.rc());
314
315 pm::Filter filter (ComSafeArrayInArg (metricNames),
316 ComSafeArrayInArg (objects));
317
318 AutoWriteLock alock (this); /* Write lock is not needed atm since we are */
319 /* fiddling with enable bit only, but we */
320 /* care for those who come next :-). */
321
322 HRESULT rc = S_OK;
323 BaseMetricList filteredMetrics;
324 BaseMetricList::iterator it;
325 for (it = m.baseMetrics.begin(); it != m.baseMetrics.end(); ++it)
326 if (filter.match((*it)->getObject(), (*it)->getName()))
327 {
328 (*it)->enable();
329 filteredMetrics.push_back(*it);
330 }
331
332 com::SafeIfaceArray<IPerformanceMetric> retMetrics (filteredMetrics.size());
333 int i = 0;
334 for (it = filteredMetrics.begin();
335 it != filteredMetrics.end() && SUCCEEDED (rc); ++it)
336 rc = toIPerformanceMetric(*it, &retMetrics [i++]);
337 retMetrics.detachTo (ComSafeArrayOutArg(outMetrics));
338
339 LogFlowThisFuncLeave();
340 return rc;
341}
342
343STDMETHODIMP
344PerformanceCollector::DisableMetrics (ComSafeArrayIn (IN_BSTR, metricNames),
345 ComSafeArrayIn (IUnknown *, objects),
346 ComSafeArrayOut (IPerformanceMetric *,
347 outMetrics))
348{
349 AutoCaller autoCaller (this);
350 CheckComRCReturnRC (autoCaller.rc());
351
352 pm::Filter filter (ComSafeArrayInArg (metricNames),
353 ComSafeArrayInArg (objects));
354
355 AutoWriteLock alock (this); /* Write lock is not needed atm since we are */
356 /* fiddling with enable bit only, but we */
357 /* care for those who come next :-). */
358
359 HRESULT rc = S_OK;
360 BaseMetricList filteredMetrics;
361 BaseMetricList::iterator it;
362 for (it = m.baseMetrics.begin(); it != m.baseMetrics.end(); ++it)
363 if (filter.match((*it)->getObject(), (*it)->getName()))
364 {
365 (*it)->disable();
366 filteredMetrics.push_back(*it);
367 }
368
369 com::SafeIfaceArray<IPerformanceMetric> retMetrics (filteredMetrics.size());
370 int i = 0;
371 for (it = filteredMetrics.begin();
372 it != filteredMetrics.end() && SUCCEEDED (rc); ++it)
373 rc = toIPerformanceMetric(*it, &retMetrics [i++]);
374 retMetrics.detachTo (ComSafeArrayOutArg(outMetrics));
375
376 LogFlowThisFuncLeave();
377 return rc;
378}
379
380STDMETHODIMP
381PerformanceCollector::QueryMetricsData (ComSafeArrayIn (IN_BSTR, metricNames),
382 ComSafeArrayIn (IUnknown *, objects),
383 ComSafeArrayOut (BSTR, outMetricNames),
384 ComSafeArrayOut (IUnknown *, outObjects),
385 ComSafeArrayOut (BSTR, outUnits),
386 ComSafeArrayOut (ULONG, outScales),
387 ComSafeArrayOut (ULONG, outSequenceNumbers),
388 ComSafeArrayOut (ULONG, outDataIndices),
389 ComSafeArrayOut (ULONG, outDataLengths),
390 ComSafeArrayOut (LONG, outData))
391{
392 AutoCaller autoCaller (this);
393 CheckComRCReturnRC (autoCaller.rc());
394
395 pm::Filter filter (ComSafeArrayInArg (metricNames),
396 ComSafeArrayInArg (objects));
397
398 AutoReadLock alock (this);
399
400 /* Let's compute the size of the resulting flat array */
401 size_t flatSize = 0;
402 MetricList filteredMetrics;
403 MetricList::iterator it;
404 for (it = m.metrics.begin(); it != m.metrics.end(); ++it)
405 if (filter.match ((*it)->getObject(), (*it)->getName()))
406 {
407 filteredMetrics.push_back (*it);
408 flatSize += (*it)->getLength();
409 }
410
411 int i = 0;
412 size_t flatIndex = 0;
413 size_t numberOfMetrics = filteredMetrics.size();
414 com::SafeArray <BSTR> retNames (numberOfMetrics);
415 com::SafeIfaceArray <IUnknown> retObjects (numberOfMetrics);
416 com::SafeArray <BSTR> retUnits (numberOfMetrics);
417 com::SafeArray <ULONG> retScales (numberOfMetrics);
418 com::SafeArray <ULONG> retSequenceNumbers (numberOfMetrics);
419 com::SafeArray <ULONG> retIndices (numberOfMetrics);
420 com::SafeArray <ULONG> retLengths (numberOfMetrics);
421 com::SafeArray <LONG> retData (flatSize);
422
423 for (it = filteredMetrics.begin(); it != filteredMetrics.end(); ++it, ++i)
424 {
425 ULONG *values, length, sequenceNumber;
426 /* @todo We may want to revise the query method to get rid of excessive alloc/memcpy calls. */
427 (*it)->query(&values, &length, &sequenceNumber);
428 LogFlow (("PerformanceCollector::QueryMetricsData() querying metric %s "
429 "returned %d values.\n", (*it)->getName(), length));
430 memcpy(retData.raw() + flatIndex, values, length * sizeof(*values));
431 Bstr tmp((*it)->getName());
432 tmp.detachTo(&retNames[i]);
433 (*it)->getObject().queryInterfaceTo (&retObjects[i]);
434 tmp = (*it)->getUnit();
435 tmp.detachTo(&retUnits[i]);
436 retScales[i] = (*it)->getScale();
437 retSequenceNumbers[i] = sequenceNumber;
438 retLengths[i] = length;
439 retIndices[i] = flatIndex;
440 flatIndex += length;
441 }
442
443 retNames.detachTo (ComSafeArrayOutArg (outMetricNames));
444 retObjects.detachTo (ComSafeArrayOutArg (outObjects));
445 retUnits.detachTo (ComSafeArrayOutArg (outUnits));
446 retScales.detachTo (ComSafeArrayOutArg (outScales));
447 retSequenceNumbers.detachTo (ComSafeArrayOutArg (outSequenceNumbers));
448 retIndices.detachTo (ComSafeArrayOutArg (outDataIndices));
449 retLengths.detachTo (ComSafeArrayOutArg (outDataLengths));
450 retData.detachTo (ComSafeArrayOutArg (outData));
451 return S_OK;
452}
453
454// public methods for internal purposes
455///////////////////////////////////////////////////////////////////////////////
456
457void PerformanceCollector::registerBaseMetric (pm::BaseMetric *baseMetric)
458{
459 //LogFlowThisFuncEnter();
460 AutoCaller autoCaller (this);
461 if (!SUCCEEDED (autoCaller.rc())) return;
462
463 AutoWriteLock alock (this);
464 LogAleksey(("{%p} " LOG_FN_FMT ": obj=%p name=%s\n", this, __PRETTY_FUNCTION__, (void *)baseMetric->getObject(), baseMetric->getName()));
465 m.baseMetrics.push_back (baseMetric);
466 //LogFlowThisFuncLeave();
467}
468
469void PerformanceCollector::registerMetric (pm::Metric *metric)
470{
471 //LogFlowThisFuncEnter();
472 AutoCaller autoCaller (this);
473 if (!SUCCEEDED (autoCaller.rc())) return;
474
475 AutoWriteLock alock (this);
476 LogAleksey(("{%p} " LOG_FN_FMT ": obj=%p name=%s\n", this, __PRETTY_FUNCTION__, (void *)metric->getObject(), metric->getName()));
477 m.metrics.push_back (metric);
478 //LogFlowThisFuncLeave();
479}
480
481void PerformanceCollector::unregisterBaseMetricsFor (const ComPtr <IUnknown> &aObject)
482{
483 //LogFlowThisFuncEnter();
484 AutoCaller autoCaller (this);
485 if (!SUCCEEDED (autoCaller.rc())) return;
486
487 AutoWriteLock alock (this);
488 LogAleksey(("{%p} " LOG_FN_FMT ": before remove_if: m.baseMetrics.size()=%d\n", this, __PRETTY_FUNCTION__, m.baseMetrics.size()));
489 BaseMetricList::iterator it = std::remove_if (
490 m.baseMetrics.begin(), m.baseMetrics.end(), std::bind2nd (
491 std::mem_fun (&pm::BaseMetric::associatedWith), aObject));
492 m.baseMetrics.erase(it, m.baseMetrics.end());
493 LogAleksey(("{%p} " LOG_FN_FMT ": after remove_if: m.baseMetrics.size()=%d\n", this, __PRETTY_FUNCTION__, m.baseMetrics.size()));
494 //LogFlowThisFuncLeave();
495}
496
497void PerformanceCollector::unregisterMetricsFor (const ComPtr <IUnknown> &aObject)
498{
499 //LogFlowThisFuncEnter();
500 AutoCaller autoCaller (this);
501 if (!SUCCEEDED (autoCaller.rc())) return;
502
503 AutoWriteLock alock (this);
504 LogAleksey(("{%p} " LOG_FN_FMT ": obj=%p\n", this, __PRETTY_FUNCTION__, (void *)aObject));
505 MetricList::iterator it = std::remove_if (
506 m.metrics.begin(), m.metrics.end(), std::bind2nd (
507 std::mem_fun (&pm::Metric::associatedWith), aObject));
508 m.metrics.erase(it, m.metrics.end());
509 //LogFlowThisFuncLeave();
510}
511
512// private methods
513///////////////////////////////////////////////////////////////////////////////
514
515/* static */
516void PerformanceCollector::staticSamplerCallback (RTTIMERLR hTimerLR, void *pvUser,
517 uint64_t iTick)
518{
519 AssertReturnVoid (pvUser != NULL);
520 PerformanceCollector *collector = static_cast <PerformanceCollector *> (pvUser);
521 Assert (collector->mMagic == MAGIC);
522 if (collector->mMagic == MAGIC)
523 {
524 collector->samplerCallback();
525 }
526 NOREF (hTimerLR);
527}
528
529void PerformanceCollector::samplerCallback()
530{
531 Log4(("{%p} " LOG_FN_FMT ": ENTER\n", this, __PRETTY_FUNCTION__));
532 AutoWriteLock alock (this);
533
534 pm::CollectorHints hints;
535 uint64_t timestamp = RTTimeMilliTS();
536 BaseMetricList toBeCollected;
537 BaseMetricList::iterator it;
538 /* Compose the list of metrics being collected at this moment */
539 for (it = m.baseMetrics.begin(); it != m.baseMetrics.end(); it++)
540 if ((*it)->collectorBeat(timestamp))
541 {
542 (*it)->preCollect(hints);
543 toBeCollected.push_back(*it);
544 }
545
546 if (toBeCollected.size() == 0)
547 return;
548
549 /* Let know the platform specific code what is being collected */
550 m.hal->preCollect(hints);
551
552 /* Finally, collect the data */
553 std::for_each (toBeCollected.begin(), toBeCollected.end(),
554 std::mem_fun (&pm::BaseMetric::collect));
555 Log4(("{%p} " LOG_FN_FMT ": LEAVE\n", this, __PRETTY_FUNCTION__));
556}
557
558////////////////////////////////////////////////////////////////////////////////
559// PerformanceMetric class
560////////////////////////////////////////////////////////////////////////////////
561
562// constructor / destructor
563////////////////////////////////////////////////////////////////////////////////
564
565PerformanceMetric::PerformanceMetric()
566{
567}
568
569PerformanceMetric::~PerformanceMetric()
570{
571}
572
573HRESULT PerformanceMetric::FinalConstruct()
574{
575 LogFlowThisFunc (("\n"));
576
577 return S_OK;
578}
579
580void PerformanceMetric::FinalRelease()
581{
582 LogFlowThisFunc (("\n"));
583
584 uninit ();
585}
586
587// public initializer/uninitializer for internal purposes only
588////////////////////////////////////////////////////////////////////////////////
589
590HRESULT PerformanceMetric::init (pm::Metric *aMetric)
591{
592 m.name = aMetric->getName();
593 m.object = aMetric->getObject();
594 m.description = aMetric->getDescription();
595 m.period = aMetric->getPeriod();
596 m.count = aMetric->getLength();
597 m.unit = aMetric->getUnit();
598 m.min = aMetric->getMinValue();
599 m.max = aMetric->getMaxValue();
600 return S_OK;
601}
602
603HRESULT PerformanceMetric::init (pm::BaseMetric *aMetric)
604{
605 m.name = aMetric->getName();
606 m.object = aMetric->getObject();
607 m.description = "";
608 m.period = aMetric->getPeriod();
609 m.count = aMetric->getLength();
610 m.unit = aMetric->getUnit();
611 m.min = aMetric->getMinValue();
612 m.max = aMetric->getMaxValue();
613 return S_OK;
614}
615
616void PerformanceMetric::uninit()
617{
618}
619
620STDMETHODIMP PerformanceMetric::COMGETTER(MetricName) (BSTR *aMetricName)
621{
622 /// @todo (r=dmik) why do all these getters not do AutoCaller and
623 /// AutoReadLock? Is the underlying metric a constant object?
624
625 m.name.cloneTo (aMetricName);
626 return S_OK;
627}
628
629STDMETHODIMP PerformanceMetric::COMGETTER(Object) (IUnknown **anObject)
630{
631 m.object.queryInterfaceTo(anObject);
632 return S_OK;
633}
634
635STDMETHODIMP PerformanceMetric::COMGETTER(Description) (BSTR *aDescription)
636{
637 m.description.cloneTo (aDescription);
638 return S_OK;
639}
640
641STDMETHODIMP PerformanceMetric::COMGETTER(Period) (ULONG *aPeriod)
642{
643 *aPeriod = m.period;
644 return S_OK;
645}
646
647STDMETHODIMP PerformanceMetric::COMGETTER(Count) (ULONG *aCount)
648{
649 *aCount = m.count;
650 return S_OK;
651}
652
653STDMETHODIMP PerformanceMetric::COMGETTER(Unit) (BSTR *aUnit)
654{
655 m.unit.cloneTo(aUnit);
656 return S_OK;
657}
658
659STDMETHODIMP PerformanceMetric::COMGETTER(MinimumValue) (LONG *aMinValue)
660{
661 *aMinValue = m.min;
662 return S_OK;
663}
664
665STDMETHODIMP PerformanceMetric::COMGETTER(MaximumValue) (LONG *aMaxValue)
666{
667 *aMaxValue = m.max;
668 return S_OK;
669}
670/* vi: set tabstop=4 shiftwidth=4 expandtab: */
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use