From 1ae25561fa3f6fe8295526b28031686c1123a8b6 Mon Sep 17 00:00:00 2001 From: Tom Tsou Date: Fri, 5 Dec 2014 12:56:34 -0800 Subject: 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 --- Transceiver52M/UHDDevice.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) 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 @@ public: /** 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 @@ int uhd_device::readSamples(std::vector &bufs, int len, bool *overrun, 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 @@ int uhd_device::readSamples(std::vector &bufs, int len, bool *overrun, // 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 @@ int uhd_device::readSamples(std::vector &bufs, int len, bool *overrun, 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 @@ ssize_t smpl_buf::write(void *buf, size_t len, uhd::time_spec_t ts) 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; -- cgit v1.2.3