Changeset f980561 in rtems for cpukit/sapi


Ignore:
Timestamp:
03/10/14 09:04:09 (10 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, 5, master
Children:
53ad908
Parents:
350f88dc
git-author:
Sebastian Huber <sebastian.huber@…> (03/10/14 09:04:09)
git-committer:
Sebastian Huber <sebastian.huber@…> (03/14/14 07:46:49)
Message:

score: Add per-CPU profiling

Add per-CPU profiling stats API. Implement the thread dispatch disable
level profiling. The interrupt profiling must be implemented in CPU
port specific parts (mostly assembler code). Add a support function
_Profiling_Outer_most_interrupt_entry_and_exit() for this purpose.

File:
1 edited

Legend:

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

    r350f88dc rf980561  
    1818
    1919#include <rtems/profiling.h>
     20#include <rtems/counter.h>
     21#include <rtems.h>
     22
     23#include <string.h>
     24
     25static void per_cpu_stats_iterate(
     26  rtems_profiling_visitor visitor,
     27  void *visitor_arg,
     28  rtems_profiling_data *data
     29)
     30{
     31#ifdef RTEMS_PROFILING
     32  uint32_t n = rtems_smp_get_processor_count();
     33  uint32_t i;
     34
     35  memset(data, 0, sizeof(*data));
     36  data->header.type = RTEMS_PROFILING_PER_CPU;
     37  for (i = 0; i < n; ++i) {
     38    const Per_CPU_Control *per_cpu = _Per_CPU_Get_by_index(i);
     39    const Per_CPU_Stats *stats = &per_cpu->Stats;
     40    rtems_profiling_per_cpu *per_cpu_data = &data->per_cpu;
     41
     42    per_cpu_data->processor_index = i;
     43
     44    per_cpu_data->max_thread_dispatch_disabled_time =
     45      rtems_counter_ticks_to_nanoseconds(
     46        stats->max_thread_dispatch_disabled_time
     47      );
     48
     49    per_cpu_data->max_interrupt_time =
     50      rtems_counter_ticks_to_nanoseconds(stats->max_interrupt_time);
     51
     52    per_cpu_data->max_interrupt_delay =
     53      rtems_counter_ticks_to_nanoseconds(stats->max_interrupt_delay);
     54
     55    per_cpu_data->thread_dispatch_disabled_count =
     56      stats->thread_dispatch_disabled_count;
     57
     58    per_cpu_data->total_thread_dispatch_disabled_time =
     59      rtems_counter_ticks_to_nanoseconds(
     60        stats->total_thread_dispatch_disabled_time
     61      );
     62
     63    per_cpu_data->interrupt_count = stats->interrupt_count;
     64
     65    per_cpu_data->total_interrupt_time =
     66      rtems_counter_ticks_to_nanoseconds(
     67        stats->total_interrupt_time
     68      );
     69
     70    (*visitor)(visitor_arg, data);
     71  }
     72#else
     73  (void) visitor;
     74  (void) visitor_arg;
     75  (void) data;
     76#endif
     77}
    2078
    2179void rtems_profiling_iterate(
     
    2482)
    2583{
     84  rtems_profiling_data data;
     85
     86  per_cpu_stats_iterate(visitor, visitor_arg, &data);
    2687}
Note: See TracChangeset for help on using the changeset viewer.