K-FSW ec10f94
Modular flight software on Zephyr, for small satellites
Loading...
Searching...
No Matches
K-FSW resource monitor

Data Structures

struct  kfsw_resmon_status
 

Macros

#define KFSW_RESMON_PARAM_TABLE_ID   36U
 
#define KFSW_RESMON_PARAM_TABLE_NAME   "resmon"
 
#define KFSW_RESMON_NAME_SIZE   20U
 

Enumerations

enum  kfsw_resmon_event { KFSW_EVENT_RESMON_LOW_STACK = 1 }
 

Functions

int kfsw_resmon_start (void)
 
int kfsw_resmon_stop (void)
 
int kfsw_resmon_sample (void)
 
void kfsw_resmon_get_status (struct kfsw_resmon_status *status)
 
int kfsw_resmon_set_alert_percent (uint32_t percent)
 

Variables

const struct kfsw_param_definition_set kfsw_resmon_param_definitions
 

Description

Reports stack use and unused bytes for each thread.

Sampling uses the kernel thread list; threads need no separate registration.

Usage is a percentage of each thread's configured stack size. Check it together with the unused bytes under the intended workload.

MCU targets measure their configured stacks. Native simulation uses host stacks, so its reported values do not measure stack headroom.

Macro Documentation

◆ KFSW_RESMON_NAME_SIZE

#define KFSW_RESMON_NAME_SIZE   20U

#include <resmon.h>

Longest thread name kept, including the terminator.

◆ KFSW_RESMON_PARAM_TABLE_ID

#define KFSW_RESMON_PARAM_TABLE_ID   36U

#include <resmon.h>

Table 36: stack headroom and its counters.

◆ KFSW_RESMON_PARAM_TABLE_NAME

#define KFSW_RESMON_PARAM_TABLE_NAME   "resmon"

#include <resmon.h>

Parameter table name.

Enumeration Documentation

◆ kfsw_resmon_event

#include <resmon.h>

Event IDs of this service.

Enumerator
KFSW_EVENT_RESMON_LOW_STACK 

A thread reached the alert percentage.

Payload: the percentage used, then its unused bytes as a big-endian u32.

Function Documentation

◆ kfsw_resmon_get_status()

void kfsw_resmon_get_status ( struct kfsw_resmon_status *  status)

#include <resmon.h>

Copy the current measurements and counters.

◆ kfsw_resmon_sample()

int kfsw_resmon_sample ( void  )

#include <resmon.h>

Sweep once, whether or not the periodic sweep is running.

Returns
Threads read, or a negative errno.

◆ kfsw_resmon_set_alert_percent()

int kfsw_resmon_set_alert_percent ( uint32_t  percent)

#include <resmon.h>

Set the stack use that raises an event, as a percentage.

Return values
0Applied.
-ERANGEZero or above 100.

◆ kfsw_resmon_start()

int kfsw_resmon_start ( void  )

#include <resmon.h>

Start sweeping on the configured period.

◆ kfsw_resmon_stop()

int kfsw_resmon_stop ( void  )

#include <resmon.h>

Stop sweeping.

The recorded numbers stay readable.

Variable Documentation

◆ kfsw_resmon_param_definitions

const struct kfsw_param_definition_set kfsw_resmon_param_definitions
extern

#include <resmon.h>

Parameter table 36.