home *** CD-ROM | disk | FTP | other *** search
/ Programmer's ROM - The Computer Language Library / programmersrom.iso / ada / piwg / a000022.ada < prev    next >
Encoding:
Text File  |  1988-05-03  |  961 b   |  30 lines

  1. with SYSTEM, TEXT_IO ;
  2.  
  3. package body REMOTE_GLOBAL is  -- must be compiled last
  4. --                               for explicit control of optimization
  5.   LOCAL : INTEGER;
  6.  
  7.   procedure REMOTE is -- this is an optimization control procedure
  8.   begin 
  9.     GLOBAL := GLOBAL + LOCAL; -- be sure procedure is not optimized away
  10.   exception
  11.     when NUMERIC_ERROR =>
  12.       REMOTE ; -- can not happen if test is working ( prevents inlining )
  13.   end REMOTE;
  14.  
  15.   procedure CHECK_TIME ( TEST_DURATION : in DURATION ) is
  16.   begin
  17.     if TEST_DURATION < 100 * DURATION'SMALL or
  18.        TEST_DURATION < 100 * SYSTEM.TICK then
  19.       TEXT_IO.PUT_LINE ( " ***** TEST_DURATION not large compared to "
  20.                          & "DURATION'SMALL or SYSTEM.TICK " ) ;
  21.     end if ;
  22.   end CHECK_TIME ;
  23.  
  24. begin
  25.  
  26.   A_ONE := 1 ; -- must not be changed by measurement programs
  27.   LOCAL := GLOBAL - A_ONE; -- really a zero but compiler doesn't know
  28.  
  29. end REMOTE_GLOBAL;
  30.