PX4 Firmware
PX4 Autopilot Software http://px4.io
load_mon::LoadMon Class Reference
Inheritance diagram for load_mon::LoadMon:
Collaboration diagram for load_mon::LoadMon:

Public Member Functions

 LoadMon ()
 
 ~LoadMon () override
 
int print_status () override
 
void start ()
 

Static Public Member Functions

static int task_spawn (int argc, char *argv[])
 
static int custom_command (int argc, char *argv[])
 
static int print_usage (const char *reason=nullptr)
 

Private Member Functions

void Run () override
 Do a compute and schedule the next cycle. More...
 
void _cpuload ()
 Do a calculation of the CPU load and publish it. More...
 
float _ram_used ()
 Calculate the memory usage. More...
 

Private Attributes

DEFINE_PARAMETERS((ParamBool< px4::params::SYS_STCK_EN >) _param_sys_stck_en) uORB hrt_abstime _last_idle_time {0}
 
hrt_abstime _last_idle_time_sample {0}
 
perf_counter_t _stack_perf
 

Detailed Description

Definition at line 70 of file load_mon.cpp.

Constructor & Destructor Documentation

◆ LoadMon()

load_mon::LoadMon::LoadMon ( )

Definition at line 122 of file load_mon.cpp.

Referenced by task_spawn().

Here is the caller graph for this function:

◆ ~LoadMon()

load_mon::LoadMon::~LoadMon ( )
override

Definition at line 129 of file load_mon.cpp.

References _stack_perf, and perf_free().

Here is the call graph for this function:

Member Function Documentation

◆ _cpuload()

void load_mon::LoadMon::_cpuload ( )
private

Do a calculation of the CPU load and publish it.

Definition at line 178 of file load_mon.cpp.

References _last_idle_time, _last_idle_time_sample, _ram_used(), cpuload, hrt_absolute_time(), hrt_abstime, hrt_elapsed_time(), cpuload_s::load, cpuload_s::ram_usage, system_load, and cpuload_s::timestamp.

Referenced by custom_command(), and Run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _ram_used()

float load_mon::LoadMon::_ram_used ( )
private

Calculate the memory usage.

Definition at line 202 of file load_mon.cpp.

References _stack_perf, CONFIG_MAX_TASKS, FDS_LOW_WARNING_THRESHOLD, hrt_absolute_time(), perf_begin(), perf_end(), task_stack_info_s::stack_free, STACK_LOW_WARNING_THRESHOLD, system_load, task_stack_info_s::task_name, and task_stack_info_s::timestamp.

Referenced by _cpuload(), and custom_command().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ custom_command()

static int load_mon::LoadMon::custom_command ( int  argc,
char *  argv[] 
)
inlinestatic
See also
ModuleBase

Definition at line 79 of file load_mon.cpp.

References _cpuload(), _ram_used(), cpuload, ORB_ID, print_status(), print_usage(), Run(), and start().

Here is the call graph for this function:

◆ print_status()

int load_mon::LoadMon::print_status ( )
override
See also
ModuleBase::print_status()

Definition at line 310 of file load_mon.cpp.

References _stack_perf, and perf_print_counter().

Referenced by custom_command().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ print_usage()

int load_mon::LoadMon::print_usage ( const char *  reason = nullptr)
static
See also
ModuleBase

Definition at line 317 of file load_mon.cpp.

Referenced by custom_command().

Here is the caller graph for this function:

◆ Run()

void load_mon::LoadMon::Run ( )
overrideprivate

Do a compute and schedule the next cycle.

Definition at line 160 of file load_mon.cpp.

References _cpuload().

Referenced by custom_command().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ start()

void load_mon::LoadMon::start ( )

Definition at line 155 of file load_mon.cpp.

Referenced by custom_command(), and task_spawn().

Here is the caller graph for this function:

◆ task_spawn()

int load_mon::LoadMon::task_spawn ( int  argc,
char *  argv[] 
)
static

Definition at line 136 of file load_mon.cpp.

References LoadMon(), and start().

Here is the call graph for this function:

Member Data Documentation

◆ _last_idle_time

DEFINE_PARAMETERS ( (ParamBool<px4::params::SYS_STCK_EN>) _param_sys_stck_en ) uORB hrt_abstime load_mon::LoadMon::_last_idle_time {0}
private

Definition at line 116 of file load_mon.cpp.

Referenced by _cpuload().

◆ _last_idle_time_sample

hrt_abstime load_mon::LoadMon::_last_idle_time_sample {0}
private

Definition at line 117 of file load_mon.cpp.

Referenced by _cpuload().

◆ _stack_perf

perf_counter_t load_mon::LoadMon::_stack_perf
private

Definition at line 119 of file load_mon.cpp.

Referenced by _ram_used(), print_status(), and ~LoadMon().


The documentation for this class was generated from the following file: