[PATCH 3/5] score: Move is_executing_on_a_core from cpuusagereport.c to threadimpl.h
Jennifer Averett
jennifer.averett at oarcorp.com
Mon Sep 22 14:00:08 UTC 2014
---
cpukit/score/include/rtems/score/threadimpl.h | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/cpukit/score/include/rtems/score/threadimpl.h b/cpukit/score/include/rtems/score/threadimpl.h
index 9321c01..77126eb 100644
--- a/cpukit/score/include/rtems/score/threadimpl.h
+++ b/cpukit/score/include/rtems/score/threadimpl.h
@@ -467,6 +467,7 @@ RTEMS_INLINE_ROUTINE bool _Thread_Is_executing (
return ( the_thread == _Thread_Executing );
}
+
#if defined(RTEMS_SMP)
/**
* @brief Returns @true in case the thread executes currently on some processor
@@ -483,6 +484,31 @@ RTEMS_INLINE_ROUTINE bool _Thread_Is_executing_on_a_processor(
}
#endif
+RTEMS_INLINE_ROUTINE bool _Thread_is_executing_on_a_core(
+ 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.
--
1.8.1.4
More information about the devel
mailing list