source: rtems/cpukit/rtems/src/ratemongetstatistics.c @ 2d2352b

4.115
Last change on this file since 2d2352b was 2d2352b, checked in by Sebastian Huber <sebastian.huber@…>, on 06/05/13 at 09:48:57

score: Add and use _Objects_Put()

Add and use _Objects_Put_without_thread_dispatch(). These two functions
pair with the _Objects_Get() function. This helps to introduce object
specific SMP locks to avoid lock contention.

  • Property mode set to 100644
File size: 2.3 KB
Line 
1/**
2 *  @file
3 *
4 *  @brief RTEMS Rate Monotonic Get Statistics
5 *  @ingroup ClassicRateMon
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2009.
10 *  On-Line Applications Research Corporation (OAR).
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.rtems.com/license/LICENSE.
15 */
16
17#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <rtems/system.h>
22#include <rtems/rtems/status.h>
23#include <rtems/rtems/support.h>
24#include <rtems/score/isr.h>
25#include <rtems/score/object.h>
26#include <rtems/rtems/ratemon.h>
27#include <rtems/score/thread.h>
28
29rtems_status_code rtems_rate_monotonic_get_statistics(
30  rtems_id                                id,
31  rtems_rate_monotonic_period_statistics *statistics
32)
33{
34  Objects_Locations                        location;
35  Rate_monotonic_Control                  *the_period;
36  rtems_rate_monotonic_period_statistics  *dst;
37  Rate_monotonic_Statistics               *src;
38
39  if ( !statistics )
40    return RTEMS_INVALID_ADDRESS;
41
42  the_period = _Rate_monotonic_Get( id, &location );
43  switch ( location ) {
44
45    case OBJECTS_LOCAL:
46      dst = statistics;
47      src = &the_period->Statistics;
48      dst->count        = src->count;
49      dst->missed_count = src->missed_count;
50      #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
51        _Timestamp_To_timespec( &src->min_cpu_time,   &dst->min_cpu_time );
52        _Timestamp_To_timespec( &src->max_cpu_time,   &dst->max_cpu_time );
53        _Timestamp_To_timespec( &src->total_cpu_time, &dst->total_cpu_time );
54        _Timestamp_To_timespec( &src->min_wall_time,   &dst->min_wall_time );
55        _Timestamp_To_timespec( &src->max_wall_time,   &dst->max_wall_time );
56        _Timestamp_To_timespec( &src->total_wall_time, &dst->total_wall_time );
57      #else
58        dst->min_cpu_time    = src->min_cpu_time;
59        dst->max_cpu_time    = src->max_cpu_time;
60        dst->total_cpu_time  = src->total_cpu_time;
61        dst->min_wall_time   = src->min_wall_time;
62        dst->max_wall_time   = src->max_wall_time;
63        dst->total_wall_time = src->total_wall_time;
64      #endif
65
66      _Objects_Put( &the_period->Object );
67      return RTEMS_SUCCESSFUL;
68
69#if defined(RTEMS_MULTIPROCESSING)
70    case OBJECTS_REMOTE:            /* should never return this */
71#endif
72    case OBJECTS_ERROR:
73      break;
74  }
75
76  return RTEMS_INVALID_ID;
77}
Note: See TracBrowser for help on using the repository browser.