|
|
DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 Tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: B T
Length: 2910 (0xb5e)
Types: TextFile
Names: »B«
└─⟦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⟧
--
-- Version: @(#)floatvec.ada 1.2 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 adding of the
-- elements of a large floating point vector
--
-- Note: In order for the measurement to be meaningful, it must be the
-- only program executing while the test is run.
--
-- Please set Vector_Size 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 Float_Vector_Add_Test is
Vector_Size : 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;
type Vector is array (1 .. Vector_Size) of Float;
V1, V2, Vector_Result : Vector;
Count : Integer := Integer'First; -- used in timing loop
begin
-- Initialize Vectors
for N in Vector'Range loop
V1 (N) := Float (N);
V2 (N) := Float (Vector'Last - N + 1);
end loop;
-- Measure the timing loop overhead.
Start_Time := Clock;
for N in Vector'Range 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 Vector'Range loop
Count := Count + 1; -- prevent optimization
Vector_Result (N) := V1 (N) + V2 (N);
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 (1 iteration/element)");
Average_Time := Real_Time (Elapsed_Time - Loop_Time) /
Real_Time (Vector_Size);
Put ("Average time for adding each element = ");
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 Float_Vector_Add_Test;