diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-10-12 08:26:39 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-10-12 13:52:25 +0200 |
commit | 65080360bb01bf61aa84160f3912a9913dd97dc7 (patch) | |
tree | 2ff441675e39a73eccd8a1612cc48e5dae8b9c6b /cpukit/include/rtems/score/threadimpl.h | |
parent | edb956a0a125d282b9960e0a4f519d18984281c7 (diff) |
rtems: Fix rate monotonic statistics
The rate monotonic period statistics were affected by
rtems_cpu_usage_reset(). The logic to detect and work around a CPU
usage reset was broken.
The Thread_Contol::cpu_time_used is changed to contain the processor
time used throughout the entire lifetime of the thread. The new member
Thread_Contol::cpu_time_used_at_last_reset is added to contain the
processor time used at the time of the last reset through
rtems_cpu_usage_reset(). This decouples the resets of the CPU usage and
the rate monotonic period statistics.
Update #4528.
Diffstat (limited to 'cpukit/include/rtems/score/threadimpl.h')
-rw-r--r-- | cpukit/include/rtems/score/threadimpl.h | 40 |
1 files changed, 33 insertions, 7 deletions
diff --git a/cpukit/include/rtems/score/threadimpl.h b/cpukit/include/rtems/score/threadimpl.h index 8bf885c3b0..d467f12f97 100644 --- a/cpukit/include/rtems/score/threadimpl.h +++ b/cpukit/include/rtems/score/threadimpl.h @@ -1242,15 +1242,41 @@ RTEMS_INLINE_ROUTINE void _Thread_Dispatch_update_heir( #endif /** - * @brief Gets the used cpu time of the thread and stores it in the given - * Timestamp_Control. + * @brief Gets the used processor time of the thread throughout its entire + * lifetime. * - * @param the_thread The thread to get the used cpu time of. - * @param[out] cpu_time_used Stores the used cpu time of @a the_thread. + * @param[in, out] the_thread is the thread. + * + * @return Returns the used processor time of the thread throughout its entire + * lifetime. */ -void _Thread_Get_CPU_time_used( - Thread_Control *the_thread, - Timestamp_Control *cpu_time_used +Timestamp_Control _Thread_Get_CPU_time_used( Thread_Control *the_thread ); + +/** + * @brief Gets the used processor time of the thread throughout its entire + * lifetime if the caller already acquired the thread state and home + * scheduler locks. + * + * @param[in, out] the_thread is the thread. + * + * @return Returns the used processor time of the thread throughout its entire + * lifetime. + */ +Timestamp_Control _Thread_Get_CPU_time_used_locked( + Thread_Control *the_thread +); + +/** + * @brief Gets the used processor time of the thread after the last CPU usage + * reset. + * + * @param[in, out] the_thread is the thread. + * + * @return Returns the used processor time of the thread after the last CPU usage + * reset. + */ +Timestamp_Control _Thread_Get_CPU_time_used_after_last_reset( + Thread_Control *the_thread ); /** |