! Timestamp log giving operational statistics.
! We get kicked by the datestamp routine if a pre-determined interval
! of time has elapsed.  Note that this means that we don't get called
! %every 10 minutes (or whatever), but only if somebody is transacting
! with the system.

%include "CONFIG.INC"
%include "COMMON"
%include "SCHEDULE.INC"
%include "UTILITY.INC"

%externalrecord(common fm)%mapspec common area

%externalintegerspec disc high water

%externalroutine stamp main entry
   %conststring(3)%array stat(1 : last stat) =
      "FR",  "FW",  "DR",  "DW",  "DE",  "ER",  "EW",  "EE",
      "OO",  "EO",  "LO"
   %record(common fm)%name common
   %integer i, comma, count
      common == common area
      %cycle
         wait for(stamp flag)
         comma = 0
         pdate
         %for i = 1, 1, last stat %cycle
            %if common_monitor_s(i) # 0 %start
               printstring(", ") %if comma # 0
               comma = 1
               write(common_monitor_s(i), 0)
               space
               printstring(stat(i))
            %finish
         %repeat
         common_monitor = 0
         printstring(", ") %if comma # 0
         comma = 1
         write(common_buffer pool used, 0)
         printstring(" BHW, ")
         write(disc high water, 0)
         printstring(" DHW, ")
         disc high water = 0
         count = 0
         %for i = 0, 1, Unos %cycle
            count = count + 1 %if common_Uno(i)_l owner # 0
         %repeat
         write(count, 0)
         print symbol('U')
         count = 0
         %for i = 1, 1, Xnos %cycle
            count = count + 1 %if common_Xno(i)_Uno >= 0
         %repeat
         %if count # 0 %start
            printstring(", ")
            write(count, 0)
            print symbol('X')
         %finish
         count = 0
         %for i = 1, 1, ports %cycle
            count = count + 1 %if common_port info(i)_state # 0
         %repeat
         %if count # 0 %start
            printstring(", ")
            write(count, 0)
            print symbol('P')
         %finish
         newline
      %repeat
%end

%end %of %file
