diff --git a/RTCP/LofarStMan/include/LofarStMan/LofarStMan.h b/RTCP/LofarStMan/include/LofarStMan/LofarStMan.h index f0d352afe3b8228d507f1be4e2edac984c108bd2..f642dfd4788ac73c717611d714e17cd063363b6e 100644 --- a/RTCP/LofarStMan/include/LofarStMan/LofarStMan.h +++ b/RTCP/LofarStMan/include/LofarStMan/LofarStMan.h @@ -283,30 +283,20 @@ private: const void* getReadPointer (casa::uInt blocknr, casa::uInt offset, casa::uInt size) { - if (sizeof(void*) <= 4) { - return readFile (blocknr, offset, size); - } else { - return itsMapFile->getReadPointer (blocknr*itsBlockSize + offset); - } + return readFile (blocknr, offset, size); } // Get a pointer where data can be written. void* getWritePointer (casa::uInt blocknr, casa::uInt offset, casa::uInt size) { - if (sizeof(void*) <= 4) { - return getBuffer (size); - } else { - return itsMapFile->getWritePointer (blocknr*itsBlockSize + offset); - } + return getBuffer (size); } // Write the data. It is a no-op if mmap is used. void writeData (casa::uInt blocknr, casa::uInt offset, casa::uInt size) { - if (sizeof(void*) <= 4) { - writeFile (blocknr, offset, size); - } + writeFile (blocknr, offset, size); } // Read or write the data for regular files. @@ -333,8 +323,6 @@ private: // On 32-bit systems regular IO is used. casa::LargeFiledesIO* itsRegFile; casa::Block<char> itsBuffer; //# buffer of size itsBLDataSize for regular IO - // On 64-bit systems memory-mapped IO is used. - casa::MMapIO* itsMapFile; // The seqnr file (if present) is always memory-mapped because it is small. casa::MMapIO* itsSeqFile; bool itsDoSwap; //# True = byte-swapping is needed diff --git a/RTCP/LofarStMan/src/LofarStMan.cc b/RTCP/LofarStMan/src/LofarStMan.cc index 9de173001031ee822a1d3d0121df4706fbaeb73c..d36b2ed7c0d89b12bf3d329e56af7f0e519d4206 100644 --- a/RTCP/LofarStMan/src/LofarStMan.cc +++ b/RTCP/LofarStMan/src/LofarStMan.cc @@ -41,7 +41,6 @@ LofarStMan::LofarStMan (const String& dataManName) : DataManager (), itsDataManName (dataManName), itsRegFile (0), - itsMapFile (0), itsSeqFile (0) {} @@ -50,7 +49,6 @@ LofarStMan::LofarStMan (const String& dataManName, : DataManager (), itsDataManName (dataManName), itsRegFile (0), - itsMapFile (0), itsSeqFile (0) {} @@ -58,7 +56,6 @@ LofarStMan::LofarStMan (const LofarStMan& that) : DataManager (), itsDataManName (that.itsDataManName), itsRegFile (0), - itsMapFile (0), itsSeqFile (0) {} @@ -68,7 +65,6 @@ LofarStMan::~LofarStMan() delete itsColumns[i]; } delete itsRegFile; - delete itsMapFile; delete itsSeqFile; } @@ -220,11 +216,6 @@ void LofarStMan::prepare() void LofarStMan::openFile (bool writable) { - // Use mmap-ed IO non 64-bit systems. - if (sizeof(void*) == 8) { - mapFile (writable); - return; - } // Open the data file using unbuffered IO. delete itsRegFile; itsRegFile = 0; @@ -241,23 +232,7 @@ void LofarStMan::openFile (bool writable) } } -void LofarStMan::mapFile (bool writable) -{ - // Memory-map the data file. - delete itsMapFile; - itsMapFile = 0; - if (writable) { - itsMapFile = new MMapIO (fileName() + "data", ByteIO::Update); - } else { - itsMapFile = new MMapIO (fileName() + "data"); - } - // Set correct number of rows. - itsNrRows = itsMapFile->getFileSize() / itsBlockSize * itsAnt1.size(); - // Map the file with seqnrs. - mapSeqFile(); -} - - void LofarStMan::mapSeqFile() +void LofarStMan::mapSeqFile() { delete itsSeqFile; itsSeqFile = 0; @@ -280,12 +255,7 @@ void LofarStMan::resync (uInt) } uInt LofarStMan::resync1 (uInt) { - uInt nrows; - if (sizeof(void*) == 8) { - nrows = itsMapFile->getFileSize() / itsBlockSize * itsAnt1.size(); - } else { - nrows = itsRegFile->length() / itsBlockSize * itsAnt1.size(); - } + uInt nrows = itsRegFile->length() / itsBlockSize * itsAnt1.size(); // Reopen file if different nr of rows. if (nrows != itsNrRows) { openFile (table().isWritable()); @@ -302,8 +272,6 @@ void LofarStMan::deleteManager() { delete itsRegFile; itsRegFile = 0; - delete itsMapFile; - itsMapFile = 0; delete itsSeqFile; itsSeqFile = 0; DOos::remove (fileName()+"meta", False, False); diff --git a/RTCP/LofarStMan/test/tIOPerf.cc b/RTCP/LofarStMan/test/tIOPerf.cc index d447e62735f9c86e87df7fc5f2fe29cfd51ebaa1..1ba8ae3501b3860f4b9a740aefafdbdb5912a3bf 100644 --- a/RTCP/LofarStMan/test/tIOPerf.cc +++ b/RTCP/LofarStMan/test/tIOPerf.cc @@ -488,3 +488,18 @@ int main (int argc, char* argv[]) } return 0; // exit with success status } + + +/* +Remarks: + +1. First stepping sequentially, then by baseline is not bad at all provided that the MS is not very much larger than memory. In such a case a lot of data is already mapped in and does not need to be read randomly. +Test this for a, say, 40 GByte MS by first stepping through it in time, then by baseline. +Probably reading in half the MS is good enough. + +2. Reading an entire tile and thereafter by time is much better than by time. +However, readseq3a might benefit from the data still in the file cache from readseq3. +Yet, readseq3a is much faster when first reading a tile. +Probably readbl3 benefits in the same way. + +*/