1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-09-20 11:56:36 -04:00

SDRdaemon plugin: report LZ4 statistics

This commit is contained in:
f4exb 2016-02-23 19:27:47 +01:00
parent e5f2a49835
commit 153b1c017c
7 changed files with 54 additions and 9 deletions

View File

@ -38,6 +38,8 @@ SDRdaemonBuffer::SDRdaemonBuffer(uint32_t rateDivider) :
m_nbLz4Decodes(0), m_nbLz4Decodes(0),
m_nbLz4SuccessfulDecodes(0), m_nbLz4SuccessfulDecodes(0),
m_nbLz4CRCOK(0), m_nbLz4CRCOK(0),
m_nbLastLz4SuccessfulDecodes(0),
m_nbLastLz4CRCOK(0),
m_dataCRC(0), m_dataCRC(0),
m_sampleRateStream(0), m_sampleRateStream(0),
m_sampleRate(0), m_sampleRate(0),
@ -199,6 +201,8 @@ void SDRdaemonBuffer::writeDataLZ4(const char *array, uint32_t length)
<< "/" << m_nbLz4Decodes << "/" << m_nbLz4Decodes
<< std::endl; << std::endl;
m_nbLastLz4SuccessfulDecodes = m_nbLz4SuccessfulDecodes;
m_nbLastLz4CRCOK = m_nbLz4CRCOK;
m_nbLz4Decodes = 0; m_nbLz4Decodes = 0;
m_nbLz4SuccessfulDecodes = 0; m_nbLz4SuccessfulDecodes = 0;
m_nbLz4CRCOK = 0; m_nbLz4CRCOK = 0;

View File

@ -74,7 +74,9 @@ public:
bool isSyncLocked() const { return m_syncLock; } bool isSyncLocked() const { return m_syncLock; }
uint32_t getFrameSize() const { return m_frameSize; } uint32_t getFrameSize() const { return m_frameSize; }
bool isLz4Compressed() const { return m_lz4; } bool isLz4Compressed() const { return m_lz4; }
float getCompressionRatio() const { return (m_frameSize ? (float) m_lz4InSize / (float) m_frameSize : 1.0); } float getCompressionRatio() const { return (m_frameSize > 0 ? (float) m_lz4InSize / (float) m_frameSize : 1.0); }
uint32_t getLz4DataCRCOK() const { return m_nbLastLz4CRCOK; }
uint32_t getLz4SuccessfulDecodes() const { return m_nbLastLz4SuccessfulDecodes; }
static const int m_udpPayloadSize; static const int m_udpPayloadSize;
static const int m_sampleSize; static const int m_sampleSize;
@ -104,6 +106,8 @@ private:
uint32_t m_nbLz4Decodes; uint32_t m_nbLz4Decodes;
uint32_t m_nbLz4SuccessfulDecodes; uint32_t m_nbLz4SuccessfulDecodes;
uint32_t m_nbLz4CRCOK; uint32_t m_nbLz4CRCOK;
uint32_t m_nbLastLz4SuccessfulDecodes;
uint32_t m_nbLastLz4CRCOK;
uint64_t m_dataCRC; uint64_t m_dataCRC;
uint32_t m_sampleRateStream; //!< Current sample rate from the stream uint32_t m_sampleRateStream; //!< Current sample rate from the stream

View File

@ -40,6 +40,11 @@ SDRdaemonGui::SDRdaemonGui(PluginAPI* pluginAPI, QWidget* parent) :
m_sampleRateStream(0), m_sampleRateStream(0),
m_centerFrequency(0), m_centerFrequency(0),
m_syncLocked(false), m_syncLocked(false),
m_frameSize(0),
m_lz4(false),
m_compressionRatio(1.0),
m_nbLz4DataCRCOK(0),
m_nbLz4SuccessfulDecodes(0),
m_samplesCount(0), m_samplesCount(0),
m_tickCount(0), m_tickCount(0),
m_address("127.0.0.1"), m_address("127.0.0.1"),
@ -202,7 +207,16 @@ bool SDRdaemonGui::handleMessage(const Message& message)
m_syncLocked = ((SDRdaemonInput::MsgReportSDRdaemonStreamTiming&)message).getSyncLock(); m_syncLocked = ((SDRdaemonInput::MsgReportSDRdaemonStreamTiming&)message).getSyncLock();
m_frameSize = ((SDRdaemonInput::MsgReportSDRdaemonStreamTiming&)message).getFrameSize(); m_frameSize = ((SDRdaemonInput::MsgReportSDRdaemonStreamTiming&)message).getFrameSize();
m_lz4 = ((SDRdaemonInput::MsgReportSDRdaemonStreamTiming&)message).getLz4Compression(); m_lz4 = ((SDRdaemonInput::MsgReportSDRdaemonStreamTiming&)message).getLz4Compression();
m_compressionRatio = ((SDRdaemonInput::MsgReportSDRdaemonStreamTiming&)message).getLz4Compression();
if (m_lz4) {
m_compressionRatio = ((SDRdaemonInput::MsgReportSDRdaemonStreamTiming&)message).getLz4CompressionRatio();
} else {
m_compressionRatio = 1.0;
}
m_nbLz4DataCRCOK = ((SDRdaemonInput::MsgReportSDRdaemonStreamTiming&)message).getLz4DataCRCOK();
m_nbLz4SuccessfulDecodes = ((SDRdaemonInput::MsgReportSDRdaemonStreamTiming&)message).getLz4SuccessfulDecodes();
updateWithStreamTime(); updateWithStreamTime();
return true; return true;
} }
@ -323,6 +337,12 @@ void SDRdaemonGui::updateWithStreamTime()
s = QString::number(m_compressionRatio, 'f', 2); s = QString::number(m_compressionRatio, 'f', 2);
ui->compressionRatioText->setText(tr("%1").arg(s)); ui->compressionRatioText->setText(tr("%1").arg(s));
s = QString::number(m_nbLz4DataCRCOK, 'f', 0);
ui->dataCRCOKText->setText(tr("%1").arg(s));
s = QString::number(m_nbLz4SuccessfulDecodes, 'f', 0);
ui->lz4DecodesOKText->setText(tr("%1").arg(s));
} }
void SDRdaemonGui::tick() void SDRdaemonGui::tick()

