// IfsTelnetMemStat.bcpl -- IFS system statistics commands
// Copyright Xerox Corporation 1979, 1980, 1981
// Last modified January 28, 1981  2:40 PM by Taft

get "IfsVMem.decl"

// outgoing procedures

// incoming procedures
Ws; PutTemplate; Plural
LeafVPBIStatistics; PrintMemoryErrors;

// incoming statics
smallZoneOverflows; bigZoneOverflows
numOverflowPages; maxOverflowPages; netAllocBlocks
numOverflowPBIs; maxOverflowPBIs; numPBIs
numVMemBufs; vmemBufferShortages
numOvXMPages; vmStats; leafPresent

let MemStatistics() be
PutTemplate(dsp, "*n*n$UD smallZone overflow$S, $UD bigZone overflow$S",
 smallZoneOverflows, Plural(smallZoneOverflows),
 bigZoneOverflows, Plural(bigZoneOverflows))
PutTemplate(dsp, "*nOverflow pages: present = $D, maximum = $D",
 numOverflowPages, maxOverflowPages)
PutTemplate(dsp, "*nNet blocks allocated minus blocks freed: $D",
PutTemplate(dsp, "*n$D total PBIs; overflow PBIs: present = $D, maximum = $D",
 numPBIs, numOverflowPBIs, maxOverflowPBIs)
PutTemplate(dsp, "*n$D total VMem buffers, $D buffer shortage$S",
 numVMemBufs, vmemBufferShortages, Plural(vmemBufferShortages))
PutTemplate(dsp, "*nVMem    Overlay    VFile       DD     Leaf")
Ws("*nReads ")
for i = 1 to maxVMIType do
   PutTemplate(dsp, "$9ED", lv vmStats>>VMStats.reads↑i)
for i = 1 to maxVMIType do
    PutTemplate(dsp, "$9ED", lv vmStats>>VMStats.writes↑i)
if numOvXMPages ne 0 then
   PutTemplate(dsp, "*n$D XM pages; $ED overlay reads from XM, $ED from disk",
    numOvXMPages, lv vmStats>>VMStats.ovXMReads,
    lv vmStats>>VMStats.ovDiskReads)
if leafPresent then LeafVPBIStatistics()