add warning if scaling governor is not performance mode

master
Francisco Paisana 4 years ago
parent 8d10aa906e
commit 087805d222

@ -424,6 +424,27 @@ static size_t fixup_log_file_maxsize(int x)
return (x < 0) ? 0 : size_t(x) * 1024u;
}
void check_scaling_governor(const all_args_t& args)
{
if (args.rf.device_name == "zmq") {
return;
}
std::ifstream file("/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor");
bool found = false;
if (file.is_open()) {
std::string line;
while (getline(file, line)) {
if (line.find("performance") != std::string::npos) {
found = true;
break;
}
}
}
if (not found) {
cout << "WARNING: cpu scaling governor is not set to performance mode.";
}
}
int main(int argc, char* argv[])
{
srslte_register_signal_handler();
@ -457,6 +478,8 @@ int main(int argc, char* argv[])
srslte::logmap::get("COMMON")->set_level(srslte::LOG_LEVEL_INFO);
log_args(argc, argv, "ENB");
check_scaling_governor(args);
// Create eNB
unique_ptr<srsenb::enb> enb{new srsenb::enb};
if (enb->init(args, &log_wrapper) != SRSLTE_SUCCESS) {

@ -608,6 +608,27 @@ static size_t fixup_log_file_maxsize(int x)
return (x < 0) ? 0 : size_t(x) * 1024u;
}
void check_scaling_governor(const all_args_t& args)
{
if (args.rf.device_name == "zmq") {
return;
}
std::ifstream file("/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor");
bool found = false;
if (file.is_open()) {
std::string line;
while (getline(file, line)) {
if (line.find("performance") != std::string::npos) {
found = true;
break;
}
}
}
if (not found) {
cout << "WARNING: cpu scaling governor is not set to performance mode.";
}
}
int main(int argc, char* argv[])
{
srslte_register_signal_handler();
@ -637,6 +658,8 @@ int main(int argc, char* argv[])
srslte::logmap::set_default_logger(&log_wrapper);
log_args(argc, argv, "UE");
check_scaling_governor(args);
// Create UE instance
srsue::ue ue;
if (ue.init(args, &log_wrapper)) {

Loading…
Cancel
Save