Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-09 - 43,50466/times.mac
There are 2 other files named times.mac in the archive. Click here to see a list.
	TITLE TIMES SUBROUTINE AND OTHERS
;
	INTERNAL TIMES,RSAC,RELEA
	OPDEF TTCALL [51B8]
	OPDEF RESET.[15B8]
;
;	RSAC IS A ROUTINE TO FIND IF THERE HAS BEEN ANY INPUT FROM
;	THE TTY. THE TWO INPUTS IT CHECKS FOR ARE "^" AND "_".
;	IF IT FINDS ANOTHER CHARACTER THERE IS AND ERROR AND IT RETURNS
;	A TRUE VALUE.
;	THE FIRST ONE IS THE TTY COMMAND TO STOP EXECUTION OF A PART
;	OF A PROGRAM.
;	THE SECOND ONE IS USED TO STOP THE LISTING OF THE
;	HELP COMMAND
;
RSAC:	0
	MOVE	1,@(16)	;GET PARAMETER
	TTCALL	2,3
	JRST	EXIT
	JUMPN	1,RTARR	;JUMP IF NOT 0
	CAIE	3,"^"	;SKIP IF STOP CHARACTER
	JRST	FALSE	; NOPE, MUST BE SOMETHING WRONG
	JRST	EXIT-2
RTARR:	CAIE	1,12	;IF NOT 10 (DECMAL) THEN ERROR
	HALT
	CAIE	3,"_"
	JRST	FALSE	;NOPE, MUST BE SOMETING WRONG
	JRST	EXIT-2
	SETO	0,
	JRA	16,1(16)
EXIT:	SETZ	0,
	JRA	16,1(16)
FALSE:	TTCALL	11,	;CLEAR INPUT BUFFER
	TTCALL	3,[ASCIZ/
?
/]	;OUTPUT ERROR QUESTION MARK
	JRST	EXIT	;GOOD-BYE
;
;
;	NOW FOR THE TIME SUBROUTINE
;	TIMES GETS BOTH THE CPU TIME AND THE ELAPSED TIME
;	FOR THE JOB IN WHICH IT IS RUNNING
;
TIMES:	0
	MOVE	4,@3(16)	;GET INPUT PARAMETER
	CALLI	2,23	;READ CLOCK IN MSEC
	SETZ	3,	;SET TO ZERO SO TIME IS THIS JOB
	CALLI	3,27	;READ CPU TIME FOR THIS JOB
	MOVE	5,2	;SAVE TIME INCASE RESET
	MOVE	1,3	;SAVE CPU TIME INCASE RESET
	JUMPE	4,RESET	;THEY WANT TO RESET TIMES
	SUB	1,CPUTIME	;GET CPU TIME UNTIL NOW
	MOVEM	1,@0(16)	;PUT IN VARIABLE
	SUB	5,STIME	;SUBTRACT START TIME
	IDIVI	5,^D1000	;DIVIDE BY 1000 DROP MSEC
	IDIVI	5,^D60	;CONVERT TO HRS, SEC
	MOVEM	5,@1(16)	;PUT OUT HOURS
	MOVEM	6,@2(16)	; PUT OUT SEC
	CAIE	4,2
	JRA	16,4(16)
RESET:	MOVEM	3,CPUTIME	;STORE CPU TIME
	MOVEM	2,STIME	;STORE START TIME
	JRA	16,4(16)
CPUTIME:	0
STIME:	0
;
;	THE RELEAS ROUTINE DOES A FORTRAN "RESET."- THEREBY RELEASING
;	ALL DEVICES
;	IT IS USED SO AS TO ENTER DIFFERENT FILE NAMES ON A 
;	DEVICE
;
;
;	DEFINED THE FORTRAN RESET. UUO
;
RELEA:	0
	RESET.
	JRA	16,0(16)
	END