GGStatistics.mesa
Copyright © 1986 by Xerox Corporation. All rights reserved.
Last edited by Bier on June 18, 1986
Contents: Routines for maintaining a table of average times for user-specified operations.
DIRECTORY
BasicTime, IO;
GGStatistics: CEDAR DEFINITIONS =
BEGIN
Table: TYPE = REF TableObj;
TableObj: TYPE = RECORD [
intervals: LIST OF Interval,
name: ATOM
];
Interval: TYPE = REF IntervalObj;
IntervalObj: TYPE = RECORD [
name: ATOM,
subintervals: LIST OF Interval,
starts, stops, unmatchedStarts: NAT,
startTime: BasicTime.Pulses,
totalTime: BasicTime.Pulses,
maxTime: BasicTime.Pulses,
maxIndex: NAT,
minTime: BasicTime.Pulses
];
Getting ready to test performance.
CreateTable: PROC [name: ATOM] RETURNS [table: Table];
Creates a table and registers it in a global database, so it can be retrieved by name. If a table of this name already exists, it is reset and returned.
GetTable: PROC [name: ATOM] RETURNS [table: Table];
Retrieve a table by name. StartInterval[$IntervalName, GetTable[$TableName]] is a sensible way to start an interval that is deep in the code of a known application.
ResetTable: PROC [table: Table];
Set all of the interval times to zero.
CreateInterval: PROC [name: ATOM, subintervals: LIST OF Interval ← NIL] RETURNS [interval: Interval];
AddInterval: PROC [interval: Interval, table: Table];
AddInt: PROC [interval: Interval, tableName: ATOM];
Equivalent to AddInterval[interval, GetTable[tableName]].
ResetInterval: PROC [name: ATOM, table: Table];
Testing performance.
StartInterval: PROC [name: ATOM, table: Table];
StartInt: PROC [intervalName: ATOM, tableName: ATOM];
Equivalent to StartInterval[intervalName, GetTable[tableName]].
StopInterval: PROC [name: ATOM, table: Table];
StopInt: PROC [intervalName: ATOM, tableName: ATOM];
Equivalent to StopInterval[intervalName, GetTable[tableName]].
Printing results.
PrintTable: PROC [f: IO.STREAM, table: Table];
END.