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 - download
Index: ┃ B T

⟦6b5b7319e⟧ TextFile

    Length: 4245 (0x1095)
    Types: TextFile
    Names: »B«

Derivation

└─⟦d10a02448⟧ Bits:30000409 8mm tape, Rational 1000, ENVIRONMENT, D_12_7_3
    └─ ⟦fc9b38f02⟧ »DATA« 
        └─⟦9b46a407a⟧ 
            └─⟦12c68c704⟧ 
                └─⟦this⟧ 
└─⟦5f3412b64⟧ Bits:30000745 8mm tape, Rational 1000, ENVIRONMENT 12_6_5 TOOLS 
    └─ ⟦91c658230⟧ »DATA« 
        └─⟦458657fb6⟧ 
            └─⟦220843204⟧ 
                └─⟦this⟧ 

TextFile

with Io;
with Table_Formatter;
with Time_Utilities;
with Scheduler;
with String_Utilities;
with System_Utilities;

procedure Users (Jobs_Too : Boolean := False; Verbose : Boolean := False) is

    use System_Utilities;
    use Io;
    package Tu renames Time_Utilities;

    function Image (Value   : Long_Integer;
                    Base    : Natural   := 10;
                    Width   : Natural   := 0;
                    Leading : Character := ' ') return String
        renames String_Utilities.Number_To_String;

    Output : File_Type := Current_Output;

    S      : Session_Iterator;
    J_Iter : Job_Iterator;

    function Elapsed (For_Job : Job_Id) return String is
    begin
        return Tu.Image (Elapsed (For_Job));
    end Elapsed;

    function Trim (S : String; Width : Natural; Left : Boolean := False)
                  return String is
    begin
        if S'Length > Width then
            if Left then
                return S (S'Last - Width .. S'Last);
            else
                return S (S'First .. S'First + Width);
            end if;
        else
            return S;
        end if;
    end Trim;

    function Name (S : Session_Id) return String is
    begin
        return User_Name (S) & '.' & Session_Name (S);
    end Name;

    procedure Show_Sessions is

        package Tf is new Table_Formatter (5);
        use Tf;

        procedure Display_Session (S : Session_Id) is
            J         : Job_Iterator;
            Displayed : Boolean := False;
        begin
            Item (Name (S));
            Item (Port'Image (System_Utilities.Terminal (S)));
            Init (J, S);
            while not Done (J) loop
                declare
                    use Scheduler;
                begin
                    if Get_Job_Kind (Value (J)) = Scheduler.Ce then
                        Item (Image (Long_Integer (Value (J))));
                        Item (Tu.Image (Elapsed (Value (J))));
                        Displayed := True;
                        exit;
                    end if;
                end;
                Next (J);
            end loop;
            if not Displayed then
                Item ("?");
                Item ("?");
            end if;
            Item (Image (Input_Count (System_Utilities.Terminal (S))) & "/" &
                  Image (Output_Count (System_Utilities.Terminal (S))));
        end Display_Session;
    begin
        Header ("Session");
        Header ("Line", Right);
        Header ("Job", Right);
        Header ("Time", Right);
        Header ("IO Count", Centered);

        Init (S);
        while not Done (S) loop
            Display_Session (Value (S));
            Next (S);
        end loop;
        Sort;
        Display (Output);

    end Show_Sessions;

    procedure Show_Jobs is
        package Tf is new Table_Formatter (5);
        use System_Utilities;
        J : System_Utilities.Job_Iterator;
    begin
        Io.New_Line;

        Tf.Header ("Owner");
        Tf.Header ("Job");
        Tf.Header ("Elapsed", Tf.Right);
        Tf.Header ("CPU", Tf.Right);
        Tf.Header ("Job Name");
        Init (S);
        while not Done (S) loop
            System_Utilities.Init (J, Value (S));
            while not Done (J) loop
                Tf.Item (Trim (Name (Value (S)), 14, Left => False));
                Tf.Item (Image (Long_Integer (Value (J)))); -- job #
                Tf.Item (Trim (Elapsed (Value (J)), 8, Left => False));
                Tf.Item (Trim (Tu.Image (System_Utilities.Cpu (Value (J))), 8,
                               Left => False));
                Tf.Item (Trim (Job_Name (Value (J)), 37, Left => False));
                Next (J);
            end loop;

            Next (S);
        end loop;
        Tf.Sort;
        Tf.Display (Output);
    end Show_Jobs;
begin
    Io.Put_Line (Output, "Rational Environment " &
                            System_Utilities.System_Boot_Configuration &
                            ", Last boot: " &
                            Tu.Image (Tu.Convert_Time
                                         (System_Utilities.System_Up_Time)));
    Io.New_Line;

    Show_Sessions;
    if Jobs_Too then
        Show_Jobs;
    end if;


end Users;
pragma Main;