-- OtherPerformers.mesa
-- Edited by Paul Rovner on 7-Jan-82 16:00:13
-- Jlarson, July 10, 1985 4:45:19 pm PDT
DIRECTORY
Plotter USING [Create],
Process USING [Pause, SecondsToTicks, Detach],
Real USING [FixC],
RealEvent USING [CreateTimerDrivenStream, StreamHandle, Object],
RTBases USING [GetDQIS],
RTMicrocode USING [RCFINALIZECOUNT],
RTProcess USING [GetTotalPageFaults],
RTRefCounts USING [QuantizedAllocatorTrapStats, PrefixedAllocatorTrapStats, GCState, ProbeSize],
SafeStorage USING [NWordsAllocated, NWordsReclaimed],
Timer USING[Seconds, Create, Read, Handle];
OtherPerformers: PROGRAM
IMPORTS Plotter, Process, Real, RealEvent, RTBases, RTMicrocode, RTProcess, RTRefCounts, SafeStorage, Timer
= BEGIN
samplingInterval: Timer.Seconds = 5;
nEvents: NAT = 100;
testingCoForkStuff: BOOLEAN = FALSE;
-- SAMPLING PROCEDURES
QuantaISSampler: PROC[s: REF ANY] RETURNS[REAL] =
{RETURN[RTBases.GetDQIS[]];
};
WordsISSampler: PROC[s: REF ANY] RETURNS[REAL] =
{RETURN[SafeStorage.NWordsAllocated[] - SafeStorage.NWordsReclaimed[]];
};
FinalizeCountSampler: PROC[s: REF ANY] RETURNS[REAL] =
{RETURN[RTMicrocode.RCFINALIZECOUNT[]];
};
RCOverflowUsageSampler: PROC[s: REF ANY] RETURNS[REAL] =
{overflowUsage: REAL = RTRefCounts.GCState.GCEventCounters.OTCellCreate - RTRefCounts.GCState.GCEventCounters.OTCellDelete;
RETURN[overflowUsage];
};
RCTableFullnessSampler: PROC[s: REF ANY] RETURNS[REAL] =
{htFullness: REAL ← RTRefCounts.GCState.GCEventCounters.HTCellCreate - RTRefCounts.GCState.GCEventCounters.HTCellDelete;
RETURN[(htFullness*100.0)/RTRefCounts.ProbeSize];
};
AllocTrapsSampler: PROC[s: REF ANY] RETURNS[REAL] =
{RETURN[RTRefCounts.PrefixedAllocatorTrapStats.ZoneLockedTraps
+ RTRefCounts.PrefixedAllocatorTrapStats.NoBlockFoundTraps
+ RTRefCounts.PrefixedAllocatorTrapStats.LongFreeListTraps
+ RTRefCounts.QuantizedAllocatorTrapStats.ZoneLockedTraps
+ RTRefCounts.QuantizedAllocatorTrapStats.NoBlockFoundTraps
+ RTRefCounts.QuantizedAllocatorTrapStats.LongFreeListTraps];
};
RCOpsSampler: PROC[s: REF ANY] RETURNS[REAL] =
{RETURN[RTRefCounts.GCState.GCEventCounters.AlterCountDecrement
+ RTRefCounts.GCState.GCEventCounters.AlterCountIncrement
+ RTRefCounts.GCState.GCEventCounters.AlterCountZeroChange*2];
};
PageFaultSampleProducer: PROC[self: REF ANY,sink: RealEvent.StreamHandle] =
{timer: Timer.Handle = Timer.Create[];
dt: CARDINAL = Real.FixC[samplingInterval]; -- seconds
DO
sink.procs.put[sink, NEW[RealEvent.Object ← [sampleValue: RTProcess.GetTotalPageFaults[],
time: timer.Read[].time]]];
IF sink.procs.endOf[sink] THEN EXIT;
Process.Pause[Process.SecondsToTicks[dt]];
ENDLOOP;
};
WordsInServiceSampleProducer: PROC[sink: RealEvent.StreamHandle] =
{timer: Timer.Handle = Timer.Create[];
dt: CARDINAL = Real.FixC[samplingInterval]; -- seconds
DO
sink.procs.put[sink, NEW[RealEvent.Object ← [sampleValue: SafeStorage.NWordsAllocated[] - SafeStorage.NWordsReclaimed[],
time: timer.Read[].time]]];
IF sink.procs.endOf[sink] THEN EXIT;
Process.Pause[Process.SecondsToTicks[dt]];
ENDLOOP;
};
-- START HERE...Create performance plotters
[] ← Plotter.Create[label: "dataQuantaInServiceHistory",
autoRepaint: TRUE,
nEvents: nEvents,
eventSource: RealEvent.CreateTimerDrivenStream[interval: samplingInterval, sampler: QuantaISSampler]];
[] ← Plotter.Create[label: "wordsInServiceHistory",
autoRepaint: TRUE,
nEvents: nEvents,
eventSource: RealEvent.CreateTimerDrivenStream[interval: samplingInterval, sampler: WordsISSampler]];
[] ← Plotter.Create[label: "rcFinalizeCountHistory",
autoRepaint: TRUE,
nEvents: nEvents,
eventSource: RealEvent.CreateTimerDrivenStream[interval: samplingInterval, sampler: FinalizeCountSampler]];
[] ← Plotter.Create[label: "rcOverflowUsageHistory",
autoRepaint: TRUE,
nEvents: nEvents,
eventSource: RealEvent.CreateTimerDrivenStream[interval: samplingInterval, sampler: RCOverflowUsageSampler]];
[] ← Plotter.Create[label: "rcTableFullnessHistory",
autoRepaint: TRUE,
nEvents: nEvents,
eventSource: RealEvent.CreateTimerDrivenStream[interval: samplingInterval, sampler: RCTableFullnessSampler]];
[] ← Plotter.Create[label: "allocTrapsPerSecHistory",
autoRepaint: TRUE,
nEvents: nEvents,
plotValueDifferences: TRUE,
plotValuePerSecond: TRUE,
eventSource: RealEvent.CreateTimerDrivenStream[interval: samplingInterval, sampler: AllocTrapsSampler]];
[] ← Plotter.Create[label: "rcOpsPerSecHistory",
autoRepaint: TRUE,
nEvents: nEvents,
plotValueDifferences: TRUE,
plotValuePerSecond: TRUE,
eventSource: RealEvent.CreateTimerDrivenStream[interval: samplingInterval, sampler: RCOpsSampler]];
END.