-- File: StatsDefs.mesa,  Last Edit: HGM January 7, 1981  4:36 PM

StatsDefs: DEFINITIONS =
  BEGIN

  WindowHandle: TYPE = POINTER; -- Beware of compilation order problems

  -- these routines bump the actual counters
  StatIncr: PROCEDURE [StatCounterIndex];
  StatBump: PROCEDURE [StatCounterIndex, CARDINAL];
  StatGetCounter: PROCEDURE [StatCounterIndex] RETURNS [LONG CARDINAL];

  StatNew: PROCEDURE; -- call before MakeImage to remember Date+Time
  StatStart: PROCEDURE [WindowHandle, STRING];
  -- prints header line, resets counters
  StatPrintCurrent: PROCEDURE [WindowHandle]; -- prints totals so far
  StatFinish: PROCEDURE [WindowHandle]; -- prints grand totals

  -- there is also a second parallel set of counters that can be used
  -- for local timings without klobbering the totals for the whole run
  StatReady: PROCEDURE; -- resets extra set of counters
  StatSince: PROCEDURE [WindowHandle]; -- print, then reset extra set of counters


  -- extra hooks for do it yourself types

  -- Allocates one of the spares if the STRING is not already known.
  -- NB: The STRING is NOT copied over.  Be sure it does not go away.
  StatsStringToIndex: PROCEDURE [STRING] RETURNS [StatCounterIndex];
  StatsStringsFull: ERROR;

  StatUpdate: PROCEDURE;
  StatsGetCounters: PROCEDURE
    RETURNS [POINTER TO ARRAY StatCounterIndex OF LONG CARDINAL];
  StatsGetText: PROCEDURE RETURNS [POINTER TO ARRAY StatCounterIndex OF STRING];

  --  ******** keep Text in StatsStrings up to date too!!

  StatCounterIndex: TYPE = {

    -- General
    statMouseTrap, -- for anybody to use
    statTime, -- Time in MiliSeconds
    statSeconds, -- Time in Seconds
    statHours, -- Time in Hours

    -- Queue Package
    statEnqueue, statDequeue, statXqueue, statDequeueNIL, statXqueueNIL,
    statNoBuffer, statBufferWaits, statRecyclingZombieBuffersTime,


    -- Router
    statZappedP, -- Lightning
    statJunkBroadcastPups, statJunkBroadcastOis, statJunkPupsForUsNoLocalSocket,
    statJunkOisForUsNoLocalSocket, statPacketsDiscarded, statPupsDiscarded,
    statOisDiscarded, statPupReceived, statOisReceived, statPupForwarded,
    statOisForwarded, statPupSent, statOisSent, statPupBroadcast,
    statOisBroadcast, statPupGatewayPacketsRecv, statOisGatewayPacketsRecv,
    statErrorPupsSent, statOisErrorPacketsSent, -- not via stream
    statPupsSentNowhere, statOisSentNowhere, statPupNotForwarded,
    statOisNotForwarded, statPupInputQueueOverflow, statOisInputQueueOverflow,
    pupTooShort, statReceivedBadPupChecksum, statReceivedBadOisChecksum,

    -- Low level debugging
    pupsEchoed, pupsBadEchoed, pupBytesEchoed, packetsEchoed, packetsBadEchoed,
    bytesEchoed,

    -- EtherNet Hardware Interface
    statEtherPacketsSent, statEtherWordsSent, statEtherPacketsReceived,
    statEtherWordsReceived, statEtherPacketsLocal, statEtherWordsLocal,
    statEtherInUnderOut,

    -- Collisions
    statEtherSendsCollision1, statEtherSendsCollision2, statEtherSendsCollision3,
    statEtherSendsCollision4, statEtherSendsCollision5, statEtherSendsCollision6,
    statEtherSendsCollision7, statEtherSendsCollision8, statEtherSendsCollision9,
    statEtherSendsCollision10, statEtherSendsCollision11,
    statEtherSendsCollision12, statEtherSendsCollision13,
    statEtherSendsCollision14, statEtherSendsCollision15,
    statEtherSendsCollisionLoadOverflow,

    -- Ethernet driver Glitches
    statEtherLostInterrupts, statEtherMissingStatus,
    statEtherInterruptDuringInterrupt, statResetDidntPost, statInterfaceReset,
    statPacketsStuckInOutput, statInputIdle,

    -- receiver funnys
    statEtherReceivedNot16, statEtherReceivedNot16BadCRC, statEtherReceivedBadCRC,
    statEtherReceivedOverrun, statEtherReceivedBadStatus,
    statEtherReceivedTooLong, statEtherReceivedKlobberedByReset,
    statEtherEmptyFreeQueue, statEtherEmptyNoBuffer, statEtherEmptyInputChain,

    -- transmitter funnys
    statEtherSendWhileReceiving, statEtherSendOverrun, statEtherSendBadStatus,
    statEtherSendFromOutputQueue,


    -- 8/32/48 translation things
    cacheFault, unsuccessfulTranslation, translationRetries, requestsForMe,
    cacheDepth,

    -- Streams
    statDataPacketsSent, statDataBytesSent, statDataPacketsReceived,
    statDataBytesReceived, statMarksSent, statMarksReceived, statAckRequestsSent,
    statAckRequestsReceived, statAcksSent, statAcksReceived,
    statSystemPacketsSent, statSystemPacketsReceived, statAttentionsSent,
    statAttentionsReceived,

    statDataPacketsRetransmitted, statErrorPacketsSent, statErrorPacketsReceived,

    statDataPacketsReceivedAgain, statDataPacketsReceivedEarly,
    statDataPacketsReceivedVeryLate,

    statProbesSent, statProbesReceived, statEmptyFunnys, statEmptyAlloc,
    statDuplicateAcks,

    statPacketsRejectedBadID, statPacketsRejectedBadSource,
    statPacketsRejectedBadType,


    -- spares for other use
    statSpares0, statSpares1, statSpares2, statSpares3, statSpares4, statSpares5,
    statSpares6, statSpares7, statSpares8, statSpares9, statSpares10,
    statSpares11, statSpares12, statSpares13, statSpares14, statSpares15,
    statSpares16, statSpares17, statSpares18, statSpares19, statSpares20,
    statSpares21, statSpares22, statSpares23, statSpares24, statSpares25,
    statSpares26, statSpares27, statSpares28, statSpares29, statSpares30,
    statSpares31, statSpares32, statSpares33, statSpares34, statSpares35,
    statSpares36, statSpares37, statSpares38, statSpares39, statSpares40,
    statSpares41, statSpares42, statSpares43, statSpares44, statSpares45,
    statSpares46, statSpares47, statSpares48, statSpares49, statSpares50,
    statSpares51, statSpares52, statSpares53, statSpares54, statSpares55,
    statSpares56, statSpares57, statSpares58, statSpares59, statSpares60,
    statSpares61, statSpares62, statSpares63, statSpares64, statSpares65,
    statSpares66, statSpares67, statSpares68, statSpares69, statSpares70,
    statSpares71, statSpares72, statSpares73, statSpares74, statSpares75,
    statSpares76, statSpares77, statSpares78, statSpares79, statSpares80,
    statSpares81, statSpares82, statSpares83, statSpares84, statSpares85,
    statSpares86, statSpares87, statSpares88, statSpares89, statSpares90,
    statSpares91, statSpares92, statSpares93, statSpares94, statSpares95,
    statSpares96, statSpares97, statSpares98, statSpares99

    };

  END.