6 #ifndef APPLICATIONSTATUS_HPP_INCLUDE
7 #define APPLICATIONSTATUS_HPP_INCLUDE
15 #include "geopm/Helper.hpp"
36 virtual void set_hint(
int cpu_idx, uint64_t hint) = 0;
40 virtual uint64_t
get_hint(
int cpu_idx)
const = 0;
43 virtual void set_hash(
int cpu_idx, uint64_t hash, uint64_t hint) = 0;
46 virtual uint64_t
get_hash(
int cpu_idx)
const = 0;
77 static std::unique_ptr<ApplicationStatus>
make_unique(
int num_cpu,
78 std::shared_ptr<SharedMemory> shmem);
87 static constexpr
size_t M_STATUS_SIZE = geopm::hardware_destructive_interference_size;
94 std::shared_ptr<SharedMemory> shmem);
96 void set_hint(
int cpu_idx, uint64_t hint)
override;
97 uint64_t
get_hint(
int cpu_idx)
const override;
98 void set_hash(
int cpu_idx, uint64_t hash, uint64_t hint)
override;
99 uint64_t
get_hash(
int cpu_idx)
const override;
107 struct m_app_status_s
113 uint32_t completed_work;
116 static_assert((
sizeof(ApplicationStatusImp::m_app_status_s) % geopm::hardware_destructive_interference_size) == 0,
117 "m_app_status_s not aligned to cache lines");
119 "M_STATUS_SIZE does not match size of m_app_status_s");
122 std::shared_ptr<SharedMemory> m_shmem;
123 m_app_status_s *m_buffer;
124 std::vector<m_app_status_s> m_cache;
Object that encapsulates application process information such as the process ID, region hash,...
Definition: ApplicationStatus.hpp:27
virtual void increment_work_unit(int cpu_idx)=0
Mark a unit of work completed for this CPU.
virtual void update_cache(void)=0
Updates the local memory with the latest values from the shared memory. Any calls to get methods will...
static size_t buffer_size(int num_cpu)
Return the required size of the shared memory region used by the ApplicationStatus for the given numb...
Definition: ApplicationStatus.cpp:26
virtual void reset_work_units(int cpu_idx)=0
virtual void set_hint(int cpu_idx, uint64_t hint)=0
Set the current hint bits for a CPU.
virtual void set_total_work_units(int cpu_idx, int work_units)=0
Reset the total work units for all threads to be completed as part of a parallel region....
virtual ~ApplicationStatus()=default
virtual double get_progress_cpu(int cpu_idx) const =0
Get the current progress for this CPU. Progress is the fraction of the total work units that have bee...
virtual uint64_t get_hash(int cpu_idx) const =0
Get the hash of the region currently running on a CPU.
virtual uint64_t get_hint(int cpu_idx) const =0
Get the current hint bits for a CPU.
static std::unique_ptr< ApplicationStatus > make_unique(int num_cpu, std::shared_ptr< SharedMemory > shmem)
Create an ApplicationStatus object using the given SharedMemory. The caller is responsible for callin...
Definition: ApplicationStatus.cpp:20
static constexpr size_t M_STATUS_SIZE
Definition: ApplicationStatus.hpp:87
virtual void set_hash(int cpu_idx, uint64_t hash, uint64_t hint)=0
Set the hash and hint of the region currently running on a CPU.
Definition: ApplicationStatus.hpp:91
ApplicationStatusImp(int num_cpu, std::shared_ptr< SharedMemory > shmem)
Definition: ApplicationStatus.cpp:31
void set_hint(int cpu_idx, uint64_t hint) override
Set the current hint bits for a CPU.
Definition: ApplicationStatus.cpp:51
uint64_t get_hash(int cpu_idx) const override
Get the hash of the region currently running on a CPU.
Definition: ApplicationStatus.cpp:92
void reset_work_units(int cpu_idx) override
Definition: ApplicationStatus.cpp:103
uint64_t get_hint(int cpu_idx) const override
Get the current hint bits for a CPU.
Definition: ApplicationStatus.cpp:63
void update_cache(void) override
Updates the local memory with the latest values from the shared memory. Any calls to get methods will...
Definition: ApplicationStatus.cpp:159
virtual ~ApplicationStatusImp()=default
void set_total_work_units(int cpu_idx, int work_units) override
Reset the total work units for all threads to be completed as part of a parallel region....
Definition: ApplicationStatus.cpp:114
double get_progress_cpu(int cpu_idx) const override
Get the current progress for this CPU. Progress is the fraction of the total work units that have bee...
Definition: ApplicationStatus.cpp:143
void set_hash(int cpu_idx, uint64_t hash, uint64_t hint) override
Set the hash and hint of the region currently running on a CPU.
Definition: ApplicationStatus.cpp:76
void increment_work_unit(int cpu_idx) override
Mark a unit of work completed for this CPU.
Definition: ApplicationStatus.cpp:130
Definition: Accumulator.cpp:12