[rtems commit] score: Delete Thread_CPU_usage_t

Sebastian Huber sebh at rtems.org
Tue Mar 1 06:42:06 UTC 2016


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Tue Mar  1 06:36:16 2016 +0100

score: Delete Thread_CPU_usage_t

This type is superfluous since all operations with it are done via the
_Timestamp_*() functions.

---

 cpukit/libmisc/cpuuse/cpuusagetop.c            | 14 +++++++-------
 cpukit/rtems/include/rtems/rtems/ratemon.h     |  8 ++++----
 cpukit/rtems/include/rtems/rtems/ratemonimpl.h |  2 +-
 cpukit/rtems/src/ratemongetstatus.c            |  2 +-
 cpukit/rtems/src/ratemonperiod.c               |  8 ++++----
 cpukit/score/include/rtems/score/thread.h      | 11 ++---------
 6 files changed, 19 insertions(+), 26 deletions(-)

diff --git a/cpukit/libmisc/cpuuse/cpuusagetop.c b/cpukit/libmisc/cpuuse/cpuusagetop.c
index 811a8bf..6355e4e 100644
--- a/cpukit/libmisc/cpuuse/cpuusagetop.c
+++ b/cpukit/libmisc/cpuuse/cpuusagetop.c
@@ -62,7 +62,7 @@ typedef struct
   volatile uint32_t      poll_rate_usecs;
   volatile uint32_t      show;
   rtems_cpu_usage_plugin plugin;
-  Thread_CPU_usage_t     zero;
+  Timestamp_Control      zero;
   Timestamp_Control      uptime;
   Timestamp_Control      last_uptime;
   Timestamp_Control      period;
@@ -71,9 +71,9 @@ typedef struct
   int                    task_size;         /* The size of the arrays */
   Thread_Control**       tasks;             /* List of tasks in this sample. */
   Thread_Control**       last_tasks;        /* List of tasks in the last sample. */
-  Thread_CPU_usage_t*    usage;             /* Usage of task's in this sample. */
-  Thread_CPU_usage_t*    last_usage;        /* Usage of task's in the last sample. */
-  Thread_CPU_usage_t*    current_usage;     /* Current usage for this sample. */
+  Timestamp_Control*     usage;             /* Usage of task's in this sample. */
+  Timestamp_Control*     last_usage;        /* Usage of task's in the last sample. */
+  Timestamp_Control*     current_usage;     /* Current usage for this sample. */
   Timestamp_Control      total;             /* Total run run, should equal the uptime. */
   Timestamp_Control      idle;              /* Time spent in idle. */
   Timestamp_Control      current;           /* Current time run in this period. */
