Skip to content

Commit 2380be4

Browse files
committed
Remove time from MMF file name
1 parent c1f5598 commit 2380be4

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

include/ReadoutCard/InterprocessLock.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <chrono>
1212
#include <sys/socket.h>
1313
#include <sys/un.h>
14+
#include <iostream>
1415

1516
#define LOCK_TIMEOUT 5 //5 second timeout in case we wait for the lock (e.g PDA)
1617
#define UNIX_SOCK_NAME_LENGTH 104 //108 for most UNIXs, 104 for macOS
@@ -72,8 +73,11 @@ class Lock
7273
if (mSocketName.length() >= UNIX_SOCK_NAME_LENGTH) {
7374
std::string lockType = mSocketName.substr(0, 17); // isolate the class that created the lock
7475
// Alice_O2_RoC_XYZ_*
75-
std::size_t lockNameHash = std::hash<std::string>{} (mSocketName); // hash the mutable part
76+
std::cout << "mSocketName: " << mSocketName << std::endl;
77+
std::cout << "cstr: " << mSocketName.c_str() << std::endl;
78+
std::size_t lockNameHash = std::hash<std::string>{} (mSocketName.c_str()); // hash the mutable part
7679
std::string safeLockName = lockType + std::to_string(lockNameHash) + "_lock"; // return conformant name
80+
std::cout << "lockNameHash: " << lockNameHash << std::endl;
7781
return safeLockName;
7882
} else {
7983
return mSocketName;

src/CommandLineUtilities/ProgramDmaBench.cxx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -259,11 +259,8 @@ class ProgramDmaBench: public Program
259259
throw ParameterException() << ErrorInfo::Message("Buffer size smaller than superpage size");
260260
}
261261

262-
// Add time to the buffer's filename. This way we guard our buffer from being overwritten by another process
263-
// as this is before the DMA Channel initialization and no lock protection is in place.
264-
std::string bufferName = (b::format("roc-bench-dma_id=%s_chan=%s_%s_pages") % map["id"].as<std::string>()
265-
% mOptions.dmaChannel
266-
% time(0)).str();
262+
std::string bufferName = (b::format("roc-bench-dma_id=%s_chan=%s_pages") % map["id"].as<std::string>()
263+
% mOptions.dmaChannel).str();
267264

268265
Utilities::HugepageType hugepageType;
269266
mMemoryMappedFile = Utilities::tryMapFile(mBufferSize, bufferName, !mOptions.noRemovePagesFile, &hugepageType);

0 commit comments

Comments
 (0)