µOS++ IIIe Reference 7.0.0
The third edition of µOS++, a POSIX inspired open source framework, written in C++
Loading...
Searching...
No Matches
os::rtos::scheduler::statistics Namespace Reference

Scheduler statistics.

Functions

void clear (void)
 
rtos::statistics::counter_t context_switches (void)
 Get the total number of context switches.
 
rtos::statistics::duration_t cpu_cycles (void)
 Get the total duration of all threads.
 

Function Documentation

◆ clear()

void os::rtos::scheduler::statistics::clear ( void  )
inline

This function sets all statistic counters to zero.

Note
This function is available only when OS_INCLUDE_RTOS_STATISTICS_THREAD_CPU_CYCLES or OS_INCLUDE_RTOS_STATISTICS_THREAD_CONTEXT_SWITCHES is/are defined.
Can be invoked from Interrupt Service Routines.

Definition at line 1075 of file os-sched.h.

1076 {
1077#if defined(OS_INCLUDE_RTOS_STATISTICS_THREAD_CONTEXT_SWITCHES)
1078 context_switches_ = 0;
1079#endif /* defined(OS_INCLUDE_RTOS_STATISTICS_THREAD_CONTEXT_SWITCHES) */
1080
1081#if defined(OS_INCLUDE_RTOS_STATISTICS_THREAD_CPU_CYCLES)
1082 cpu_cycles_ = 0;
1083#endif /* defined(OS_INCLUDE_RTOS_STATISTICS_THREAD_CPU_CYCLES) */
1084 }

◆ context_switches()

rtos::statistics::counter_t os::rtos::scheduler::statistics::context_switches ( void  )
inline
Returns
Integer with the total number of context switches since scheduler start.

Each time the scheduler performs a context switch, it increments the thread counter and the scheduler total counter.

This value can be used together with the corresponding thread function, to compute percentages.

Note
This function is available only when OS_INCLUDE_RTOS_STATISTICS_THREAD_CONTEXT_SWITCHES is defined.
Can be invoked from Interrupt Service Routines.

Definition at line 1027 of file os-sched.h.

1028 {
1029 return context_switches_;
1030 }

Referenced by os_sched_stat_get_context_switches().

◆ cpu_cycles()

rtos::statistics::duration_t os::rtos::scheduler::statistics::cpu_cycles ( void  )
inline
Returns
Integer with the number of CPU cycles, possibly divided by some prescaller.

For Cortex-M ports, this value is usually derived from the clock that drives the SysTick, which most of the times is the system clock.

This value can be used together with the corresponding thread function, to compute percentages.

Note
This function is available only when OS_INCLUDE_RTOS_STATISTICS_THREAD_CPU_CYCLES is defined.
Can be invoked from Interrupt Service Routines.

Definition at line 1052 of file os-sched.h.

1053 {
1054 return cpu_cycles_;
1055 }

Referenced by os_sched_stat_get_cpu_cycles().