Skip to content
Snippets Groups Projects
Commit 64778b95 authored by Andreas Antener's avatar Andreas Antener Committed by Lorenz Meier
Browse files

Load monitor: added parameter to disable stack check

parent 72f52c92
No related branches found
No related tags found
No related merge requests found
......@@ -118,6 +118,7 @@ private:
orb_advert_t _cpuload_pub;
hrt_abstime _last_idle_time;
perf_counter_t _stack_perf;
bool _stack_check_enabled;
};
LoadMon::LoadMon() :
......@@ -132,8 +133,17 @@ LoadMon::LoadMon() :
_cpuload{},
_cpuload_pub(nullptr),
_last_idle_time(0),
_stack_perf(perf_alloc(PC_ELAPSED, "stack_check"))
{}
_stack_perf(perf_alloc(PC_ELAPSED, "stack_check")),
_stack_check_enabled(false)
{
/* Parameter for stack checking */
param_t _param_stack_check = param_find("SYS_STCK_EN");
int ret_val = 0;
param_get(_param_stack_check, &ret_val);
_stack_check_enabled = ret_val > 0;
PX4_INFO("stack check enabled: %s", _stack_check_enabled ? "yes" : "no");
}
LoadMon::~LoadMon()
{
......@@ -190,7 +200,11 @@ void LoadMon::_compute()
_cpuload.ram_usage = _ram_used();
#ifdef __PX4_NUTTX
_stack_usage();
if (_stack_check_enabled) {
_stack_usage();
}
#endif
if (_cpuload_pub == nullptr) {
......
......@@ -153,3 +153,11 @@ PARAM_DEFINE_INT32(SYS_PARAM_VER, 1);
* @group System
*/
PARAM_DEFINE_INT32(SYS_LOGGER, 0);
/**
* Enable stack checking
*
* @min 0
* @group System
*/
PARAM_DEFINE_INT32(SYS_STCK_EN, 0);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment