29 static size_t size = sysconf(_SC_PAGESIZE);
37 mFd =
::open(mPath.c_str(), O_RDONLY | O_CLOEXEC);
39 throw IoError(mPath, std::strerror(errno));
42 if (fstat(mFd, &
st) != 0) {
45 throw IoError(mPath, std::strerror(err));
48 if (options.
localIO == Options::LocalIO::MMap &&
sizeof(
void*) == 8 && mSize > 0) {
49 void* p = mmap(
nullptr, mSize, PROT_READ, MAP_PRIVATE, mFd, 0);
50 if (p != MAP_FAILED) {
59 munmap((
void*)mMap, mSize);
64void LocalByteSource::checkRange(
uint64_t off,
size_t len)
const
66 if (off > mSize ||
len > mSize - off) {
77 mReadCalls.fetch_add(1, std::memory_order_relaxed);
78 mBytesRead.fetch_add(
len, std::memory_order_relaxed);
80 std::memcpy(
dst, mMap + off,
len);
85 auto n = ::pread(mFd, out,
len, off);
86 if (
n < 0 && errno == EINTR) {
90 throw IoError(mPath,
n == 0 ?
"unexpected end of file" : std::strerror(errno));
100 for (
auto&
r : requests) {
110 checkRange(off,
len);
112 mReadCalls.fetch_add(1, std::memory_order_relaxed);
113 mBytesRead.fetch_add(
len, std::memory_order_relaxed);
114 return {mMap + off,
len};
117void LocalByteSource::advise(
uint64_t off,
size_t len,
int advice)
119 if (!mMap || off >= mSize) {
122 len = std::min<uint64_t>(
len, mSize - off);
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char Directory with events to Events directory is and not inside events Show standalone event Run event generator maximum time bin of continuous for triggered for automatic continuous for automatic continuous triggered uint64_t
static std::unique_ptr< ByteSource > open(std::string url, const Options &)
void dontNeed(uint64_t off, size_t len) override
LocalByteSource(std::string path, Options const &options)
void willNeed(uint64_t off, size_t len) override
Hints that a range will be needed soon, or is no longer needed.
void readvInto(std::span< ReadRequest > requests) override
~LocalByteSource() override
std::span< const uint8_t > tryMap(uint64_t off, size_t len) override
A view of the bytes without copying them, if the backend can provide it.
void readInto(uint64_t off, size_t len, void *dst) override
Throws IoError, or CorruptData when the range is past the end of the file.
GLsizei const GLchar *const * path
GLenum GLenum GLsizei len
std::string to_string(gsl::span< T, Size > span)
Failure of the underlying transport.