|
|
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: T V
Length: 8264 (0x2048)
Types: TextFile
Names: »V«
└─⟦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⟧
with Type_Definitions, Calendar;
--------------
package Clocks is
--------------
--| Overview
--|
--| This package contains procedures and functions for managing
--| program unit startng and ending times. In a non-tasking
--| program environment it functions merely as a stack. When a
--| program unit begins execution its starting time is pushed onto
--| the stack. When the unit ends execution its starting time is
--| popped from the stack.
--|
--| However, in a tasking environment when a program unit
--| ends execution its starting time may not necessarily be the top
--| element on the stack. This is true not only for tasks but also
--| for other program units called by tasks. Therefore, tasks
--| must be handled differently than other program units. There must
--| also be a mechanism for determining whether a program unit
--| that is ending execution was also the last currently active
--| program unit to begin execution.
--|
--| To accomplish this, two separate dynamic structures are
--| maintained. Tasks are managed in a dynamic array. All other
--| program units are maintained on a stack with a mechanism
--| for fetching the starting times for units other than the
--| last active unit started. However, when this happens, a
--| fault occurs and the calling program is informed via the
--| boolean flag "Clock_Fault".
--| Requires:
--| Prior to use the calling program must create the clock
--| structures via a call to Create_Clocks.
--| N/A: Requires, Modifies, Errors
use Type_Definitions;
Inactive_Program_Unit : exception;
No_More_Units : exception;
No_More_Tasks : exception;
No_More_Clock_Faults : exception;
type Unit_Start_Times is
record
Unit_Num : Natural;
Start_Time : Calendar.Time;
Stop_Watch : Calendar.Day_Duration;
Sons : Natural;
Grandsons : Natural;
end record;
------------------------ Heap Management --------------------------------
-----------------------
procedure Create_Clocks; --| Create a dynamic Clock structure
--| Effects
--| Creates the dynamic program unit clock structures
--| N/A: Raises, Modifies, Errors
------------------------
procedure Destroy_Clocks; --| Destroy the clock structure
--| Effects
--| Destroys the dynamic program unit clock structures
--| N/A: Raises, Modifies, Errors
----------------------- Constructors ------------------------------------
--------------------
procedure Start_Unit (--| Store a unit starting time in the clock structure
Unit_Id : in Program_Unit_Unique_Identifier;
Unit_Start_Time : in Unit_Start_Times);
--| Effects
--| Saves the starting time of the program unit in a dynamic clock
--| structure
--| N/A: Raises, Modifies, Errors
----------------------
procedure Restart_Unit
(--| Restore a unit starting time to the clock structure
Unit_Start_Time : in Unit_Start_Times);
--| Effects
--| Saves the starting time of the program unit in a dynamic clock
--| structure
--| N/A: Raises, Modifies, Errors
-------------------
procedure Stop_Unit (--| Fetch a unit starting time from the clock structure
Unit_Num : in Natural;
Unit_Id : in Program_Unit_Unique_Identifier;
Unit_Start_Time : out Unit_Start_Times;
Clock_Fault : out Boolean);
--| Raises: Inactive_Program_Unit
--| Effects
--| Retrieves the starting time of the terminating program unit.
--| If the program unit is not a task and and is not the last
--| active program unit started the Clock_Fault is returned true.
--| Otherwise, Clock_Fault is returned false.
--| Modifies
--| The Unit_Start_Time for the specified unit is deleted from
--| the clock structure.
--| N/A: Errors
--------------------
procedure Pause_Unit (--| Remove a unit starting time from the clock
Unit_Start_Time : out Unit_Start_Times);
--| Raises: No_More_Units
--| Effects
--| Retrieves the starting time of the last currently active
--| non-task program unit from the clock structure.
--| Modifies
--| The Unit_Start_Time for the specified unit is deleted from
--| the clock structure.
--| N/A: Errors
----------------------
function Dangling_Unit --| Fetch the unit starting time for a dangling
--| unit from the clock structure
return Unit_Start_Times;
--| Raises: No_More_Units
--| Effects
--| Returns the starting time of a "dangling" unit.
--| A dangling unit is a unit that has been left in the clock
--| structure after all records have been read from the log file.
--| Under normal circumstances this should not occur unless
--| the instrumented program that generated the log file terminated
--| abnormally.
--| Modifies
--| The Unit_Start_Time for the specified unit is deleted from
--| the clock structure.
--| N/A: Requires, Errors
----------------------
function Dangling_Task --| Fetch the unit starting time for a dangling
--| task from the clock structure
return Unit_Start_Times;
--| Raises: No_More_Tasks
--| Effects
--| Returns the starting time of a "dangling" task.
--| A dangling task is a task that has been left in the clock
--| structure after all records have been read from the log file.
--| Under normal circumstances this should not occur unless
--| the task was aborted or the instrumented program that
--| generated the log file terminated abnormally.
--| Modifies
--| The Unit_Start_Time for the specified task is deleted from
--| the clock structure.
--| N/A: Requires, Errors
-------------------------
function Next_Clock_Fault --| Clear and return the unit number of the
--| next clock fault
return Natural;
--| Raises: No_More_Clock_Faults
--| Effects
--| Clears one clock fault and returns the unit number of a non-task
--| program unit that was active when the fault occurred. If no clock
--| faults are outstanding then the exception No_More_Clock_Faults
--| is raised.
--| Requires;
--| The calling program must check for outstanding clock faults via
--| the function More_Clock_Faults.
--| N/A: Modifies, Errors
----------------------- Queries --------------------------------------
----------------------
function Previous_Unit --| Return the starting time of the last active
--| non task program unit to begin execution
return Unit_Start_Times;
--| Raises: No_More_Units
--| Effects
--| Returns the starting time of the last active non-task
--| program unit to begin execution. This function is
--| non-destructive, i.e., the starting time of the unit is
--| not deleted from the structure.
--| N/A: Modifies, Errors
-------------------
function More_Units --| Return true if more non-task program units in clock
return Boolean;
--| Effects
--| Returns true if one or more non-task program units remain in
--| the clock structure.
--| N/A: Raises, Modifies, Errors
-------------------
function More_Tasks --| Return true if more tasks in clock
return Boolean;
--| Effects
--| Returns true if one or tasks remain in the clock structure.
--| N/A: Raises, Modifies, Errors
--------------------------
function More_Clock_Faults --| Returns true if clock faults remain uncleared
return Boolean;
--| Effects
--| Checks to see if any clock faults remain uncleared. Returns true if
--| any clock faults remain, otherwise returns false;
--| N/A: Raises, Requires, Modifies, Errors
end Clocks;