avr-fw-modules/core/src/thread_stat.c

34 lines
721 B
C

#include <sys/threads.h>
#include <sys/systick.h>
#if defined(DEBUG_SCHEDULING)
int32_t _ts_timer_resolution;
int32_t _ts_timer_cycles_per_increment;
int32_t _ts_timer_last_counter_value;
int32_t _ts_timer_increments_per_second;
sched_time_t
_ts_sys_time,
_ts_irq_time;
void thread_stat_schedule(sched_time_t *sched_time){
if (!sched_time)
return;
sched_time->cycles -= (int32_t)st_current_counter();
};
void thread_stat_unschedule(sched_time_t *sched_time){
if (!sched_time)
return;
sched_time->cycles += (int32_t)st_current_counter();
if ( sched_time->cycles > _ts_timer_increments_per_second ){
sched_time->seconds++;
sched_time->cycles -= _ts_timer_increments_per_second;
};
};
#endif