diff --git a/src/FileDmaInputFilter.cc b/src/FileDmaInputFilter.cc index b340791b68d3656753699fcb61419dbe7cfeda08..09289633768d8d1b5829671bf6b4ae9d28c20e8a 100644 --- a/src/FileDmaInputFilter.cc +++ b/src/FileDmaInputFilter.cc @@ -18,6 +18,7 @@ const bool USE_DAX_MEM = true; const size_t DEV_PAGE_SIZE = 4096; // Presumably const size_t DAX_START_OFFSET = 16777216; // Multiple of page size -- 4096 pages constexpr size_t DAX_DATA_LENGTH = 16777216; // Note: might need to be multiple of huge page +const size_t ACTUAL_GMT_FILE_SIZE = 9050784; // (((9050784 / DEV_PAGE_SIZE) + 1) * DEV_PAGE_SIZE); // 9052160 (2210 pages) const std::string DAX_ADDRESS = "/dev/dax0.0"; @@ -124,8 +125,8 @@ static inline ssize_t read_dma_packet_buffer(char *src_buf, char *dst_buf, size_ size_t bytes_read = 0; const size_t align_by = 32; assert(size % align_by == 0); - std::cout << "read_dma_packet_buffer: reading up to " << std::to_string(size) << " bytes." - << std::endl; + // std::cout << "read_dma_packet_buffer: reading up to " << std::to_string(size) << " bytes." + // << std::endl; static constexpr uint64_t deadbeef = 0xdeadbeefdeadbeefL; @@ -134,14 +135,15 @@ static inline ssize_t read_dma_packet_buffer(char *src_buf, char *dst_buf, size_ memcpy(dst_buf + bytes_read, src_buf + bytes_read, align_by); // Must find end of packet ('deadbeef') within the destination buffer's allocated space if (*(uint64_t *)(src_buf + bytes_read) == deadbeef) { - std::cout << "Found deadbeef after " << std::to_string(bytes_read) << " bytes." << std::endl; + // std::cout << "Found deadbeef after " << std::to_string(bytes_read) << " bytes." << + // std::endl; return static_cast<ssize_t>(bytes_read + align_by); } bytes_read += align_by; } if (bytes_read == size) { - std::cout << "Filled buffer but no deadbeef" << std::endl; + std::cout << "Filled buffer but no deadbeef found" << std::endl; // return static_cast<ssize_t>(bytes_read); } @@ -157,8 +159,8 @@ inline ssize_t FileDmaInputFilter::readPacket(char **buffer, ssize_t bufferSize) if constexpr (USE_DAX_MEM) { // bufferSize must be multiple of page size - if (source_offset_ >= DAX_DATA_LENGTH) { - LOG(INFO) << "Reached end of data buffer content (" << DAX_DATA_LENGTH + if (source_offset_ >= ACTUAL_GMT_FILE_SIZE) { + LOG(INFO) << "Reached end of data buffer content (" << ACTUAL_GMT_FILE_SIZE << " bytes), starting over"; source_offset_ = DAX_START_OFFSET; } @@ -168,7 +170,7 @@ inline ssize_t FileDmaInputFilter::readPacket(char **buffer, ssize_t bufferSize) bytesRead = read_dma_packet_from_file(inputFile, *buffer, bufferSize, nbReads()); } - std::cout << "Bytes read: " << std::to_string(bytesRead) << std::endl; + // std::cout << "Bytes read: " << std::to_string(bytesRead) << std::endl; while (bytesRead > (ssize_t)bufferSize) { stats.nbOversizedPackets++; skip++;