home *** CD-ROM | disk | FTP | other *** search
-
- -- PERFORMANCE MEASUREMENT : opening files
-
- with TEXT_IO ; use TEXT_IO ;
- with REMOTE_GLOBAL ; use REMOTE_GLOBAL ; -- control optimization
- with ITERATION ; -- obtain stable measurement
- with PIWG_IO ; -- output results
-
- procedure G000007 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
- SCRATCH : FILE_TYPE ;
-
- begin
-
- CREATE ( SCRATCH , OUT_FILE , "SCRATCH7" );
- PUT_LINE ( SCRATCH , " just stuff " ) ;
- CLOSE ( SCRATCH ) ;
-
- 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 the time to open a file
-
- ITERATION.START_TEST ;
- for J in 1 .. ITERATION_COUNT loop
- GLOBAL := 0 ;
- for INSIDE_LOOP in 1 .. CHECK_TIMES loop
- GLOBAL := GLOBAL + A_ONE ;
- REMOTE ;
- OPEN ( SCRATCH , IN_FILE , "SCRATCH7" ) ;
- CLOSE ( SCRATCH ) ;
- 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 ( "G000007" , "Input/Output" ,
- CPU_TIME , WALL_TIME , ITERATION_COUNT ,
- " Open and close an existing file, time measurement" ,
- " A scratch file is created and closed " ,
- " The scratch file is opened IN_FILE and closed in a loop" ) ;
-
- end G000007 ;
-