mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-09-02 21:27:48 -04:00
SDRdaemon plugin: added gauges for main buffer read vs writes
This commit is contained in:
parent
335ecea84a
commit
22c3078c3a
@ -61,7 +61,7 @@ SDRdaemonBuffer::SDRdaemonBuffer(uint32_t throttlems) :
|
|||||||
m_skewCorrection(false),
|
m_skewCorrection(false),
|
||||||
m_readCount(0),
|
m_readCount(0),
|
||||||
m_writeCount(0),
|
m_writeCount(0),
|
||||||
m_nbCycles(0)
|
m_nbCycles(0)
|
||||||
{
|
{
|
||||||
m_currentMeta.init();
|
m_currentMeta.init();
|
||||||
}
|
}
|
||||||
|
@ -80,6 +80,28 @@ public:
|
|||||||
uint32_t getLz4SuccessfulDecodes() const { return m_nbLastLz4SuccessfulDecodes; }
|
uint32_t getLz4SuccessfulDecodes() const { return m_nbLastLz4SuccessfulDecodes; }
|
||||||
void setAutoFollowRate(bool autoFollowRate) { m_autoFollowRate = autoFollowRate; }
|
void setAutoFollowRate(bool autoFollowRate) { m_autoFollowRate = autoFollowRate; }
|
||||||
|
|
||||||
|
/** Get buffer gauge value in % of buffer size ([-50:50])
|
||||||
|
* [-50:0] : write leads or read lags
|
||||||
|
* [0:50] : read leads or write lags
|
||||||
|
*/
|
||||||
|
inline int32_t getBufferGauge() const
|
||||||
|
{
|
||||||
|
if (m_rawSize)
|
||||||
|
{
|
||||||
|
int32_t val = ((m_writeIndex - m_readIndex) * 100) / m_rawSize;
|
||||||
|
|
||||||
|
if (val < 0) {
|
||||||
|
return (val < -50 ? 100 - val : val);
|
||||||
|
} else {
|
||||||
|
return (val > 50 ? val - 100 : val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return -50;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static const int m_udpPayloadSize;
|
static const int m_udpPayloadSize;
|
||||||
static const int m_sampleSize;
|
static const int m_sampleSize;
|
||||||
static const int m_iqSampleSize;
|
static const int m_iqSampleSize;
|
||||||
|
@ -45,6 +45,7 @@ SDRdaemonGui::SDRdaemonGui(PluginAPI* pluginAPI, QWidget* parent) :
|
|||||||
m_compressionRatio(1.0),
|
m_compressionRatio(1.0),
|
||||||
m_nbLz4DataCRCOK(0),
|
m_nbLz4DataCRCOK(0),
|
||||||
m_nbLz4SuccessfulDecodes(0),
|
m_nbLz4SuccessfulDecodes(0),
|
||||||
|
m_bufferGauge(-50),
|
||||||
m_samplesCount(0),
|
m_samplesCount(0),
|
||||||
m_tickCount(0),
|
m_tickCount(0),
|
||||||
m_address("127.0.0.1"),
|
m_address("127.0.0.1"),
|
||||||
@ -227,6 +228,7 @@ bool SDRdaemonGui::handleMessage(const Message& message)
|
|||||||
|
|
||||||
m_nbLz4DataCRCOK = ((SDRdaemonInput::MsgReportSDRdaemonStreamTiming&)message).getLz4DataCRCOK();
|
m_nbLz4DataCRCOK = ((SDRdaemonInput::MsgReportSDRdaemonStreamTiming&)message).getLz4DataCRCOK();
|
||||||
m_nbLz4SuccessfulDecodes = ((SDRdaemonInput::MsgReportSDRdaemonStreamTiming&)message).getLz4SuccessfulDecodes();
|
m_nbLz4SuccessfulDecodes = ((SDRdaemonInput::MsgReportSDRdaemonStreamTiming&)message).getLz4SuccessfulDecodes();
|
||||||
|
m_bufferGauge = ((SDRdaemonInput::MsgReportSDRdaemonStreamTiming&)message).getBufferGauge();
|
||||||
|
|
||||||
updateWithStreamTime();
|
updateWithStreamTime();
|
||||||
return true;
|
return true;
|
||||||
@ -384,6 +386,9 @@ void SDRdaemonGui::updateWithStreamTime()
|
|||||||
|
|
||||||
s = QString::number(m_nbLz4SuccessfulDecodes, 'f', 0);
|
s = QString::number(m_nbLz4SuccessfulDecodes, 'f', 0);
|
||||||
ui->lz4DecodesOKText->setText(tr("%1").arg(s));
|
ui->lz4DecodesOKText->setText(tr("%1").arg(s));
|
||||||
|
|
||||||
|
ui->bufferGaugeNegative->setValue((m_bufferGauge < 0 ? 50 + m_bufferGauge : 0));
|
||||||
|
ui->bufferGaugePositive->setValue((m_bufferGauge < 0 ? 0 : 50 - m_bufferGauge));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SDRdaemonGui::tick()
|
void SDRdaemonGui::tick()
|
||||||
|
@ -66,6 +66,7 @@ private:
|
|||||||
uint32_t m_nbLz4DataCRCOK;
|
uint32_t m_nbLz4DataCRCOK;
|
||||||
uint32_t m_nbLz4SuccessfulDecodes;
|
uint32_t m_nbLz4SuccessfulDecodes;
|
||||||
|
|
||||||
|
int32_t m_bufferGauge;
|
||||||
int m_samplesCount;
|
int m_samplesCount;
|
||||||
std::size_t m_tickCount;
|
std::size_t m_tickCount;
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>398</width>
|
<width>398</width>
|
||||||
<height>156</height>
|
<height>175</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
@ -29,7 +29,16 @@
|
|||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>3</number>
|
<number>3</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="margin">
|
<property name="leftMargin">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
<number>2</number>
|
<number>2</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
@ -167,6 +176,63 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="bufferGaugesLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QProgressBar" name="bufferGaugeNegative">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>10</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Main buffer gauge: write leads read lags</string>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>50</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="textVisible">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="invertedAppearance">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="format">
|
||||||
|
<string>%v</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QProgressBar" name="bufferGaugePositive">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>10</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Main buffer gauge: read leads write lags</string>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>50</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="textVisible">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="Line" name="line_freq_2">
|
<widget class="Line" name="line_freq_2">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
@ -194,6 +194,7 @@ public:
|
|||||||
float getLz4CompressionRatio() const { return m_compressionRatio; }
|
float getLz4CompressionRatio() const { return m_compressionRatio; }
|
||||||
uint32_t getLz4DataCRCOK() const { return m_nbLz4CRCOK; }
|
uint32_t getLz4DataCRCOK() const { return m_nbLz4CRCOK; }
|
||||||
uint32_t getLz4SuccessfulDecodes() const { return m_nbLz4SuccessfulDecodes; }
|
uint32_t getLz4SuccessfulDecodes() const { return m_nbLz4SuccessfulDecodes; }
|
||||||
|
int32_t getBufferGauge() const { return m_bufferGauge; }
|
||||||
|
|
||||||
static MsgReportSDRdaemonStreamTiming* create(uint32_t tv_sec,
|
static MsgReportSDRdaemonStreamTiming* create(uint32_t tv_sec,
|
||||||
uint32_t tv_usec,
|
uint32_t tv_usec,
|
||||||
@ -202,7 +203,8 @@ public:
|
|||||||
bool lz4,
|
bool lz4,
|
||||||
float compressionRatio,
|
float compressionRatio,
|
||||||
uint32_t nbLz4CRCOK,
|
uint32_t nbLz4CRCOK,
|
||||||
uint32_t nbLz4SuccessfulDecodes)
|
uint32_t nbLz4SuccessfulDecodes,
|
||||||
|
int32_t bufferGauge)
|
||||||
{
|
{
|
||||||
return new MsgReportSDRdaemonStreamTiming(tv_sec,
|
return new MsgReportSDRdaemonStreamTiming(tv_sec,
|
||||||
tv_usec,
|
tv_usec,
|
||||||
@ -211,7 +213,8 @@ public:
|
|||||||
lz4,
|
lz4,
|
||||||
compressionRatio,
|
compressionRatio,
|
||||||
nbLz4CRCOK,
|
nbLz4CRCOK,
|
||||||
nbLz4SuccessfulDecodes);
|
nbLz4SuccessfulDecodes,
|
||||||
|
bufferGauge);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -223,6 +226,7 @@ public:
|
|||||||
float m_compressionRatio;
|
float m_compressionRatio;
|
||||||
uint32_t m_nbLz4CRCOK;
|
uint32_t m_nbLz4CRCOK;
|
||||||
uint32_t m_nbLz4SuccessfulDecodes;
|
uint32_t m_nbLz4SuccessfulDecodes;
|
||||||
|
int32_t m_bufferGauge;
|
||||||
|
|
||||||
MsgReportSDRdaemonStreamTiming(uint32_t tv_sec,
|
MsgReportSDRdaemonStreamTiming(uint32_t tv_sec,
|
||||||
uint32_t tv_usec,
|
uint32_t tv_usec,
|
||||||
@ -231,7 +235,8 @@ public:
|
|||||||
bool lz4,
|
bool lz4,
|
||||||
float compressionRatio,
|
float compressionRatio,
|
||||||
uint32_t nbLz4CRCOK,
|
uint32_t nbLz4CRCOK,
|
||||||
uint32_t nbLz4SuccessfulDecodes) :
|
uint32_t nbLz4SuccessfulDecodes,
|
||||||
|
int32_t bufferGauge) :
|
||||||
Message(),
|
Message(),
|
||||||
m_tv_sec(tv_sec),
|
m_tv_sec(tv_sec),
|
||||||
m_tv_usec(tv_usec),
|
m_tv_usec(tv_usec),
|
||||||
@ -240,7 +245,8 @@ public:
|
|||||||
m_lz4(lz4),
|
m_lz4(lz4),
|
||||||
m_compressionRatio(compressionRatio),
|
m_compressionRatio(compressionRatio),
|
||||||
m_nbLz4CRCOK(nbLz4CRCOK),
|
m_nbLz4CRCOK(nbLz4CRCOK),
|
||||||
m_nbLz4SuccessfulDecodes(nbLz4SuccessfulDecodes)
|
m_nbLz4SuccessfulDecodes(nbLz4SuccessfulDecodes),
|
||||||
|
m_bufferGauge(bufferGauge)
|
||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -241,7 +241,8 @@ void SDRdaemonUDPHandler::tick()
|
|||||||
m_sdrDaemonBuffer.isLz4Compressed(),
|
m_sdrDaemonBuffer.isLz4Compressed(),
|
||||||
m_sdrDaemonBuffer.getCompressionRatio(),
|
m_sdrDaemonBuffer.getCompressionRatio(),
|
||||||
m_sdrDaemonBuffer.getLz4DataCRCOK(),
|
m_sdrDaemonBuffer.getLz4DataCRCOK(),
|
||||||
m_sdrDaemonBuffer.getLz4SuccessfulDecodes());
|
m_sdrDaemonBuffer.getLz4SuccessfulDecodes(),
|
||||||
|
m_sdrDaemonBuffer.getBufferGauge());
|
||||||
m_outputMessageQueueToGUI->push(report);
|
m_outputMessageQueueToGUI->push(report);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user