Changeset 53ad908 in rtems for cpukit/sapi


Ignore:
Timestamp:
03/07/14 13:36:22 (10 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, 5, master
Children:
de5d6d0
Parents:
f980561
git-author:
Sebastian Huber <sebastian.huber@…> (03/07/14 13:36:22)
git-committer:
Sebastian Huber <sebastian.huber@…> (03/14/14 07:46:49)
Message:

score: Add SMP lock profiling support

Location:
cpukit/sapi/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cpukit/sapi/src/chainsmp.c

    rf980561 r53ad908  
    2323#include <rtems/score/smplock.h>
    2424
    25 static SMP_lock_Control chain_lock = SMP_LOCK_INITIALIZER;
     25static SMP_lock_Control chain_lock = SMP_LOCK_INITIALIZER("chains");
    2626
    2727static void chain_acquire( SMP_lock_Context *lock_context )
  • cpukit/sapi/src/profilingiterate.c

    rf980561 r53ad908  
    1919#include <rtems/profiling.h>
    2020#include <rtems/counter.h>
     21#include <rtems/score/smplock.h>
    2122#include <rtems.h>
    2223
     
    7778}
    7879
     80#if defined(RTEMS_PROFILING) && defined(RTEMS_SMP)
     81RTEMS_STATIC_ASSERT(
     82  RTEMS_PROFILING_SMP_LOCK_CONTENTION_COUNTS
     83    == SMP_LOCK_STATS_CONTENTION_COUNTS,
     84  smp_lock_contention_counts
     85);
     86#endif
     87
     88static void smp_lock_stats_iterate(
     89  rtems_profiling_visitor visitor,
     90  void *visitor_arg,
     91  rtems_profiling_data *data
     92)
     93{
     94#if defined(RTEMS_PROFILING) && defined(RTEMS_SMP)
     95  SMP_lock_Stats_iteration_context iteration_context;
     96  SMP_lock_Stats snapshot;
     97  char name[64];
     98
     99  memset(data, 0, sizeof(*data));
     100  data->header.type = RTEMS_PROFILING_SMP_LOCK;
     101
     102  _SMP_lock_Stats_iteration_start(&iteration_context);
     103  while (
     104    _SMP_lock_Stats_iteration_next(
     105      &iteration_context,
     106      &snapshot,
     107      &name[0],
     108      sizeof(name)
     109    )
     110  ) {
     111    rtems_profiling_smp_lock *smp_lock_data = &data->smp_lock;
     112
     113    smp_lock_data->name = name;
     114    smp_lock_data->max_acquire_time =
     115      rtems_counter_ticks_to_nanoseconds(snapshot.max_acquire_time);
     116    smp_lock_data->max_section_time =
     117      rtems_counter_ticks_to_nanoseconds(snapshot.max_section_time);
     118    smp_lock_data->usage_count = snapshot.usage_count;
     119    smp_lock_data->total_acquire_time =
     120      rtems_counter_ticks_to_nanoseconds(snapshot.total_acquire_time);
     121    smp_lock_data->total_section_time =
     122      rtems_counter_ticks_to_nanoseconds(snapshot.total_section_time);
     123
     124    memcpy(
     125      &smp_lock_data->contention_counts[0],
     126      &snapshot.contention_counts[0],
     127      sizeof(smp_lock_data->contention_counts)
     128    );
     129
     130    (*visitor)(visitor_arg, data);
     131  }
     132  _SMP_lock_Stats_iteration_stop(&iteration_context);
     133#else
     134  (void) visitor;
     135  (void) visitor_arg;
     136  (void) data;
     137#endif
     138}
     139
    79140void rtems_profiling_iterate(
    80141  rtems_profiling_visitor visitor,
     
    85146
    86147  per_cpu_stats_iterate(visitor, visitor_arg, &data);
     148  smp_lock_stats_iterate(visitor, visitor_arg, &data);
    87149}
Note: See TracChangeset for help on using the changeset viewer.