µOS++ IIIe Reference  v6.3.15
“Perfekt ist nicht gut genug”
The third edition of µOS++, a POSIX inspired open source system, written in C++.
os::rtos::scheduler::statistics Namespace Reference

Scheduler statistics. More...

Functions

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

Detailed Description

Scheduler statistics.

Function Documentation

◆ context_switches()

rtos::statistics::counter_t os::rtos::scheduler::statistics::context_switches ( void  )
inline

Get the total number of context switches.

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.
Warning
Cannot be invoked from Interrupt Service Routines.

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

◆ cpu_cycles()

rtos::statistics::duration_t os::rtos::scheduler::statistics::cpu_cycles ( void  )
inline

Get the total duration of all threads.

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.
Warning
Cannot be invoked from Interrupt Service Routines.

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