Statistics for try-read access

parent 33a76773
...@@ -202,6 +202,7 @@ private: ...@@ -202,6 +202,7 @@ private:
int iNetStreamingBlockID; //!< Network streaming block id int iNetStreamingBlockID; //!< Network streaming block id
friend class CITANetAudioStreamingClient; friend class CITANetAudioStreamingClient;
static std::string GetStreamingStatusString( int iStreamingStatus );
}; };
#endif // INCLUDE_WATCHER_ITA_NET_AUDIO_STREAM #endif // INCLUDE_WATCHER_ITA_NET_AUDIO_STREAM
...@@ -88,7 +88,7 @@ private: ...@@ -88,7 +88,7 @@ private:
ITABufferedDataLoggerImplClient* m_pClientLogger; ITABufferedDataLoggerImplClient* m_pClientLogger;
std::string m_sClientLoggerBaseName; std::string m_sClientLoggerBaseName;
ITAStopWatch m_swTryReadStats; ITAStopWatch m_swTryReadBlockStats, m_swTryReadAccessStats;
friend class CITANetAudioStream; friend class CITANetAudioStream;
}; };
......
...@@ -36,7 +36,7 @@ struct ITAAudioStreamLog : public ITALogDataBase ...@@ -36,7 +36,7 @@ struct ITAAudioStreamLog : public ITALogDataBase
os << uiBlockId; os << uiBlockId;
os << "\t" << std::setprecision( 12 ) << dWorldTimeStamp; os << "\t" << std::setprecision( 12 ) << dWorldTimeStamp;
os << "\t" << std::setprecision( 12 ) << dStreamingTimeCode; os << "\t" << std::setprecision( 12 ) << dStreamingTimeCode;
os << "\t" << iStreamingStatus; os << "\t" << sStreamingStatus;
os << "\t" << iFreeSamples; os << "\t" << iFreeSamples;
os << std::endl; os << std::endl;
return os; return os;
...@@ -45,7 +45,7 @@ struct ITAAudioStreamLog : public ITALogDataBase ...@@ -45,7 +45,7 @@ struct ITAAudioStreamLog : public ITALogDataBase
unsigned int uiBlockId; //!< Block identifier (audio streaming) unsigned int uiBlockId; //!< Block identifier (audio streaming)
double dWorldTimeStamp; double dWorldTimeStamp;
double dStreamingTimeCode; double dStreamingTimeCode;
int iStreamingStatus; //!< ... usw std::string sStreamingStatus;
int iFreeSamples; int iFreeSamples;
}; };
...@@ -242,7 +242,7 @@ void CITANetAudioStream::IncrementBlockPointer() ...@@ -242,7 +242,7 @@ void CITANetAudioStream::IncrementBlockPointer()
m_bRingBufferFull = false; m_bRingBufferFull = false;
ITAAudioStreamLog oLog; ITAAudioStreamLog oLog;
oLog.iStreamingStatus = m_iStreamingStatus; oLog.sStreamingStatus = GetStreamingStatusString( m_iStreamingStatus );
oLog.dWorldTimeStamp = ITAClock::getDefaultClock()->getTime(); oLog.dWorldTimeStamp = ITAClock::getDefaultClock()->getTime();
oLog.dStreamingTimeCode = m_dLastStreamingTimeCode; oLog.dStreamingTimeCode = m_dLastStreamingTimeCode;
oLog.uiBlockId = ++iAudioStreamingBlockID; oLog.uiBlockId = ++iAudioStreamingBlockID;
...@@ -323,6 +323,24 @@ int CITANetAudioStream::GetRingBufferFreeSamples() const ...@@ -323,6 +323,24 @@ int CITANetAudioStream::GetRingBufferFreeSamples() const
return iFreeSamples; return iFreeSamples;
} }
std::string CITANetAudioStream::GetStreamingStatusString( int iStreamingStatus )
{
if( iStreamingStatus == CITANetAudioStream::INVALID )
return "INVALID";
if( iStreamingStatus == CITANetAudioStream::STOPPED )
return "STOPPED";
if( iStreamingStatus == CITANetAudioStream::CONNECTED )
return "CONNECTED";
if( iStreamingStatus == CITANetAudioStream::STREAMING )
return "STREAMING";
if( iStreamingStatus == CITANetAudioStream::BUFFER_UNDERRUN )
return "BUFFER_UNDERRUN";
if( iStreamingStatus == CITANetAudioStream::BUFFER_OVERRUN )
return "BUFFER_OVERRUN";
return "UNKOWN";
}
std::string CITANetAudioStream::GetNetAudioStreamLoggerBaseName() const std::string CITANetAudioStream::GetNetAudioStreamLoggerBaseName() const
{ {
return m_sNetAudioStreamLoggerBaseName; return m_sNetAudioStreamLoggerBaseName;
......
...@@ -19,7 +19,6 @@ struct ITAClientLog : public ITALogDataBase ...@@ -19,7 +19,6 @@ struct ITAClientLog : public ITALogDataBase
os << "\t" << "WorldTimeStamp"; os << "\t" << "WorldTimeStamp";
os << "\t" << "ProtocolStatus"; os << "\t" << "ProtocolStatus";
os << "\t" << "FreeSamples"; os << "\t" << "FreeSamples";
os << "\t" << "Channel";
os << std::endl; os << std::endl;
return os; return os;
}; };
...@@ -30,7 +29,6 @@ struct ITAClientLog : public ITALogDataBase ...@@ -30,7 +29,6 @@ struct ITAClientLog : public ITALogDataBase
os << "\t" << std::setprecision( 12 ) << dWorldTimeStamp; os << "\t" << std::setprecision( 12 ) << dWorldTimeStamp;
os << "\t" << iProtocolStatus; os << "\t" << iProtocolStatus;
os << "\t" << iFreeSamples; os << "\t" << iFreeSamples;
os << "\t" << iChannel;
os << std::endl; os << std::endl;
return os; return os;
}; };
...@@ -39,7 +37,6 @@ struct ITAClientLog : public ITALogDataBase ...@@ -39,7 +37,6 @@ struct ITAClientLog : public ITALogDataBase
double dWorldTimeStamp; double dWorldTimeStamp;
int iProtocolStatus; //!< ... usw int iProtocolStatus; //!< ... usw
int iFreeSamples; int iFreeSamples;
int iChannel;
}; };
...@@ -79,6 +76,9 @@ CITANetAudioStreamingClient::~CITANetAudioStreamingClient() ...@@ -79,6 +76,9 @@ CITANetAudioStreamingClient::~CITANetAudioStreamingClient()
delete m_pClientLogger; delete m_pClientLogger;
delete m_pClient; delete m_pClient;
delete m_pMessage; delete m_pMessage;
vstr::out() << "Try-read block calc time (ms): " << m_swTryReadBlockStats.ToString() << endl;
vstr::out() << "Try-read access time : " << m_swTryReadAccessStats.ToString() << endl;
} }
bool CITANetAudioStreamingClient::Connect( const std::string& sAddress, int iPort ) bool CITANetAudioStreamingClient::Connect( const std::string& sAddress, int iPort )
...@@ -123,7 +123,6 @@ bool CITANetAudioStreamingClient::LoopBody() ...@@ -123,7 +123,6 @@ bool CITANetAudioStreamingClient::LoopBody()
ITAClientLog oLog; ITAClientLog oLog;
oLog.uiBlockId = ++m_iStreamingBlockId; oLog.uiBlockId = ++m_iStreamingBlockId;
oLog.iChannel = m_pStream->GetNumberOfChannels();
oLog.iFreeSamples = m_pStream->GetRingBufferFreeSamples(); oLog.iFreeSamples = m_pStream->GetRingBufferFreeSamples();
oLog.iProtocolStatus = CITANetAudioProtocol::NP_CLIENT_IDLE; oLog.iProtocolStatus = CITANetAudioProtocol::NP_CLIENT_IDLE;
...@@ -155,10 +154,13 @@ bool CITANetAudioStreamingClient::LoopBody() ...@@ -155,10 +154,13 @@ bool CITANetAudioStreamingClient::LoopBody()
// Try-read message (blocking for a timeout of 1ms) // Try-read message (blocking for a timeout of 1ms)
m_pMessage->ResetMessage(); m_pMessage->ResetMessage();
m_swTryReadStats.start(); m_swTryReadBlockStats.start();
m_swTryReadAccessStats.start();
if( m_pMessage->ReadMessage( 1 ) ) if( m_pMessage->ReadMessage( 1 ) )
{ {
m_swTryReadStats.stop(); double dAccessTime = m_swTryReadAccessStats.stop();
int iMsgType = m_pMessage->GetMessageType(); int iMsgType = m_pMessage->GetMessageType();
switch( iMsgType ) switch( iMsgType )
{ {
...@@ -192,7 +194,7 @@ bool CITANetAudioStreamingClient::LoopBody() ...@@ -192,7 +194,7 @@ bool CITANetAudioStreamingClient::LoopBody()
oLog.iProtocolStatus = iMsgType; oLog.iProtocolStatus = iMsgType;
} }
m_swTryReadStats.stop(); m_swTryReadBlockStats.stop();
m_pClientLogger->log( oLog ); m_pClientLogger->log( oLog );
......
...@@ -23,7 +23,8 @@ const static int g_iServerPort = 12480; ...@@ -23,7 +23,8 @@ const static int g_iServerPort = 12480;
const static double g_dSampleRate = 44100; const static double g_dSampleRate = 44100;
const static int g_iBlockLength = 512; const static int g_iBlockLength = 512;
const static int g_iChannels = 2; const static int g_iChannels = 2;
const static int g_iTargetLatencySamples = 512; const static int g_iTargetLatencySamples = g_iBlockLength * 10;
const static int g_iRingerBufferSize = g_iBlockLength * 10;
class CServer : public VistaThread class CServer : public VistaThread
{ {
...@@ -71,7 +72,7 @@ int main( int, char** ) ...@@ -71,7 +72,7 @@ int main( int, char** )
CServer* pServer = new CServer( g_sInputFilePath ); CServer* pServer = new CServer( g_sInputFilePath );
// Client dumping received stream and mixing down to two channels // Client dumping received stream and mixing down to two channels
CITANetAudioStream oNetAudioStream( g_iChannels, g_dSampleRate, g_iBlockLength, 20 * g_iBlockLength ); CITANetAudioStream oNetAudioStream( g_iChannels, g_dSampleRate, g_iBlockLength, g_iRingerBufferSize );
oNetAudioStream.SetNetAudioStreamingLoggerBaseName( "ITANetAudioTest_NetAudioStream" ); oNetAudioStream.SetNetAudioStreamingLoggerBaseName( "ITANetAudioTest_NetAudioStream" );
ITAStreamPatchbay oPatchbay( g_dSampleRate, g_iBlockLength ); ITAStreamPatchbay oPatchbay( g_dSampleRate, g_iBlockLength );
......
Markdown is supported
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