home *** CD-ROM | disk | FTP | other *** search
- -- ++
- -- Procedure to test the granularity and accuracy of the delay statement.
- -- --
-
- with Calendar;
- with System;
- with Text_IO;
- procedure Delay_Test is
-
- package Fixed_IO is new Text_IO.Fixed_IO ( Duration );
-
- Waiter_Priority : constant System.Priority := System.Priority'Last;
- task Waiter is
- pragma PRIORITY ( Waiter_Priority );
- end Waiter;
-
- task body Waiter is
- Cum_Delay : Duration := 0.0;
- The_Delay : constant Duration := 0.57;
- Time : Calendar.Time;
- Count : constant := 10;
- use Calendar; -- for ops on Calendar only
- begin
- Time := Calendar.Clock;
- for I in 1 .. Count loop
- delay The_Delay;
- end loop;
- Cum_Delay := (Calendar.Clock - Time);
-
- Text_IO.Put ( "average actual delay = " );
- Fixed_IO.Put ( Cum_Delay / Count );
- Text_IO.Put ( " requested = " );
- Fixed_IO.Put ( The_Delay );
- Text_IO.New_Line;
- end Waiter;
-
- begin
-
- Fixed_IO.Put ( Calendar.Seconds ( Calendar.Clock ) );
- Text_IO.New_Line;
- delay 3.3;
- Fixed_IO.Put ( Calendar.Seconds ( Calendar.Clock ) );
- Text_IO.New_Line;
-
- end Delay_Test;