1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-23 10:05:46 -05:00

TestSource: debug message for QTimer

This commit is contained in:
f4exb 2019-05-21 21:18:49 +02:00
parent 319c988ef9
commit bdd685c63e
2 changed files with 27 additions and 1 deletions

View File

@ -63,7 +63,8 @@ TestSourceThread::TestSourceThread(SampleSinkFifo* sampleFifo, QObject* parent)
m_fcPosShift(0),
m_throttlems(TESTSOURCE_THROTTLE_MS),
m_throttleToggle(false),
m_mutex(QMutex::Recursive)
m_mutex(QMutex::Recursive),
m_histoCounter(0)
{
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection);
}
@ -74,6 +75,7 @@ TestSourceThread::~TestSourceThread()
void TestSourceThread::startWork()
{
//m_timer.setTimerType(Qt::PreciseTimer);
connect(&m_timer, SIGNAL(timeout()), this, SLOT(tick()));
m_timer.start(50);
m_startWaitMutex.lock();
@ -392,6 +394,25 @@ void TestSourceThread::tick()
{
qint64 throttlems = m_elapsedTimer.restart();
std::map<int,int>::iterator it;
it = m_timerHistogram.find(throttlems);
if (it == m_timerHistogram.end()) {
m_timerHistogram[throttlems] = 1;
} else {
it->second++;
}
if (m_histoCounter < 49) {
m_histoCounter++;
} else {
qDebug("TestSourceThread::tick: -----------");
for (std::map<int,int>::iterator it = m_timerHistogram.begin(); it != m_timerHistogram.end(); ++it) {
qDebug("TestSourceThread::tick: %d: %d", it->first, it->second);
}
m_histoCounter = 0;
}
if ((throttlems > 45) && (throttlems < 55) && (throttlems != m_throttlems))
{
QMutexLocker mutexLocker(&m_mutex);

View File

@ -18,6 +18,8 @@
#ifndef _TESTSOURCE_TESTSOURCETHREAD_H_
#define _TESTSOURCE_TESTSOURCETHREAD_H_
#include <map>
#include <QThread>
#include <QMutex>
#include <QWaitCondition>
@ -133,6 +135,9 @@ private:
Decimators<qint32, qint16, SDR_RX_SAMP_SZ, 12> m_decimators_12;
Decimators<qint32, qint16, SDR_RX_SAMP_SZ, 16> m_decimators_16;
std::map<int, int> m_timerHistogram;
uint32_t m_histoCounter;
void startWork();
void stopWork();
void run();