program cpu ! ! This task calculates CPU utilization and optionally displays it ! ! Don Rubin Feb 1985 1.0 initial version ! Don Rubin 8-mar-1985 1.1 changed priority to 5, qio ! ! common /extrab/junk !for global common (see documentation) common /tick/done parameter (IAVERG=5) !averaging time in seconds integer*2 done,ibuf(IAVERG),param(6) integer*4 ticks character*80 comand byte bar(50),blank(50),disply,calib data blank/50*' '/,bar/50*'#'/ data ibuf/IAVERG*100/,ipoint/1/ external ast movavg=IAVERG*100 cal=115000. !calibration for 11/73 M+ 2.1 D calib=.false. disply=.false. call getmcr(comand,ids) if(ids.le.3)then !if no command then display bar graph 3 disply=.true. ! Set up AST routine call getadr (param,ast) ! get address of ast routine call wtqio ("1410,5,1,,,param) ! attach terminal with ast call clref (1) call enastr ! enable ast recognition type8,0,27,27,27,4,IAVERG !clear and set scrolling reigon 8 format(2a1,'[1;1f',a1,'[2J',a1,'[',i1,';24r':, 1 'Instantaneous ',i2,' sec Average ', 1 '0--------20--------40--------60--------80-------100') else if(index(comand,'CALIB').gt.0)then calib=.true. !show calibration else read(comand(5:ids),'(f10.0)',err=1)z if(z.gt.50000.)then cal=z !use new cal goto 3 endif endif endif 1 done=0 ticks=0 call altpri(,5) !lower priority to 5 call mymark !declare marktime for 1 second 2 ticks=ticks+1 if(done.eq.0)goto 2 !loop j=min(100,ifix(float(ticks)/cal*100.)) ipoint=mod(ipoint,IAVERG)+1 k=ibuf(ipoint) movavg=movavg-k+j ibuf(ipoint)=j javer=(100-movavg/IAVERG) k=javer/2 if(disply)then type9,'+',27,100-j,javer,(bar(j),j=1,k),(blank(j),j=k+1,50) 9 format(2a1,'[2;1f',2(' ',i4,' %'),' ',50a1) call readef(1,ids) !ast received, so exit if(ids.gt.0)goto 5 elseif(calib)then type*,ticks endif goto 1 5 type8,0,27,27,27,1 !clear and reset scrolling call exit end