DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400 Tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Rational R1000/400 Tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: B T

⟦c8a90c458⟧ TextFile

    Length: 2989 (0xbad)
    Types: TextFile
    Names: »B«

Derivation

└─⟦180fe333a⟧ Bits:30000405 8mm tape, Rational 1000, SW CATALOG, 10_20_0
└─⟦180fe333a⟧ Bits:30000537 8mm tape, Rational 1000, SW Catalog 10_20_0
    └─⟦5cb1d1d7f⟧ »DATA« 
        └─⟦3b1ee7bd8⟧ 
            └─⟦this⟧ 

TextFile

--
-- Version: @(#)boolvec.ada 1.3  Date: 9/21/84
--
-- Author:  Edward Colbert
--     Ada Technology Group
--     Information Software Systems Lab
--     Defense Systems Group
--     TRW
--     Redondo Beach, CA
--
-- This program measures the time required for the "and" operation on the
-- elements of a boolean vector
--
-- Note:  In order for the measurement to be meaningful, it must be the
-- only program executing while the test is run.
--
-- Please set Iterations large enough to provide at least two significant
-- digits in the average times, i.e., the difference between
-- the elapsed time and the loop time must be at least 100 times
-- Duration'Small & at least 100 times System.Tick.
--

with Text_Io;
use Text_Io;
with Calendar;
use Calendar;
with System;
use System;
procedure Boolean_Vector_And_Test is

    Iterations : constant Positive := 1000;

    type Real_Time is digits Max_Digits;

    Start_Time : Time;
    Loop_Time : Duration;
    Elapsed_Time : Duration;
    Average_Time : Real_Time;

    package Duration_Io is new Fixed_Io (Duration);
    use Duration_Io;

    package Real_Time_Io is new Float_Io (Real_Time);
    use Real_Time_Io;

    package Int_Io is new Integer_Io (Integer);
    use Int_Io;

    Vector_Size : constant Positive := 25;
    type Vector is array (1 .. Vector_Size) of Boolean;

    V1, V2, Vector_Result : Vector;
    Count : Integer := Integer'First;  -- used in timing loop

begin

    -- Initialize Vectors
    for N in Vector'Range loop
        V1 (N) := True;
        V2 (N) := Boolean'Val (N mod 2);
    end loop;

    -- Measure the timing loop overhead.
    Start_Time := Clock;

    for N in 1 .. Iterations loop
        Count := Count + 1;                 -- prevent optimization
    end loop;

    Loop_Time := Clock - Start_Time;


    -- Measure the time including the adding of vector elements
    Start_Time := Clock;

    for N in 1 .. Iterations loop
        Count := Count + 1;                 -- prevent optimization
        Vector_Result := V1 and V2;
    end loop;

    Elapsed_Time := Clock - Start_Time;


    Put ("Loop time = ");
    Put (Loop_Time, Fore => 0);
    Put (" seconds for ");
    Put (Vector_Size, Width => 0);
    Put_Line (" iterations");


    Put ("Elapsed time = ");
    Put (Elapsed_Time, Fore => 0);
    Put (" seconds for ");
    Put (Vector_Size, Width => 0);
    Put_Line (" iterations");

    Average_Time := Real_Time (Elapsed_Time - Loop_Time) /
                       Real_Time (Vector_Size);
    Put ("Average time for " & '"' & "and" & '"' & " of 2 arrays (" &
         Integer'Image (Vector_Size) & " elements) = ");
    Put (Average_Time, Fore => 0);
    Put_Line (" seconds");

    New_Line;

    if (Elapsed_Time - Loop_Time < 100 * Duration'Small or
        Elapsed_Time - Loop_Time < 100 * System.Tick) then
        Put_Line ("** TEST FAILED (due to insufficient precision)! **");
    else
        Put_Line ("** TEST PASSED **");
    end if;

end Boolean_Vector_And_Test;