32#error CH_DBG_STATISTICS should be defined to TRUE to use this monitoring tool
61 ti->totalTicks +=
ti->ticks[
idx];
65 ti->totalISRTicks =
ch0.kernel_stats.m_crit_isr.cumulative;
66 ti->totalTicks +=
ti->totalISRTicks;
70 ti->cpu[
idx] = (
ti->ticks[
idx] * 100.f) /
ti->totalTicks;
87 return ti->totalISRTicks * 100.0f /
ti->totalTicks;
108 chprintf(
lchp,
" addr stack frestk prio refs state time \t percent name\r\n");
111 chprintf(
lchp,
"%.8lx %.8lx %6lu %4lu %4lu %9s %9lu %.2f%% \t%s\r\n",
131 chprintf(
lchp,
"Interrupt Service Routine \t\t %9lu %.2f%% \tISR\r\n",
141 chprintf(sh,
"Usage: rtos_mon\r\n");
145 chprintf(sh,
"Data reported in the RTOS_MON message:\r\n");
154 chprintf(sh,
" thread %d load: %0.1f, free stack: %d\r\n", i,
203 sum += (
float)(
tp->stats.cumulative);
215 sum +=
ch0.kernel_stats.m_crit_isr.cumulative;
231 unsigned long long *
stkAdr = (
unsigned long long *)((
uint8_t *)
tp->wabase);
static uint32_t thread_p_time[RTOS_MON_MAX_THREADS]
void rtos_mon_periodic_arch(void)
void rtos_mon_init_arch(void)
static uint16_t get_stack_free(const thread_t *tp)
static struct nodeState states[UWB_SERIAL_COMM_DIST_NUM_NODES]
void chprintf(BaseSequentialStream *lchp, const char *fmt,...)
Mini printf-like functionality.
struct rtos_monitoring rtos_mon
void shell_add_entry(char *cmd_name, shell_cmd_t *cmd)
Add dynamic entry.
BaseSequentialStream shell_stream_t
System monitoring for RTOS targets return cpu load, average exec time, ...
uint8_t cpu_load
global CPU/MCU load in %
char thread_names[RTOS_MON_THREAD_NAMES+1]
string of thread names / identifiers
uint32_t core_free_memory
core free memory in bytes
uint16_t thread_free_stack[RTOS_MON_MAX_THREADS]
individual thread free stack in bytes
uint32_t heap_free_memory
Total fragmented free memory in the heap.
uint16_t thread_load[RTOS_MON_MAX_THREADS]
individual thread load in centi-percent (10*%)
uint8_t thread_name_idx
length of the string in thread_names buffer
uint8_t thread_counter
number of threads
#define RTOS_MON_MAX_THREADS
uint32_t heap_fragments
Number of fragments in the heap.
#define RTOS_MON_NAME_LEN
uint32_t heap_largest
Largest free block in the heap.
Architecture independent timing functions.
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.
int int32_t
Typedef defining 32 bit int type.
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.