Files
perfect/examples/os_perf.cpp
2019-09-20 08:48:26 -05:00

26 lines
586 B
C++

#include "perfect/os_perf.hpp"
#include <map>
int main(void) {
perfect::init();
std::map<int, perfect::OsPerfState> states;
for (auto cpu : perfect::cpus()) {
perfect::OsPerfState state;
perfect::get_os_perf_state(&state, cpu);
states[cpu] = state;
perfect::os_perf_state_maximum(cpu);
}
// do things with all CPUs set to the maximum performancem mode by the OS
for (auto kv : states) {
int cpu = kv.first;
perfect::OsPerfState state = kv.second;
perfect::set_os_perf_state(cpu, state);
}
}