Google
 

Trailing-Edge - PDP-10 Archives - BB-AE97C-BM - sources/tracer.mac
There are 24 other files named tracer.mac in the archive. Click here to see a list.
	TITLE	TRACER

	SEARCH	MACSYM,MONSYM
;****************************************************************************
;*									    *
;*  COPYRIGHT (C) 1985                                                      *
;*  BY DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.			    *
;*  ALL RIGHTS RESERVED.                                                    *
;* 									    *
;*  THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND  COPIED  *
;*  ONLY  IN  ACCORDANCE  WITH  THE  TERMS  OF  SUCH  LICENSE AND WITH THE  *
;*  INCLUSION OF THE ABOVE COPYRIGHT NOTICE.  THIS SOFTWARE OR  ANY  OTHER  *
;*  COPIES  THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY  *
;*  OTHER PERSON.  TITLE TO AND OWNERSHIP OF  THE  SOFTWARE  IS  HEREBY     *
;*  TRANSFERRED.							    *
;* 									    *
;*  THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE  WITHOUT  NOTICE  *
;*  AND  SHOULD  NOT  BE  CONSTRUED  AS  A COMMITMENT BY DIGITAL EQUIPMENT  *
;*  CORPORATION.							    *
;* 									    *
;*  DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR  RELIABILITY  OF  ITS  *
;*  SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DIGITAL.		    *
;*									    *
;****************************************************************************

;
; This program converts the data file produced by the trace routine into a
; listing file. The source file is assumed to be TRACE.DAT and the listing
; file is TRACE.LST.
;

	A=1
	B=2
	C=3
	D=4
	E=5
	F=6
	P=17

; Locations in the record buffer:

	.TNAME=0			;NAME OF ROUTINE
	.TCNT=2				;ENTRY COUNTER
	.TENT=4				;TIME OF ENTRY
	.TTIM=5				;TOTAL TIME IN ROUTINE
	.TSCNT=7			;NUMBER OF STACK ITEMS
	.TSTK=10			;FIRST STACK ITEM

; The following entries must be offset by STKMAX

	.TAC1=10			;CONTENTS OF AC1 ON EXIT
	.TLNAM=11			;NAME OF LOCATION
	.TLVAL=13			;CONTENTS OF LOCATION
	PAGE
TRACER::
	MOVE	P,[IOWD 20,STACK]
	HRLI	A,(GJ%OLD)
	MOVE	B,[POINT 7,[ASCIZ /TRACE.DAT/]]
	GTJFN
	 ERJMP	ERROR
	HRRZM	A,DATJFN
	MOVEI	B,OF%RD
	OPENF				;OPEN THE DATA FILE
	 ERJMP	ERROR

	HRLI	A,(GJ%FOU)
	MOVE	B,[POINT 7,[ASCIZ /TRACE.LST/]]
	GTJFN
	 ERJMP	ERROR
	HRRZM	A,LSTJFN
	MOVE	B,[7B5+OF%WR]
	OPENF				;OPEN THE LIST FILE
	 ERJMP	ERROR

	MOVE	A,DATJFN
	MOVE	B,[POINT 36,RECBUF]
	MOVNI	C,4
	SIN				;READ THE FILE HEADER
	 ERJMP	ERROR

	MOVE	A,LSTJFN
	MOVE	B,[POINT 7,[ASCIZ /Date and time of trace: /]]
	SETZB	C,D
	SOUT
	 ERJMP	ERROR
	MOVE	B,RECBUF
	ODTIM
	 ERJMP	ERROR

	MOVE	B,[POINT 7,[ASCIZ /
Program name: /]]
	SOUT
	 ERJMP	ERROR
	MOVE	B,RECBUF+1
	CALL	SIXOUT
	MOVE	B,[POINT 7,[ASCIZ /


/]]
	SOUT
	 ERJMP	ERROR

	HRRZ	A,RECBUF+2
	MOVEM	A,RECLEN		;LENGTH OF A RECORD
	HLRZ	A,RECBUF+2
	MOVEM	A,STKMAX		;MAXIMUM NUMBER OF STACK ITEMS
	MOVE	A,RECBUF+3
	MOVEM	A,BASE			;BASE RUNTIME

	MOVE	A,LSTJFN
	MOVE	B,[POINT 7,LSTHDR]
	SETZB	C,D
	SOUT				;HEADER
	 ERJMP	ERROR

