Files
perfect/examples/os_perf.cpp
Carl Pearson 91e15ee7ea
Some checks failed
CI / build_cuda10-1 (push) Failing after 2s
CI / build (push) Failing after 3s
Squashed commit of the following:
commit 25e7cb77683736a588acb6b30a8ac89e2bd7f56a
Author: Carl Pearson <pearson@illinois.edu>
Date:   Fri Sep 20 13:25:49 2019 -0500

    automatically define PERFECT_HAS_CUDA with nvcc

commit fcc699c165ba515619781aefb378d3c0c4d1093d
Author: Carl Pearson <pearson@illinois.edu>
Date:   Fri Sep 20 13:18:42 2019 -0500

    optional CUDA support
2019-09-20 13:26:08 -05:00

27 lines
629 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::Result result;
result = perfect::get_os_perf_state(&state, cpu);
if (perfect::Result::SUCCESS == result) {
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);
}
}