1#ifndef IPPL_LOGGING_BUFFER_HANDLER_HPP
2#define IPPL_LOGGING_BUFFER_HANDLER_HPP
9 template <
typename MemorySpace>
15 template <
typename MemorySpace>
17 handler_m = std::make_shared<DefaultBufferHandler<MemorySpace>>();
18 MPI_Comm_rank(MPI_COMM_WORLD, &
rank_m);
21 template <
typename MemorySpace>
24 auto buffer =
handler_m->getBuffer(size, overallocation);
25 logMethod(
"getBuffer", {{
"size", std::to_string(size)},
26 {
"overallocation", std::to_string(overallocation)}});
30 template <
typename MemorySpace>
36 template <
typename MemorySpace>
42 template <
typename MemorySpace>
48 template <
typename MemorySpace>
54 template <
typename MemorySpace>
60 template <
typename MemorySpace>
65 template <
typename MemorySpace>
67 const std::string& methodName,
const std::map<std::string, std::string>& parameters) {
70 std::chrono::high_resolution_clock::now()});
Interface for memory buffer handling.
typename BufferHandler< MemorySpace >::size_type size_type
LoggingBufferHandler()
Default constructor, creates an internal BufferHandler for managing buffers. This constructor also in...
buffer_type getBuffer(size_type size, double overallocation) override
Allocates or retrieves a buffer and logs the action.
std::shared_ptr< BufferHandler< MemorySpace > > handler_m
Internal handler for buffer management.
void freeAllBuffers() override
Frees all buffers and logs the action.
void logMethod(const std::string &methodName, const std::map< std::string, std::string > ¶meters)
Records a method call in the log with its parameters.
size_type getUsedSize() const override
Retrieves the total size of allocated buffers.
typename BufferHandler< MemorySpace >::buffer_type buffer_type
const std::vector< LogEntry > & getLogs() const
Retrieves the list of log entries.
size_type getFreeSize() const override
Retrieves the total size of free buffers.
void deleteAllBuffers() override
Deletes all buffers and logs the action.
int rank_m
MPI rank for identifying log sources.
void freeBuffer(buffer_type buffer) override
Frees a buffer and logs the action.
std::vector< LogEntry > logEntries_m
Log entries for buffer operations.