1 | /* |
---|
2 | * Rate Monotonic Manager -- Reset Statistics for All Periods |
---|
3 | * |
---|
4 | * COPYRIGHT (c) 1989-2007. |
---|
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 | #ifdef 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/object.h> |
---|
22 | #include <rtems/rtems/ratemon.h> |
---|
23 | #include <rtems/score/thread.h> |
---|
24 | |
---|
25 | /* |
---|
26 | * rtems_rate_monotonic_reset_all_statistics |
---|
27 | */ |
---|
28 | void rtems_rate_monotonic_reset_all_statistics( void ) |
---|
29 | { |
---|
30 | Objects_Id id; |
---|
31 | rtems_status_code status; |
---|
32 | |
---|
33 | /* |
---|
34 | * Prevent allocation or deallocation of any of the periods while |
---|
35 | * we are cycling. Also this is an optimization which ensures that |
---|
36 | * we only disable/enable once. The call to |
---|
37 | * rtems_rate_monotonic_reset_statistics will be in a nested dispatch |
---|
38 | * disabled critical section. |
---|
39 | */ |
---|
40 | _Thread_Disable_dispatch(); |
---|
41 | |
---|
42 | /* |
---|
43 | * Cycle through all possible ids and try to reset each one. If it |
---|
44 | * is a period that is inactive, we just get an error back. No big deal. |
---|
45 | */ |
---|
46 | for ( id=_Rate_monotonic_Information.minimum_id ; |
---|
47 | id <= _Rate_monotonic_Information.maximum_id ; |
---|
48 | id++ ) { |
---|
49 | status = rtems_rate_monotonic_reset_statistics( id ); |
---|
50 | } |
---|
51 | |
---|
52 | /* |
---|
53 | * Done so exit thread dispatching disabled critical section. |
---|
54 | */ |
---|
55 | _Thread_Enable_dispatch(); |
---|
56 | } |
---|