diff --git a/RTCP/Storage/include/Storage/RTStorage.h b/RTCP/Storage/include/Storage/RTStorage.h index 70a435a823404974a9777c0ff5f9c4216debe17a..f34c7a680088be75278003575e64386e066195c2 100644 --- a/RTCP/Storage/include/Storage/RTStorage.h +++ b/RTCP/Storage/include/Storage/RTStorage.h @@ -18,6 +18,7 @@ #include <Interface/Exceptions.h> #include <Interface/PipelineOutput.h> #include <Interface/MultiDimArray.h> +#include <Interface/RSPTimeStamp.h> #include <Storage/Format.h> #include <Storage/InputThread.h> @@ -50,6 +51,7 @@ namespace LOFAR { // writes, for O_DIRECT Matrix<int> itsPreviousSequenceNumbers; + TimeStamp itsSyncedStamp; NSTimer itsWriteTimer; double bytesWritten; diff --git a/RTCP/Storage/include/Storage/SubbandWriter.h b/RTCP/Storage/include/Storage/SubbandWriter.h index 53affa58ede144028cdbbc2769c7715b24beee27..14e62f294991ade015cbf32e6c00a31b3a7675e5 100644 --- a/RTCP/Storage/include/Storage/SubbandWriter.h +++ b/RTCP/Storage/include/Storage/SubbandWriter.h @@ -38,6 +38,7 @@ #include <Interface/PipelineOutput.h> #include <Interface/StreamableData.h> #include <Interface/Queue.h> +#include <Interface/RSPTimeStamp.h> #include <Storage/InputThread.h> #include <Stream/Stream.h> @@ -96,6 +97,8 @@ class SubbandWriter NSTimer itsWriteTimer; + TimeStamp itsSyncedStamp; + #ifdef USE_MAC_PI bool itsWriteToMAC; GCF::CEPPMLlight::CEPPropertySet* itsPropertySet; diff --git a/RTCP/Storage/src/RTStorage.cc b/RTCP/Storage/src/RTStorage.cc index 7861486abc918066412e73c223af8ac6735f8854..860ebaf9aae32dcf21591054a30a54eeb8b29c6a 100644 --- a/RTCP/Storage/src/RTStorage.cc +++ b/RTCP/Storage/src/RTStorage.cc @@ -58,6 +58,14 @@ RTStorage::~RTStorage() void RTStorage::preprocess() { + const double startTime = itsPS->startTime(); + const double sampleFreq = itsPS->sampleRate(); + const unsigned seconds = static_cast<unsigned>(floor(startTime)); + const unsigned samples = static_cast<unsigned>((startTime - floor(startTime)) * sampleFreq); + + itsSyncedStamp.setStationClockSpeed(static_cast<unsigned>(sampleFreq * 1024)); + itsSyncedStamp = TimeStamp(seconds, samples); + /// Get various observation parameters itsNrSubbands = itsPS->nrSubbands(); if (itsNrSubbands % itsSize == 0) { @@ -115,7 +123,7 @@ void RTStorage::preprocess() itsPreviousSequenceNumbers[i][j] = -1; } - } + } } @@ -175,7 +183,10 @@ void RTStorage::writeLogMessage() #if defined HAVE_MPI ", rank = " << itsRank << #endif - ", count = " << counter ++); + ", count = " << counter ++ << + ", timestamp = " << itsSyncedStamp); + + itsSyncedStamp += itsPS->nrSubbandSamples() * itsPS->IONintegrationSteps(); } @@ -213,7 +224,7 @@ bool RTStorage::processSubband(unsigned sb) itsWriteTimer.start(); /// write data to correct fd for (unsigned i = 0; i < itsNrOutputs; i++) { - data->write( myFDs[sb][i], true, itsAlignment); + data->write( myFDs[sb][i], true, itsAlignment ); } itsWriteTimer.stop(); diff --git a/RTCP/Storage/src/SubbandWriter.cc b/RTCP/Storage/src/SubbandWriter.cc index 730826255e557e27e47a3098b7f1ab6062e7a7b3..58982e944ab178e0657bad9fb401b4253da078d3 100644 --- a/RTCP/Storage/src/SubbandWriter.cc +++ b/RTCP/Storage/src/SubbandWriter.cc @@ -164,6 +164,14 @@ void SubbandWriter::preprocess() itsNrSubbandsPerStorage = (itsNrSubbands / itsSize) + 1; } + + const double sampleFreq = itsPS->sampleRate(); + const unsigned seconds = static_cast<unsigned>(floor(startTime)); + const unsigned samples = static_cast<unsigned>((startTime - floor(startTime)) * sampleFreq); + + itsSyncedStamp.setStationClockSpeed(static_cast<unsigned>(sampleFreq * 1024)); + itsSyncedStamp = TimeStamp(seconds, samples); + LOG_TRACE_VAR_STR("SubbandsPerStorage = " << itsNrSubbandsPerStorage); itsMyNrSubbands = 0; @@ -281,9 +289,12 @@ void SubbandWriter::writeLogMessage() LOG_INFO_STR("time = " << buf << #if defined HAVE_MPI - ", rank = " << itsRank << + ", rank = " << itsRank << #endif - ", count = " << counter ++); + ", count = " << counter ++ << + ", timestamp = " << itsSyncedStamp) ; + + itsSyncedStamp += itsPS->nrSubbandSamples() * itsPS->IONintegrationSteps(); }