|
powerd++
0.4.4
|
File local scope. More...
Classes | |
| struct | Core |
| Contains the management information for a single CPU core. More... | |
| struct | CoreGroup |
| Contains the management information for a group of cores with a common clock frequency. More... | |
| class | FreqGuard |
| A core frequency guard. More... | |
| struct | Global |
| A collection of all the gloabl, mutable states. More... | |
Enumerations | |
| enum | AcLineState : unsigned int { AcLineState::BATTERY, AcLineState::ONLINE, AcLineState::UNKNOWN, AcLineState::LENGTH } |
| The available AC line states. More... | |
| enum | OE { OE::USAGE, OE::MODE_AC, OE::MODE_BATT, OE::FREQ_MIN, OE::FREQ_MAX, OE::FREQ_MIN_AC, OE::FREQ_MAX_AC, OE::FREQ_MIN_BATT, OE::FREQ_MAX_BATT, OE::FREQ_RANGE, OE::FREQ_RANGE_AC, OE::FREQ_RANGE_BATT, OE::HITEMP_RANGE, OE::MODE_UNKNOWN, OE::TEMP_CTL, OE::IVAL_POLL, OE::FILE_PID, OE::FLAG_VERBOSE, OE::FLAG_FOREGROUND, OE::FLAG_NICE, OE::CNT_SAMPLES, OE::IGNORE, OE::OPT_UNKNOWN, OE::OPT_NOOPT, OE::OPT_DASH, OE::OPT_LDASH, OE::OPT_DONE } |
| An enum for command line parsing. More... | |
Functions | |
| template<typename... MsgTs> | |
| void | verbose (MsgTs &&... msg) |
| Outputs the given printf style message on stderr if g.verbose is set. More... | |
| void | sysctl_fail (sys::sc_error< sys::ctl::error > const err) |
| Treat sysctl errors. More... | |
| void | init () |
| Perform initial tasks. More... | |
| template<bool Load = 1, bool Temperature = 0> | |
| void | update_loads () |
| Updates the cp_times ring buffer and computes the load average for each core. More... | |
| template<> | |
| void | update_loads< 0, 0 > () |
| Do nada if neither load nor temperature are to be updated. | |
| template<bool Foreground, bool Temperature, bool Fixed> | |
| void | update_freq (Global::ACSet const &acstate) |
| Update the CPU clocks depending on the AC line state and targets. More... | |
| void | update_freq () |
| Dispatch update_freq<>(). | |
| void | init_loads () |
| Fill the loads buffers with n samples. More... | |
| void | set_mode (AcLineState const line, char const *const str) |
| Sets a load target or fixed frequency for the given AC line state. More... | |
| void | read_args (int const argc, char const *const argv[]) |
| Parse command line arguments. More... | |
| void | show_settings () |
| Prints the configuration on stderr in verbose mode. | |
| void | signal_recv (int signal) |
| Sets g.signal, terminating the main loop. More... | |
| void | run_daemon () |
| Daemonise and run the main loop. | |
Variables | |
| struct anonymous_namespace{powerd++.cpp}::Global | g |
| The gobal state. | |
| const char *const | USAGE = "[-hvfN] [-abn mode] [-mM freq] [-FAB freq:freq] [-H temp:temp] [-t sysctl] [-p ival] [-s cnt] [-P file]" |
| The short usage string. | |
| const Parameter< OE > | PARAMETERS [] |
| Definitions of command line parameters. More... | |
File local scope.
| struct anonymous_namespace{powerd++.cpp}::Core |
Contains the management information for a single CPU core.
| Class Members | ||
|---|---|---|
| cptime_t | all | Count of all ticks. |
| const cptime_t * | cp_time | A pointer to the kern.cp_times section for this core. |
| CoreGroup * | group | The core that controls the frequency for this core. |
| cptime_t | idle | The idle ticks count. |
| SysctlSync< decikelvin_t > | temp |
The dev.cpu. d.temperature sysctl, if present. |
| struct anonymous_namespace{powerd++.cpp}::CoreGroup |
Contains the management information for a group of cores with a common clock frequency.
| Class Members | ||
|---|---|---|
| coreid_t | corei |
The number of the core owning dev.cpu. d.freq. |
| SysctlSync< mhz_t > | freq |
The sysctl dev.cpu. d.freq. |
| Max< mhz_t > | load |
The maximum load reported by all cores in the group. This is updated by update_loads(). |
| unique_ptr< mhz_t[]> | loads |
A ring buffer of maximum load samples for this core group. Each maximum load sample is weighted with the core frequency at which it was taken. This is updated by update_loads(). |
| mhz_t | loadsum |
The maximum load sum of all controlled cores. This is updated by update_loads(). |
| Min< mhz_t > | max |
The maximum group clock rate. The least of all core maxima in the group. |
| Max< mhz_t > | min |
The minimum group clock rate. The greatest of all core minima in the group. |
| mhz_t | sample_freq |
The dev.cpu. d.freq value for the current load sample. This is updated by update_loads(). |
| Max< decikelvin_t > | temp | The maximum temperature measurement taken in the group. |
| Min< decikelvin_t > | temp_crit | Critical core temperature in dK. |
| Min< decikelvin_t > | temp_high | High core temperature in dK. |
|
strong |
|
strong |
An enum for command line parsing.
| void anonymous_namespace{powerd++.cpp}::init | ( | ) |
Perform initial tasks.
| void anonymous_namespace{powerd++.cpp}::init_loads | ( | ) |
Fill the loads buffers with n samples.
The samples are filled with the target load, this creates a bias to stay at the initial frequency until sufficient real measurements come in to flush these initial samples out.
| void anonymous_namespace{powerd++.cpp}::read_args | ( | int const | argc, |
| char const *const | argv[] | ||
| ) |
Parse command line arguments.
| argc,argv | The command line arguments |
| void anonymous_namespace{powerd++.cpp}::set_mode | ( | AcLineState const | line, |
| char const *const | str | ||
| ) |
Sets a load target or fixed frequency for the given AC line state.
The string must be in the following format:
mode_predefined = "minimum" | "min" | "maximum" | "max" |
"adaptive" | "adp" | "hiadptive" | "hadp";
mode = mode_predefined | load | freq;
Scalar values are treated as loads.
The predefined values have the following meaning:
| Symbol | Meaning |
|---|---|
| minimum | The minimum clock rate (default 0 MHz) |
| min | |
| maximum | The maximum clock rate (default 1000000 MHz) |
| max | |
| adaptive | A target load of 50% |
| adp | |
| hiadptive | A target load of 37.5% |
| hadp |
| line | The power line state to set the mode for |
| str | A mode string |
| void anonymous_namespace{powerd++.cpp}::signal_recv | ( | int | signal | ) |
Sets g.signal, terminating the main loop.
| signal | The signal number received |
|
inline |
Treat sysctl errors.
Fails appropriately for the given error.
| err | The errno value after calling sysctl |
| void anonymous_namespace{powerd++.cpp}::update_freq | ( | Global::ACSet const & | acstate | ) |
Update the CPU clocks depending on the AC line state and targets.
| Foreground | Set for foreground operation (reporting on std::cout) |
| Temperature | Set for temperature based throttling |
| Fixed | Set for fixed frequency mode |
| acstate | The set of acline dependent variables |
| void anonymous_namespace{powerd++.cpp}::update_loads | ( | ) |
Updates the cp_times ring buffer and computes the load average for each core.
| Load | Determines whether CoreGroup::loadsum is updated |
| Temperature | Determines whether CoreGroup::temp is updated |
|
inline |
Outputs the given printf style message on stderr if g.verbose is set.
| MsgTs | The message argument types |
| msg | The message to output |
Definitions of command line parameters.
1.8.17