powerd++
0.4.4
|
Instances of this class represent an emulator session. More...
Classes | |
struct | Core |
Per core information. More... | |
Public Member Functions | |
Emulator (ifile< io::link > fin, ofile< io::link > fout, bool const &die) | |
The constructor initialises all the members necessary for emulation. More... | |
void | operator() () |
Performs load emulation and prints statistics on io::fout. More... | |
Private Attributes | |
ifile< io::link > | fin |
The input data source. | |
ofile< io::link > | fout |
The output data sink. | |
const bool & | die |
A reference to a bool that tells the emulator to die. | |
const size_t | size = sysctls[CP_TIMES].size() |
The size of the kern.cp_times buffer. | |
const int | ncpu = this->size / sizeof(cptime_t[CPUSTATES]) |
The number of CPUs in kern.cp_times, may be greater than the hw.ncpu value (e.g. More... | |
std::unique_ptr< Core[]> | cores {new Core[this->ncpu]{}} |
Simulation state information for each core. | |
SysctlValue & | cp_times = sysctls[CP_TIMES] |
The kern.cp_times sysctl handler. | |
std::unique_ptr< cptime_t[]> | sum {new cptime_t[CPUSTATES * ncpu]{}} |
The current kern.cp_times values. | |
Instances of this class represent an emulator session.
This should be run in its own thread and expects the sysctl table to be complete.
struct anonymous_namespace{libloadplay.cpp}::Emulator::Core |
Per core information.
Class Members | ||
---|---|---|
cycles_t | carryCycles[CPUSTATES] |
The cycles carried over to the next frame in [cycles]. This is determined at the beginning of frame and used to calculated the simulation load at the beginning of the next frame. |
SysctlValue * | freqCtl |
The sysctl handler. The constructor ensures this points to a valid handler. |
mhz_t | recFreq |
The recorded clock frequency. If FREQ_TRACKING is enabled this is updated at during the preliminary stage and used at the beginning of frame stage. |
mhz_t | runFreq |
The clock frequency the simulation is running at. Updated at the end of frame and used in the next frame. |
cycles_t | runLoadCycles |
The load cycles simulated for this frame in [cycles]. This is determined at the beginning of frame and used to calculate the reported load at the end of frame. |
|
inline |
The constructor initialises all the members necessary for emulation.
It also prints the column headers on stdout.
std::out_of_range | In case one of the required sysctls is missing |
fin,fout | The character input and output streams |
die | If the referenced bool is true, emulation is terminated prematurely |
|
inline |
Performs load emulation and prints statistics on io::fout.
Reads fin to pull in load changes and updates the kern.cp_times sysctl to represent the current state.
When it runs out of load changes it terminates emulation and sends a SIGINT to the process.
|
private |
The number of CPUs in kern.cp_times, may be greater than the hw.ncpu value (e.g.
if hyperthreading was turned off).