[rtems commit] smp: Use Thread_Control.is_executing

Sebastian Huber sebh at rtems.org
Tue Jul 30 07:48:50 UTC 2013


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Fri Jul 26 14:04:22 2013 +0200

smp: Use Thread_Control.is_executing

FIXME: This area needs proper locking.

---

 cpukit/libmisc/cpuuse/cpuusagereport.c |   11 ++++-------
 1 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/cpukit/libmisc/cpuuse/cpuusagereport.c b/cpukit/libmisc/cpuuse/cpuusagereport.c
index 14945d7..fcf7d26 100644
--- a/cpukit/libmisc/cpuuse/cpuusagereport.c
+++ b/cpukit/libmisc/cpuuse/cpuusagereport.c
@@ -41,13 +41,10 @@
         return true;
       }
     #else
-      int  cpu;
-      for ( cpu=0 ; cpu < rtems_smp_get_processor_count() ; cpu++ ) {
-        Per_CPU_Control *p = &_Per_CPU_Information[cpu];
-        if ( p->executing->Object.id == the_thread->Object.id ) {
-          *time_of_context_switch = p->time_of_last_context_switch;
-          return true;
-        }
+      /* FIXME: Locking */
+      if ( the_thread->is_executing ) {
+        *time_of_context_switch = the_thread->cpu->time_of_last_context_switch;
+        return true;
       }
     #endif
     return false;




More information about the vc mailing list