@@ -218,8 +218,8 @@ static void
 task_usage(Thread_Control* thread, void* arg)
 {
   rtems_cpu_usage_data* data = (rtems_cpu_usage_data*) arg;
-  Thread_CPU_usage_t    usage = thread->cpu_time_used;
-  Thread_CPU_usage_t    current = data->zero;
+  Timestamp_Control     usage = thread->cpu_time_used;
+  Timestamp_Control     current = data->zero;
   int                   j;
 
   data->stack_size += thread->Start.Initial_stack.size;
@@ -333,7 +333,7 @@ rtems_cpuusage_top_thread (rtems_task_argument arg)
     rtems_iterate_over_all_threads_2(task_counter, data);
 
     tasks_size = sizeof(Thread_Control*) * (data->task_count + 1);
-    usage_size = sizeof(Thread_CPU_usage_t) * (data->task_count + 1);
+    usage_size = sizeof(Timestamp_Control) * (data->task_count + 1);
 
     if (data->task_count > data->task_size)
     {
diff --git a/cpukit/rtems/include/rtems/rtems/ratemon.h b/cpukit/rtems/include/rtems/rtems/ratemon.h
index 5af170d..267502e 100644
--- a/cpukit/rtems/include/rtems/rtems/ratemon.h
+++ b/cpukit/rtems/include/rtems/rtems/ratemon.h
@@ -156,11 +156,11 @@ typedef struct {
   uint32_t     missed_count;
 
   /** This field contains the least amount of CPU time used in a period. */
-  Thread_CPU_usage_t                   min_cpu_time;
+  Timestamp_Control                    min_cpu_time;
   /** This field contains the highest amount of CPU time used in a period. */
-  Thread_CPU_usage_t                   max_cpu_time;
+  Timestamp_Control                    max_cpu_time;
   /** This field contains the total amount of wall time used in a period. */
-  Thread_CPU_usage_t                   total_cpu_time;
+  Timestamp_Control                    total_cpu_time;
 
   /** This field contains the least amount of wall time used in a period. */
   Rate_monotonic_Period_time_t         min_wall_time;
@@ -226,7 +226,7 @@ typedef struct {
    * the period was initiated.  It is used to compute the period's
    * statistics.
    */
-  Thread_CPU_usage_t                      cpu_usage_period_initiated;
+  Timestamp_Control                       cpu_usage_period_initiated;
 
   /**
    * This field contains the wall time value when the period
diff --git a/cpukit/rtems/include/rtems/rtems/ratemonimpl.h b/cpukit/rtems/include/rtems/rtems/ratemonimpl.h
index 90724a4..490912e 100644
--- a/cpukit/rtems/include/rtems/rtems/ratemonimpl.h
+++ b/cpukit/rtems/include/rtems/rtems/ratemonimpl.h
@@ -161,7 +161,7 @@ void _Rate_monotonic_Timeout(
 bool _Rate_monotonic_Get_status(
   Rate_monotonic_Control        *the_period,
   Rate_monotonic_Period_time_t  *wall_since_last_period,
-  Thread_CPU_usage_t            *cpu_since_last_period
+  Timestamp_Control             *cpu_since_last_period
 );
 
 /**
diff --git a/cpukit/rtems/src/ratemongetstatus.c b/cpukit/rtems/src/ratemongetstatus.c
index b61e234..b70abef 100644
--- a/cpukit/rtems/src/ratemongetstatus.c
+++ b/cpukit/rtems/src/ratemongetstatus.c
@@ -31,7 +31,7 @@ rtems_status_code rtems_rate_monotonic_get_status(
   rtems_rate_monotonic_period_status *status
 )
 {
-  Thread_CPU_usage_t             executed;
+  Timestamp_Control              executed;
   Objects_Locations              location;
   Rate_monotonic_Period_time_t   since_last_period;
   Rate_monotonic_Control        *the_period;
diff --git a/cpukit/rtems/src/ratemonperiod.c b/cpukit/rtems/src/ratemonperiod.c
index 144164e..6afe101 100644
--- a/cpukit/rtems/src/ratemonperiod.c
+++ b/cpukit/rtems/src/ratemonperiod.c
@@ -27,12 +27,12 @@
 bool _Rate_monotonic_Get_status(
   Rate_monotonic_Control        *the_period,
   Rate_monotonic_Period_time_t  *wall_since_last_period,
-  Thread_CPU_usage_t            *cpu_since_last_period
+  Timestamp_Control             *cpu_since_last_period
 )
 {
   Timestamp_Control        uptime;
   Thread_Control          *owning_thread = the_period->owner;
-  Thread_CPU_usage_t       used;
+  Timestamp_Control        used;
 
   /*
    *  Determine elapsed wall time since period initiated.
@@ -49,7 +49,7 @@ bool _Rate_monotonic_Get_status(
 
   if (owning_thread == _Thread_Executing) {
 
-    Thread_CPU_usage_t ran;
+    Timestamp_Control ran;
 
     /* How much time time since last context switch */
     _Timestamp_Subtract(
@@ -120,7 +120,7 @@ static void _Rate_monotonic_Update_statistics(
   Rate_monotonic_Control    *the_period
 )
 {
-  Thread_CPU_usage_t              executed;
+  Timestamp_Control               executed;
   Rate_monotonic_Period_time_t    since_last_period;
   Rate_monotonic_Statistics      *stats;
   bool                            valid_status;
diff --git a/cpukit/score/include/rtems/score/thread.h b/cpukit/score/include/rtems/score/thread.h
index 69caef1..73776b3 100644
--- a/cpukit/score/include/rtems/score/thread.h
+++ b/cpukit/score/include/rtems/score/thread.h
@@ -33,6 +33,7 @@
 #include <rtems/score/stack.h>
 #include <rtems/score/states.h>
 #include <rtems/score/threadq.h>
+#include <rtems/score/timestamp.h>
 #include <rtems/score/watchdog.h>
 
 #if defined(RTEMS_SMP)
@@ -83,14 +84,6 @@ extern "C" {
 #endif
 
 /*
- *  The user can define this at configure time and go back to ticks
- *  resolution.
- */
-#include <rtems/score/timestamp.h>
-
-typedef Timestamp_Control Thread_CPU_usage_t;
-
-/*
  * Only provided for backward compatiblity to not break application
  * configurations.
  */
@@ -807,7 +800,7 @@ struct _Thread_Control {
   /** This field is the amount of CPU time consumed by this thread
    *  since it was created.
    */
-  Thread_CPU_usage_t                    cpu_time_used;
+  Timestamp_Control                     cpu_time_used;
 
   /** This field contains information about the starting state of
    *  this thread.




More information about the vc mailing list