PROCEDURE dum$display_swap_trace_stats, display_swap_trace_stats, dissts (
  output, o: file = $output
  status)

  VAR
    input_string: string
    local_output_file: file = $fname($unique)
    local_status: status
    scratch_file: file = $fname($unique)
  VAREND

  collect_text o=scratch_file
   SWAPPING STATISTICS

   LONG WAIT AGING
 55    Long wait aging called
 56    CP aging called
 57    Total pages removed
 58    Modified pages removed
 59    Long wait aging caused task to go ready

   Job swapped out.
 76    Total jobs swapped out (job went from R -> OR) via JOB MODE
 77    Total jobs swapped out (job went from R -> OR) via MTR MODE
 67    Advance Swap changed swap direction
 63      swapout aborted - waiting for tasks to idle
 64      swapout aborted - wait states
 82      swapout aborted - direction IN noticed at idle_task_complete
 86      swapout aborted - direction IN noticed at idle_task_comp 2nd check
 88      swapout aborted - changed direction at swapped_io_complete
 89      swapout aborted - changed direction at swapout_complete
 65      swapout aborted - swapout IO was active
 17    Allocated swap file in monitor
 18      dm flag required (should not happen often)
 19      dm transient error on allocate swap file
 61    Swapout IO error at swapout_io_complete
 08    Free mm resources called during swapout
 06        .. Free mmm resources also freed SFD
100    Freed an S2 job that had been readied
107    Recalculate the swapped job entry count -- job shared pages removed
108      recalculate from S0
109      recalculate from S2


   FLUSH AM during SWAPOUT.
 13    Pages in AM flushed.
 14    Pages linked to JWS - write to disk reject
 15    Task ready after flush
 75       .. modified pages removed

   Swap in
 16    Advanced swap from R -> R (should not happen)
 78    Swapin requests made through job mode
 79    Swapin requests made through monitor mode after S0
 80    Swapin requests made through monitor mode - S0 to R
 81    Job mode swapin request got bad status on advance swap
 83    Swap in from idle_tasks_complete
 97    No ajlo, swapin_before_io--reset to swapped out
101    No ajlo, swapin_after_io--reset to swapped out
114    No ajlo, monitor swapin.

   Claim pages for swap in
 01    Claim pages failed - Insufficient memory. (Should seldom happen.)
 02    Cant reclaim job fixed ASID because reassigned.
 03    Reclaimed ASID for job fixed.
 04    Reclaimed ASID for job fixed but not still assigned.
 05    Claim pages failed - cant assign SFD pages.
 09    Claim pages failed - got pass first memory check -- now count may be wrong.

 60    Swapin IO error at swapin_io_complete
 68    Swapin IO complete discovered job should be swapped OUT
 07       .. free_mm_resources during swapin aborted
 69    No AJL ordinal at swapin time - swapin aborted.

   Move avail-modified pages back to AM queue during SWAPIN.
 11    Total times procedure was called. (not called unless pages to move)
 12    Total pages moved. (modified stale pages + pages in AM queue at swapout)

   Change ASID of page during SWAPIN.
 21    Number of ASIDs changed in swap file desc (first time).
 20    Number of ASIDs changed in swap file desc again.
 22    Number of pages that had an ASID change.

   Reset job tables during SWAPIN from disk.
 24    No change in ASID.
 25    ASID change of permanent file in JWS.
 26      Modified PF page assigned new ASID during job recovery.
 27      Discarded unmodified PF page during job recovery.
 28      PF page assigned new ASID - DM has no ASID.
 29      PF page ASID reassigned - got new ASID from DM.
 30    Assign ASID for local file.
 31    Reuse ASID for local file.
 32    Page table entry made successfully.
 33    Page table full on attempt to make entry in page table.
 34      page table full processing failed.
 35      Changed ASID as result of page table full.
 36    Page table entry exists - Discard PF page on swapin - another job read it in while job swapped.
 37    Page table entry exists in available modified for a local file.
 38    Page table entry exists in available queue for a local file.
 39    Page table entry exists in swapped error queue for a local file.
 46    Page table full reassigned job fixed asid.

   Reset sdt and xcb tables during SWAPIN.
 40 Template ASIDs changed while job swapped.
 41 Job ASIDs changed while job swapped.
 42 Global ASIDs changed while job swapped.
 43 Total XCBs scanned during SDT updates.
 44   ASIDs need to be fixed.
 45 Fix template asid.
 47 Fix job fixed asid.
 48 Fix permanent file asid.
 49 Zero out permanent file asid.

 53   Swapins after job recovery.
 54   Reset tables zeroed out an ASID in a segment table.

 85 Could not reclaim ASID of non-pageable segment on swapin.

   SWAPPING IO
 10 IO - reject from iop$pager_io for swapin/swapout IO.

   SWAPPING DFT

 90 IO error at swapin init (resource claimed).
 91 IO error at swapout io init.
 93 Disk down at swapout io complete.
 94 Disk down at swapin io complete.
103 Advance from CANNOT init io.

104 Page queue counts different at job_io_complete.
105 Advance swap from job allocate swap file.
106 Advance swap from swapped io cannot init.

   DUMP SHARED QUEUE

 95 Abort swap at allocate sfd.
 96 Advance from wait allocate sfd.
 98 Dump shared queue for sfd.
 99 Dump shared queue to claim pages.

 87 Reserve memory request failed.
110 Pages relinked to job io error queue from swapped error queue.
111 IO errors and memory freed.
112   Pages that had M bit reset.
113 IO error on an initial write.

115 Failed to find an S2 job to free for memory.
116 Reset mmv$reassignable_page_frames.now

117 Age before swap tried.
118 Number of pages freed by aging.
119 Aging freed enough pages.  Do not continue swapout.

    UNUSED entries. A non-zero count indicates a need to update the procedure.
 23 unused
 50 unused
 51 unused
 52 unused
 62 unused
 66 unused
 70 unused
 71 unused
 72 unused
 73 unused
 74 unused
 75 unused
 84 unused
 85 unused
 92 unused
102 unused

zzz
**

  rewind_file f=scratch_file
  set_file_attribute f=scratch_file op=$asis
  set_file_attribute f=local_output_file op=$asis

  accept_line v=input_string i=scratch_file

  WHILE input_string <> 'zzz' DO
    IF $substr(input_string 1 3) = ' ' THEN
      put_line l='          '//input_string o=local_output_file
    ELSE
      index = $integer($substr(input_string 1 3))
      swap_trace_value = $memory($symbol_address(jsv$swap_trace)+index*8 8)
      sj = '           ' // $strrep(swap_trace_value)
      sk = '    '//$strrep(index)
      sk = $substr(sk $strlen(sk)-3 4)
      output_line = $substr(sj $strlen(sj)-9 10)//sk//'   '//$substr(input_string 4 $strlen(input_string)-3)
      put_line l=output_line o=local_output_file
    IFEND
    accept_line v=input_string i=scratch_file
  WHILEND
  copy_file i=local_output_file.$boi o=output
  delete_file f=scratch_file
  delete_file f=local_output_file

PROCEND dum$display_swap_trace_stats
