powerd++  0.4.4
Classes | Typedefs | Functions | Variables
anonymous_namespace{libloadplay.cpp} Namespace Reference

File local scope. More...

Classes

class  Callback
 Implements a recursion safe std::function wrapper. More...
 
struct  CoreFrameReport
 The report frame information for a single CPU pipeline. More...
 
struct  CoreReport
 The reported state of a single CPU pipeline. More...
 
class  Emulator
 Instances of this class represent an emulator session. More...
 
class  Hold
 Sets a referenced variable to a given value and restores it when going out of context. More...
 
class  Main
 Singleton class representing the main execution environment. More...
 
struct  mib_t
 Represents MIB, but wraps it to provide the necessary operators to use it as an std::map key. More...
 
class  Report
 Provides a mechanism to provide frame wise per core load information. More...
 
class  Sysctls
 Singleton class representing the sysctl table for this library. More...
 
class  SysctlValue
 Instances of this class represents a specific sysctl value. More...
 

Typedefs

using cycles_t = uint64_t
 Clock cycle counting type.
 
template<auto Ownership>
using ofile = io::file< Ownership, io::write >
 Output file type alias. More...
 
template<auto Ownership>
using ifile = io::file< Ownership, io::read >
 Input file type alias. More...
 

Functions

template<size_t Size>
int strcmp (char const *const s1, char const (&s2)[Size])
 Safe wrapper around strncmp, which automatically determines the buffer size of s2. More...
 
std::regex operator""_r (char const *const str, size_t const len)
 User defined literal for regular expressions. More...
 
template<typename ... ArgTs>
constexpr void dprintf (ArgTs &&... args)
 Calls io::ferr.printf(...) if built with -DEBUG. More...
 
template<>
std::string SysctlValue::get< std::string > () const
 Returns a copy of the value string. More...
 
template<typename... MsgTs>
ofile< io::link > debug (MsgTs &&... msg)
 Print a debugging message if built with -DEBUG. More...
 
template<typename... MsgTs>
ofile< io::link > warn (MsgTs &&... msg)
 Print a warning. More...
 
int sys_result (int const result)
 Combine sys_results with a computed result. More...
 
template<typename... MsgTs>
ofile< io::link > fail (MsgTs &&... msg)
 This prints an error message and sets sys_results to make the hijacked process fail. More...
 
ofile< io::link > operator<< (ofile< io::link > fout, CoreFrameReport const &frame)
 Print recorded and running clock frequency and load for a frame. More...
 

Variables

constexpr const flag_t FEATURES
 The set of supported features. More...
 
int sys_results = 0
 The success return value of intercepted functions.
 
class anonymous_namespace{libloadplay.cpp}::Sysctls sysctls
 Sole instance of Sysctls.
 
bool sysctl_startup = true
 Set to activate fallback to the original sysctl functions. More...
 
class anonymous_namespace{libloadplay.cpp}::Main main
 Sole instance of Main.
 

Detailed Description

File local scope.


Class Documentation

◆ anonymous_namespace{libloadplay.cpp}::CoreFrameReport

struct anonymous_namespace{libloadplay.cpp}::CoreFrameReport

The report frame information for a single CPU pipeline.

Collaboration diagram for anonymous_namespace{libloadplay.cpp}::CoreFrameReport:
[legend]
Class Members
CoreReport rec The recorded core state.
CoreReport run The running core state.

◆ anonymous_namespace{libloadplay.cpp}::CoreReport

struct anonymous_namespace{libloadplay.cpp}::CoreReport

The reported state of a single CPU pipeline.

Collaboration diagram for anonymous_namespace{libloadplay.cpp}::CoreReport:
[legend]
Class Members
mhz_t freq The core clock frequency in [MHz].
double load The core load as a fraction.

Typedef Documentation

◆ ifile

template<auto Ownership>
using anonymous_namespace{libloadplay.cpp}::ifile = typedef io::file<Ownership, io::read>

Input file type alias.

Template Parameters
OwnershipThe io::ownership type of the file

◆ ofile

template<auto Ownership>
using anonymous_namespace{libloadplay.cpp}::ofile = typedef io::file<Ownership, io::write>

Output file type alias.

Template Parameters
OwnershipThe io::ownership type of the file

Function Documentation

◆ debug()

template<typename... MsgTs>
ofile<io::link> anonymous_namespace{libloadplay.cpp}::debug ( MsgTs &&...  msg)
inline

Print a debugging message if built with -DEBUG.

Template Parameters
MsgTsThe message argument types
Parameters
msgThe debugging message
Returns
An output file handle for extending the message

◆ dprintf()

template<typename ... ArgTs>
constexpr void anonymous_namespace{libloadplay.cpp}::dprintf ( ArgTs &&...  args)
constexpr

Calls io::ferr.printf(...) if built with -DEBUG.

Template Parameters
ArgTsThe argument types to forward
Parameters
argsArguments are forwarded to fprintf()

◆ fail()

template<typename... MsgTs>
ofile<io::link> anonymous_namespace{libloadplay.cpp}::fail ( MsgTs &&...  msg)
inline

This prints an error message and sets sys_results to make the hijacked process fail.

Template Parameters
MsgTsThe message argument types
Parameters
msgThe error message
Returns
An output file handle for extending the message

◆ operator""_r()

std::regex anonymous_namespace{libloadplay.cpp}::operator""_r ( char const *const  str,
size_t const  len 
)
inline

User defined literal for regular expressions.

Parameters
str,lenThe literal string and its length
Returns
A regular expression

◆ operator<<()

ofile<io::link> anonymous_namespace{libloadplay.cpp}::operator<< ( ofile< io::link >  fout,
CoreFrameReport const &  frame 
)

Print recorded and running clock frequency and load for a frame.

The clock frequency is printed at 1 MHz resolution, the load at 0.1 MHz.

Parameters
foutThe stream to print to
frameThe frame information to print
Returns
A reference to the out stream

◆ strcmp()

template<size_t Size>
int anonymous_namespace{libloadplay.cpp}::strcmp ( char const *const  s1,
char const (&)  s2[Size] 
)
inline

Safe wrapper around strncmp, which automatically determines the buffer size of s2.

Template Parameters
SizeThe size of the buffer s2
Parameters
s1,s2The strings to compare
Return values
0Strings are equal
!0Strings are not equal

◆ sys_result()

int anonymous_namespace{libloadplay.cpp}::sys_result ( int const  result)
inline

Combine sys_results with a computed result.

Parameters
resultA computed result
Return values
sys_resultsIf sys_results is a non-zero value
resultIf sys_results is set to 0

◆ SysctlValue::get< std::string >()

template<>
std::string anonymous_namespace{libloadplay.cpp}::SysctlValue::get< std::string > ( ) const

Returns a copy of the value string.

Returns
The value

◆ warn()

template<typename... MsgTs>
ofile<io::link> anonymous_namespace{libloadplay.cpp}::warn ( MsgTs &&...  msg)
inline

Print a warning.

Template Parameters
MsgTsThe message argument types
Parameters
msgThe warning message
Returns
An output file handle for extending the message

Variable Documentation

◆ FEATURES

constexpr const flag_t anonymous_namespace{libloadplay.cpp}::FEATURES
constexpr
Initial value:
{
1_FREQ_TRACKING
}

The set of supported features.

This value is used to ensure correct input data interpretation.

◆ sysctl_startup

bool anonymous_namespace{libloadplay.cpp}::sysctl_startup = true

Set to activate fallback to the original sysctl functions.

This is reset when Main initialisation completes.