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

4.104.115
Last change on this file since dca9a82 was dca9a82, checked in by Glenn Humphrey <glenn.humphrey@…>, on 12/02/09 at 18:22:19

2009-12-02 Glenn Humphrey <glenn.humphrey@…>

  • libcsupport/src/times.c, libmisc/cpuuse/cpuusagedata.c, libmisc/cpuuse/cpuusagereport.c, libmisc/cpuuse/cpuusagereset.c, rtems/include/rtems/rtems/types.h, rtems/src/ratemongetstatistics.c, rtems/src/ratemonreportstatistics.c, score/src/threaddispatch.c, score/src/threadinitialize.c, score/src/threadtickletimeslice.c: Updated copyright line.
  • Property mode set to 100644
File size: 2.6 KB
Line 
1/*
2 *  Rate Monotonic Manager -- Get Statistics
3 *
4 *  COPYRIGHT (c) 1989-2009.
5 *  On-Line Applications Research Corporation (OAR).
6 *
7 *  The license and distribution terms for this file may be
8 *  found in the file LICENSE in this distribution or at
9 *  http://www.rtems.com/license/LICENSE.
10 *
11 *  $Id$
12 */
13
14#if HAVE_CONFIG_H
15#include "config.h"
16#endif
17
18#include <rtems/system.h>
19#include <rtems/rtems/status.h>
20#include <rtems/rtems/support.h>
21#include <rtems/score/isr.h>
22#include <rtems/score/object.h>
23#include <rtems/rtems/ratemon.h>
24#include <rtems/score/thread.h>
25
26/*PAGE
27 *
28 *  rtems_rate_monotonic_get_statistics
29 *
30 *  This directive allows a thread to obtain statistics information on a
31 *  period.
32 *
33 *  Input parameters:
34 *    id         - rate monotonic id
35 *    statistics - pointer to statistics control block
36 *
37 *  Output parameters:
38 *    RTEMS_SUCCESSFUL - if successful
39 *    error code       - if unsuccessful
40 *
41 */
42
43rtems_status_code rtems_rate_monotonic_get_statistics(
44  Objects_Id                               id,
45  rtems_rate_monotonic_period_statistics  *statistics
46)
47{
48  Objects_Locations                        location;
49  Rate_monotonic_Control                  *the_period;
50  rtems_rate_monotonic_period_statistics  *dst;
51  Rate_monotonic_Statistics               *src;
52
53  if ( !statistics )
54    return RTEMS_INVALID_ADDRESS;
55
56  the_period = _Rate_monotonic_Get( id, &location );
57  switch ( location ) {
58
59    case OBJECTS_LOCAL:
60      dst = statistics;
61      src = &the_period->Statistics;
62      dst->count        = src->count;
63      dst->missed_count = src->missed_count;
64      #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
65        _Timestamp_To_timespec( &src->min_cpu_time,   &dst->min_cpu_time );
66        _Timestamp_To_timespec( &src->max_cpu_time,   &dst->max_cpu_time );
67        _Timestamp_To_timespec( &src->total_cpu_time, &dst->total_cpu_time );
68        _Timestamp_To_timespec( &src->min_wall_time,   &dst->min_wall_time );
69        _Timestamp_To_timespec( &src->max_wall_time,   &dst->max_wall_time );
70        _Timestamp_To_timespec( &src->total_wall_time, &dst->total_wall_time );
71      #else
72        dst->min_cpu_time    = src->min_cpu_time;
73        dst->max_cpu_time    = src->max_cpu_time;
74        dst->total_cpu_time  = src->total_cpu_time;
75        dst->min_wall_time   = src->min_wall_time;
76        dst->max_wall_time   = src->max_wall_time;
77        dst->total_wall_time = src->total_wall_time;
78      #endif
79
80      _Thread_Enable_dispatch();
81      return RTEMS_SUCCESSFUL;
82
83#if defined(RTEMS_MULTIPROCESSING)
84    case OBJECTS_REMOTE:            /* should never return this */
85#endif
86    case OBJECTS_ERROR:
87      break;
88  }
89
90  return RTEMS_INVALID_ID;
91}
Note: See TracBrowser for help on using the repository browser.