mirror of
https://github.com/nostar/urfd.git
synced 2026-11-08 04:19:39 +00:00
moved tc stats to CCodecStream
This commit is contained in:
1 parent
765132b3c3
commit
04cb61bfde
2 files changed
+16
-19
No files matched your search
+16
-13
@@ -69,19 +69,6 @@ bool CCodecStream::Init()
|
||||
return true;
|
||||
}
|
||||
|
||||
void CCodecStream::Close(void)
|
||||
{
|
||||
// close socket
|
||||
keep_running = false;
|
||||
m_TCReader->Close();
|
||||
|
||||
// kill threads
|
||||
if ( m_Future.valid() )
|
||||
{
|
||||
m_Future.get();
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// get
|
||||
|
||||
@@ -99,6 +86,22 @@ void CCodecStream::Thread()
|
||||
{
|
||||
Task();
|
||||
}
|
||||
// display stats
|
||||
if (m_fPingMin >= 0.0)
|
||||
{
|
||||
char sz[64];
|
||||
double min = m_fPingMin * 1000.0;
|
||||
double max = m_fPingMax * 1000.0;
|
||||
double ave = (m_fPingCount > 0) ? m_fPingSum / m_fPingCount * 1000.0 : 0.0;
|
||||
sprintf(sz, "ambed stats (ms) : %.1f/%.1f/%.1f", min, ave, max);
|
||||
std::cout << sz << std::endl;
|
||||
}
|
||||
if (m_uiTimeoutPackets)
|
||||
{
|
||||
char sz[64];
|
||||
sprintf(sz, "ambed %d of %d packets timed out", m_uiTimeoutPackets, m_uiTotalPackets);
|
||||
std::cout << sz << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void CCodecStream::Task(void)
|
||||
|
||||
@@ -37,15 +37,9 @@ public:
|
||||
|
||||
// initialization
|
||||
bool Init();
|
||||
void Close(void);
|
||||
|
||||
// get
|
||||
uint16_t GetStreamId(void) const { return m_uiStreamId; }
|
||||
double GetPingMin(void) const { return m_fPingMin; }
|
||||
double GetPingMax(void) const { return m_fPingMax; }
|
||||
double GetPingAve(void) const { return (m_fPingCount != 0) ? m_fPingSum/m_fPingCount : 0; }
|
||||
uint32_t GetTotalPackets(void) const { return m_uiTotalPackets; }
|
||||
uint32_t GetTimeoutPackets(void) const { return m_uiTimeoutPackets; }
|
||||
bool IsEmpty(void) const;
|
||||
|
||||
// task
|
||||
|
||||
Reference in new issue
Block a user