-- File: StatsStrings.mesa, Last Edit: HGM November 19, 1979 12:09 PM

-- Copyright Xerox Corporation 1979, 1980

DIRECTORY
StringDefs: FROM "StringDefs" USING [EquivalentString],
StatsDefs: FROM "StatsDefs" USING [StatCounterIndex],
StatsPrivateDefs: FROM "StatsPrivateDefs"; -- EXPORTS

StatsStrings: MONITOR
IMPORTS StringDefs
EXPORTS StatsDefs
, StatsPrivateDefs =
BEGIN OPEN StatsDefs;

-- This needs to be kep
t parallel to the definitions in StatsDefs.

statText: PUBLIC ARRAY StatCounterIndex OF STRING ← [

-- General
"***** MouseTrap *****",
"MiliSeconds Wall Time", "Seconds", "Hours",

-- Queue package
"Buffers Enqueued", "Buffers Dequeued", "Buffers extracted from a queue",
"Empty Dequeue calls", "Empty ExtractFromQueue calls",
"FreeQueue Empty", "Waits for a Buffer",

-- Router
"Zapped Packets",
"Junk Broadcast Pups",
"Junk Pups For Us - No Local Socket",
"Packets Discarded", "Pups Discarded",
"Pups Received",
"Pups Sent",
"Pups Broadcast",
"Pup Gateway Info Packets Received",
"Error Pups sent",
"Pups Sent to Unknown Network",
"Pups Not Forwarded",
"Pups recycled - Input Queue Full",
"Pups received with Bad Software Checksum ***",

-- Ethernet Hardware Interface
"Ether Packets Sent", "Ether Words Sent",
"Ether Packets Received", "Ether Words Received",
"Ether Packets copied Locally", "Ether Words copied Locally",
"Ether Packets Received while Sending - InUnderOut",

-- Collisions
"Collisions - once", "Collisions - twice", "Collisions - 3",
"Collisions - 4", "Collisions - 5", "Collisions - 6",
"Collisions - 7", "Collisions - 8", "Collisions - 9",
"Collisions - 10", "Collisions - 11", "Collisions - 12",
"Collisions - 13", "Collisions - 14", "Collisions - 15",
"Collisions - too many",

-- Ethernet driver Glitches
"Lost Ethernet Interrupts ************",
"Missing Ethernet Interrupt Status",
"Ethernet Interrupts during Interrupt",
"Ethernet Resets didn’t Post ************",
"Ethernet Interface Reset",
"Ethernet Packets Stuck in Output",
"Ethernet Input Idle too long",

-- receiver funnys
"Ethernet Receiver Not 16 and OK CRC ******",
"Ethernet Receiver Not 16 and Bad CRC",
"Ethernet Receiver with Bad CRC ***",
"Ethernet Receiver Overran",
"Ethernet Receiver Bad Status",
"Ethernet Packets received that were Too Long",
"Ethernet Packets Klobbered by Reset (to Send)",
"Ethernet Packets Recycled - FreeQueue Empty",
"Ethernet Packets Missed - No Buffer ready",
"Ethernet Input Chain was Empty",

-- transmitter funnys
"Ethernet Packets Sent while Pouring In",
"Ethernet Transmitter Overrun",
"Ethernet Transmitter Bad Status",
"Ethernet Packets sent from Output Queue",

-- Streams
"Data Packets Sent", "Data Bytes Sent",

"Data Packets Received", "Data Bytes Received",
"Marks Sent", "Marks Received",
"Acks Sent", "Acks Received",
"Attentions Sent", "Attentions Received",

"Data Packets Retransmitted",
"Error Packets Sent", "Error Packets Received",

"Data Packets Received Again",
"Data Packets Received Early",
"Data Packets Received Very Late",

"Probes Sent", "Probes Received", "Funny Empty Packets",
"Empty Allocates", "Duplicate Acks",

"Packets Rejected - Bad ID",
"Packets Rejected - Bad Source",
"Packets Rejected - Bad Type",



-- spares for user use
NIL, NIL, NIL, NIL, NIL, NIL, NIL, NIL, NIL, NIL,
NIL, NIL, NIL, NIL, NIL, NIL, NIL, NIL, NIL, NIL,
NIL, NIL, NIL, NIL, NIL, NIL, NIL, NIL, NIL, NIL,
NIL, NIL, NIL, NIL, NIL, NIL, NIL, NIL, NIL, NIL,
NIL, NIL, NIL, NIL, NIL, NIL, NIL, NIL, NIL, NIL,
NIL, NIL, NIL, NIL, NIL, NIL, NIL, NIL, NIL, NIL,
NIL, NIL, NIL, NIL, NIL, NIL, NIL, NIL, NIL, NIL,
NIL, NIL, NIL, NIL, NIL, NIL, NIL, NIL, NIL, NIL,
NIL, NIL, NIL, NIL, NIL, NIL, NIL, NIL, NIL, NIL
];

StatsStringsFull: PUBLIC ERROR = CODE;

StatsStringToIndex: PUBLIC ENTRY PROCEDURE [s: STRING] RETURNS [i: StatCounterIndex] =
BEGIN
-- first, check for the string already existing
FOR i IN StatCounterIndex DO
IF statText[i]#NIL AND StringDefs.EquivalentString[s,statText[i]] THEN RETURN;
ENDLOOP;
-- its not here yet, find a slot for it
FOR i IN StatCounterIndex DO
IF statText[i]=NIL THEN EXIT;
REPEAT FINISHED => ERROR StatsStringsFull;
ENDLOOP;
statText[i] ← s; -- NB: Not copied over
END;

StatsGetText: PUBLIC PROCEDURE RETURNS [
POINTER TO ARRAY StatCounterIndex OF STRING] =
BEGIN
RETURN[@statText];
END;

-- initialization
END.