View File

@ -63,6 +63,8 @@ private:
uint32_t m_frameSize; uint32_t m_frameSize;
bool m_lz4; bool m_lz4;
float m_compressionRatio; float m_compressionRatio;
uint32_t m_nbLz4DataCRCOK;
uint32_t m_nbLz4SuccessfulDecodes;
int m_samplesCount; int m_samplesCount;
std::size_t m_tickCount; std::size_t m_tickCount;

View File

@ -368,7 +368,7 @@
<string>Data CRC OK (%)</string> <string>Data CRC OK (%)</string>
</property> </property>
<property name="text"> <property name="text">
<string>100</string> <string>0</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@ -394,7 +394,7 @@
<string>LZ4 successful decodes (%)</string> <string>LZ4 successful decodes (%)</string>
</property> </property>
<property name="text"> <property name="text">
<string>100</string> <string>0</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>

View File

@ -171,20 +171,27 @@ public:
bool getSyncLock() const { return m_syncLock; } bool getSyncLock() const { return m_syncLock; }
uint32_t getFrameSize() const { return m_frameSize; } uint32_t getFrameSize() const { return m_frameSize; }
bool getLz4Compression() const { return m_lz4; } bool getLz4Compression() const { return m_lz4; }
float getLz4CompressionRatio() const { return m_compressionRatio; }
uint32_t getLz4DataCRCOK() const { return m_nbLz4CRCOK; }
uint32_t getLz4SuccessfulDecodes() const { return m_nbLz4SuccessfulDecodes; }
static MsgReportSDRdaemonStreamTiming* create(uint32_t tv_sec, static MsgReportSDRdaemonStreamTiming* create(uint32_t tv_sec,
uint32_t tv_usec, uint32_t tv_usec,
bool syncLock, bool syncLock,
uint32_t frameSize, uint32_t frameSize,
bool lz4, bool lz4,
float compressionRatio) float compressionRatio,
uint32_t nbLz4CRCOK,
uint32_t nbLz4SuccessfulDecodes)
{ {
return new MsgReportSDRdaemonStreamTiming(tv_sec, return new MsgReportSDRdaemonStreamTiming(tv_sec,
tv_usec, tv_usec,
syncLock, syncLock,
frameSize, frameSize,
lz4, lz4,
compressionRatio); compressionRatio,
nbLz4CRCOK,
nbLz4SuccessfulDecodes);
} }
protected: protected:
@ -194,20 +201,26 @@ public:
uint32_t m_frameSize; uint32_t m_frameSize;
bool m_lz4; bool m_lz4;
float m_compressionRatio; float m_compressionRatio;
uint32_t m_nbLz4CRCOK;
uint32_t m_nbLz4SuccessfulDecodes;
MsgReportSDRdaemonStreamTiming(uint32_t tv_sec, MsgReportSDRdaemonStreamTiming(uint32_t tv_sec,
uint32_t tv_usec, uint32_t tv_usec,
bool syncLock, bool syncLock,
uint32_t frameSize, uint32_t frameSize,
bool lz4, bool lz4,
float compressionRatio) : float compressionRatio,
uint32_t nbLz4CRCOK,
uint32_t nbLz4SuccessfulDecodes) :
Message(), Message(),
m_tv_sec(tv_sec), m_tv_sec(tv_sec),
m_tv_usec(tv_usec), m_tv_usec(tv_usec),
m_syncLock(syncLock), m_syncLock(syncLock),
m_frameSize(frameSize), m_frameSize(frameSize),
m_lz4(lz4), m_lz4(lz4),
m_compressionRatio(compressionRatio) m_compressionRatio(compressionRatio),
m_nbLz4CRCOK(nbLz4CRCOK),
m_nbLz4SuccessfulDecodes(nbLz4SuccessfulDecodes)
{ } { }
}; };

View File

@ -212,7 +212,9 @@ void SDRdaemonUDPHandler::tick()
m_sdrDaemonBuffer.isSyncLocked(), m_sdrDaemonBuffer.isSyncLocked(),
m_sdrDaemonBuffer.getFrameSize(), m_sdrDaemonBuffer.getFrameSize(),
m_sdrDaemonBuffer.isLz4Compressed(), m_sdrDaemonBuffer.isLz4Compressed(),
m_sdrDaemonBuffer.getCompressionRatio()); m_sdrDaemonBuffer.getCompressionRatio(),
m_sdrDaemonBuffer.getLz4DataCRCOK(),
m_sdrDaemonBuffer.getLz4SuccessfulDecodes());
m_outputMessageQueueToGUI->push(report); m_outputMessageQueueToGUI->push(report);
} }
} }