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

⟦124b5c7a3⟧ TextFile

    Length: 4580 (0x11e4)
    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


-- PERFORMANCE MEASUREMENT : Measure the time to store and extract bit fields
--                           that are defined by representation clauses using
--                           Boolean and Integer record components
--                           12 accesses, 5 stores, 1 record copy

with Remote_Global;
use Remote_Global;  -- control optimization
with Iteration;  -- obtain stable measurement

with Piwg_Io;  -- output results


procedure H000007 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

--
-- define record, then define representation clause
--
    type My_Rec is
        record
            A1 : Integer range -3 .. 3; -- symmetric
            A2 : Boolean;  
            A3 : Integer range 0 .. 15; -- positive
            A4 : Integer range 10 .. 100; -- arbitrary
            A5 : Boolean;  --5
        end record;

    for My_Rec use
        record
            A1 at 0 range 0 .. 2;
            A2 at 0 range 3 .. 3;
            A3 at 0 range 4 .. 7;
            A4 at 0 range 8 .. 15;
            A5 at 0 range 16 .. 16;
        end record;

    A_Rec : My_Rec := (1, True, 7, 11, False); -- initialize
    B_Rec : My_Rec := A_Rec;

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;  -- prevent optimization
                Remote;
            end loop;
        end loop;
        Iteration.Stop_Control (Global, Check_Times);

--
-- Test loop
--
        Iteration.Start_Test;
        for J in 1 .. Iteration_Count loop
            Global := 0;
            for Inside_Loop in 1 .. Check_Times loop
                Global := Global + A_One;  -- prevent optimization
                Remote;

--       time accessing all five fields once
                if A_Rec.A1 /= 1 then
                    raise Program_Error;
                end if;
                if A_Rec.A2 /= True then
                    raise Program_Error;
                end if;
                if A_Rec.A3 /= 7 then
                    raise Program_Error;
                end if;
                if A_Rec.A4 /= 11 then
                    raise Program_Error;
                end if;
                if A_Rec.A5 /= False then
                    raise Program_Error;
                end if;
--         time record to record store and access of first and last fields
                B_Rec := A_Rec;
                if B_Rec.A1 /= 1 then
                    raise Program_Error;
                end if;
                if B_Rec.A5 /= False then
                    raise Program_Error;
                end if;
--          time storing of all five fields and then read all five fields
                B_Rec.A1 := -2;
                B_Rec.A2 := False;
                B_Rec.A3 := 5;
                B_Rec.A4 := 14;
                B_Rec.A5 := True;
                if B_Rec.A1 /= -2 then
                    raise Program_Error;
                end if;
                if B_Rec.A2 /= False then
                    raise Program_Error;
                end if;
                if B_Rec.A3 /= 5 then
                    raise Program_Error;
                end if;
                if B_Rec.A4 /= 14 then
                    raise Program_Error;
                end if;
                if B_Rec.A5 /= True then
                    raise Program_Error;
                end if;

            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
       ("H000007", "Chapter 13", Cpu_Time, Wall_Time, Iteration_Count,
        " The time to store and extract bit fields that are",
        " defined by representation clauses using Boolean and Integer",
        " record components. 12 accesses, 5 stores, 1 record copy");

end H000007;