mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-31 10:26:52 +08:00
loadmon: Stub away cpuload() for nuttx protected build
CPU load monitoring needs to be in kernel, and some proper interface to be used in here Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
This commit is contained in:
@@ -137,7 +137,7 @@ void LoadMon::cpuload()
|
|||||||
// compute system load
|
// compute system load
|
||||||
const float interval = total_time_stamp - _last_total_time_stamp;
|
const float interval = total_time_stamp - _last_total_time_stamp;
|
||||||
const float interval_spent_time = spent_time_stamp - _last_spent_time_stamp;
|
const float interval_spent_time = spent_time_stamp - _last_spent_time_stamp;
|
||||||
#elif defined(__PX4_NUTTX)
|
#elif defined(__PX4_NUTTX) && defined(CONFIG_BUILD_FLAT)
|
||||||
|
|
||||||
if (_last_idle_time == 0) {
|
if (_last_idle_time == 0) {
|
||||||
// Just get the time in the first iteration */
|
// Just get the time in the first iteration */
|
||||||
@@ -154,6 +154,12 @@ void LoadMon::cpuload()
|
|||||||
// compute system load
|
// compute system load
|
||||||
const float interval = now - _last_idle_time_sample;
|
const float interval = now - _last_idle_time_sample;
|
||||||
const float interval_idletime = total_runtime - _last_idle_time;
|
const float interval_idletime = total_runtime - _last_idle_time;
|
||||||
|
#elif defined(__PX4_NUTTX)
|
||||||
|
// TODO: NuttX protected & kernel builds
|
||||||
|
const hrt_abstime now = hrt_absolute_time();
|
||||||
|
const hrt_abstime total_runtime = 0.0f;
|
||||||
|
const float interval = 1.0f;
|
||||||
|
const float interval_idletime = 1.0f;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
cpuload_s cpuload{};
|
cpuload_s cpuload{};
|
||||||
@@ -238,7 +244,7 @@ void LoadMon::cpuload()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__PX4_NUTTX)
|
#if defined(__PX4_NUTTX) && defined(CONFIG_BUILD_FLAT)
|
||||||
void LoadMon::stack_usage()
|
void LoadMon::stack_usage()
|
||||||
{
|
{
|
||||||
unsigned stack_free = 0;
|
unsigned stack_free = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user