-- IntervalTimerTest.mesa
Last Edited by: Swinehart, March 8, 1983 9:31 am
Last Edited by: L. Stewart March 24, 1983 12:22 pm
DIRECTORY
IntervalTimer,
IO,
Process,
UserExec;
IntervalTimerTest: PROGRAM
IMPORTS IntervalTimer, IO, Process, UserExec = {
out: IO.STREAM;
SetStream: UserExec.CommandProc =
TRUSTED {
out ← exec.GetStreams[].out;
};
Test: UserExec.CommandProc =
TRUSTED {
out ← exec.GetStreams[].out;
Start[4 * 1000000];
Start[10 * 1000000];
Start[1 * 1000000];
Start[8 * 1000000];
Start[5 * 1000000];
Start[9 * 1000000];
Start[2 * 1000000];
Start[6 * 1000000];
Start[3 * 1000000];
Start[7 * 1000000];
};
Uest: UserExec.CommandProc =
TRUSTED {
out ← exec.GetStreams[].out;
TTart[IntervalTimer.Now[] + 4];
TTart[IntervalTimer.Now[] + 10];
TTart[IntervalTimer.Now[] + 1];
TTart[IntervalTimer.Now[] + 8];
TTart[IntervalTimer.Now[] + 5];
TTart[IntervalTimer.Now[] - 9];
TTart[IntervalTimer.Now[] + 2];
TTart[IntervalTimer.Now[] + 6];
TTart[IntervalTimer.Now[] + 3];
TTart[IntervalTimer.Now[] - 7];
};
Start: PROC[pulses: LONG CARDINAL] = {
Process.Detach[FORK Wait[pulses]];
};
TTart: PROC[pulses: LONG CARDINAL] = {
Process.Detach[FORK Xait[pulses]];
};
Wait: PROC[pulses: LONG CARDINAL] = {
IntervalTimer.WaitForExpirationInterval[pulses];
IF out # NIL THEN out.PutF["%d\n", IO.card[pulses]];
};
Xait: PROC[pulses: LONG CARDINAL] = {
IntervalTimer.WaitForExpirationTime[pulses];
IF out # NIL THEN out.PutF["%d\n", IO.card[pulses]];
};
Now: PROC RETURNS [pulses: LONG CARDINAL] = {
RETURN[IntervalTimer.Now[]];
};
NowInPulses: PROC RETURNS [pulses: LONG CARDINAL] = {
RETURN[IntervalTimer.NowInPulses[]];
};
UserExec.RegisterCommand["ITTest", Test, "Test IntervalTimer"];
UserExec.RegisterCommand["JTTest", Uest, "Test IntervalTimer another way"];
UserExec.RegisterCommand["SetStream", SetStream, "Set printout stream for IntervalTimer test"];
}.