geopm  3.1.1.dev272+gdfb40a8d
GEOPM - Global Extensible Open Power Manager
Public Member Functions | Protected Attributes | List of all members
geopm::ProfileImp Class Reference

#include <Profile.hpp>

Inheritance diagram for geopm::ProfileImp:
Inheritance graph
[legend]
Collaboration diagram for geopm::ProfileImp:
Collaboration graph
[legend]

Public Member Functions

 ProfileImp ()
 ProfileImp constructor. More...
 
 ProfileImp (const std::string &prof_name, const std::string &report, int num_cpu, std::set< int > cpu_set, std::shared_ptr< ApplicationStatus > app_status, std::shared_ptr< ApplicationRecordLog > app_record_log, bool do_profile, std::shared_ptr< ServiceProxy > service_proxy, std::shared_ptr< Scheduler > scheduler, int registered_pid)
 ProfileImp testable constructor. More...
 
 ProfileImp (const ProfileImp &other)=delete
 
ProfileImp operator= (const ProfileImp &other)=delete
 
virtual ~ProfileImp ()
 ProfileImp destructor, virtual. More...
 
uint64_t region (const std::string &region_name, long hint) override
 Register a region of code to be profiled. More...
 
void enter (uint64_t region_id) override
 Mark a region entry point. More...
 
void exit (uint64_t region_id) override
 Mark a region exit point. More...
 
void epoch (void) override
 Signal pass through outer loop. More...
 
void shutdown (void) override
 
void thread_init (uint32_t num_work_unit) override
 Update the total work for all CPUs. This method should be called by one thread in the same parallel region with the total work units expected to be completed by the entire group. More...
 
void thread_post (int cpu) override
 Mark one unit of work completed by the thread on this CPU. More...
 
std::vector< std::string > region_names (void) override
 
void reset_cpu_set (void) override
 
void overhead (double overhead_sec) override
 
void connect (void) override
 
- Public Member Functions inherited from geopm::Profile
 Profile ()=default
 
virtual ~Profile ()=default
 

Protected Attributes

bool m_is_enabled
 

Additional Inherited Members

- Static Public Member Functions inherited from geopm::Profile
static Profiledefault_profile (void)
 
static int get_cpu (void)
 Returns the Linux logical CPU index that the calling thread is executing on, and caches the result to be used in future calls. This method should be used by callers to report the correct CPU to thread_init() and thread_post(). More...
 

Constructor & Destructor Documentation

◆ ProfileImp() [1/3]

geopm::ProfileImp::ProfileImp ( void  )

ProfileImp constructor.

The ProfileImp object is used by the application to instrument regions of code and post profile information to a shared memory region to be read by the geopm::Controller process.

◆ ProfileImp() [2/3]

geopm::ProfileImp::ProfileImp ( const std::string &  prof_name,
const std::string &  report,
int  num_cpu,
std::set< int >  cpu_set,
std::shared_ptr< ApplicationStatus app_status,
std::shared_ptr< ApplicationRecordLog app_record_log,
bool  do_profile,
std::shared_ptr< ServiceProxy >  service_proxy,
std::shared_ptr< Scheduler scheduler,
int  registered_pid 
)

ProfileImp testable constructor.

Parameters
[in]prof_nameName associated with the profile. This name will be printed in the header of the report.
[in]reportReport file name.
[in]num_cpuNumber of CPUs for the platform
[in]cpu_setSet of CPUs assigned to the process owning the Profile object

◆ ProfileImp() [3/3]

geopm::ProfileImp::ProfileImp ( const ProfileImp other)
delete

◆ ~ProfileImp()

geopm::ProfileImp::~ProfileImp ( )
virtual

ProfileImp destructor, virtual.

Member Function Documentation

◆ connect()

void geopm::ProfileImp::connect ( void  )
overridevirtual

Implements geopm::Profile.

◆ enter()

void geopm::ProfileImp::enter ( uint64_t  region_id)
overridevirtual

Mark a region entry point.

Called to denote the beginning of region of code that was assigned the region_id when it was registered. Nesting of regions is not supported: calls to this method from within a region previously entered but not yet exited are silently ignored.

Parameters
[in]region_idThe identifier returned by Profile::region() when the region was registered.

Implements geopm::Profile.

◆ epoch()

void geopm::ProfileImp::epoch ( void  )
overridevirtual

Signal pass through outer loop.

Called once for each pass through the outer most computational loop executed by the application. This function call should occur exactly once in the application source at the beginning of the loop that encapsulates the primary computational region of the application.

Implements geopm::Profile.

◆ exit()

void geopm::ProfileImp::exit ( uint64_t  region_id)
overridevirtual

Mark a region exit point.

Called to denote the end of a region of code that was assigned the region_id when it was registered. Nesting of regions is not supported: calls to this method that are not exiting from the oldest unclosed entry point with the same region_id are silently ignored.

Parameters
[in]region_idThe identifier returned by Profile::region() when the region was registered.

Implements geopm::Profile.

◆ operator=()

ProfileImp geopm::ProfileImp::operator= ( const ProfileImp other)
delete

◆ overhead()

void geopm::ProfileImp::overhead ( double  overhead_sec)
overridevirtual

Implements geopm::Profile.

◆ region()

uint64_t geopm::ProfileImp::region ( const std::string &  region_name,
long  hint 
)
overridevirtual

Register a region of code to be profiled.

The statistics gathered for each region are aggregated in the final report, and the power policy will be determined distinctly for each region. The registration of a region is idempotent, and the first call will have more overhead than subsequent attempts to re-register the same region.

Parameters
[in]region_nameUnique name that identifies the region being profiled. This name will be printed next to the region statistics in the report.
[in]hintValue from the #geopm_hint_e structure which is used to derive a starting policy before the application has been profiled.
Returns
Returns the region_id which is a unique identifier derived from the region_name. This value is passed to Profile::enter() and Profile::exit() to associate these calls with the registered region.

Record hint when registering a region.

Implements geopm::Profile.

◆ region_names()

std::vector< std::string > geopm::ProfileImp::region_names ( void  )
overridevirtual

Implements geopm::Profile.

◆ reset_cpu_set()

void geopm::ProfileImp::reset_cpu_set ( void  )
overridevirtual

Implements geopm::Profile.

◆ shutdown()

void geopm::ProfileImp::shutdown ( void  )
overridevirtual

Implements geopm::Profile.

◆ thread_init()

void geopm::ProfileImp::thread_init ( uint32_t  num_work_unit)
overridevirtual

Update the total work for all CPUs. This method should be called by one thread in the same parallel region with the total work units expected to be completed by the entire group.

Parameters
[in]num_work_unitThe total work units for all threads in the same parallel region.

Implements geopm::Profile.

◆ thread_post()

void geopm::ProfileImp::thread_post ( int  cpu)
overridevirtual

Mark one unit of work completed by the thread on this CPU.

Parameters
[in]cpuThe Linux logical CPU obtained with get_cpu().

Implements geopm::Profile.

Member Data Documentation

◆ m_is_enabled

bool geopm::ProfileImp::m_is_enabled
protected

The documentation for this class was generated from the following files: