ltl@CUGSBVAX.BITNET (05/16/88)
With all the clock program and show mode command procedure floating around, I have gathered up some thought at producing the following programs which will display on the 25th line of the screen of PC running MSKERMIT the status of (respectively): Memory usage: Total Physical memory in Megabytes Memory free in K-pages Memory used in K-pages CPU usage: Total % Kernel Mode % Executive Mode % Supervisor Mode % User Mode % Interrupt Stack % Compatibility Mode % Jobs : Interactive job count Batch job count Date and time You may modify the program to suit your taste like setting up scrolling regions and display on the 24th line instead. The ideas main is attributed to the previous program/command procedure submit by messrs: Wolfgang J. Moeller U0012@DGOGWDGS.BITNET and FETZER@nmfecc.ARPA. LTL LTL@cugsbvax.Bitnet System Manager ..............................cut here.................................... program clock implicit none C Cc Ccc Compile and link as follows: Ccc fortran/extend_source clock Ccc link clock,sys$system:sys.stb/selective,sysdef.stb/selective Ccc Ccc This program is meant to be spawned in a subprocess. Ccc e.g. spawn/nowait/nological/nosymbols run clock Cc C include '($syssrvnam)' include '($iodef)' character*(*) esc integer*4 delay_seconds integer*4 delay_half parameter (esc = char(27)) parameter (delay_seconds = 30) parameter (delay_half = delay_seconds / 2 - 1) external sys$gw_ijobcnt, sys$gw_bjobcnt ! Jobs external exe$gl_rpb, rpb$l_memdsc, sch$gl_freecnt, sch$gl_mfycnt ! Memory external pms$gl_kernel, pms$gl_compat, exe$gl_abstim ! Cpu external sch$gl_nullpcb, pcb$l_phd, phd$l_cputim ! Null character*256 buffer integer*4 delayed(2)/-1e7,-1/,initial_delay(2)/2*-1/ integer*4 eval,eval_array integer*4 status,i,j,k,total integer*4 last(6),current(6),null_elapsed,null_last,null_current integer*4 total_memory,used_memory,free_memory integer*2 tt_channel,size,time(7) delayed(1) = delayed(1) * delay_seconds status = sys$assign('tt:',tt_channel,,) if (.not.status) call lib$signal(%val(status)) total_memory= iand('ffffff'x, & eval(%val(eval(%val(%loc(exe$gl_rpb)))+%loc(rpb$l_memdsc)))) status = sys$fao('!AS7!AS[1;33;46m!AS[25;1H!3ULMb0000f000u 000%000k &000e000s000u000i000c I:000 B:000 00/00/00 00:00:00!AS[0m!AS8', & size,buffer,esc,esc,esc, & %val(total_memory/2048), & esc,esc) if (.not.status) call lib$signal(%val(status)) null_last = eval(%val(eval(%val(%loc(sch$gl_nullpcb)+%loc(pcb$l_phd)))+ & %loc(phd$l_cputim))) call eval_array(%val(%loc(pms$gl_kernel)),last,6) call sys$numtim(time,) initial_delay(1) = (mod(zext(time(6) * 100 + time(7)), & delay_seconds * 100) - delay_seconds*100) * 1e5 call sys$schdwk (,,initial_delay,delayed) do while (.true.) call sys$hiber call sys$numtim(time,) null_current = eval(%val(eval(%val(%loc(sch$gl_nullpcb) + & %loc(pcb$l_phd))) + %loc(phd$l_cputim))) null_elapsed = null_current - null_last call eval_array(%val(%loc(pms$gl_kernel)),current,6) total = 0 do i = 1, 6 total = total + current(i) - last(i) if (i.eq.1) total = total - null_elapsed enddo free_memory = eval(%val(%loc(sch$gl_freecnt))) used_memory = total_memory-free_memory-eval(%val(%loc(sch$gl_mfycnt))) call sys$fao('!4ULf!3ULu !3UL%!3ULk!3ULe!3ULs!3ULu!3ULi!3ULc I: &!3UW B:!3UW !2UW/!2ZW/!2ZW !2UW:!2ZW:!2ZW',, & buffer(25:98), & %val((free_memory + 511) / 1024), & %val((used_memory + 511) / 1024), & %val(total / delay_seconds), & %val((current(1)-last(1)-null_elapsed+delay_half)/delay_seconds), & %val((current(2)-last(2)+delay_half) / delay_seconds), & %val((current(3)-last(3)+delay_half) / delay_seconds), & %val((current(4)-last(4)+delay_half) / delay_seconds), & %val((current(5)-last(5)+delay_half) / delay_seconds), & %val((current(6)-last(6)+delay_half) / delay_seconds), & %val(eval(%val(%loc(sys$gw_ijobcnt)))), & %val(eval(%val(%loc(sys$gw_bjobcnt)))), & %val(time(2)),%val(time(3)),%val(mod(time(1),100)), & %val(time(4)),%val(time(5)),%val(time(6))) call sys$qio(,%val(tt_channel), & %val(io$_writevblk+io$m_breakthru+io$m_noformat),,,, & %ref(buffer),%val(size),,,,) do i = 1, 6 last(i) = current(i) enddo null_last = null_current enddo end integer*4 function eval(pointer) implicit none integer*4 eval_array,pointer(1),returned_value(1),size,i eval = pointer(1) return entry eval_array(pointer,returned_value,size) do i = 1, size returned_value(i) = pointer(i) enddo eval_array = pointer(1) return end -------