home *** CD-ROM | disk | FTP | other *** search
- -- PERFORMANCE MEASUREMENT : task creation and termination time
- -- 1 task no entry
- -- task local in declare block, no select
-
- with REMOTE_GLOBAL ; use REMOTE_GLOBAL ; -- control optimization
- with ITERATION ; -- obtain stable measurement
- with PIWG_IO ; -- output results
-
- procedure C000003 is -- main procedure to execute
-
- CPU_TIME : DURATION ; -- CPU time for one feature execution
- WALL_TIME : DURATION ; -- WALL time for one feature execution
- CHECK_TIMES : constant := 100 ; -- inside loop count and check
- ITERATION_COUNT : INTEGER ; -- set and varied by ITERATION package
- STABLE : BOOLEAN ; -- true when measurement stable
-
- begin
-
- ITERATION.START_CONTROL ; -- dummy to bring in pages on some machines
-
- delay 0.5 ; -- wait for stable enviornment on some machines
-
- ITERATION.INITIALIZE ( ITERATION_COUNT ) ;
-
- loop -- until stable measurement, ITERATION_COUNT increases each time
-
- --
- -- Control loop
- --
- ITERATION.START_CONTROL ;
- for J in 1 .. ITERATION_COUNT loop
- GLOBAL := 0 ;
- for INSIDE_LOOP in 1 .. CHECK_TIMES loop
- GLOBAL := GLOBAL + A_ONE ;
- REMOTE ;
- end loop ;
- end loop ;
- ITERATION.STOP_CONTROL ( GLOBAL , CHECK_TIMES ) ;
-
- --
- -- Test loop
- --
- -- establish task create and terminate time
-
- ITERATION.START_TEST ;
- for J in 1 .. ITERATION_COUNT loop
- GLOBAL := 0 ;
- for INSIDE_LOOP in 1 .. CHECK_TIMES loop
- declare
- -- this creates the task, runs task to completion and terminates
- task T1 is
- end T1 ;
-
- task body T1 is
- begin
- GLOBAL := GLOBAL + A_ONE ;
- REMOTE ;
- end T1 ;
- begin
- null ;
- end ;
- end loop ;
- end loop ;
- ITERATION.STOP_TEST ( GLOBAL , CHECK_TIMES ) ;
- ITERATION.TEST_STABLE ( ITERATION_COUNT , STABLE ) ;
- exit when STABLE ;
- end loop ;
- --
- ITERATION.FEATURE_TIMES ( CPU_TIME , WALL_TIME ) ;
-
- --
- -- Printout
- --
- PIWG_IO.PIWG_OUTPUT ( "C000003" , "Tasking" ,
- CPU_TIME , WALL_TIME , ITERATION_COUNT ,
- " Task create and terminate time measurement " ,
- " Task is in declare block of main procedure " ,
- " one task, no entries, task is in the loop" ) ;
-
- end C000003 ;
-