home *** CD-ROM | disk | FTP | other *** search
- -- PERFORMANCE MEASUREMENT : task creation and termination time
- -- 1 task no entry
- -- task type in package, no select
-
- with REMOTE_GLOBAL ; use REMOTE_GLOBAL ;
- package CREATE_PACK_1 is
- task type T1 is
- end T1 ;
- procedure P1 ; -- will create task, run task, and terminate task
- end CREATE_PACK_1 ;
-
- with CREATE_PACK_1 ; use CREATE_PACK_1 ;
- with REMOTE_GLOBAL ; use REMOTE_GLOBAL ; -- control optimization
- with ITERATION ; -- obtain stable measurement
- with PIWG_IO ; -- output results
-
- procedure C000001 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 5.0 ; -- 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
- P1 ; -- this has task that has global increment and call inside
- 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 ( "C000001" , "Tasking" ,
- CPU_TIME , WALL_TIME , ITERATION_COUNT ,
- " Task create and terminate measurement " ,
- " with one task, no entries, when task is in a procedure" ,
- " using a task type in a package, no select statement, no loop, " ) ;
-
- end C000001 ;
-
- package body CREATE_PACK_1 is
- task body T1 is
- begin
- GLOBAL := GLOBAL + A_ONE ;
- REMOTE ;
- end T1 ;
-
- procedure P1 is
- T : T1 ; -- this creates the task, runs task to completion and terminates
- begin
- null ;
- end P1 ;
-
- end CREATE_PACK_1 ;
-