6 #ifndef APPLICATIONRECORDLOG_HPP_INCLUDE
7 #define APPLICATIONRECORDLOG_HPP_INCLUDE
15 #include "geopm_time.h"
21 class SharedMemoryScopedLock;
62 static std::unique_ptr<ApplicationRecordLog>
make_unique(std::shared_ptr<SharedMemory> shmem);
79 virtual void enter(uint64_t hash,
const geopm_time_s &time) = 0;
96 virtual void exit(uint64_t hash,
const geopm_time_s &time) = 0;
106 virtual void epoch(
const geopm_time_s &time) = 0;
136 virtual void dump(std::vector<record_s> &records,
137 std::vector<short_region_s> &short_regions) = 0;
138 virtual void affinity(
const geopm_time_s &time,
int cpu_idx) = 0;
140 virtual void start_profile(
const geopm_time_s &time,
const std::string &profile_name) = 0;
141 virtual void stop_profile(
const geopm_time_s &time,
const std::string &profile_name) = 0;
142 virtual void overhead(
const geopm_time_s &time,
double overhead_sec) = 0;
179 std::shared_ptr<Scheduler> scheduler);
181 void enter(uint64_t hash,
const geopm_time_s &time)
override;
182 void exit(uint64_t hash,
const geopm_time_s &time)
override;
183 void epoch(
const geopm_time_s &time)
override;
184 void dump(std::vector<record_s> &records,
185 std::vector<short_region_s> &short_regions)
override;
186 void affinity(
const geopm_time_s &time,
int cpu_idx)
override;
188 void start_profile(
const geopm_time_s &time,
const std::string &profile_name)
override;
189 void stop_profile(
const geopm_time_s &time,
const std::string &profile_name)
override;
190 void overhead(
const geopm_time_s &time,
double overhead_sec)
override;
199 "Layout size used in geopmdpy/system_files.py to create shared memory footprint is smaller than required by C++ code");
201 struct m_region_enter_s {
204 geopm_time_s enter_time;
207 void check_reset(m_layout_s &layout);
208 void append_record(m_layout_s &layout,
const record_s &record);
210 std::shared_ptr<SharedMemory> m_shmem;
211 std::map<uint64_t, m_region_enter_s> m_hash_region_enter_map;
212 uint64_t m_epoch_count;
213 uint64_t m_entered_region_hash;
214 std::shared_ptr<Scheduler> m_scheduler;
Provides an abstraction for a shared memory buffer that can be used to pass entry,...
Definition: ApplicationRecordLog.hpp:57
static size_t max_record(void)
Gets the maximum number of records.
Definition: ApplicationRecordLog.cpp:31
virtual void dump(std::vector< record_s > &records, std::vector< short_region_s > &short_regions)=0
Get all events that have occurred since the last call to dump().
virtual void exit(uint64_t hash, const geopm_time_s &time)=0
Create a message in the log defining a region exit.
static constexpr int M_MAX_REGION
Definition: ApplicationRecordLog.hpp:171
virtual void affinity(const geopm_time_s &time, int cpu_idx)=0
virtual ~ApplicationRecordLog()=default
Destructor for pure virtual base class.
static size_t max_region(void)
Gets the maximum number of short region events.
Definition: ApplicationRecordLog.cpp:36
virtual void cpuset_changed(const geopm_time_s &time)=0
static std::unique_ptr< ApplicationRecordLog > make_unique(std::shared_ptr< SharedMemory > shmem)
Factory constructor.
Definition: ApplicationRecordLog.cpp:21
static constexpr size_t M_LAYOUT_SIZE
Definition: ApplicationRecordLog.hpp:169
virtual void overhead(const geopm_time_s &time, double overhead_sec)=0
ApplicationRecordLog()=default
virtual void stop_profile(const geopm_time_s &time, const std::string &profile_name)=0
virtual void epoch(const geopm_time_s &time)=0
Create a message in the log defining an epoch event.
virtual void enter(uint64_t hash, const geopm_time_s &time)=0
Create a message in the log defining a region entry.
virtual void start_profile(const geopm_time_s &time, const std::string &profile_name)=0
static size_t buffer_size(void)
Gets the shared memory size requirement.
Definition: ApplicationRecordLog.cpp:26
static constexpr int M_MAX_RECORD
Definition: ApplicationRecordLog.hpp:170
Definition: ApplicationRecordLog.hpp:174
void start_profile(const geopm_time_s &time, const std::string &profile_name) override
Definition: ApplicationRecordLog.cpp:199
void enter(uint64_t hash, const geopm_time_s &time) override
Create a message in the log defining a region entry.
Definition: ApplicationRecordLog.cpp:61
void stop_profile(const geopm_time_s &time, const std::string &profile_name) override
Definition: ApplicationRecordLog.cpp:214
void affinity(const geopm_time_s &time, int cpu_idx) override
Definition: ApplicationRecordLog.cpp:185
void cpuset_changed(const geopm_time_s &time) override
Definition: ApplicationRecordLog.cpp:174
virtual ~ApplicationRecordLogImp()=default
void overhead(const geopm_time_s &time, double overhead_sec) override
Definition: ApplicationRecordLog.cpp:229
void epoch(const geopm_time_s &time) override
Create a message in the log defining an epoch event.
Definition: ApplicationRecordLog.cpp:158
ApplicationRecordLogImp(std::shared_ptr< SharedMemory > shmem)
Definition: ApplicationRecordLog.cpp:41
void dump(std::vector< record_s > &records, std::vector< short_region_s > &short_regions) override
Get all events that have occurred since the last call to dump().
Definition: ApplicationRecordLog.cpp:244
void exit(uint64_t hash, const geopm_time_s &time) override
Create a message in the log defining a region exit.
Definition: ApplicationRecordLog.cpp:88
Definition: Accumulator.cpp:12
Record of an application event.
Definition: record.hpp:61
Definition: record.hpp:72