PerformanceImpl.cpp revision 89df7e059e1c40c041429d4f678bc7b99851457a
/* $Id$ */
/** @file
*
* VBox Performance API COM Classes implementation
*/
/*
* Copyright (C) 2008 Sun Microsystems, Inc.
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
* Clara, CA 95054 USA or visit http://www.sun.com if you need
* additional information or have any questions.
*/
#if defined(RT_OS_WINDOWS)
#elif defined(RT_OS_LINUX)
#endif
#include "PerformanceImpl.h"
#include "Logging.h"
#include <vector>
#include <algorithm>
#include <functional>
static Bstr gMetricNames[] =
{
};
////////////////////////////////////////////////////////////////////////////////
// PerformanceCollector class
////////////////////////////////////////////////////////////////////////////////
// constructor / destructor
////////////////////////////////////////////////////////////////////////////////
{
LogFlowThisFunc (("\n"));
return S_OK;
}
void PerformanceCollector::FinalRelease()
{
LogFlowThisFunc (("\n"));
}
// public initializer/uninitializer for internal purposes only
////////////////////////////////////////////////////////////////////////////////
/**
* Initializes the PerformanceCollector object.
*/
{
/* Enclose the state transition NotReady->InInit->Ready */
AutoInitSpan autoInitSpan (this);
/* Let the sampler know it gets a valid collector. */
/* Start resource usage sampler */
&PerformanceCollector::staticSamplerCallback, this);
"sampling timer(%Rra)\n", vrc));
if (RT_FAILURE (vrc))
return rc;
}
/**
* Uninitializes the PerformanceCollector object.
*
* Called either from FinalRelease() or by the parent when it gets destroyed.
*/
void PerformanceCollector::uninit()
{
/* Enclose the state transition Ready->InUninit->NotReady */
AutoUninitSpan autoUninitSpan (this);
if (autoUninitSpan.uninitDone())
{
LogFlowThisFunc (("Already uninitialized.\n"));
return;
}
mMagic = 0;
/* Destroy resource usage sampler */
"sampling timer (%Rra)\n", vrc));
//delete m.factory;
//m.factory = NULL;
delete m.hal;
}
// IPerformanceCollector properties
////////////////////////////////////////////////////////////////////////////////
{
return E_POINTER;
AutoCaller autoCaller (this);
AutoReadLock alock (this);
{
}
//gMetricNames.detachTo(ComSafeArrayOutArg (theMetricNames));
return S_OK;
}
// IPerformanceCollector methods
////////////////////////////////////////////////////////////////////////////////
{
//LogFlowThisFunc (("mState=%d, mType=%d\n", mState, mType));
AutoCaller autoCaller (this);
AutoReadLock alock (this);
int i = 0;
{
LogFlow (("PerformanceCollector::GetMetrics() store a metric at "
"retMetrics[%d]...\n", i));
}
return rc;
}
{
AutoCaller autoCaller (this);
AutoWriteLock alock (this);
{
LogFlow (("PerformanceCollector::SetupMetrics() setting period to %u,"
{
LogFlow (("PerformanceCollector::SetupMetrics() disabling %s\n",
}
else
{
LogFlow (("PerformanceCollector::SetupMetrics() enabling %s\n",
}
}
return S_OK;
}
{
AutoCaller autoCaller (this);
/* fiddling with enable bit only, but we */
/* care for those who come next :-). */
return S_OK;
}
{
AutoCaller autoCaller (this);
/* fiddling with enable bit only, but we */
/* care for those who come next :-). */
return S_OK;
}
{
AutoCaller autoCaller (this);
AutoReadLock alock (this);
/* Let's compute the size of the resulting flat array */
{
}
int i = 0;
{
/* @todo Filtering goes here! */
LogFlow (("PerformanceCollector::QueryMetricsData() querying metric %s "
retLengths[i] = length;
retIndices[i] = flatIndex;
}
return S_OK;
}
// public methods for internal purposes
///////////////////////////////////////////////////////////////////////////////
{
//LogFlowThisFuncEnter();
AutoCaller autoCaller (this);
AutoWriteLock alock (this);
LogAleksey(("{%p} " LOG_FN_FMT ": obj=%p name=%s\n", this, __PRETTY_FUNCTION__, (void *)baseMetric->getObject(), baseMetric->getName()));
//LogFlowThisFuncLeave();
}
{
//LogFlowThisFuncEnter();
AutoCaller autoCaller (this);
AutoWriteLock alock (this);
LogAleksey(("{%p} " LOG_FN_FMT ": obj=%p name=%s\n", this, __PRETTY_FUNCTION__, (void *)metric->getObject(), metric->getName()));
//LogFlowThisFuncLeave();
}
{
//LogFlowThisFuncEnter();
AutoCaller autoCaller (this);
AutoWriteLock alock (this);
LogAleksey(("{%p} " LOG_FN_FMT ": before remove_if: m.baseMetrics.size()=%d\n", this, __PRETTY_FUNCTION__, m.baseMetrics.size()));
LogAleksey(("{%p} " LOG_FN_FMT ": after remove_if: m.baseMetrics.size()=%d\n", this, __PRETTY_FUNCTION__, m.baseMetrics.size()));
//LogFlowThisFuncLeave();
}
{
//LogFlowThisFuncEnter();
AutoCaller autoCaller (this);
AutoWriteLock alock (this);
//LogFlowThisFuncLeave();
}
// private methods
///////////////////////////////////////////////////////////////////////////////
/* static */
{
{
}
}
void PerformanceCollector::samplerCallback()
{
AutoWriteLock alock (this);
/* Compose the list of metrics being collected at this moment */
{
}
/* Let know the platform specific code what is being collected */
/* Finally, collect the data */
}
////////////////////////////////////////////////////////////////////////////////
// PerformanceMetric class
////////////////////////////////////////////////////////////////////////////////
// constructor / destructor
////////////////////////////////////////////////////////////////////////////////
{
}
{
}
{
LogFlowThisFunc (("\n"));
return S_OK;
}
void PerformanceMetric::FinalRelease()
{
LogFlowThisFunc (("\n"));
uninit ();
}
// public initializer/uninitializer for internal purposes only
////////////////////////////////////////////////////////////////////////////////
{
return S_OK;
}
void PerformanceMetric::uninit()
{
}
{
/// @todo (r=dmik) why do all these getters not do AutoCaller and
/// AutoReadLock? Is the underlying metric a constant object?
return S_OK;
}
{
return S_OK;
}
{
return S_OK;
}
{
return S_OK;
}
{
return S_OK;
}
{
return S_OK;
}
{
return S_OK;
}
{
return S_OK;
}