Trailing-Edge
-
PDP-10 Archives
-
decuslib10-12
-
43,50554/4/prf.mac
There is 1 other file named prf.mac in the archive. Click here to see a list.
title prf
;
; routine to collect performance data using gettabs
; fortran callable as follows
;
; CALL PRF
;
; uses a common array PRFDAT
;
.common prfdat [20]
pd=prfdat ;alternate name
;
; prfdat data word definitions
.datm==0 ;daytime (universal date-time)
.smem==1 ;system memory size (words)
.jobs==2 ;number of jobs
.upt==3 ;uptime (tics)
.usr==4 ;user time (tics)
.oht==5 ;overhead time (tics)
.nul==6 ;null time (tics)
.lst==7 ;lost time (tics)
.idl==10 ;idle time (tics)
.cr==11 ;cpu response (tics)
.ncr==12 ;number of cpu responses (tics)
.vcrh==13 ;high order variance squared of cpu response (tics)
.vcrl==14 ;low order variance squared of cpu response (tics)
.umem==15 ;user memory size (words)
.vmem==16 ;virtual memory used (words)
;
; ac definitions
t==1
s==2
r==3
f==16
p==17
;
search uuosym
sall
;
; definition of gettab macro
define gt(gtparm,pl)<
move t,[gtparm] ;get gettab parameter
gettab t, ;do the gettab
jrst gterr ;error?
movem t,pl ;store data in prfdat
>
;
; ****** execution ******
;
prf::
gt(%cndtm,pd+.datm)
gt(%nsmms,pd+.smem) ;t=size of physical memory
move r,[%cnsiz] ;get size of monitor low segment
gettab r,
jrst gterr
move s,[%cnhsl] ;get size of monitor high segment
gettab s,
jrst gterr
add s,r ;sum of monitor sizes
sub t,s ;remainder is available to users
movem t,pd+.umem
move t,[%odk4s] ;maximum virtual pages available
gettab t,
jrst gterr ;error?
move s,[%swvrt] ;virtual pages remaining
gettab s,
jrst gterr ;error?
sub t,s ;virtual pages in use
ash t,^d9 ;convert pages to words
movem t,pd+.vmem ;save virtual memory in use
gt(%cnlnm,pd+.jobs)
gt(%cnsup,pd+.upt)
gt(%cvoht,pd+.oht)
gt(%cvnul,pd+.nul)
gt(%cvlst,pd+.lst)
move t,pd+.upt ;get uptime
sub t,pd+.oht ;subtract overhead time
sub t,pd+.nul ;and null time
movem t,pd+.usr ;to get user time
move t,pd+.nul ;get null time
sub t,pd+.lst ;subtract lost
movem t,pd+.idl ;to get idle time
;get responses
move r,[%ccrsp] ;get response subtable pointer
gettab r,
jrst gterr ;error?
addi r,%cvrsc ;cpu responses
hrlzs r ;in left side
hrri r,.gtc0v ;cpu0 responses
move s,[xwd -4,pd+.cr] ;set up for loop
loop: move t,r ;get new pointer
gettab t, ;get response data
jrst gterr ;error?
movem t,(s) ;save it
add r,[1,,0] ;prepare next gettab
aobjn s,loop ;loop
popj p, ;return
;
; here on gettab error
gterr:
outstr [asciz/?PRFGTT GETTAB error/]
exit
;
; routine to wake up at the specified time
; callable by fortran as follows:
;
; CALL WAKEUP(WAKTIM)
;
; where WAKTIM is the time to wake up (universal date-time format)
mulfac=1000 ;multiplier for time accuracy
units=3021 ;time units per mulfac seconds
wakeup::
move t,[%cndtm] ;get time of day
gettab t,
jrst gterr ;error?
movns t ;make negative
add t,@(f) ;add wake time to make difference
jumple t,xpopj ;quit if time already past
imuli t,mulfac ;increase scale for accuracy
idivi t,units ;divide by units/second
movem t,slpsec ;seconds to sleep
move t,[xwd 2,slpblk]
daemon t, ;set time
jrst [outstr [asciz/?PRFCLK error in DAEMON clock request/]
exit]
movei t,0 ;clear timer
hiber t, ;sleep that long
jrst [outstr [asciz/?PRFHIB error trying to hibernate/]
exit]
xpopj: popj p, ;return
slpblk: exp .clock ;sleep function
slpsec: block 1 ;seconds to sleep
end