Browse Source

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.
sbg
Julian Oes 9 years ago committed by Lorenz Meier
parent
commit
544ea72d4c
  1. 17
      src/platforms/posix/main.cpp

17
src/platforms/posix/main.cpp

@ -162,6 +162,21 @@ bool px4_exit_requested(void) @@ -162,6 +162,21 @@ bool px4_exit_requested(void)
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)
{
bool daemon_mode = false;
@ -184,6 +199,8 @@ int main(int argc, char **argv) @@ -184,6 +199,8 @@ int main(int argc, char **argv)
//sigaction(SIGTERM, &sig_int, NULL);
sigaction(SIGFPE, &sig_fpe, NULL);
set_cpu_scaling();
int index = 1;
char *commands_file = nullptr;

Loading…
Cancel
Save