OPALX (Object Oriented Parallel Accelerator Library for Exascale) MINIorX
OPALX
LoggingBufferHandler.h
Go to the documentation of this file.
1#ifndef IPPL_LOGGING_BUFFER_HANDLER_H
2#define IPPL_LOGGING_BUFFER_HANDLER_H
3
4#include <chrono>
5#include <map>
6#include <memory>
7#include <string>
8#include <vector>
9
12
13namespace ippl {
14
30 template <typename MemorySpace>
31 class LoggingBufferHandler : public BufferHandler<MemorySpace> {
32 public:
35
42 LoggingBufferHandler(std::shared_ptr<BufferHandler<MemorySpace>> handler, int rank);
43
49
60 buffer_type getBuffer(size_type size, double overallocation) override;
61
70 void freeBuffer(buffer_type buffer) override;
71
78 void freeAllBuffers() override;
79
86 void deleteAllBuffers() override;
87
92 size_type getUsedSize() const override;
93
98 size_type getFreeSize() const override;
99
104 const std::vector<LogEntry>& getLogs() const;
105
106 private:
107 std::shared_ptr<BufferHandler<MemorySpace>>
109 std::vector<LogEntry> logEntries_m;
110 int rank_m;
111
122 void logMethod(const std::string& methodName,
123 const std::map<std::string, std::string>& parameters);
124 };
125} // namespace ippl
126
128
129#endif
Implementations for FFT constructor/destructor and transforms.
Definition: Archive.h:20
Interface for memory buffer handling.
Definition: BufferHandler.h:21
ippl::detail::size_type size_type
Definition: BufferHandler.h:25
std::shared_ptr< archive_type > buffer_type
Definition: BufferHandler.h:24
Decorator class for buffer management that adds logging capabilities to buffer operations.
LoggingBufferHandler()
Default constructor, creates an internal BufferHandler for managing buffers.
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 > &parameters)
Records a method call in the log with its parameters.
size_type getUsedSize() const override
Retrieves the total size of allocated buffers.
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.