Common logger for basic CPU and FreeRTOS task profiling data.
More...
#include "diagnostics.h"
#include <string.h>
#include "rtos/rtos.h"
Common logger for basic CPU and FreeRTOS task profiling data.
- Author
- Patrick McNaughton (pmcna.nosp@m.ugh@.nosp@m.purdu.nosp@m.e.ed.nosp@m.u)
◆ begin_snapshot()
| static void begin_snapshot |
( |
UBaseType_t | count | ) |
|
|
static |
◆ calculate_task_utilization()
| static void calculate_task_utilization |
( |
TaskStatus_t * | raw_task, |
|
|
diagnostics_task_t * | task, |
|
|
uint32_t | total_delta ) |
|
static |
◆ calculate_utilization()
| static bool calculate_utilization |
( |
uint32_t | current_runtime, |
|
|
uint32_t | previous_runtime, |
|
|
uint32_t | total_delta, |
|
|
float * | cpu_usage ) |
|
static |
◆ diagnostics_periodic()
Periodically samples task statistics and transmits diagnostics over CAN.
Samples all tasks once per second (every 20 ticks at 50 ms) Sends at most one task (status + name character) per tick and one board summary per cycle.
- Parameters
-
| can_fns | CAN send callbacks |
◆ encode_cpu_percent()
| static uint8_t encode_cpu_percent |
( |
float | percent, |
|
|
bool | valid ) |
|
static |
◆ encode_stack_hwm()
| static uint16_t encode_stack_hwm |
( |
uint32_t | bytes | ) |
|
|
static |
◆ encode_task_state()
| static diagnostics_task_state_t encode_task_state |
( |
eTaskState | state | ) |
|
|
static |
◆ sample_diagnostics()
| static void sample_diagnostics |
( |
void | | ) |
|
|
static |
◆ save_task_runtimes()
| static void save_task_runtimes |
( |
UBaseType_t | task_count | ) |
|
|
static |
◆ send_summary_diagnostics()
◆ send_task_diagnostics()
◆ DIAGNOSTICS_CPU_INVALID
| uint8_t DIAGNOSTICS_CPU_INVALID = UINT8_MAX |
|
staticconstexpr |
◆ DIAGNOSTICS_SAMPLE_PERIOD_MS
| uint32_t DIAGNOSTICS_SAMPLE_PERIOD_MS = 1000 |
|
staticconstexpr |
◆ DIAGNOSTICS_TICKS_PER_SAMPLE
| uint8_t DIAGNOSTICS_TICKS_PER_SAMPLE |
|
staticconstexpr |
Initial value:=
static constexpr uint32_t DIAGNOSTICS_SAMPLE_PERIOD_MS
Definition diagnostics.c:13
#define DIAGNOSTICS_TICK_PERIOD_MS
Definition diagnostics.h:19
◆ g_diagnostics_context