summaryrefslogtreecommitdiffstats
path: root/cpukit/score/include/rtems/score/threadimpl.h
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2013-07-29 17:25:50 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2013-08-01 16:45:44 +0200
commit1e51fa5f4de9f15a99e3cb1fd1787f1861304e7e (patch)
tree2704821edf18abd2392e7e9ceeae4ad196487a20 /cpukit/score/include/rtems/score/threadimpl.h
parenttmtests/tm27: Fixes for RTEMS_DEBUG (diff)
downloadrtems-1e51fa5f4de9f15a99e3cb1fd1787f1861304e7e.tar.bz2
score: Add and use _Thread_Update_cpu_time_used()
Fix _times().
Diffstat (limited to 'cpukit/score/include/rtems/score/threadimpl.h')
-rw-r--r--cpukit/score/include/rtems/score/threadimpl.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/cpukit/score/include/rtems/score/threadimpl.h b/cpukit/score/include/rtems/score/threadimpl.h
index f5a0ff9faa..e818bc8c50 100644
--- a/cpukit/score/include/rtems/score/threadimpl.h
+++ b/cpukit/score/include/rtems/score/threadimpl.h
@@ -23,6 +23,7 @@
#include <rtems/score/isr.h>
#include <rtems/score/objectimpl.h>
#include <rtems/score/statesimpl.h>
+#include <rtems/score/tod.h>
#ifdef __cplusplus
extern "C" {
@@ -651,6 +652,24 @@ RTEMS_INLINE_ROUTINE void _Thread_Signal_notification( Thread_Control *thread )
}
}
+RTEMS_INLINE_ROUTINE void _Thread_Update_cpu_time_used(
+ Thread_Control *executing,
+ Timestamp_Control *time_of_last_context_switch
+)
+{
+ Timestamp_Control uptime;
+ Timestamp_Control ran;
+
+ _TOD_Get_uptime( &uptime );
+ _Timestamp_Subtract(
+ time_of_last_context_switch,
+ &uptime,
+ &ran
+ );
+ *time_of_last_context_switch = uptime;
+ _Timestamp_Add_to( &executing->cpu_time_used, &ran );
+}
+
#if !defined(__DYNAMIC_REENT__)
/**
* This routine returns the C library re-enterant pointer.