mirror of
https://github.com/paulscherrerinstitute/sf_daq_buffer.git
synced 2026-04-21 08:04:35 +02:00
2bf658d30c
When started to use the buffer on GPFS we notices an increase of metadata access times on GPFS. To try to reduce the number of metadata updates we set the file size at creation time.
37 lines
745 B
C++
37 lines
745 B
C++
#ifndef BINARYWRITER_HPP
|
|
#define BINARYWRITER_HPP
|
|
|
|
#include <string>
|
|
|
|
#include "formats.hpp"
|
|
|
|
class BufferBinaryWriter {
|
|
|
|
const size_t MAX_FILE_BYTES =
|
|
buffer_config::FILE_MOD * sizeof(BufferBinaryFormat);
|
|
|
|
const std::string root_folder_;
|
|
const std::string device_name_;
|
|
std::string latest_filename_;
|
|
|
|
std::string current_output_filename_;
|
|
int output_file_fd_;
|
|
|
|
void open_file(const std::string& filename);
|
|
void close_current_file();
|
|
|
|
|
|
public:
|
|
BufferBinaryWriter(
|
|
const std::string& root_folder,
|
|
const std::string& device_name);
|
|
|
|
virtual ~BufferBinaryWriter();
|
|
|
|
void write(const uint64_t pulse_id, const BufferBinaryFormat* buffer);
|
|
|
|
};
|
|
|
|
|
|
#endif //BINARYWRITER_HPP
|