;********************************************************************* ;* JOBTIM.M68 ;* ;* Scans the system and prints every defined job to the screen ;* AND their cumulative CPU time ;* ;* Usage: JOBTIM ;* ;* Must .LNKLIT JOBTIM after "Phase 2" when assembling ;* ;* by Dave Heyliger - AMUS Staff ;********************************************************************* ; added Elapsed Time. 12 May 1992. Rhett McMahon MCMA/AM ;********************************************************************* AUTOEXTERN OBJNAM JOBTIM.LIT ;Define the final product SEARCH SYS ;Grab all MACRO definitions SEARCH SYSSYM SEARCH TRM VMAJOR=1. ;Major version number of the program VMINOR=1. ;Minor version number of the program VEDIT=101. ;the edit number of the program .OFINI ;OFfset INItialization: .OFDEF BUFFER,7. ;OFfset DEFinition - "BUFFER" .OFSIZ IMPSIZ ;IMPSIZ is the final size of bytes (7) DEFINE TYPEIT V,B ;+--- ;| TYPEIT will process a JCB variable that is two words packed RAD50 data ;| and type this variable to the screen in ascii format. ;| where ;| V = variable to be UNPACKED ;| B = buffer area to place unpacked characters ;+-------------------------------------------------------------------------- LEA A1,V(A4) ;A1 points to variable to be unpacked LEA A2,B(A5) ;and ^ A2 to byte "0" of "BUFFER" UNPACK ;get the letters unpacked UNPACK ; ...for up to full letters CLRB @A2 ;Place a "null" after the characters LEA A2,B(A5) ;Repoint A2 to byte "0" of "BUFFER" TTYL @A2 ;Print out all chars until a null ENDM DEFINE PRTTAB AA,BB ;+--- ;| PRTTAB acts just like "PRINT TAB (#,#) from within BASIC ;| where ;| AA is the first #, BB is the second # ;+------------------------------------------------------------ MOVB #AA,D1 ;move 1st number into D1 LSLW D1,#10 ;shift it left 8. bits MOVB #BB,D1 ;move in 2nd number TCRT ;and perform TCRT call ENDM DEFINE TABDWN AA,BB ;+--- ;| TABDWN - or "TAB DOWN" will place the cursor at the row specified by ;| AA and the column specified by BB. Assumes a data register ;| (AA) has been "dedicated" to keep track of which row. ;| where ;| AA is a dedicated data register holding current row number ;| BB is the column number ;+---------------------------------------------------------------------- MOVB AA,D1 ;move in value from dedicated reg. LSLW D1,#10 ;shift it left 8. bits MOVB #BB,D1 ;move in column number TCRT ;and perform TCRT call INC AA ;increment dedicated data register ENDM ;--- Program initialization and screen format headers etc... ; PHDR -1,0,PH$REE!PH$REU ;Program is Re-entrant & Re-useable GETIMP IMPSIZ,A5 ;Reg. A5 now ^'s to byte "0" of BUFFER PRTTAB -1,29. ;cursor OFF PRTTAB -1,0 ;clear the screen MOV #1,D4 ;initialize dedicated register TABDWN D4,40 ;move cursor here TYPE < Job CPU Time Elapsed Time> ;create a header TABDWN D4,40 ;again move the cursor TYPE <-------+----------+-------------> ;create an underline ;--- First loop: type out both the JOB name and the cum. CPU time ; LOOP: CTRLC EXIT ;quit on a ^C MOV JOBTBL,A0 ;Get base of JOB TABLE into A0 NXTJOB: MOV (A0)+,A4 ;and let A4 point to each JBC MOV A4,D0 ;this will set the flags 2 B checked BMI SNOOZE ;end of the JOB TABLE on a "-1" BEQ NXTJOB ;goto the top on a "0" TABDWN D4,40 ;adjust cursor TYPEIT JOBNAM,BUFFER ;type out the JOB NAME TYPE < > ;type some spaces MOV JOBCPU(A4),D1 ;get cpu time MOV #0,A2 ;a must for $OTCPU CALL $OTCPU ;type out the time BR NXTJOB ;do it again ;--- Now for each loop thereafter, just type out the CPU time ; ; NOTE: if you have more than 15 or so JOBs, you might want to make ; have SNOOZE: at the EXIT: label for just a 1-time listing. ; SNOOZE: PRTTAB -1,29. ;cursor OFF while sleeping SLEEP #25000. ;sleep for a bit CTRLC EXIT ;quit on a ^C MOV #3,D4 ;initialize D4 for TABDWN MOV JOBTBL,A0 ;Get base of JOB TABLE into A0 ;;; PRTTAB -1,28. ;cursor ON for effect NXTPRG: MOV (A0)+,A4 ;and let A4 point to each JBC MOV A4,D0 ;this will set the flags 2 B checked BMI SNOOZE ;end of the JOB TABLE on a "-1" BEQ NXTPRG ;goto the top on a "0" TABDWN D4,51 ;adjust before each PROGRAM is typed MOV JOBCPU(A4),D1 ;get CPU time MOV #0,A2 ;a must for $OTCPU CALL $OTCPU ;type it out MOV JOBUSR(A4),D1 BEQ NXTPRG TYPESP < > MOV JOBCON(A4),D1 ;get elapsed time SUB A2,A2 ;clear register A2 for $OTCON CALL $OTCON ;output elapsed time to screen BR NXTPRG ;do it again EXIT: PRTTAB -1,28. ;cursor ON PRTTAB -1,0 ;clear the screen EXIT ;return to AMOS END