Skip to content
Snippets Groups Projects
Commit 1d3ccb68 authored by Giovanna Lazzari Miotto's avatar Giovanna Lazzari Miotto :mushroom:
Browse files

Re-introduce hard-coded input size

parent f4b8d235
No related branches found
No related tags found
No related merge requests found
Pipeline #7187079 failed
...@@ -18,6 +18,7 @@ const bool USE_DAX_MEM = true; ...@@ -18,6 +18,7 @@ const bool USE_DAX_MEM = true;
const size_t DEV_PAGE_SIZE = 4096; // Presumably const size_t DEV_PAGE_SIZE = 4096; // Presumably
const size_t DAX_START_OFFSET = 16777216; // Multiple of page size -- 4096 pages 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 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) // (((9050784 / DEV_PAGE_SIZE) + 1) * DEV_PAGE_SIZE); // 9052160 (2210 pages)
const std::string DAX_ADDRESS = "/dev/dax0.0"; 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_ ...@@ -124,8 +125,8 @@ static inline ssize_t read_dma_packet_buffer(char *src_buf, char *dst_buf, size_
size_t bytes_read = 0; size_t bytes_read = 0;
const size_t align_by = 32; const size_t align_by = 32;
assert(size % align_by == 0); assert(size % align_by == 0);
std::cout << "read_dma_packet_buffer: reading up to " << std::to_string(size) << " bytes." // std::cout << "read_dma_packet_buffer: reading up to " << std::to_string(size) << " bytes."
<< std::endl; // << std::endl;
static constexpr uint64_t deadbeef = 0xdeadbeefdeadbeefL; 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_ ...@@ -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); memcpy(dst_buf + bytes_read, src_buf + bytes_read, align_by);
// Must find end of packet ('deadbeef') within the destination buffer's allocated space // Must find end of packet ('deadbeef') within the destination buffer's allocated space
if (*(uint64_t *)(src_buf + bytes_read) == deadbeef) { 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); return static_cast<ssize_t>(bytes_read + align_by);
} }
bytes_read += align_by; bytes_read += align_by;
} }
if (bytes_read == size) { 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); // return static_cast<ssize_t>(bytes_read);
} }
...@@ -157,8 +159,8 @@ inline ssize_t FileDmaInputFilter::readPacket(char **buffer, ssize_t bufferSize) ...@@ -157,8 +159,8 @@ inline ssize_t FileDmaInputFilter::readPacket(char **buffer, ssize_t bufferSize)
if constexpr (USE_DAX_MEM) { if constexpr (USE_DAX_MEM) {
// bufferSize must be multiple of page size // bufferSize must be multiple of page size
if (source_offset_ >= DAX_DATA_LENGTH) { if (source_offset_ >= ACTUAL_GMT_FILE_SIZE) {
LOG(INFO) << "Reached end of data buffer content (" << DAX_DATA_LENGTH LOG(INFO) << "Reached end of data buffer content (" << ACTUAL_GMT_FILE_SIZE
<< " bytes), starting over"; << " bytes), starting over";
source_offset_ = DAX_START_OFFSET; source_offset_ = DAX_START_OFFSET;
} }
...@@ -168,7 +170,7 @@ inline ssize_t FileDmaInputFilter::readPacket(char **buffer, ssize_t bufferSize) ...@@ -168,7 +170,7 @@ inline ssize_t FileDmaInputFilter::readPacket(char **buffer, ssize_t bufferSize)
bytesRead = read_dma_packet_from_file(inputFile, *buffer, bufferSize, nbReads()); 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) { while (bytesRead > (ssize_t)bufferSize) {
stats.nbOversizedPackets++; stats.nbOversizedPackets++;
skip++; skip++;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment