summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJennifer Averett <jennifer.averett@oarcorp.com>2014-09-19 14:04:49 -0500
committerJennifer Averett <jennifer.averett@oarcorp.com>2014-10-27 13:24:35 -0500
commitf9b19d9f838d7ef0b99e06149e58cbec1d775711 (patch)
tree92b3496235f05adf690ab76ea9c195ed14368bf1
parent134a1811c1c3c2a06fba6faf4487adee7b414560 (diff)
downloadrtems-f9b19d9f838d7ef0b99e06149e58cbec1d775711.tar.bz2
score: Move is_executing_on_a_core from cpuusagereport.c to threadimpl.h
-rw-r--r--cpukit/score/include/rtems/score/threadimpl.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/cpukit/score/include/rtems/score/threadimpl.h b/cpukit/score/include/rtems/score/threadimpl.h
index 61b498a9cf..bfaf1fdf67 100644
--- a/cpukit/score/include/rtems/score/threadimpl.h
+++ b/cpukit/score/include/rtems/score/threadimpl.h
@@ -494,6 +494,36 @@ RTEMS_INLINE_ROUTINE bool _Thread_Is_executing_on_a_processor(
#endif
/**
+ * @brief Returns @true and sets time_of_context_switch to the the
+ * time of the last context switch when the thread is currently executing
+ * in the system, otherwise @a false.
+ */
+RTEMS_INLINE_ROUTINE bool _Thread_Get_time_of_last_context_switch(
+ Thread_Control *the_thread,
+ Timestamp_Control *time_of_context_switch
+)
+{
+ bool retval = false;
+
+ _Thread_Disable_dispatch();
+ #ifndef RTEMS_SMP
+ if ( _Thread_Executing->Object.id == the_thread->Object.id ) {
+ *time_of_context_switch = _Thread_Time_of_last_context_switch;
+ retval = true;
+ }
+ #else
+ if ( _Thread_Is_executing_on_a_processor( the_thread ) ) {
+ *time_of_context_switch =
+ _Thread_Get_CPU( the_thread )->time_of_last_context_switch;
+ retval = true;
+ }
+ #endif
+ _Thread_Enable_dispatch();
+ return retval;
+}
+
+
+/**
* This function returns true if the_thread is the heir
* thread, and false otherwise.
*/