30 #if !CH_DBG_THREADS_PROFILING
31 #error CH_DBG_THREADS_PROFILING should be defined to TRUE to use this monitoring tool
49 size_t total_fragments, total_fragmented_free_space, largest_free_block;
50 total_fragments = chHeapStatus(NULL, &total_fragmented_free_space, &largest_free_block);
63 tp = chRegFirstThread();
76 sum += (float)(tp->time);
79 if (tp == chSysGetIdleThreadX()) {
83 tp = chRegNextThread(tp);
105 const uint8_t *max_ram_addr = (
uint8_t*) (0x20000000 + (128*1024));
106 const int32_t internal_struct_size = (CH_KERNEL_MAJOR == 2) ? 80 : 120;
107 unsigned long long *stk_addr = (
unsigned long long *) ((
uint8_t *)tp + internal_struct_size);
109 while ((stk_addr[index] == 0x5555555555555555) && (((
uint8_t *) &(stk_addr[index])) < max_ram_addr))
112 const int32_t free_bytes = (index * (
int32_t)
sizeof(
long long)) - internal_struct_size;
114 if (free_bytes < 0) {
117 }
else if (free_bytes > 0xFFFF) {
119 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
uint32_t heap_largest
Largest free block in the heap.
static uint32_t thread_p_time[RTOS_MON_MAX_THREADS]
uint32_t heap_free_memory
Total fragmented free memory in the heap.
uint32_t heap_fragments
Number of fragments in the heap.
#define CH_CFG_ST_FREQUENCY
System tick frequency.
System monitoring for RTOS targets return cpu load, average exec time, ...