source: rtems/cpukit/rtems/src/ratemongetstatistics.c @ c499856

4.115
Last change on this file since c499856 was c499856, checked in by Chris Johns <chrisj@…>, on 03/20/14 at 21:10:47

Change all references of rtems.com to rtems.org.

  • 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.org/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/rtems/ratemonimpl.h>
26#include <rtems/score/thread.h>
27
28rtems_status_code rtems_rate_monotonic_get_statistics(
29  rtems_id                                id,
30  rtems_rate_monotonic_period_statistics *statistics
31)
32{
33  Objects_Locations                        location;
34  Rate_monotonic_Control                  *the_period;
35  rtems_rate_monotonic_period_statistics  *dst;
36  Rate_monotonic_Statistics               *src;
37
38  if ( !statistics )
39    return RTEMS_INVALID_ADDRESS;
40
41  the_period = _Rate_monotonic_Get( id, &location );
42  switch ( location ) {
43
44    case OBJECTS_LOCAL:
45      dst = statistics;
46      src = &the_period->Statistics;
47      dst->count        = src->count;
48      dst->missed_count = src->missed_count;
49      #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
50        _Timestamp_To_timespec( &src->min_cpu_time,   &dst->min_cpu_time );
51        _Timestamp_To_timespec( &src->max_cpu_time,   &dst->max_cpu_time );
52        _Timestamp_To_timespec( &src->total_cpu_time, &dst->total_cpu_time );
53        _Timestamp_To_timespec( &src->min_wall_time,   &dst->min_wall_time );
54        _Timestamp_To_timespec( &src->max_wall_time,   &dst->max_wall_time );
55        _Timestamp_To_timespec( &src->total_wall_time, &dst->total_wall_time );
56      #else
57        dst->min_cpu_time    = src->min_cpu_time;
58        dst->max_cpu_time    = src->max_cpu_time;
59        dst->total_cpu_time  = src->total_cpu_time;
60        dst->min_wall_time   = src->min_wall_time;
61        dst->max_wall_time   = src->max_wall_time;
62        dst->total_wall_time = src->total_wall_time;
63      #endif
64
65      _Objects_Put( &the_period->Object );
66      return RTEMS_SUCCESSFUL;
67
68#if defined(RTEMS_MULTIPROCESSING)
69    case OBJECTS_REMOTE:            /* should never return this */
70#endif
71    case OBJECTS_ERROR:
72      break;
73  }
74
75  return RTEMS_INVALID_ID;
76}
Note: See TracBrowser for help on using the repository browser.