Snapdragon: set CPUs scaling to performance mode

Sdlog2 misses least updates when the CPU scaling governor is set at
maximum performance. This is not optimal to save power but the best
effort until there is a RT patched kernel on Snapdragon.
This commit is contained in:
Julian Oes
2016-07-07 13:46:12 +02:00
committed by Lorenz Meier
parent 03dbcf5464
commit 544ea72d4c
+17
View File
@@ -162,6 +162,21 @@ bool px4_exit_requested(void)
return _ExitFlag; return _ExitFlag;
} }
static void set_cpu_scaling()
{
#ifdef __PX4_POSIX_EAGLE
// On Snapdragon we miss updates in sdlog2 unless all 4 CPUs are run
// at the maximum frequency all the time.
// Interestingely, cpu0 and cpu3 set the scaling for all 4 CPUs on Snapdragon.
system("echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor");
system("echo performance > /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor");
// Alternatively we could also raise the minimum frequency to save some power,
// unfortunately this still lead to some drops.
//system("echo 1190400 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq");
#endif
}
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
bool daemon_mode = false; bool daemon_mode = false;
@@ -184,6 +199,8 @@ int main(int argc, char **argv)
//sigaction(SIGTERM, &sig_int, NULL); //sigaction(SIGTERM, &sig_int, NULL);
sigaction(SIGFPE, &sig_fpe, NULL); sigaction(SIGFPE, &sig_fpe, NULL);
set_cpu_scaling();
int index = 1; int index = 1;
char *commands_file = nullptr; char *commands_file = nullptr;