blob: 5683afa774b17aa750582121f0d844fcd0ee1d70 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
--
-- Demonstrate CPU Usage Report
--
-- $Id$
--
with Text_IO; use Text_IO;
with Ada.Dynamic_Priorities; use Ada.Dynamic_Priorities;
with System;
with Interfaces.C;
with RTEMS;
procedure CPUUSE is
task Low_Task is
pragma Priority(16);
end Low_Task;
task High_Task is
pragma Priority(17);
end High_Task;
task body High_Task is
Seconds : Integer;
Result : RTEMS.Status_Codes;
begin
RTEMS.Object_Set_Name( RTEMS.Self, "High_Task", Result );
Seconds := 0;
loop
delay 1.0;
Seconds := Seconds + 1;
Put_Line ("High - waking up at " & Integer'Image(Seconds));
if (Seconds mod 5) = 0 then
RTEMS.CPU_Usage_Report;
end if;
if Seconds = 30 then
Put_Line ("*** End of Ada CPU Use Test ***");
RTEMS.Shutdown_Executive (0);
end if;
end loop;
end High_Task;
task body Low_Task is
Result : RTEMS.Status_Codes;
begin
RTEMS.Object_Set_Name( RTEMS.Self, "Low_Task", Result );
delay 0.1;
loop
Null;
end loop;
end Low_Task;
Result : RTEMS.Status_Codes;
begin
RTEMS.Object_Set_Name( RTEMS.Self, "Ada Main", Result );
Put_Line ("*** Start of Ada CPU Use Test ***");
end CPUUSE;
|