Debug: More real-time instrumentation.
This commit is contained in:
parent
1339e427e1
commit
4c192001fc
|
@ -26,7 +26,6 @@
|
|||
#include "DriveLoop.h"
|
||||
#include <Logger.h>
|
||||
#include "RTMD.h"
|
||||
#define WITH_RTMD
|
||||
|
||||
using namespace GSM;
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include <uhd/usrp/multi_usrp.hpp>
|
||||
#include <uhd/utils/thread_priority.hpp>
|
||||
#include <uhd/utils/msg.hpp>
|
||||
#include "RTMD.h"
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
|
@ -788,14 +789,19 @@ int uhd_device::readSamples(short **buf, int chans, int len,
|
|||
ssize_t rc;
|
||||
uhd::time_spec_t ts;
|
||||
uhd::rx_metadata_t metadata;
|
||||
RTMD_SET("readSamples");
|
||||
|
||||
if (skip_rx) {
|
||||
LOG(INFO) << "Skipping Rx";
|
||||
RTMD_VAL("readSamples", -1);
|
||||
RTMD_CLEAR("readSamples");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (chans != NUM_RX_CHANS) {
|
||||
LOG(ERR) << "Number of requested channels does not match build";
|
||||
RTMD_VAL("readSamples", -2);
|
||||
RTMD_CLEAR("readSamples");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -810,6 +816,8 @@ int uhd_device::readSamples(short **buf, int chans, int len,
|
|||
if (rc < 0) {
|
||||
LOG(ERR) << rx_smpl_buf[0]->str_code(rc);
|
||||
LOG(ERR) << rx_smpl_buf[0]->str_status();
|
||||
RTMD_VAL("readSamples", -3);
|
||||
RTMD_CLEAR("readSamples");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -852,8 +860,11 @@ int uhd_device::readSamples(short **buf, int chans, int len,
|
|||
if ((rc < 0)) {
|
||||
LOG(ERR) << rx_smpl_buf[i]->str_code(rc);
|
||||
LOG(ERR) << rx_smpl_buf[i]->str_status();
|
||||
if (rc != smpl_buf::ERROR_OVERFLOW)
|
||||
if (rc != smpl_buf::ERROR_OVERFLOW) {
|
||||
RTMD_VAL("readSamples", -4);
|
||||
RTMD_CLEAR("readSamples");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -864,10 +875,14 @@ int uhd_device::readSamples(short **buf, int chans, int len,
|
|||
if ((rc < 0) || (rc != len)) {
|
||||
LOG(ERR) << rx_smpl_buf[i]->str_code(rc);
|
||||
LOG(ERR) << rx_smpl_buf[i]->str_status();
|
||||
RTMD_VAL("readSamples", -5);
|
||||
RTMD_CLEAR("readSamples");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
RTMD_VAL("readSamples", len);
|
||||
RTMD_CLEAR("readSamples");
|
||||
return len;
|
||||
}
|
||||
|
||||
|
@ -875,6 +890,8 @@ int uhd_device::writeSamples(short **buf, int chans, int len,
|
|||
TIMESTAMP timestamp, bool *underrun,
|
||||
bool isControl)
|
||||
{
|
||||
RTMD_SET("writeSamples");
|
||||
|
||||
uhd::tx_metadata_t metadata;
|
||||
metadata.has_time_spec = true;
|
||||
metadata.start_of_burst = false;
|
||||
|
@ -884,6 +901,8 @@ int uhd_device::writeSamples(short **buf, int chans, int len,
|
|||
// No control packets
|
||||
if (isControl) {
|
||||
LOG(ERR) << "Control packets not supported";
|
||||
RTMD_VAL("writeSamples", -1);
|
||||
RTMD_CLEAR("writeSamples");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -897,6 +916,8 @@ int uhd_device::writeSamples(short **buf, int chans, int len,
|
|||
metadata.end_of_burst = true;
|
||||
} else if (drop_cnt < 30) {
|
||||
LOG(DEBUG) << "Aligning transmitter: packet advance";
|
||||
RTMD_VAL("writeSamples", -2);
|
||||
RTMD_CLEAR("writeSamples");
|
||||
return len;
|
||||
} else {
|
||||
LOG(DEBUG) << "Aligning transmitter: start burst";
|
||||
|
@ -918,6 +939,8 @@ int uhd_device::writeSamples(short **buf, int chans, int len,
|
|||
exit(-1);
|
||||
}
|
||||
|
||||
RTMD_VAL("writeSamples", num_smpls);
|
||||
RTMD_CLEAR("writeSamples");
|
||||
return num_smpls;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#include "Transceiver.h"
|
||||
#include "radioDevice.h"
|
||||
#include "RTMD.h"
|
||||
#define WITH_RTMD
|
||||
|
||||
ConfigurationTable gConfig("/etc/OpenBTS/OpenBTS.db");
|
||||
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include "radioInterface.h"
|
||||
#include <Logger.h>
|
||||
#include "RTMD.h"
|
||||
#define WITH_RTMD
|
||||
|
||||
bool started = false;
|
||||
|
||||
|
@ -206,9 +205,13 @@ void RadioInterface::alignRadio() {
|
|||
void RadioInterface::driveTransmitRadio(signalVector **radioBurst, bool *zeroBurst)
|
||||
{
|
||||
int i;
|
||||
RTMD_SET("drvTxRadio");
|
||||
|
||||
if (!mOn)
|
||||
if (!mOn) {
|
||||
RTMD_VAL("drvTxRadio", -1);
|
||||
RTMD_CLEAR("drvTxRadio");
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < mChanM; i++) {
|
||||
radioifyVector(*radioBurst[i], sendBuffer[i] + 2 * sendCursor,
|
||||
|
@ -222,6 +225,7 @@ void RadioInterface::driveTransmitRadio(signalVector **radioBurst, bool *zeroBur
|
|||
sendCursor += radioBurst[0]->size();
|
||||
|
||||
pushBuffer();
|
||||
RTMD_CLEAR("drvTxRadio");
|
||||
}
|
||||
|
||||
static inline void shiftRxBuffers(float **buf, int offset, int len, int chanM)
|
||||
|
@ -329,6 +333,7 @@ void RadioInterface::close()
|
|||
void RadioInterface::pullBuffer()
|
||||
{
|
||||
bool local_underrun;
|
||||
RTMD_SET("RIPullBuff");
|
||||
|
||||
/* Read samples. Fail if we don't get what we want. */
|
||||
int num_rd = mRadio->readSamples(rx_buf, mChanM, OUTCHUNK, readTimestamp);
|
||||
|
@ -343,13 +348,18 @@ void RadioInterface::pullBuffer()
|
|||
shortToFloat(rcvBuffer[i] + 2 * rcvCursor, rx_buf[i], num_rd);
|
||||
|
||||
rcvCursor += num_rd;
|
||||
RTMD_CLEAR("RIPullBuff");
|
||||
}
|
||||
|
||||
/* Send timestamped chunk to the device with arbitrary size */
|
||||
void RadioInterface::pushBuffer()
|
||||
{
|
||||
if (sendCursor < INCHUNK)
|
||||
RTMD_SET("RIPushBuff");
|
||||
if (sendCursor < INCHUNK) {
|
||||
RTMD_VAL("RIPushBuff", -1);
|
||||
RTMD_CLEAR("RIPushBuff");
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < mChanM; i++)
|
||||
floatToShort(tx_buf[i], sendBuffer[i], sendCursor);
|
||||
|
@ -361,4 +371,5 @@ void RadioInterface::pushBuffer()
|
|||
|
||||
writeTimestamp += (TIMESTAMP) num_smpls;
|
||||
sendCursor = 0;
|
||||
RTMD_CLEAR("RIPushBuff");
|
||||
}
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
|
||||
#include "radioVector.h"
|
||||
#include "RTMD.h"
|
||||
#define WITH_RTMD
|
||||
|
||||
radioVector::radioVector(const signalVector& wVector, GSM::Time& wTime)
|
||||
: signalVector(wVector), mTime(wTime)
|
||||
|
|
Loading…
Reference in New Issue