30 #if !CH_DBG_THREADS_PROFILING
31 #error CH_DBG_THREADS_PROFILING should be defined to TRUE to use this monitoring tool
59 tp = chRegFirstThread();
72 sum += (float)(tp->p_time);
75 if (tp == chSysGetIdleThreadX()) {
79 tp = chRegNextThread(tp);
101 const uint8_t *max_ram_addr = (
uint8_t*) (0x20000000 + (128*1024));
102 const int32_t internal_struct_size = (CH_KERNEL_MAJOR == 2) ? 80 : 120;
103 unsigned long long *stk_addr = (
unsigned long long *) ((
uint8_t *)tp + internal_struct_size);
105 while ((stk_addr[index] == 0x5555555555555555) && (((
uint8_t *) &(stk_addr[index])) < max_ram_addr))
108 const int32_t free_bytes = (index * (
int32_t)
sizeof(
long long)) - internal_struct_size;
110 if (free_bytes < 0) {
113 }
else if (free_bytes > 0xFFFF) {
115 ret = (
uint16_t) (free_bytes / 1024);
static uint16_t get_stack_free(const thread_t *tp)
#define RTOS_MON_NAME_LEN
uint16_t thread_load[RTOS_MON_MAX_THREADS]
individual thread load in centi-percent (10*%)
void rtos_mon_init_arch(void)
static uint32_t last_idle_counter
void rtos_mon_periodic_arch(void)
struct rtos_monitoring rtos_mon
#define RTOS_MON_MAX_THREADS
char thread_names[RTOS_MON_THREAD_NAMES+1]
string of thread names / identifiers
uint8_t thread_name_idx
length of the string in thread_names buffer
static uint32_t idle_counter
uint8_t cpu_load
global CPU/MCU load in %
uint16_t thread_free_stack[RTOS_MON_MAX_THREADS]
individual thread free stack in bytes
uint8_t thread_counter
number of threads
uint32_t core_free_memory
core free memory in bytes
static uint32_t thread_p_time[RTOS_MON_MAX_THREADS]
uint32_t heap_free_memory
heap free memory in bytes
#define CH_CFG_ST_FREQUENCY
System tick frequency.
System monitoring for RTOS targets return cpu load, average exec time, ...