summaryrefslogtreecommitdiffstats
path: root/cpukit/include/rtems
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2022-09-08 09:41:12 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2022-09-09 06:57:10 +0200
commit270200e972e6c2a5733a12ee70fcc3b7e2940c6c (patch)
tree284b6a902cc2165c94b6bb78e45f7760d1ed712c /cpukit/include/rtems
parentlibcrypt: There is no need to clear message digest (diff)
downloadrtems-270200e972e6c2a5733a12ee70fcc3b7e2940c6c.tar.bz2
score: Remove _CPU_Counter_difference()
All CPU ports used the same _CPU_Counter_difference() implementation. Remove this CPU port interface and mandate a monotonically increasing CPU counter. Close #3456.
Diffstat (limited to 'cpukit/include/rtems')
-rw-r--r--cpukit/include/rtems/counter.h8
-rw-r--r--cpukit/include/rtems/score/profiling.h5
-rw-r--r--cpukit/include/rtems/score/smplockstats.h4
3 files changed, 7 insertions, 10 deletions
diff --git a/cpukit/include/rtems/counter.h b/cpukit/include/rtems/counter.h
index ad6d5517a3..61a0677bd3 100644
--- a/cpukit/include/rtems/counter.h
+++ b/cpukit/include/rtems/counter.h
@@ -99,20 +99,20 @@ static inline rtems_counter_ticks rtems_counter_read( void )
* @brief Returns the difference between the second and first CPU counter
* value.
*
- * This operation may be carried out as a modulo operation depending on the
- * range of the CPU counter device.
+ * This function is provided for backward compatibility.
+ * You may use "second - first" directly in the code.
*
* @param[in] second The second CPU counter value.
* @param[in] first The first CPU counter value.
*
- * @return Returns second minus first modulo counter period.
+ * @return Returns second minus first.
*/
static inline rtems_counter_ticks rtems_counter_difference(
rtems_counter_ticks second,
rtems_counter_ticks first
)
{
- return _CPU_Counter_difference( second, first );
+ return second - first;
}
/**
diff --git a/cpukit/include/rtems/score/profiling.h b/cpukit/include/rtems/score/profiling.h
index 90e470a775..90d441b0d0 100644
--- a/cpukit/include/rtems/score/profiling.h
+++ b/cpukit/include/rtems/score/profiling.h
@@ -129,10 +129,7 @@ static inline void _Profiling_Thread_dispatch_enable(
if ( new_thread_dispatch_disable_level == 0 ) {
Per_CPU_Stats *stats = &cpu->Stats;
CPU_Counter_ticks now = _CPU_Counter_read();
- CPU_Counter_ticks delta = _CPU_Counter_difference(
- now,
- stats->thread_dispatch_disabled_instant
- );
+ CPU_Counter_ticks delta = now - stats->thread_dispatch_disabled_instant;
stats->total_thread_dispatch_disabled_time += delta;
diff --git a/cpukit/include/rtems/score/smplockstats.h b/cpukit/include/rtems/score/smplockstats.h
index 102fb6eac5..cebfb80bd6 100644
--- a/cpukit/include/rtems/score/smplockstats.h
+++ b/cpukit/include/rtems/score/smplockstats.h
@@ -235,7 +235,7 @@ static inline void _SMP_lock_Stats_acquire_end(
second = _CPU_Counter_read();
stats_context->acquire_instant = second;
- delta = _CPU_Counter_difference( second, acquire_context->first );
+ delta = second - acquire_context->first;
++stats->usage_count;
@@ -270,7 +270,7 @@ static inline void _SMP_lock_Stats_release_update(
stats = stats_context->stats;
first = stats_context->acquire_instant;
second = _CPU_Counter_read();
- delta = _CPU_Counter_difference( second, first );
+ delta = second - first;
stats->total_section_time += delta;