µ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::thread::statistics Class Reference

Thread statistics. More...

#include <cmsis-plus/rtos/os.h>

Public Member Functions

Constructors & Destructor
 statistics ()=default
 Construct a thread attributes object instance.
 
 ~statistics ()=default
 Destruct the thread attributes object instance.
 
Public Member Functions
rtos::statistics::counter_t context_switches (void)
 Get the number of thread context switches.
 
rtos::statistics::duration_t cpu_cycles (void)
 Get the thread execution time.
 
void clear (void)
 Clear the thread statistic counters.
 

Detailed Description

Definition at line 893 of file os-thread.h.

Constructor & Destructor Documentation

◆ statistics()

os::rtos::thread::statistics::statistics ( )
default
Parameters
None.

◆ ~statistics()

os::rtos::thread::statistics::~statistics ( )
default

Member Function Documentation

◆ clear()

void os::rtos::thread::statistics::clear ( void  )
inline
Parameters
None.
Returns
Nothing.

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 2322 of file os-thread.h.

2323 {
2324#if defined(OS_INCLUDE_RTOS_STATISTICS_THREAD_CONTEXT_SWITCHES)
2325 context_switches_ = 0;
2326#endif /* defined(OS_INCLUDE_RTOS_STATISTICS_THREAD_CONTEXT_SWITCHES) */
2327
2328#if defined(OS_INCLUDE_RTOS_STATISTICS_THREAD_CPU_CYCLES)
2329 cpu_cycles_ = 0;
2330#endif /* defined(OS_INCLUDE_RTOS_STATISTICS_THREAD_CPU_CYCLES) */
2331 }

◆ context_switches()

statistics::counter_t os::rtos::thread::statistics::context_switches ( void  )
inline
Parameters
None.
Returns
A long integer with the number of times the thread was scheduled for execution.

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 scheduler 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 2278 of file os-thread.h.

2279 {
2280 return context_switches_;
2281 }

◆ cpu_cycles()

rtos::statistics::duration_t os::rtos::thread::statistics::cpu_cycles ( void  )
inline
Parameters
None.
Returns
A long integer with accumulated number of CPU cycles.

This value can be used together with the corresponding scheduler 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 2299 of file os-thread.h.

2300 {
2301 return cpu_cycles_;
2302 }

The documentation for this class was generated from the following file: