add enable-cpu-turbo, disable-cpu-turbo
This commit is contained in:
@@ -34,8 +34,11 @@ set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} \
|
|||||||
-Wfatal-errors\
|
-Wfatal-errors\
|
||||||
")
|
")
|
||||||
|
|
||||||
add_executable(enable-turbo enable_turbo.cpp)
|
add_executable(enable-cpu-turbo enable_cpu_turbo.cpp)
|
||||||
target_link_libraries(enable-turbo perfect)
|
target_link_libraries(enable-cpu-turbo perfect)
|
||||||
|
|
||||||
|
add_executable(disable-cpu-turbo disable_cpu_turbo.cpp)
|
||||||
|
target_link_libraries(disable-cpu-turbo perfect)
|
||||||
|
|
||||||
add_executable(sync-drop-caches sync_drop_caches.cpp)
|
add_executable(sync-drop-caches sync_drop_caches.cpp)
|
||||||
target_link_libraries(sync-drop-caches perfect)
|
target_link_libraries(sync-drop-caches perfect)
|
||||||
|
23
tools/disable_cpu_turbo.cpp
Normal file
23
tools/disable_cpu_turbo.cpp
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
#include "perfect/cpu_turbo.hpp"
|
||||||
|
|
||||||
|
using namespace perfect;
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
|
||||||
|
CpuTurboState state;
|
||||||
|
|
||||||
|
perfect::init();
|
||||||
|
|
||||||
|
PERFECT(get_cpu_turbo_state(&state));
|
||||||
|
|
||||||
|
if (!is_turbo_enabled(state)) {
|
||||||
|
std::cerr << "cpu turbo already disabled\n";
|
||||||
|
exit(EXIT_SUCCESS);
|
||||||
|
} else {
|
||||||
|
PERFECT(disable_cpu_turbo());
|
||||||
|
std::cerr << "disabled cpu turbo\n";
|
||||||
|
exit(EXIT_SUCCESS);
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user