DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400

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

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download

⟦0558a54b5⟧ Ada Source

    Length: 5120 (0x1400)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, procedure Towers_Of_Hanoi_Benchmark, seg_02a46e

Derivation

└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
    └─ ⟦5a81ac88f⟧ »Space Info Vol 1« 
        └─⟦this⟧ 

E3 Source Code



with Calendar;
with Fact;
with Towers_Of_Hanoi_Frames;
with Towers_Of_Hanoi_Rule_Base;
with Towers_Of_Hanoi_Rules_For_Benchmark;
with Text_Io;

use Calendar;
use Fact;
use Towers_Of_Hanoi_Frames;

procedure Towers_Of_Hanoi_Benchmark is

    Tower_Size         : constant := 12;
    Initial_Priority   : constant := 1;
    Inference_Count    : Natural;
    Elapsed_Time       : Duration;
    Firings_Per_Second : Integer;

    Started_At, Stopped_At : Calendar.Time;

    function Firable_On_Facts return Fact.Collection
        renames Towers_Of_Hanoi_Rule_Base.Rule_Base.Firable_On_Facts;

    function Firable_On_Rule return Towers_Of_Hanoi_Rule_Base.Rule_Base.Rule_Id
        renames Towers_Of_Hanoi_Rule_Base.Rule_Base.Firable_On_Rule;

    package Toh_Rules renames Towers_Of_Hanoi_Rules_For_Benchmark;
    package Duration_Io is new Text_Io.Fixed_Io (Duration);

begin
    for Size in 5 .. 13 loop  
        Inference_Count := 0;
        Started_At      := Calendar.Clock;

        Movements.Add ((From_Tower => 1,
                        To_Tower   => 3,
                        Count      => Size,
                        Priority   => Initial_Priority));
        loop
            declare
                Result : constant Fact.Collection := Firable_On_Facts;
            begin
                exit when Result = Empty_Collection;
                Toh_Rules.Do_Action (For_Rule => Firable_On_Rule,  
                                     On_Facts => Result);
                Inference_Count := Inference_Count + 1;
            end;
        end loop;

        Stopped_At         := Calendar.Clock;
        Elapsed_Time       := Stopped_At - Started_At;
        Firings_Per_Second := Integer (Float (Inference_Count) /
                                       Float (Elapsed_Time));

        Text_Io.Put (Integer'Image (Size) & " towers : time =>");
        Duration_Io.Put (Elapsed_Time, Fore => 3, Aft => 2);  
        Text_Io.Put (", inferences =>" & Integer'Image (Inference_Count));
        Text_Io.Put (", firings per second =>" &
                     Integer'Image (Firings_Per_Second));
        Text_Io.New_Line;
    end loop;
end Towers_Of_Hanoi_Benchmark;

E3 Meta Data

    nblk1=4
    nid=2
    hdr6=6
        [0x00] rec0=23 rec1=00 rec2=01 rec3=012
        [0x01] rec0=17 rec1=00 rec2=04 rec3=07c
        [0x02] rec0=07 rec1=00 rec2=03 rec3=000
        [0x03] rec0=06 rec1=00 rec2=02 rec3=000
    tail 0x21522582883e24cf1acbf 0x42a00088462063c03
Free Block Chain:
  0x2: 0000  00 00 00 c5 80 03 29 29 3b 03 00 30 20 20 20 20  ┆      ));  0    ┆