|
|
@ -29,6 +29,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
#include "srslte/common/logmap.h"
|
|
|
|
#include "srslte/common/logmap.h"
|
|
|
|
#include <fstream>
|
|
|
|
#include <fstream>
|
|
|
|
|
|
|
|
#include <thread>
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
extern "C" {
|
|
|
@ -52,20 +53,25 @@ inline void check_scaling_governor(const std::string& device_name)
|
|
|
|
if (device_name == "zmq") {
|
|
|
|
if (device_name == "zmq") {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
std::ifstream file("/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor");
|
|
|
|
int nof_cpus = std::thread::hardware_concurrency();
|
|
|
|
bool found = false;
|
|
|
|
for (int cpu = 0; cpu < nof_cpus; ++cpu) {
|
|
|
|
|
|
|
|
char buffer[128];
|
|
|
|
|
|
|
|
snprintf(buffer, sizeof(buffer), "/sys/devices/system/cpu/cpu%d/cpufreq/scaling_governor", cpu);
|
|
|
|
|
|
|
|
std::ifstream file(buffer);
|
|
|
|
if (file.is_open()) {
|
|
|
|
if (file.is_open()) {
|
|
|
|
std::string line;
|
|
|
|
std::stringstream ss;
|
|
|
|
while (getline(file, line)) {
|
|
|
|
ss << file.rdbuf();
|
|
|
|
if (line.find("performance") != std::string::npos) {
|
|
|
|
if (ss.str().find("performance") == std::string::npos) {
|
|
|
|
found = true;
|
|
|
|
printf(
|
|
|
|
|
|
|
|
"WARNING: cpu%d scaling governor is not set to performance mode. Realtime processing could be compromised. "
|
|
|
|
|
|
|
|
"Consider setting it to performance mode before running the application.\n",
|
|
|
|
|
|
|
|
cpu);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
printf("WARNING: Could not verify cpu%d scaling governor\n", cpu);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (not found) {
|
|
|
|
|
|
|
|
printf("WARNING: cpu scaling governor is not set to performance mode.\n");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
#ifdef __cplusplus
|
|
|
|