ada-examples-4-10-branch
Last change
on this file since 789d0e8 was
12b2266,
checked in by Joel Sherrill <joel.sherrill@…>, on 09/10/08 at 14:59:03
|
2008-09-10 Joel Sherrill <joel.sherrill@…>
- Makefile: Add new tests. Most of these eitehr demonstrate or verify a
particular functionality.
- cpuuse/Makefile, cpuuse/cpuuse.adb, exception_test2/Makefile,
exception_test2/exceptiontest2.adb, exception_test3/Makefile,
exception_test3/exceptiontest3.adb: New files.
|
-
Property mode set to
100644
|
File size:
1.2 KB
|
Line | |
---|
1 | -- |
---|
2 | -- Demonstrate CPU Usage Report |
---|
3 | -- |
---|
4 | -- $Id$ |
---|
5 | -- |
---|
6 | |
---|
7 | |
---|
8 | with Text_IO; use Text_IO; |
---|
9 | with Ada.Dynamic_Priorities; use Ada.Dynamic_Priorities; |
---|
10 | with System; |
---|
11 | with Interfaces.C; |
---|
12 | with RTEMS; |
---|
13 | |
---|
14 | procedure CPUUSE is |
---|
15 | |
---|
16 | task Low_Task is |
---|
17 | pragma Priority(16); |
---|
18 | end Low_Task; |
---|
19 | |
---|
20 | task High_Task is |
---|
21 | pragma Priority(17); |
---|
22 | end High_Task; |
---|
23 | |
---|
24 | task body High_Task is |
---|
25 | Seconds : Integer; |
---|
26 | Result : RTEMS.Status_Codes; |
---|
27 | begin |
---|
28 | RTEMS.Object_Set_Name( RTEMS.Self, "High_Task", Result ); |
---|
29 | Seconds := 0; |
---|
30 | loop |
---|
31 | delay 1.0; |
---|
32 | Seconds := Seconds + 1; |
---|
33 | Put_Line ("High - waking up at " & Integer'Image(Seconds)); |
---|
34 | if (Seconds mod 5) = 0 then |
---|
35 | RTEMS.CPU_Usage_Report; |
---|
36 | end if; |
---|
37 | if Seconds = 30 then |
---|
38 | Put_Line ("*** End of Ada CPU Use Test ***"); |
---|
39 | RTEMS.Shutdown_Executive (0); |
---|
40 | end if; |
---|
41 | end loop; |
---|
42 | end High_Task; |
---|
43 | |
---|
44 | task body Low_Task is |
---|
45 | Result : RTEMS.Status_Codes; |
---|
46 | begin |
---|
47 | RTEMS.Object_Set_Name( RTEMS.Self, "Low_Task", Result ); |
---|
48 | delay 0.1; |
---|
49 | loop |
---|
50 | Null; |
---|
51 | end loop; |
---|
52 | end Low_Task; |
---|
53 | |
---|
54 | Result : RTEMS.Status_Codes; |
---|
55 | begin |
---|
56 | RTEMS.Object_Set_Name( RTEMS.Self, "Ada Main", Result ); |
---|
57 | Put_Line ("*** Start of Ada CPU Use Test ***"); |
---|
58 | end CPUUSE; |
---|
Note: See
TracBrowser
for help on using the repository browser.