diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-05-18 16:54:12 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-05-19 11:50:37 +0200 |
commit | 26fafd5a2f707e5aac1cd92354d42b759996c789 (patch) | |
tree | 3a900c6b6fd6a34fe2946c18590de72ea34ec4b5 /cpukit/score/include/rtems/score/smplockticket.h | |
parent | SMP: Move ticket lock to separate header file (diff) | |
download | rtems-26fafd5a2f707e5aac1cd92354d42b759996c789.tar.bz2 |
SMP: Add and use lock statistics helper
Diffstat (limited to 'cpukit/score/include/rtems/score/smplockticket.h')
-rw-r--r-- | cpukit/score/include/rtems/score/smplockticket.h | 41 |
1 files changed, 13 insertions, 28 deletions
diff --git a/cpukit/score/include/rtems/score/smplockticket.h b/cpukit/score/include/rtems/score/smplockticket.h index 57d541161e..e04c4056a5 100644 --- a/cpukit/score/include/rtems/score/smplockticket.h +++ b/cpukit/score/include/rtems/score/smplockticket.h @@ -82,21 +82,18 @@ static inline void _SMP_ticket_lock_Do_acquire( SMP_ticket_lock_Control *lock #if defined(RTEMS_PROFILING) , - SMP_lock_Stats *stats, - SMP_lock_Stats_context *stats_context + SMP_lock_Stats *stats, + SMP_lock_Stats_context *stats_context #endif ) { - unsigned int my_ticket; - unsigned int now_serving; - + unsigned int my_ticket; + unsigned int now_serving; #if defined(RTEMS_PROFILING) - CPU_Counter_ticks first; - CPU_Counter_ticks second; - CPU_Counter_ticks delta; - unsigned int initial_queue_length; + unsigned int initial_queue_length; + SMP_lock_Stats_acquire_context acquire_context; - first = _CPU_Counter_read(); + _SMP_lock_Stats_acquire_begin( &acquire_context ); #endif my_ticket = @@ -118,24 +115,12 @@ static inline void _SMP_ticket_lock_Do_acquire( #if defined(RTEMS_PROFILING) } - second = _CPU_Counter_read(); - stats_context->acquire_instant = second; - delta = _CPU_Counter_difference( second, first ); - - ++stats->usage_count; - - stats->total_acquire_time += delta; - - if ( stats->max_acquire_time < delta ) { - stats->max_acquire_time = delta; - } - - if ( initial_queue_length >= SMP_LOCK_STATS_CONTENTION_COUNTS ) { - initial_queue_length = SMP_LOCK_STATS_CONTENTION_COUNTS - 1; - } - ++stats->contention_counts[initial_queue_length]; - - stats_context->stats = stats; + _SMP_lock_Stats_acquire_end( + &acquire_context, + stats, + stats_context, + initial_queue_length + ); #endif } |