LST.0:
	MOVE	A,DATJFN
	MOVE	B,[POINT 36,RECBUF]
	MOVN	C,RECLEN
	SIN
	 ERJMP	CHECK

	MOVE	A,[POINT 7,LSTBUF]
	CALL	SPACE1
	MOVE	B,RECBUF+.TNAME
	CALL	SIXOUT			;ROUTINE NAME
	MOVE	B,RECBUF+.TCNT
	MOVE	C,[NO%LFL+4B17+^D10]
	NOUT				;ENTRY COUNTER
	 JFCL
	CALL	SPACE2
	MOVE	B,RECBUF+.TENT
	SUB	B,BASE			;ENTRY TIME RELATIVE
	MOVE	C,[NO%LFL+7B17+^D10]
	NOUT				;ENTRY TIME
	 JFCL
	CALL	SPACE2
	MOVEI	F,RECBUF
	ADD	F,STKMAX
	MOVE	B,.TAC1(F)
	CALL	BINOUT			;CONTENTS OF AC1
	MOVE	B,.TLNAM(F)
	JUMPE	B,[MOVE	  E,A
		   MOVEI  D,^D22
		   MOVE   B,[POINT 7,SPACES]
		   MOVEI  A,^D22
		   EXTEND A,[MOVSLJ]
		    JFCL
		   MOVE   A,E
		   JRST	  LST.1]
	CALL	SIXOUT			;LOCATION NAME
	MOVE	B,.TLVAL(F)
	CALL	BINOUT			;LOCATION VALUE
LST.1:
	MOVEI	F,RECBUF+.TSTK
	MOVN	B,RECBUF+.TSCNT
	JUMPE	B,LST.3
	HRL	F,B			;AOBJN POINTER TO STACK ITEMS
LST.2:
	MOVE	B,(F)
	CALL	BINOUT			;A STACK ITEM
	AOBJN	F,LST.2
LST.3:
	MOVEI	B,15
	IDPB	B,A
	MOVEI	B,12
	IDPB	B,A
	SETZ	B,
	IDPB	B,A			;END ON <CR><LF><NUL>
	MOVE	A,LSTJFN
	MOVE	B,[POINT 7,LSTBUF]
	SETZB	C,D
	SOUT				;WRITE THE RECORD
	JRST	LST.0			;LOOP FOR MORE

	PAGE

SIXOUT:				;OUTPUT A SIXBIT WORD
	PUSH	P,B
	MOVE	C,[POINT 6,(P)]		;POINT TO DATA
SIX.1:
	ILDB	B,C
	ADDI	B," "			;MAKE ASCII
	BOUT				;PUT TO RIGHT PLACE
	TLNE	C,770000		;ANY MORE?
	 JRST	SIX.1
	POP	P,B
					;FALL INTO SPACE2

SPACE2:
	MOVEI	B," "
	IDPB	B,A
SPACE1:
	MOVEI	B," "
	IDPB	B,A
	RET

BINOUT:				;OUTPUT OCTAL NUMBER
	PUSH	P,B
	TLNN	B,-1			;RIGHT HALF ONLY?
	 JRST	[MOVE	E,A
		 MOVEI	D,^D8		;YES - SPACE OUT THE LEFT HALF
		 MOVE	B,[POINT 7,SPACES]
		 MOVEI	A,^D8
		 EXTEND	A,[MOVSLJ]
		  JFCL
		 MOVE	A,E
		 JRST	BIN.1]
	HLRZS	B			;GET LEFT HALF
	MOVE	C,[NO%MAG+NO%LFL+6B17+^D8]
	NOUT				;OUTPUT HALF WORD
	 ERJMP	ERROR
	MOVEI	B,","			;PUT IN THE COMMAS
	IDPB	B,A
	IDPB	B,A
BIN.1:
	HRRZ	B,(P)
	MOVE	C,[NO%MAG+NO%LFL+6B17+^D8]
	NOUT				;OUTPUT HALF WORD
	 ERJMP	ERROR
	POP	P,B
	JRST	SPACE2			;AND PUT IN THE SPACES

	PAGE

CHECK:
	MOVE	A,LSTJFN
	CLOSF				;CLOSE LIST FILE
	 JFCL
	MOVE	A,DATJFN
	CLOSF				;CLOSE DATA FILE
	 JFCL
	TMSG	<Done
>
	HALTF
ERROR:
	MOVEI	A,.PRIOU
	MOVE	B,[.FHSLF,,-1]
	SETZ	C,
	ERSTR
	 JFCL
	 JFCL
	HALTF

	PAGE

SPACES:	ASCIZ /                      /
STACK:	BLOCK	20
DATJFN:	0				;JFN OF DATA FILE
RECBUF:	BLOCK	^D20
STKMAX:	0				;MAX ITEMS OF STACK
RECLEN:	0				;LENGTH OF A RECORD
BASE:	0				;BASE RUNTIME
LSTJFN:	0
LSTBUF:	BLOCK	^D26
LSTHDR:	ASCIZ	/
Routine  Entry Runtime       AC1            Location                                 Stack    Arguments
 Name     #      (mS)     Contents       Name     Contents           #1              #2              #3              #4
_______  ____  _______  ______________  ______  ______________  ______________  ______________  ______________  ______________

/

	END	TRACER