mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-22 04:13:39 +08:00
[rtos/sys mon] Add cpu_time field
This commit is contained in:
@@ -46,12 +46,16 @@ void rtos_mon_periodic(void)
|
||||
// update struct
|
||||
rtos_mon_periodic_arch();
|
||||
|
||||
// update cpu time
|
||||
rtos_mon.cpu_time = get_sys_time_float();
|
||||
|
||||
// send report
|
||||
DOWNLINK_SEND_RTOS_MON(DefaultChannel, DefaultDevice,
|
||||
&rtos_mon.thread_counter,
|
||||
&rtos_mon.cpu_load,
|
||||
&rtos_mon.core_free_memory,
|
||||
&rtos_mon.heap_free_memory);
|
||||
&rtos_mon.heap_free_memory,
|
||||
&rtos_mon.cpu_time);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -49,6 +49,7 @@ struct rtos_monitoring {
|
||||
uint16_t thread_free_stack[RTOS_MON_MAX_THREADS]; ///< individual thread free stack in bytes
|
||||
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
|
||||
float cpu_time; // in secs since startup
|
||||
};
|
||||
|
||||
extern struct rtos_monitoring rtos_mon;
|
||||
|
||||
@@ -48,6 +48,7 @@ void init_sysmon(void)
|
||||
sys_mon.periodic_cycle_min = 0xFFFF;
|
||||
sys_mon.periodic_cycle_max = 0;
|
||||
sys_mon.event_number = 0;
|
||||
sys_mon.cpu_time = 0;
|
||||
|
||||
n_periodic = 0;
|
||||
n_event = 0;
|
||||
@@ -71,12 +72,13 @@ void periodic_report_sysmon(void)
|
||||
sys_mon.periodic_cycle = sum_cycle_periodic / n_periodic;
|
||||
sys_mon.cpu_load = 100 * sys_mon.periodic_cycle / sys_mon.periodic_time;
|
||||
sys_mon.event_number = sum_n_event / n_periodic;
|
||||
sys_mon.cpu_time = get_sys_time_float();
|
||||
|
||||
DOWNLINK_SEND_SYS_MON(DefaultChannel, DefaultDevice, &sys_mon.periodic_time,
|
||||
&sys_mon.periodic_time_min, &sys_mon.periodic_time_max,
|
||||
&sys_mon.periodic_cycle, &sys_mon.periodic_cycle_min,
|
||||
&sys_mon.periodic_cycle_max, &sys_mon.event_number,
|
||||
&sys_mon.cpu_load);
|
||||
&sys_mon.cpu_load, &sys_mon.cpu_time);
|
||||
}
|
||||
|
||||
n_periodic = 0;
|
||||
|
||||
@@ -40,6 +40,7 @@ struct SysMon {
|
||||
uint16_t periodic_cycle_min; ///< in usec
|
||||
uint16_t periodic_cycle_max; ///< in usec
|
||||
uint16_t event_number;
|
||||
float cpu_time; // in secs since startup
|
||||
};
|
||||
|
||||
extern struct SysMon sys_mon;
|
||||
|
||||
+1
-1
Submodule sw/ext/pprzlink updated: d562413997...a3663ad2d3
Reference in New Issue
Block a user