[rtems commit] rtems: Inline _Rate_monotonic_Reset_statistics()

Sebastian Huber sebh at rtems.org
Mon Mar 21 09:46:44 UTC 2016


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Mon Mar 21 10:36:20 2016 +0100

rtems: Inline _Rate_monotonic_Reset_statistics()

Use inline function instead of macro.

---

 cpukit/rtems/include/rtems/rtems/ratemonimpl.h | 59 +++++++-------------------
 1 file changed, 16 insertions(+), 43 deletions(-)

diff --git a/cpukit/rtems/include/rtems/rtems/ratemonimpl.h b/cpukit/rtems/include/rtems/rtems/ratemonimpl.h
index f184c44..46ca280 100644
--- a/cpukit/rtems/include/rtems/rtems/ratemonimpl.h
+++ b/cpukit/rtems/include/rtems/rtems/ratemonimpl.h
@@ -171,51 +171,24 @@ void _Rate_monotonic_Restart(
   Rate_monotonic_Control *the_period
 );
 
-/**
- *  @brief _Rate_monotonic_Reset_wall_time_statistics
- *
- *  This method resets the statistics information for a period instance.
- */
-#define _Rate_monotonic_Reset_wall_time_statistics( _the_period ) \
-   do { \
-      /* set the minimums to a large value */ \
-      _Timestamp_Set( \
-	&(_the_period)->Statistics.min_wall_time, \
-	0x7fffffff, \
-	0x7fffffff \
-      ); \
-   } while (0)
+RTEMS_INLINE_ROUTINE void _Rate_monotonic_Reset_min_time(
+  Timestamp_Control *min_time
+)
+{
+  _Timestamp_Set( min_time, 0x7fffffff, 0x7fffffff );
+}
 
-/**
- *  @brief Rate_monotonic_Reset_cpu_use_statistics
- *
- *  This helper method resets the period CPU usage statistics structure.
- */
-#define _Rate_monotonic_Reset_cpu_use_statistics( _the_period ) \
-   do { \
-      /* set the minimums to a large value */ \
-      _Timestamp_Set( \
-	&(_the_period)->Statistics.min_cpu_time, \
-	0x7fffffff, \
-	0x7fffffff \
-      ); \
-   } while (0)
+RTEMS_INLINE_ROUTINE void _Rate_monotonic_Reset_statistics(
+  Rate_monotonic_Control *the_period
+)
+{
+  Rate_monotonic_Statistics *statistics;
 
-/**
- *  @brief Rate_monotonic_Reset_statistics
- *
- *  This helper method resets the period wall time statistics structure.
- */
-#define _Rate_monotonic_Reset_statistics( _the_period ) \
-  do { \
-    memset( \
-      &(_the_period)->Statistics, \
-      0, \
-      sizeof( rtems_rate_monotonic_period_statistics ) \
-    ); \
-    _Rate_monotonic_Reset_cpu_use_statistics( _the_period ); \
-    _Rate_monotonic_Reset_wall_time_statistics( _the_period ); \
-  } while (0)
+  statistics = &the_period->Statistics;
+  memset( statistics, 0, sizeof( *statistics ) );
+  _Rate_monotonic_Reset_min_time( &statistics->min_wall_time );
+  _Rate_monotonic_Reset_min_time( &statistics->min_cpu_time );
+}
 
 /**@}*/
 



More information about the vc mailing list