Commit a0ca1fb3 authored by Thomas Edwards's avatar Thomas Edwards
Browse files

Added timestamps to SteamReader log error messages

parent 3aa80943
...@@ -219,6 +219,9 @@ int Filter_Obs::lowpass_PLASMON_1Hz(buffer_obs* buffer_in, ...@@ -219,6 +219,9 @@ int Filter_Obs::lowpass_PLASMON_1Hz(buffer_obs* buffer_in,
struct timespec this_timeblock_edge; struct timespec this_timeblock_edge;
// Timestamp as string for logging // Timestamp as string for logging
std::string timestamp; std::string timestamp;
time_t now = time(0);
tm* gmtm = gmtime(&now);
std::string log_time_str = asctime(gmtm);
// Hard limiter for the que // Hard limiter for the que
// currently set to 10 seconds at 128 Hz // currently set to 10 seconds at 128 Hz
...@@ -385,6 +388,11 @@ int Filter_Obs::lowpass_PLASMON_1Hz(buffer_obs* buffer_in, ...@@ -385,6 +388,11 @@ int Filter_Obs::lowpass_PLASMON_1Hz(buffer_obs* buffer_in,
// -------------------------------------------------------------- // --------------------------------------------------------------
// If we find more than one block elapsed, then we've probably skipped some data. Let's hold off and get some extra data first. // If we find more than one block elapsed, then we've probably skipped some data. Let's hold off and get some extra data first.
if (round(num_blocks) > 1) { if (round(num_blocks) > 1) {
now = time(0);
gmtm = gmtime(&now);
log_time_str = asctime(gmtm);
log_time_str.pop_back(); // remove the endline char
std::cerr << "[" << log_time_str << "] ";
std::cerr << "[!!!] Time skip detected! Waiting for more data." << std::endl; std::cerr << "[!!!] Time skip detected! Waiting for more data." << std::endl;
} }
// See if we can run at least one filter // See if we can run at least one filter
...@@ -408,6 +416,11 @@ int Filter_Obs::lowpass_PLASMON_1Hz(buffer_obs* buffer_in, ...@@ -408,6 +416,11 @@ int Filter_Obs::lowpass_PLASMON_1Hz(buffer_obs* buffer_in,
// Check slip count to see if we need to slip // Check slip count to see if we need to slip
if (slip_count > slip_limit) { if (slip_count > slip_limit) {
now = time(0);
gmtm = gmtime(&now);
log_time_str = asctime(gmtm);
log_time_str.pop_back(); // remove the endline char
std::cerr << "[" << log_time_str << "] ";
std::cerr << "[!!!] Slipping data to fit time!" << std::endl; std::cerr << "[!!!] Slipping data to fit time!" << std::endl;
slip_count = 0; slip_count = 0;
filter_jitter = tofilter1.size() % 8; filter_jitter = tofilter1.size() % 8;
...@@ -480,10 +493,20 @@ int Filter_Obs::lowpass_PLASMON_1Hz(buffer_obs* buffer_in, ...@@ -480,10 +493,20 @@ int Filter_Obs::lowpass_PLASMON_1Hz(buffer_obs* buffer_in,
// Check the data: Do we have too much or too little? // Check the data: Do we have too much or too little?
// -------------------------------------------------------------- // --------------------------------------------------------------
if (tofilter1.size() > max_filter1) { if (tofilter1.size() > max_filter1) {
now = time(0);
gmtm = gmtime(&now);
log_time_str = asctime(gmtm);
log_time_str.pop_back(); // remove the endline char
std::cerr << "[" << log_time_str << "] ";
std::cerr << "[!!!] Too much data!" << std::endl; std::cerr << "[!!!] Too much data!" << std::endl;
// [TODO] Reset everthing, try to start again // [TODO] Reset everthing, try to start again
} else if (tofilter1.size() < min_filter1) { } else if (tofilter1.size() < min_filter1) {
now = time(0);
gmtm = gmtime(&now);
log_time_str = asctime(gmtm);
log_time_str.pop_back(); // remove the endline char
std::cerr << "[" << log_time_str << "] ";
std::cerr << "[!!!] Not enough data!" << std::endl; std::cerr << "[!!!] Not enough data!" << std::endl;
} else { } else {
// std::cerr << "[!!!] Enough to run filter! But for some reason we didn't!" << std::endl; // std::cerr << "[!!!] Enough to run filter! But for some reason we didn't!" << std::endl;
...@@ -499,6 +522,11 @@ int Filter_Obs::lowpass_PLASMON_1Hz(buffer_obs* buffer_in, ...@@ -499,6 +522,11 @@ int Filter_Obs::lowpass_PLASMON_1Hz(buffer_obs* buffer_in,
// check error state // check error state
if (tofilter1.size() > que_limit) { if (tofilter1.size() > que_limit) {
now = time(0);
gmtm = gmtime(&now);
log_time_str = asctime(gmtm);
log_time_str.pop_back(); // remove the endline char
std::cerr << "[" << log_time_str << "] ";
std::cerr << "[!!!] WARNING! Que limit has been reached! Restarting filter!" << std::endl; std::cerr << "[!!!] WARNING! Que limit has been reached! Restarting filter!" << std::endl;
// remove all data in ques // remove all data in ques
for (int ix = 0; ix < tofilter1.size(); ix++) { for (int ix = 0; ix < tofilter1.size(); ix++) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment