uhd: Display current timestamp with buffer status errors
Existing implementation outputs sample buffer parameters, but it is
helpful to know the submitted timestamp that led to the errant
condition.
Signed-off-by: Tom Tsou <tom@tsou.cc>
diff --git a/Transceiver52M/UHDDevice.cpp b/Transceiver52M/UHDDevice.cpp
index bdeb1b5..c914868 100644
--- a/Transceiver52M/UHDDevice.cpp
+++ b/Transceiver52M/UHDDevice.cpp
@@ -225,7 +225,7 @@
/** Buffer status string
@return a formatted string describing internal buffer state
*/
- std::string str_status() const;
+ std::string str_status(size_t ts) const;
/** Formatted error string
@param code an error code
@@ -885,7 +885,7 @@
rc = rx_buffers[0]->avail_smpls(timestamp);
if (rc < 0) {
LOG(ERR) << rx_buffers[0]->str_code(rc);
- LOG(ERR) << rx_buffers[0]->str_status();
+ LOG(ERR) << rx_buffers[0]->str_status(timestamp);
return 0;
}
@@ -927,7 +927,7 @@
// Continue on local overrun, exit on other errors
if ((rc < 0)) {
LOG(ERR) << rx_buffers[i]->str_code(rc);
- LOG(ERR) << rx_buffers[i]->str_status();
+ LOG(ERR) << rx_buffers[i]->str_status(timestamp);
if (rc != smpl_buf::ERROR_OVERFLOW)
return 0;
}
@@ -939,7 +939,7 @@
rc = rx_buffers[i]->read(bufs[i], len, timestamp);
if ((rc < 0) || (rc != len)) {
LOG(ERR) << rx_buffers[i]->str_code(rc);
- LOG(ERR) << rx_buffers[i]->str_status();
+ LOG(ERR) << rx_buffers[i]->str_status(timestamp);
return 0;
}
}
@@ -1326,11 +1326,12 @@
return write(buf, len, convert_time(ts, clk_rt));
}
-std::string smpl_buf::str_status() const
+std::string smpl_buf::str_status(size_t ts) const
{
std::ostringstream ost("Sample buffer: ");
- ost << "length = " << buf_len;
+ ost << "timestamp = " << ts;
+ ost << ", length = " << buf_len;
ost << ", time_start = " << time_start;
ost << ", time_end = " << time_end;
ost << ", data_start = " << data_start;