ProcessWatch.Mesa
Spreitzer, March 31, 1986 11:32:43 pm PST
DIRECTORY Basics, Loader, PrincOps, PrincOpsUtils, Process, Terminal;
ProcessWatch: CEDAR DEFINITIONS
= {
PsbIndex: TYPE = PrincOps.PsbIndex;
nUsefulPsbs: CARDINAL = 256;
UsefulPsbIndex: TYPE = PsbIndex[0 .. nUsefulPsbs);
PsbHandle: TYPE = PrincOps.PsbHandle;
PsbLink: TYPE = PrincOps.PsbLink;
ProcessStateBlock: TYPE = PrincOps.ProcessStateBlock;
PDA: PrincOps.PDABase = PrincOps.PDA;
FrameHandle: TYPE = PrincOps.FrameHandle;
ReadyVector: TYPE = PACKED ARRAY UsefulPsbIndex OF BOOL;
readyVector: ReadyVector;
Consumer: TYPE = RECORD [
Consume: PROC [data: REF ANY],
data: REF ANYNIL];
AddConsumer: PROC [c: Consumer];
TooManyConsumers: ERROR;
RemoveConsumer: PROC [c: Consumer];
NotFound: ERROR;
Stack: TYPE = RECORD [
end: FrameIndex ← 0,
wrapped: BOOLFALSE,
frames: ARRAY FrameIndex OF Frame ← ALL[]
The first warmFrames frames are from the warm end of the stack.
The last coolFrames frames are a circular buffer of the coolest frames, starting at (IF wrapped THEN end ELSE warmFrames).
IF NOT wrapped, this captures an entire stack.
];
FrameIndex: TYPE = NAT [0 .. maxFrames);
maxFrames: NAT = coolFrames + warmFrames;
coolFrames: NAT = 8;
warmFrames: NAT = 8;
Frame: TYPE = RECORD [
repeat: RepeatCount ← 0,
gf: PrincOps.GlobalFrameHandle ← NIL,
pc: PrincOps.BytePC ← [0]];
RepeatCount: TYPE = [0 .. 64);
ProcessHistories: TYPE = REF ProcessHistoryArray;
ProcessHistoryArray: TYPE = ARRAY UsefulPsbIndex OF ProcessHistory;
ProcessHistory: TYPE = RECORD [
lastPriority: Process.Priority ← 0,
lastStack: Stack ← []
];
GetHistory: PROC [pi: UsefulPsbIndex] RETURNS [ph: ProcessHistory];
}.