mirror of
https://github.com/PDP-10/its.git
synced 2026-01-31 14:02:09 +00:00
SYSLOD - system load histogram.
This commit is contained in:
committed by
Eric Swenson
parent
167b88f646
commit
ee135ab2ec
242
src/sysen1/syslod.8
Normal file
242
src/sysen1/syslod.8
Normal file
@@ -0,0 +1,242 @@
|
||||
;-*-midas-*-
|
||||
|
||||
TITLE SYSLOD
|
||||
|
||||
;;; Written by Dennis L. Doughty, '83
|
||||
|
||||
.qmtch==1 ;make "<text>" handle text
|
||||
|
||||
a=1 ;temporary
|
||||
b=2 ;temporary
|
||||
c=3 ;temporary
|
||||
frshr=4 ;where we keep the fair share
|
||||
ofrshr=6 ;where we keep the old fair share
|
||||
ttybuf=7 ;out tty input buffer
|
||||
nusrs=10 ;where we keep the number of users
|
||||
t1=11 ;temporary
|
||||
t2=12 ;temporary
|
||||
chr=13 ;character read in JCL
|
||||
sp=17 ;stack pointer
|
||||
|
||||
tyic==13 ;can't use channel 1
|
||||
tyoc==14 ;establish an output channel
|
||||
pdleng==10 ;lots of PDL space
|
||||
|
||||
|
||||
define syscal a,b,c=<calerr>
|
||||
.call [setz ? sixbit/a/ ? b ? setz+<%clerr,,0>+c]
|
||||
termin
|
||||
|
||||
|
||||
define type &text
|
||||
push sp,a
|
||||
push sp,b
|
||||
move a,[440700,,[asciz text]]
|
||||
movei b,<.length text>
|
||||
syscal siot,[%climm,,tyoc ;ac has channel
|
||||
a
|
||||
b]
|
||||
.lose %lsfil
|
||||
pop sp,b
|
||||
pop sp,a
|
||||
termin
|
||||
|
||||
define initeval sym
|
||||
.scalar sym
|
||||
move t1,[squoze 0,/sym/]
|
||||
.eval t1,
|
||||
.lose
|
||||
movem t1,sym
|
||||
termin
|
||||
|
||||
define getval a,b
|
||||
hrl a,b
|
||||
hrri a,a
|
||||
.getloc a,
|
||||
termin
|
||||
|
||||
go: move sp,[-pdleng,,pdl] ;initialize our push stack
|
||||
|
||||
syscal open,[%clbit,,.uii ;open tty for input
|
||||
%climm,,tyic
|
||||
[sixbit /TTY/]]
|
||||
.lose %lsfil
|
||||
syscal open,[%clbit,,<.uao+%tjdis> ;open tty for output with ^P codes
|
||||
%climm,,tyoc
|
||||
[sixbit /TTY/]]
|
||||
.lose %lsfil
|
||||
;find out our tty type
|
||||
syscal cnsget,[%climm,,tyoc ? %clout,, ? %clout,, ? %clout,,tctyp]
|
||||
.lose %lsfil
|
||||
|
||||
initeval SLOADU
|
||||
initeval SUSRS
|
||||
|
||||
getjcl: .break 12,[5,,jclbuf] ;get our JCL
|
||||
move a,[440700,,jclbuf] ;get a byte pointer to it in a
|
||||
nxtchr: ildb chr,a ;get first character in chr
|
||||
cain chr,40 ;is it a space?
|
||||
jrst nxtchr ;yes, go back for more
|
||||
cain chr,150 ;is is an "h"
|
||||
setom histf ; remember it
|
||||
cain chr,77 ;is is a "?", if so, document it
|
||||
jrst [type /C
|
||||
SYSLOD produces a graph of the System Fair Share in either a continuous
|
||||
update mode or in a histogram mode. The default is continuous update
|
||||
display terminals and histogram mode for printing terminals. After the
|
||||
initial display, the program accepts one-character commands as follows:
|
||||
|
||||
h -- histogram option
|
||||
r -- continuous display mode (video terms only)
|
||||
u -- prints out the number of users on the system
|
||||
momentarily and then returns to fair share
|
||||
display
|
||||
d -- redisplays screen (or on a printing terminal
|
||||
redisplays header)
|
||||
q -- quits the program
|
||||
? -- prints abbreviated documentation
|
||||
|
||||
SYSLOD takes an optional character "h" in the jcl which selects
|
||||
histogram mode from the start.
|
||||
/
|
||||
.logout 1,]
|
||||
|
||||
go1: movei ofrshr,0 ;initialize old fair share to 0
|
||||
type /CFair Share:
|
||||
|
||||
/
|
||||
pushj sp,graph ;and produce the scale
|
||||
go2: pushj sp,ldcal ;calculate the load
|
||||
pushj sp,plotit ;and plot the fair share
|
||||
movei a,60. ;set up for waiting 2 seconds. (shawn).
|
||||
.sleep a, ;and wait
|
||||
.listen ttybuf, ;find out if he's typing anything
|
||||
cain ttybuf,0 ;if not continue graphing
|
||||
jrst go2
|
||||
.iot tyic,ttybuf ;gobble character typed
|
||||
cain ttybuf,165 ;is it a "u"
|
||||
jrst usrhdr ; yes, display number of users
|
||||
cain ttybuf,144 ;is it a "d"
|
||||
jrst go1 ; redisplay plot
|
||||
cain ttybuf,150 ;is it an "h"
|
||||
setom histf ;we want a histogram
|
||||
cain ttybuf,162 ;is it an "r"
|
||||
jrst [setzm histf ;back to non-histogram
|
||||
jrst go1] ;and redisplay
|
||||
cain ttybuf,77
|
||||
jrst [type /CCommands are:
|
||||
h -- Select histogram mode (printing terminals automatically
|
||||
select this mode)
|
||||
|
||||
r -- Returns to continuous plot mode
|
||||
(Video terminals only)
|
||||
|
||||
u -- Momentarily displays number of system users
|
||||
|
||||
d -- On video terminals, redisplays entire screen
|
||||
(in case of unwanted garbage)
|
||||
On printing terminals, redisplays header
|
||||
|
||||
q -- Quits the program
|
||||
|
||||
? -- Displays this info
|
||||
|
||||
--Type space to resume display--/
|
||||
|
||||
.iot tyic,jclbuf ;accept anything
|
||||
jrst go1] ;go back to display
|
||||
caie ttybuf,161 ;is it a "q"
|
||||
jrst go2 ; no, go back to fair share display
|
||||
.logout 1, ;and kill self
|
||||
|
||||
ldcal: getval frshr,SLOADU ;Get inverse fair share
|
||||
movei b,10000. ; fair share = 10000./sloadu.
|
||||
idivm b,frshr ; calculate it
|
||||
getval nusrs,SUSRS ;Get number of users
|
||||
popj sp, ;and return
|
||||
|
||||
usrhdr: type /CUsers: / ;herald
|
||||
move t1,nusrs ;get number of users
|
||||
pushj sp,decprt ;print it out
|
||||
movei a,60. ;sleep for 2 seconds
|
||||
.sleep a,
|
||||
jrst go1 ;and start over
|
||||
|
||||
graph: movei b,9. ;number of spaces 'till first number
|
||||
movei a,10. ;first number on scale
|
||||
pushj sp,cmove ;moves 9 spaces
|
||||
move t1,a ;print out our number
|
||||
pushj sp,decprt
|
||||
movei c,6. ;number of times through scale loop
|
||||
scloop: jumpe c,endslp ;moves 8 spaces
|
||||
addi a,10. ;increment scale number
|
||||
movei b,8. ;from now on, move 8 spaces over
|
||||
pushj sp,cmove ;do it
|
||||
move t1,a ;print out the number
|
||||
pushj sp,decprt
|
||||
subi c,1 ;one less time through loop
|
||||
jrst scloop ;and go back for more
|
||||
endslp: .iot tyoc,[^P] ;go to next line
|
||||
.iot tyoc,["A"]
|
||||
movei c,7. ;initialize out counter
|
||||
sclop1: jumpe c,endlp1 ;puts a "|" below every number of
|
||||
movei b,9. ;the scale
|
||||
pushj sp,cmove
|
||||
.iot tyoc,["|"] ;print out the "|"
|
||||
subi c,1 ;decrement out loop counter
|
||||
jrst sclop1 ;and go back for more
|
||||
endlp1: .iot tyoc,[^P]
|
||||
.iot tyoc,["A"] ;a carriage return-linefeed
|
||||
popj sp,
|
||||
|
||||
cmove: jumpe b,endcmv ;moves over b spaces
|
||||
.iot tyoc,[" "] ;print out a space
|
||||
subi b,1 ;decrement out loop
|
||||
jrst cmove
|
||||
endcmv: popj sp,
|
||||
|
||||
hline: caig a,0 ;longer than we have?
|
||||
jrst lesst ; no
|
||||
greatr: jumpe a,cpopj ;if line-length >1
|
||||
.iot tyoc,["*"] ;print an asterisk
|
||||
subi a,1 ;decrement our loop counter
|
||||
jrst greatr ;and print another
|
||||
|
||||
lesst: jumpe a,cpopj ;if line-length <1
|
||||
.iot tyoc,[^P] ;delete one character backwards
|
||||
.iot tyoc,["X"]
|
||||
addi a,1 ;increment loop counter
|
||||
jrst lesst ;and go back for more
|
||||
|
||||
plotit: move a,frshr ;determine line-length
|
||||
sub a,ofrshr ;(line-length = frshr-ofrshr)
|
||||
pushj sp,hline ;draw line of length line-length
|
||||
movem frshr,ofrshr ;save old fair share
|
||||
move t1,tctyp ;get terminal type
|
||||
move t2,histf ;get histogram flag
|
||||
cain t2,0 ;do we want a histogram
|
||||
cain t1,0 ;are we on a printing terminal
|
||||
jrst [movei ofrshr,0 ;do histogram if requested or if
|
||||
.iot tyoc,[^P] ;on a printing terminal
|
||||
.iot tyoc,["A"]
|
||||
jrst cpopj]
|
||||
cpopj: popj sp,
|
||||
|
||||
decprt: idivi t1,10. ;figure first digit
|
||||
push sp,t2 ;push remainder
|
||||
skipe t1 ;done?
|
||||
pushj sp, decprt
|
||||
pop sp,t1 ;yes, take out in opposite order
|
||||
addi t1,60 ;make ascii
|
||||
.iot tyoc,t1
|
||||
popj sp,
|
||||
|
||||
|
||||
jclbuf: 0 ;where to save the jcl
|
||||
tctyp: 0 ;terminal type
|
||||
histf: 0 ;flag -- hist or no hist
|
||||
pdl: 0 ;our stack
|
||||
block pdleng ;PDL area
|
||||
calerr: 0
|
||||
end go
|
||||
|
||||
Reference in New Issue
Block a user