Commit b1a9329f authored by Jonas Stienen's avatar Jonas Stienen
Browse files

Refactoring VAProfiler. No Profiler output if not high verbosity level now....

Refactoring VAProfiler. No Profiler output if not high verbosity level now. Some style changes. Progress on event based CallModule interface (by default outcommented with preproc flag).
parent 345f5454
......@@ -697,7 +697,7 @@ void CVAPTGenericPathAudioRenderer::UpdateGenericSoundPath( int iListenerID, int
}
}
VA_ERROR( "CVAPTGenericPathAudioRenderer", "Could not find sound path with given listener and source ID" );
VA_ERROR( "CVAPTGenericPathAudioRenderer", "Could not find sound path for listener " << iListenerID << " and source " << iSourceID );
}
......@@ -707,7 +707,7 @@ void CVAPTGenericPathAudioRenderer::UpdateGenericSoundPath( int iListenerID, int
VA_EXCEPT2( INVALID_PARAMETER, "Requested filter channel index of generic sound path out of bounds" );
if( sbIR.length() > m_iIRFilterLengthSamples )
VA_WARN( "CVAPTGenericPathAudioRenderer", "Filter length for generic sound path channel too long, cropping." );
VA_WARN( "VAPTGenericPathAudioRenderer", "Filter length for generic sound path channel too long, cropping." );
if( m_iFilterDelaySamples != 0 )
sbIR.CyclicShift( m_iFilterDelaySamples );
......@@ -730,7 +730,7 @@ void CVAPTGenericPathAudioRenderer::UpdateGenericSoundPath( int iListenerID, int
}
}
VA_ERROR( "CVAPTGenericPathAudioRenderer", "Could not find sound path with given listener and source ID" );
VA_ERROR( "CVAPTGenericPathAudioRenderer", "Could not find sound path for listener " << iListenerID << " and source " << iSourceID );
}
void CVAPTGenericPathAudioRenderer::UpdateGlobalAuralizationMode( int )
......
......@@ -348,7 +348,8 @@ CVACoreImpl::CVACoreImpl(const CVAStruct& oArgs)
} VA_RETHROW;
}
CVACoreImpl::~CVACoreImpl() {
CVACoreImpl::~CVACoreImpl()
{
VA_NO_REENTRANCE;
// Implizit finalisieren, falls dies nicht durch den Benutzer geschah
......@@ -368,7 +369,7 @@ CVACoreImpl::~CVACoreImpl() {
CVACoreEvent ev;
ev.iEventType = CVACoreEvent::VA_COREEVENT_DESTROY;
ev.pSender = this;
m_pCoreEventMan->BroadcastEvent(ev);
m_pCoreEventMan->BroadcastEvent( ev );
// Module deregistrieren
m_oModules.Clear();
......@@ -377,12 +378,13 @@ CVACoreImpl::~CVACoreImpl() {
VA_TRY
{
delete m_pCoreEventMan;
} VA_RETHROW;
}
VA_RETHROW;
VA_TRACE( "Core", "CVACoreImpl instance deleted [" << this << "]" );
// Profiling ausgeben
m_pmCoreThreadLoopTotalDuration.print();
VA_VERBOSE( "Core", m_pmCoreThreadLoopTotalDuration.ToString() );
}
void CVACoreImpl::SetDebugStream(std::ostream* posDebug) {
......@@ -868,49 +870,78 @@ void CVACoreImpl::RegisterModule(CVAObject* pModule)
}
void CVACoreImpl::EnumerateModules(std::vector<CVAModuleInfo>& viModuleInfos) const {
void CVACoreImpl::EnumerateModules( std::vector<CVAModuleInfo>& viModuleInfos )const
{
VA_NO_REENTRANCE;
VA_CHECK_INITIALIZED;
#if ( VACORE_MODULE_INTERFACE_ENABLED == 1 )
VA_TRY {
VA_TRY
{
std::vector<CVAObjectInfo> v;
m_oModules.GetObjectInfos(v);
m_oModules.GetObjectInfos( v );
VA_PRINT("Available modules (" << v.size() << ")")
VA_PRINT( "Available modules (" << v.size() << ")" );
viModuleInfos.clear();
viModuleInfos.resize( v.size() );
for (size_t i=0; i<v.size(); i++) {
VA_PRINT("'" << v[i].sName << "'\t\t\t" << v[i].sDesc);
viModuleInfos[i].sName = v[i].sName;
viModuleInfos[i].sDesc = v[i].sDesc;
for( size_t i = 0; i < v.size(); i++ )
{
VA_PRINT( "'" << v[ i ].sName << "'\t\t\t" << v[ i ].sDesc );
viModuleInfos[ i ].sName = v[ i ].sName;
viModuleInfos[ i ].sDesc = v[ i ].sDesc;
}
} VA_RETHROW;
}
VA_RETHROW;
#else // VACORE_MODULE_INTERFACE_ENABLED
VA_EXCEPT1("This VACore version does not provide modules");
VA_EXCEPT1( "This VACore version does not provide modules" );
#endif // VACORE_MODULE_INTERFACE_ENABLED
}
void CVACoreImpl::CallModule(const std::string& sModuleName, const CVAStruct& oArgs, CVAStruct& oReturn) {
void CVACoreImpl::CallModule( const std::string& sModuleName, const CVAStruct& oArgs, CVAStruct& oReturn )
{
VA_NO_REENTRANCE;
VA_CHECK_INITIALIZED;
#if ( VACORE_MODULE_INTERFACE_ENABLED == 1 )
VA_TRY {
VA_TRY
{
CVAObject* pModule = m_oModules.FindObjectByName(sModuleName);
if (!pModule)
VA_EXCEPT2(INVALID_PARAMETER, "Module not found");
if( !pModule )
VA_EXCEPT2( INVALID_PARAMETER, "Module not found" );
#ifdef VACORE_MODULE_INTERFACE_MECHANISM_EVENT_BASED
CVACoreEvent ev;
ev.iEventType = CVACoreEvent::VA_COREEVENT_SIGNALSOURCE_STATE_CHANGED;
ev.pSender = this;
ev.sObjectID = sModuleName;
ev;
m_pCoreEventMan->BroadcastEvent( ev );
m_pCoreEventMan->
#else // not VACORE_MODULE_INTERFACE_MECHANISM_EVENT_BASED
pModule->CallObject( oArgs, oReturn );
#endif // VACORE_MODULE_INTERFACE_MECHANISM_EVENT_BASED
pModule->CallObject(oArgs, oReturn);
} VA_RETHROW;
#else // VACORE_MODULE_INTERFACE_ENABLED
#if ( VACORE_NO_MODULE_INTERFACE_THROW_EXCEPTION == 1 )
VA_EXCEPT1("This VACore version does not provide modules");
#else
// Ignore. No return values.
oReturn.Clear();
#endif
#if ( VACORE_NO_MODULE_INTERFACE_THROW_EXCEPTION == 1 )
VA_EXCEPT1( "This VACore version does not provide modules" );
#else
// Ignore. No return values.
oReturn.Clear();
#endif // VACORE_NO_MODULE_INTERFACE_THROW_EXCEPTION
#endif // VACORE_MODULE_INTERFACE_ENABLED
}
......@@ -1636,7 +1667,8 @@ ITASoundSamplePool* CVACoreImpl::GetSamplePool() const {
* | | *
* +----------------------------------------------------------+ */
bool CVACoreImpl::IsSceneLocked() const {
bool CVACoreImpl::IsSceneLocked() const
{
VA_CHECK_INITIALIZED;
return (m_lSyncModOwner != -1);
......@@ -1649,12 +1681,14 @@ void CVACoreImpl::LockScene()
VA_CHECK_INITIALIZED;
VA_LOCK_REENTRANCE;
if (m_lSyncModOwner != -1) {
// Thread bereits Besitzer des Token => Spin-Count inkrementieren
if ( getCurrentThreadID() == m_lSyncModOwner ) {
if( m_lSyncModOwner != -1 )
{
// Thread already owner, increment spin counter
if ( getCurrentThreadID() == m_lSyncModOwner )
{
++m_lSyncModSpinCount;
VA_UNLOCK_REENTRANCE;
VA_VERBOSE("Core", "Attempt to enter synchronized scene modification ignored - already in a synchronized scene modification");
VA_VERBOSE( "Core", "Attempt to enter synchronized scene modification ignored - already in a synchronized scene modification" );
return;
}
}
......@@ -1682,7 +1716,9 @@ void CVACoreImpl::LockScene()
m_pNewSceneState = m_pSceneMan->CreateDerivedSceneState( m_pSceneMan->GetHeadSceneStateID(), m_dSyncEntryTime );
VA_UNLOCK_REENTRANCE;
} VA_FINALLY {
}
VA_FINALLY
{
m_mxSyncModLock.Unlock();
m_lSyncModOwner = -1;
VA_UNLOCK_REENTRANCE;
......@@ -1745,7 +1781,8 @@ int CVACoreImpl::UnlockScene()
m_pCoreThread->Trigger();
m_pCoreEventMan->BroadcastEvents();
return iNewSceneID;
} VA_RETHROW;
}
VA_RETHROW;
}
/* +----------------------------------------------------------+ *
......@@ -4324,7 +4361,8 @@ void CVACoreImpl::CoreThreadLoop()
}
// Referenzen verwalten: Alter Szenezustand wird nun nicht mehr bentigt
if (m_pCurSceneState != pNewSceneState) {
if( m_pCurSceneState != pNewSceneState )
{
// Alter Zustand wird nicht mehr bentigt
m_pCurSceneState->RemoveReference();
......@@ -4339,6 +4377,8 @@ void CVACoreImpl::CoreThreadLoop()
m_pmCoreThreadLoopTotalDuration.stop();
// @todo: signal event to process object calls (in-sync exec with internal core)
return;
}
......
......@@ -11,48 +11,61 @@
static ITAClock* g_pDefaultClock = ITAClock::getDefaultClock();
class CVAProfilerMeasure {
class CVAProfilerMeasure
{
public:
CVAProfilerMeasure(const std::string& sMeasureName)
: m_sMeasureName(sMeasureName), m_dStartTime(0)
CVAProfilerMeasure( const std::string& sMeasureName )
: m_sMeasureName( sMeasureName )
, m_dStartTime( 0 )
{
assert( !sMeasureName.empty() );
}
// Clears all values
void reset() {
void reset()
{
m_dAnalyzer.reset();
m_dStartTime = 0;
}
// Start time measurement
inline void start() {
inline void start()
{
assert( m_dStartTime == 0 );
m_dStartTime = g_pDefaultClock->getTime();
}
// Stop time measurement and handle measured timespan
// Returns measured time [s]
inline double stop() {
inline double stop()
{
assert( m_dStartTime > 0 );
double dStopTime = g_pDefaultClock->getTime();
double dElapsedTime = dStopTime-m_dStartTime;
m_dAnalyzer.handle(dElapsedTime);
double dElapsedTime = dStopTime - m_dStartTime;
m_dAnalyzer.handle( dElapsedTime );
m_dStartTime = 0;
return dElapsedTime;
}
// Cancel started time measurement
inline void cancel() {
inline void cancel()
{
m_dStartTime = 0;
}
void print() const {
std::cout << m_sMeasureName << ": min=" << timeToString(m_dAnalyzer.minimum())
<< ", avg=" << timeToString(m_dAnalyzer.mean())
<< ", max=" << timeToString(m_dAnalyzer.maximum())
<< ", std=" << timeToString(m_dAnalyzer.std_deviation())
<< std::endl;
inline void print() const
{
std::cout << ToString() << std::endl;
}
inline std::string ToString() const
{
std::stringstream ss;
ss << m_sMeasureName << ": min=" << timeToString( m_dAnalyzer.minimum() )
<< ", avg=" << timeToString( m_dAnalyzer.mean() )
<< ", max=" << timeToString( m_dAnalyzer.maximum() )
<< ", std=" << timeToString( m_dAnalyzer.std_deviation() );
return ss.str();
}
private:
......@@ -61,12 +74,9 @@ private:
ITATimeseriesAnalyzer<double> m_dAnalyzer;
};
//VA_PROFILE_DECLARE
//VA_PROFILE_START()
//VA_PROFILE_STOP()
// Profiler measures definition
enum {
enum
{
VAPROF_STREAM_PROCESSING_TIME,
VAPROF_DSP_LOAD_PERCENT,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment