[rtems commit] cpuuse: Move is_executing_on_a_core to threadimpl.h

Jennifer Averett jennifer at rtems.org
Tue Oct 28 15:17:52 UTC 2014


Module:    rtems
Branch:    master
Commit:    7c797a1d7ef44822ae3af2c36698f00c6187155e
Changeset: http://git.rtems.org/rtems/commit/?id=7c797a1d7ef44822ae3af2c36698f00c6187155e

Author:    Jennifer Averett <jennifer.averett at oarcorp.com>
Date:      Fri Sep 19 14:05:49 2014 -0500

cpuuse: Move is_executing_on_a_core to threadimpl.h

---

 cpukit/libmisc/cpuuse/cpuusagereport.c |   25 +------------------------
 1 files changed, 1 insertions(+), 24 deletions(-)

diff --git a/cpukit/libmisc/cpuuse/cpuusagereport.c b/cpukit/libmisc/cpuuse/cpuusagereport.c
index 296fa28..5cba819 100644
--- a/cpukit/libmisc/cpuuse/cpuusagereport.c
+++ b/cpukit/libmisc/cpuuse/cpuusagereport.c
@@ -30,29 +30,6 @@
 #include <rtems/score/todimpl.h>
 #include <rtems/score/watchdogimpl.h>
 
-#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
-  static bool is_executing_on_a_core(
-    Thread_Control    *the_thread,
-    Timestamp_Control *time_of_context_switch
-  )
-  {
-    #ifndef RTEMS_SMP
-      if ( _Thread_Executing->Object.id == the_thread->Object.id ) {
-        *time_of_context_switch = _Thread_Time_of_last_context_switch;
-        return true;
-      }
-    #else
-      /* FIXME: Locking */
-      if ( _Thread_Is_executing_on_a_processor( the_thread ) ) {
-        *time_of_context_switch =
-          _Thread_Get_CPU( the_thread )->time_of_last_context_switch;
-        return true;
-      }
-    #endif
-    return false;
-  }
-#endif
-
 /*
  *  rtems_cpu_usage_report
  */
@@ -149,7 +126,7 @@ void rtems_cpu_usage_report_with_plugin(
            * since the last context switch.
            */
           ran = the_thread->cpu_time_used;
-          if ( is_executing_on_a_core( the_thread, &last ) ) {
+          if ( _Thread_Get_time_of_last_context_switch( the_thread, &last ) ) {
             Timestamp_Control used;
             _TOD_Get_uptime( &uptime );
             _Timestamp_Subtract( &last, &uptime, &used );



More information about the vc mailing list