geopm 3.1.1.dev596+g0f4ddc70
GEOPM - Global Extensible Open Power Manager
|
Provides an abstraction for a shared memory buffer that can be used to pass entry, exit, epoch and short region events from Profile to ApplicationSampler. More...
#include <ApplicationRecordLog.hpp>
Public Member Functions | |
virtual | ~ApplicationRecordLog ()=default |
Destructor for pure virtual base class. | |
virtual void | enter (uint64_t hash, const geopm_time_s &time)=0 |
Create a message in the log defining a region entry. | |
virtual void | exit (uint64_t hash, const geopm_time_s &time)=0 |
Create a message in the log defining a region exit. | |
virtual void | epoch (const geopm_time_s &time)=0 |
Create a message in the log defining an epoch event. | |
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 | affinity (const geopm_time_s &time, int cpu_idx)=0 |
virtual void | cpuset_changed (const geopm_time_s &time)=0 |
virtual void | start_profile (const geopm_time_s &time, const std::string &profile_name)=0 |
virtual void | stop_profile (const geopm_time_s &time, const std::string &profile_name)=0 |
virtual void | overhead (const geopm_time_s &time, double overhead_sec)=0 |
Static Public Member Functions | |
static std::unique_ptr< ApplicationRecordLog > | make_unique (std::shared_ptr< SharedMemory > shmem) |
Factory constructor. | |
static size_t | buffer_size (void) |
Gets the shared memory size requirement. | |
static size_t | max_record (void) |
Gets the maximum number of records. | |
static size_t | max_region (void) |
Gets the maximum number of short region events. | |
Protected Member Functions | |
ApplicationRecordLog ()=default | |
Static Protected Attributes | |
static constexpr size_t | M_LAYOUT_SIZE = 57384 |
static constexpr int | M_MAX_RECORD = 1024 |
static constexpr int | M_MAX_REGION = M_MAX_RECORD + 1 |
Provides an abstraction for a shared memory buffer that can be used to pass entry, exit, epoch and short region events from Profile to ApplicationSampler.
This class provides a compression of short running regions to avoid overwhelming the controller with too many records.
If the Profile calls entry() and then exit() for the same region hash within a control interval (between two calls to dump()) the entry event is converted into a short region event. All future pairs of entry() and exit() using this hash but prior to the next dump() call will be aggregated into this short region event.
If a region hash was observed as a short region during a control interval (it was both entered and exited), but the dump() call occurs prior to an exit() call that would close the region, the subsequent exit() call to this region will be classified as a short region event and the intervening interval of time will be recorded in this event created by the exit() call.
There is a loss of information when a region is entered and exited within one control loop when compared to the case where a dump() call is made between an entry() and exit() call. In the former case, the exact timestamp associated with all region exit and entry events for a particular hash that occur after the first enter() call for that hash and prior to the next dump() call are lost. The short region event records the number of calls to the hashed region and the total amount of time in the region, but the exact sequence and timing of events following the first enter() is not recorded.
|
virtualdefault |
Destructor for pure virtual base class.
|
protecteddefault |
|
pure virtual |
Implemented in geopm::ApplicationRecordLogImp.
|
static |
Gets the shared memory size requirement.
This method returns the value to use when sizing the SharedMemory object used to construct the ApplicationRecordLog.
|
pure virtual |
Implemented in geopm::ApplicationRecordLogImp.
|
pure virtual |
Get all events that have occurred since the last call to dump().
Called by the ApplicationSampler to gather all records that have been created by the Profile object since the last time the method was called. The call effectively removes all of the records and short region data from the table.
For optimal performance the user should reserve space in the output vectors using the max_record() and max_region() static methods:
records.reserve(ApplicationRecordLog::max_record()); short_regions.reserve(ApplicationRecordLog::max_region());
Note that the "signal" in any sort region events in the records output vector is the index into the short_regions output vector, and the length of the short_regions vector will be equal to the number of events with type "EVENT_SHORT_REGION" in the records output vector.
[out] | records | Vector of records written since last dump(). |
[out] | short_regions | Vector of short region data about any short regions events in the records output vector. |
Implemented in geopm::ApplicationRecordLogImp.
|
pure virtual |
Create a message in the log defining a region entry.
Called by the Profile object when a region is entered. This creates a record_s in the log indicating entry if the region is entered for the first time since the last dump() call, or it sets the start time for a short region if the region was entered and exited since the last call to dump().
[in] | hash | The region hash that is entered. |
[in] | time | The timestamp when the entry event occurred. |
Implemented in geopm::ApplicationRecordLogImp.
|
pure virtual |
Create a message in the log defining an epoch event.
Called by the Profile object when an epoch event occurs. This creates a record_s in the log indicating that an epoch event occurred.
time | [in] The timestamp when the epoch event occurred. |
Implemented in geopm::ApplicationRecordLogImp.
|
pure virtual |
Create a message in the log defining a region exit.
Called by the Profile object when a region is exited. This creates a record_s in the log indicating exit if the matching entry for the region was called prior to the last dump() call. If the region was entered since the last call to dump(), the first entry event will be converted into a short region event. The call to exit() for short regions has the effect of updating the short region event time and count values.
hash | [in] The region hash that was exited. |
time | [in] The timestamp when the exit event occurred. |
Implemented in geopm::ApplicationRecordLogImp.
|
static |
Factory constructor.
[in] | shmem | Shared memory object of at least the size returned by buffer_size(). |
|
static |
|
static |
|
pure virtual |
Implemented in geopm::ApplicationRecordLogImp.
|
pure virtual |
Implemented in geopm::ApplicationRecordLogImp.
|
pure virtual |
Implemented in geopm::ApplicationRecordLogImp.
|
staticconstexprprotected |
|
staticconstexprprotected |
|
staticconstexprprotected |