diff options
Diffstat (limited to 'cpuuse/cpuuse.adb')
-rw-r--r-- | cpuuse/cpuuse.adb | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/cpuuse/cpuuse.adb b/cpuuse/cpuuse.adb new file mode 100644 index 0000000..5683afa --- /dev/null +++ b/cpuuse/cpuuse.adb @@ -0,0 +1,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; |