/*********************************************************************/ /* PICAPCPU REXX TO put a CAP on CPU-load */ /*********************************************************************/ /* */ /* This REXX controls CPU-LOAD and adjust usage by deactivating */ /* and reactivating BATCH-partitions */ /* any command-combination is possible and can be specified here */ /* even a simple PAUSE BG,EOJ (to introduce an artifical delay at jobend) */ /* is possible- You should (if you want to do that) then look for */ /* the correct REPLID to end the PAUSE */ /* */ /* TRACE R? */ LOW_CPU = 10 /* CPU must be below this to reactivate */ HIGH_CPU = 50 /* CPU must be above this to start acting */ measure_int = 5*60 /* size in seconds of an interval */ /* the above should be big enough to have multiple GETJA */ REACT_TIME_LOW = 3 /* CPU must be for n-intervals below LOW-CPU */ REACT_TIME_HIGH = 1 /* CPU must be for n-intervals above HIGH-CPU */ cmds = 3 /* there are so many levels to react */ cut.1 = 'SUSPEND F6' /* watch this...there is a */ inc.1 = 'RESUME F6' /* one to one relation of the commands */ cut.2 = 'SUSPEND F9' /* the commands are handled like a */ inc.2 = 'RESUME F9' /* PUSH-DOWN or */ inc.3 = '* BELOW LIMIT' /* LIFO-stack */ cut.3 = 'MARTIN PLEASE HELP' /*********************************************************************/ acci=0 /* we currently are at this level */ ADDRESS LINK 'PICC01 INIT' REQ='RUN' REACT_LOW_LIM=0 /* this allows to react on first iteration */ REACT_HIGH_LIM=0 /* this allows to react on first iteration */ CALL OPERMSG 'ON' DO UNTIL REQ='STOP' CALL SLEEP measure_int ADDRESS LINK 'PICC01 DATA' IF RC < 100 THEN CPULOAD= RC ELSE ITERATE CURTIME=TIME('E') IF CPULOAD < LOW_CPU THEN DO IF CURTIME > REACT_LOW_LIM & acci > 0 THEN CALL REACT_LOW END IF CPULOAD > HIGH_CPU THEN DO IF CURTIME > REACT_HIGH_LIM & acci < cmds THEN CALL REACT_HIGH END REQ = OPERMSG('MSGDATA') /* Any operator comm request */ if LENGTH(REQ)<>0 & REQ <> 'STOP' THEN CALL TALK_USER END EXIT /* End of Main Line */ TALK_USER: CALL ASSGN 'STDOUT','SYSLOG' SAY 'PICAPCPU does only understands STOP ' SAY 'the current CMDs to reduce CPU-load are' DO I= 1 TO CMDS SAY I"="CUT.I END SAY 'the current CMDs to increase CPU-load are' DO I= 1 TO CMDS SAY I'='INC.I END SAY 'Cmd-level =' ACCI SAY 'the system will use this level to increase load' SAY 'and the next higher level for a decrease in load' CALL ASSGN 'STDOUT','SYSLST' RETURN REACT_HIGH: REACT_HIGH_LIM=CURTIME + REACT_TIME_HIGH * Measure_int acci=acci+1 ADDRESS LINK 'DTRIATTN' cut.acci RETURN REACT_LOW: REACT_LOW_LIM=CURTIME + REACT_TIME_LOW * Measure_int ADDRESS LINK 'DTRIATTN' inc.acci acci=acci-1 RETURN