﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
352	Improvements to analyze_multics	Gary Dixon	Eric Swenson	"analyze_multics should be improved to enable use of exec_com scripts within the azm interactive environment.  This would permit scripts to be written to display complex tables without requiring creation of a new request program.

For example, the header of an Event Channel Table (ECT) could be displayed by a script which uses the azm display -as STRUCTURE.ELEMENT to select individual data items and format them.  exec_com code to display such tables is often much simpler to write and easier to maintain than an equivalent PL1 program.

An example of such output is shown below.


{{{
azm

azm:  sld >old_dumps>030121.0630.0.7
  ERF 030121.0630.0.7 in directory >old_dumps dumped at 03/01/21  0630.3 pst Mon.
  System-ID MR12.7 Version-ID MR12.7
Proc   6 DBR  16625434 running        on cpu a   Backup.SysDaemon.z

azm:  slp 0
Process   0, Initializer.SysDaemon.z, DBR  17007650

azm:  ec ect header

  Initializer.SysDaemon     2021-03-01 06:28:54
 Ring 4   Event Channel Table      at 361|16022

   --------- CHANNELS -----   Counts
    Total Channels                96
     Wait Channels                41
       Fast Chn in-use         0
       Fast Chn unassigned    36
       Regular Wait Chn        5
     Call Channels                55

   ---- PENDING MESSAGES --   Counts
               Wait Channel        0
               Call Channel        0
                ITT Channel        0

   ---------- METERS ------   Counts
              Total Wakeups   108912
               Wait Wakeups      399
               Call Wakeups   108513
                 ITT Tosses        0
     Control Points Waiting        0

   ---------- FLAGS -------   -------------
        Event Call Channels    Low Priority
      Control Point Wakeups      disabled

  ----------- LISTS -------   First Item
              Wait Channels   at 361|16200
              Call Channels   at 361|17206
  Pending Wait Channel Msgs     (none)
  Pending Call Channel Msgs     (none)
  Pending Interprocess Msgs     (none)

  ---------- STORAGE ------   -------------
                   ECT Area   at  361|15752      size:   1044 words
  Event Channel Index Table   at  533|174        size:    128 packed pointers
}}}

Code in the ect.azmec script might get data elements to be displayed in the CHANNELS section of the table.

{{{
                                                           &- Map array index numbers to names of items in that list.
 &set    Chn_Total {0}       Chn_Wait {1}       Chn_Call {2}   Ctl_Point_Wait &""""
 &set Msg_Chn_Call {3}    Msg_Chn_ITT {4}   Msg_Chn_Wait {5}

                                                            &- Get pointers to thread heads from ECT Header
 &set ChnWaitP      &||[token -cmd ""&(disp) &(ectP) -as ect_header.firstp&(Chn_Wait)""       &(match1)]
 &set ChnCallP      &||[token -cmd ""&(disp) &(ectP) -as ect_header.firstp&(Chn_Call)""       &(match1)]
 &set MsgWaitP      &||[token -cmd ""&(disp) &(ectP) -as ect_header.firstp&(Msg_Chn_Wait)""   &(match1)]
 &set MsgCallP      &||[token -cmd ""&(disp) &(ectP) -as ect_header.firstp&(Msg_Chn_Call)""   &(match1)]
 &set Msg_ITTP      &||[token -cmd ""&(disp) &(ectP) -as ect_header.firstp&(Msg_Chn_ITT)""    &(match1)]
 &set ChnWaitP      &||[if [equal null &(ChnWaitP)]  -then ""  (none)""  -else ""at &(ChnWaitP)""]
 &set ChnCallP      &||[if [equal null &(ChnCallP)]  -then ""  (none)""  -else ""at &(ChnCallP)""]
 &set MsgWaitP      &||[if [equal null &(MsgWaitP)]  -then ""  (none)""  -else ""at &(MsgWaitP)""]
 &set MsgCallP      &||[if [equal null &(MsgCallP)]  -then ""  (none)""  -else ""at &(MsgCallP)""]
 &set Msg_ITTP      &||[if [equal null &(Msg_ITTP)]  -then ""  (none)""  -else ""at &(Msg_ITTP)""]
                                                            &- These pointers may be needed to display those thread items

&if  &[nless &(Aheader) 1]  &then  &goto CHANNEL_DISPLAY    &- If MODE_STRING does not include header or brief_header
                                                            &-  then jump over code below to the CHANNEL_DISPLAY label.
 &- LOOP:  Count fast channels used in this ring.
  &set  Fast_Total         36
  &set  Fast_in_use         0
  &set  I 1
 &label CountFast
     &if &[ngreater &(I) &(Fast_Total)]   &then &goto CountFast_END
        &set     ChnBit       &[substr &(assigned_channels) &(I) 1]
        &set     Fast_in_use  &[plus &(Fast_in_use) &(ChnBit)     ]
        &set     I            &[plus &(I) 1                       ]
     &goto CountFast
 &label CountFast_END


                                                            &- Obtain ect_header data items to be displayed
                                                            &-   Items for brief_header or header
 &set CPWaits       &||[token -cmd ""&(disp) &(ectP) -as ect_header.count&(Ctl_Point_Wait)"" &(match1)]
 &set ChnTotal      &||[token -cmd ""&(disp) &(ectP) -as ect_header.count&(Chn_Total)""      &(match1)]
 &set ChnWait       &||[token -cmd ""&(disp) &(ectP) -as ect_header.count&(Chn_Wait)""       &(match1)]


 &set  Fast_unassigned  &[minus &(Fast_Total) &(Fast_in_use)]
 &set  Reg_Wait     &[plus &(ChnWait) -&(Fast_in_use) -&(Fast_unassigned) ]
 &set ChnCall       &||[token -cmd ""&(disp) &(ectP) -as ect_header.count&(Chn_Call)""       &(match1)]
 &set MsgWait       &||[token -cmd ""&(disp) &(ectP) -as ect_header.count&(Msg_Chn_Wait)""   &(match1)]
 &set MsgCall       &||[token -cmd ""&(disp) &(ectP) -as ect_header.count&(Msg_Chn_Call)""   &(match1)]
 &set Msg_ITT       &||[token -cmd ""&(disp) &(ectP) -as ect_header.count&(Msg_Chn_ITT)""    &(match1)]
}}}

Once all elements to be display had been gathered, the code could focus on displaying that data in a meaningful format.  For example:


{{{
                                                            &- Display all (or selected) data items
&print                                                      &-   All levels of detail.
 &print &[flnnl ""  ^24a  ^a ^a""  &(name_project)  &(dump_date_time) ]
 &print &[flnnl
&+              "" Ring ^d   Event Channel Table      at ^a"" &(initial_ring) &(ectP)]
 &print
 &print &""   --------- CHANNELS -----   Counts""
 &print &""    Total Channels              "" &[flnnl ""^3d"" &(ChnTotal) ]
 &print &""     Wait Channels              "" &[flnnl ""^3d"" &(ChnWait)  ]
 &print &""       Fast Chn in-use       "" &[flnnl ""^2d"" &(Fast_in_use)     ]
 &print &""       Fast Chn unassigned   "" &[flnnl ""^2d"" &(Fast_unassigned) ]
 &print &""       Regular Wait Chn      "" &[flnnl ""^2d"" &(Reg_Wait)        ]
 &print &""     Call Channels              "" &[flnnl ""^3d"" &(ChnCall)  ]
 &print
}}}
"	enhancement	closed	major	MR12.9	Tools		fixed		
