PerformanceImpl.cpp revision c7a378ed2fbad681c0b674351d698ef20a368935
/* $Id$ */
/** @file
*
* VBox Performance API COM Classes implementation
*/
/*
* Copyright (C) 2008-2010 Oracle Corporation
*
* 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.
*/
#include "PerformanceImpl.h"
#include "AutoCaller.h"
#include "Logging.h"
#include <VBox/settings.h>
#include <vector>
#include <algorithm>
#include <functional>
#include "Performance.h"
static const char *g_papcszMetricNames[] =
{
};
////////////////////////////////////////////////////////////////////////////////
// PerformanceCollector class
////////////////////////////////////////////////////////////////////////////////
// constructor / destructor
////////////////////////////////////////////////////////////////////////////////
{
LogFlowThisFunc(("\n"));
return BaseFinalConstruct();
}
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);
{
}
//gMetricNames.detachTo(ComSafeArrayOutArg(theMetricNames));
return S_OK;
}
// IPerformanceCollector methods
////////////////////////////////////////////////////////////////////////////////
{
return rc;
}
{
return rc;
}
{
//LogFlowThisFunc(("mState=%d, mType=%d\n", mState, mType));
AutoCaller autoCaller(this);
int i = 0;
{
LogFlow (("PerformanceCollector::GetMetrics() store a metric at "
"retMetrics[%d]...\n", i));
}
return rc;
}
{
AutoCaller autoCaller(this);
{
LogFlow (("PerformanceCollector::SetupMetrics() setting period to %u,"
{
LogFlow (("PerformanceCollector::SetupMetrics() disabling %s\n",
}
else
{
LogFlow (("PerformanceCollector::SetupMetrics() enabling %s\n",
}
}
int i = 0;
return rc;
}
{
AutoCaller autoCaller(this);
/* fiddling with enable bit only, but we */
/* care for those who come next :-). */
{
}
int i = 0;
return rc;
}
{
AutoCaller autoCaller(this);
/* fiddling with enable bit only, but we */
/* care for those who come next :-). */
{
}
int i = 0;
return rc;
}
{
AutoCaller autoCaller(this);
/* Let's compute the size of the resulting flat array */
{
}
int i = 0;
{
LogFlow (("PerformanceCollector::QueryMetricsData() querying metric %s "
retLengths[i] = length;
}
return S_OK;
}
// public methods for internal purposes
///////////////////////////////////////////////////////////////////////////////
{
//LogFlowThisFuncEnter();
AutoCaller autoCaller(this);
LogAleksey(("{%p} " LOG_FN_FMT ": obj=%p name=%s\n", this, __PRETTY_FUNCTION__, (void *)baseMetric->getObject(), baseMetric->getName()));
//LogFlowThisFuncLeave();
}
{
//LogFlowThisFuncEnter();
AutoCaller autoCaller(this);
LogAleksey(("{%p} " LOG_FN_FMT ": obj=%p name=%s\n", this, __PRETTY_FUNCTION__, (void *)metric->getObject(), metric->getName()));
//LogFlowThisFuncLeave();
}
{
//LogFlowThisFuncEnter();
AutoCaller autoCaller(this);
LogAleksey(("{%p} " LOG_FN_FMT ": before remove_if: m.baseMetrics.size()=%d\n", this, __PRETTY_FUNCTION__, m.baseMetrics.size()));
{
delete *it;
}
else
++it;
LogAleksey(("{%p} " LOG_FN_FMT ": after remove_if: m.baseMetrics.size()=%d\n", this, __PRETTY_FUNCTION__, m.baseMetrics.size()));
//LogFlowThisFuncLeave();
}
{
//LogFlowThisFuncEnter();
AutoCaller autoCaller(this);
{
delete *it;
}
else
++it;
//LogFlowThisFuncLeave();
}
void PerformanceCollector::suspendSampling()
{
AutoCaller autoCaller(this);
}
void PerformanceCollector::resumeSampling()
{
AutoCaller autoCaller(this);
}
// private methods
///////////////////////////////////////////////////////////////////////////////
/* static */
{
}
{
/* Compose the list of metrics being collected at this moment */
{
}
if (toBeCollected.size() == 0)
return;
/* Let know the platform specific code what is being collected */
/* Finally, collect the data */
}
////////////////////////////////////////////////////////////////////////////////
// PerformanceMetric class
////////////////////////////////////////////////////////////////////////////////
// constructor / destructor
////////////////////////////////////////////////////////////////////////////////
{
}
{
}
{
LogFlowThisFunc(("\n"));
return BaseFinalConstruct();
}
void PerformanceMetric::FinalRelease()
{
LogFlowThisFunc(("\n"));
uninit ();
}
// public initializer/uninitializer for internal purposes only
////////////////////////////////////////////////////////////////////////////////
{
return S_OK;
}
{
m.description = "";
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;
}
/* vi: set tabstop=4 shiftwidth=4 expandtab: */