diff options
| author | Sean Kurtz <seankurtz75@gmail.com> | 2026-11-25 21:48:09 -0600 |
|---|---|---|
| committer | Sean Kurtz <seankurtz75@gmail.com> | 2026-11-25 21:48:09 -0600 |
| commit | facbb0d0820c6630a3c8548cad32ed448cc5b93b (patch) | |
| tree | 32a19ab5fba4c82f50868d437918293d4ca422d3 | |
| parent | a31dca8186343f5ec7c46a8807c60453addc94e3 (diff) | |
| download | ztop-feature/views.tar.gz | |
docs: describe the views, the library and the CVT/ASVT sourcefeature/views
| -rw-r--r-- | DESIGN.md | 70 | ||||
| -rw-r--r-- | README.md | 82 |
2 files changed, 105 insertions, 47 deletions
@@ -37,11 +37,13 @@ console commands, not sources of VSM data. Nothing overlaps. Rejected as sources, and why: -- Reading the CVT and its VSM control blocks directly. It works (the PSA - reads fine from a plain `-m32` program) but the offsets are an internal - interface: they move between releases, and `CVTVSTGX` -- the structure - that holds the PLPA/FLPA/MLPA extents -- is not reachable from a field - the manual documents. +- Reading the CVT and its VSM control blocks directly, for storage. It + works (the PSA reads fine from a plain `-m32` program) but those offsets + are an internal interface, and `CVTVSTGX` -- the structure that holds the + PLPA/FLPA/MLPA extents -- is not reachable from a field the manual + documents. `VSMLIST` names what it returns; the VSM control blocks do + not. The CVT and ASVT are read for the jobs view, where the fields used + are listed as programming interfaces and no callable service exists. - SMF records (71, 78). Writing them is a system decision, reading them is privileged, and the delay makes them useless for a live display. - Console displays through `opercmd`. Correct numbers, but it needs @@ -116,16 +118,46 @@ a percentage because the unallocated request returns the holes, so footprint plus holes is the mapped extent; SQA, LSQA and the private area have no such request and show used, free and mapped without a total. +## System and jobs + +The CVT gives the system name (`CVTSNAME`, CVT+0x154) and the ASVT +(`CVTASVT`, CVT+0x22C). The ASVT holds `ASVTMAXU` at +0x204 and the +entries at +0x210; bit 0 of an entry means the ASID is free, otherwise it +is the ASCB address. From the ASCB the view takes `ASCBASID` (halfword at ++0x24) and `ASCBSRBT`'s pointer `ASCBJBNS` (fullword at +0xB0) for the +job name. All of these are in the data-areas manual as programming +interfaces, and none needs authorization. + +The fields are read as bytes with `memcpy`, never by casting an integer to +a pointer, so a misaligned read cannot fault. The strings stay EBCDIC: +the program is compiled in EBCDIC mode and the terminal converts on +output, so converting them first would double-convert. This was measured +the other way round first -- `__e2a_l` in the middle produced mojibake on +the terminal and is not used. + +CPU time is deliberately absent: `ASCBEJST` did not advance while a test +process burned 0.88 s of CPU (measured on CBT), so it is not a live field. + ## The terminal -A cell buffer and a diff flush, not curses. ncurses brings its own -terminfo database, which is another thing to install and keep in step on -every z/OS system, and its output is a stream of absolute cursor motion -anyway. `src/tui.c` keeps one screen of cells and one of what is already -on the glass, and writes only the runs that differ, with one style change -per run. No Unicode: the box and the bar are `+`, `-`, `|`, `#`, because -the terminal path is an EBCDIC-to-ASCII conversion that is not a charset -translation. +`tui/` is a small library, not a curses replacement: a cell buffer with a +diffing flush, a message loop and widgets. The loop is the Elm shape +Bubble Tea made common -- the application owns a model, receives a +message (key, resize, tick) and redraws from the model -- because it keeps +the terminal code out of the application and gives every view the same +keys. The widgets are a viewport with its own selection and scroll +offset, a table built from columns and a cell callback, tabs, a single +line input, a progress bar and a status line; an application that wants no +tabs simply never draws them. Commands and subscriptions are not modelled: +a tick message and a return value saying "redraw" are enough here, and a +`Cmd` type in C would be a function pointer by another name. + +The buffer keeps one screen of cells and one of what is already on the +glass, and writes only the runs that differ, with one style change per +run. The library is compiled into the program rather than linked from an +archive, but `tui/Makefile` can build `libtui.a` for reuse. No Unicode: +the box and the bar are `+`, `-`, `|`, `#`, because the terminal path is +an EBCDIC-to-ASCII conversion that is not a charset translation. Three z/OS details are load-bearing: @@ -153,7 +185,11 @@ Three z/OS details are load-bearing: different source, and none is planned. - `SP=PVT` output is already grouped by owning TCB, but the view still prints one list; per-TCB folding is a display change, not a data change. -- The full-screen view has been exercised on a z/OS pty: area switching, - scrolling, help, quit and the cursor restore. What has not been seen is - a real xterm over SSH answering the size query; a terminal that ignores - `ESC[6n` falls back to `COLUMNS`/`LINES` or 80x24. +- The full-screen view has been exercised on a Linux pty and a z/OS pty: + view switching, area switching, scrolling, help, quit and the cursor + restore. What has not been seen is a real xterm over SSH answering the + size query; a terminal that ignores `ESC[6n` falls back to + `COLUMNS`/`LINES` or 80x24. +- The jobs view lists every address space and its ASID and ASCB; job name + lookup uses the documented `ASCBJBNS` pointer. Sorting, filtering and + per-job storage are not implemented. @@ -1,43 +1,54 @@ # ztop -How much storage is in each area of a z/OS system -- CSA, SQA, LSQA, and -the private area -- from a z/OS UNIX shell over SSH. +What z/OS has where, from a z/OS UNIX shell over SSH: storage by subpool, +the system's identity, and one line per address space. ```text -area csa: used 71014984 free 525752 mapped 71540736 blocks 326 unallocated 194883584 total 266424320 use 27% +area csa: used 71018616 free 526216 mapped 71544832 blocks 327 unallocated 194879488 total 266424320 use 27% sp key blks used free mapped largest address 227 0 29 1607848 59224 1667072 335872 00B53000-17CF9000 228 0 54 2149808 74320 2224128 823296 00B3F000-17CFE000 -231 0 77 3354952 65208 3420160 1077248 00B54000-17CE8000 +231 0 78 3358584 65672 3424256 1077248 00B54000-17CE8000 241 0 166 63902376 327000 64229376 26689536 00B38000-17D00000 -unallocated 194883584 bytes in 5 blocks, largest 191475712 regions 00800000+0039C000, 08287000+0FA79000 +unallocated 194879488 bytes in 5 blocks, largest 191475712 regions 00800000+0039C000, 08287000+0FA79000 + +system CBT host CBT os OS/390 29.00 machine 3932 address spaces 105/355 + +asid job ascb + 1 *MASTER* 00FD7400 + 2 PCAUTH 00FC7780 + 3 RASP 00FC7600 ``` -The numbers come from `VSMLIST`, the interface z/OS offers for exactly -this. It is an assembler macro with no C equivalent, so -`src/zvslist.S` issues it and `src/vsm.c` parses the answer; `src/tui.c` is -the terminal layer and `src/ztop.c` is the command. +Storage comes from `VSMLIST`, the interface z/OS offers for exactly this. +It is an assembler macro with no C equivalent, so `src/zvslist.S` issues it +and `src/vsm.c` parses the answer. That needs no APF bit: the default +`LINKAGE=SYSTEM` path runs in problem state. + +The system name and the address spaces come from the CVT and the ASVT, +read directly as documented programming interfaces (`src/sys.c`): no +service, no authorization. + +`tui/` is the screen library: a cell buffer with a diffing flush, a +message loop shaped like Bubble Tea (model, update, view, ticks) and +widgets for a viewport, a table, tabs, a text input and a status line. +`src/ztop.c` is one user of it, not part of it. ## Build -z/OS only for the real binary, with IBM Open XL in the path: +z/OS for the real binary, with IBM Open XL in the path: ```sh -make # ibm-clang -std=c23 -m32; the .S is assembled in-process -make check # run it against each area +make # ibm-clang -std=c23 -m32; the .S is assembled by HLASM +make check # storage, system and jobs ``` -No APF bit and no special directory: `VSMLIST` was called successfully -from an ordinary HFS executable without `extattr`. (An earlier build did -abend SC78 R=90, but that was a malformed work area: the macro stores the -length itself unless the register is doubly parenthesised.) - -The parser and the TUI framework have no z/OS dependency, so on any host -with a C compiler and a terminal: +The parser, the library and `sys.c`'s structure have no z/OS dependency, +so on any host with a C compiler: ```sh -make test TESTCC=cc # synthetic VSMLIST data areas, no z/OS needed -make demo TESTCC=cc # a small exercise of the TUI framework +make test TESTCC=cc # synthetic VSMLIST bytes and library buffers +make demo TESTCC=cc # the library on its own ``` ## Use @@ -46,30 +57,41 @@ make demo TESTCC=cc # a small exercise of the TUI framework ztop one-shot CSA ztop -a sqa SQA, -a lsqa, -a pvt ztop -a csa,pvt several areas -ztop -x dump the raw work area of the first call +ztop -s system name, host, release, address-space count +ztop -j one line per address space +ztop -x dump the raw VSMLIST work and data areas ztop -d [seconds] interactive, 2 s refresh (1..60) ``` -Without `-d` the exact bytes of the answer go to standard output, suitable -for `grep` and for a shell prompt. With `-d` there is a full-screen view: +Without `-d` the bytes go to standard output, suitable for `grep` and for a +shell prompt. With `-d` there are three views, selected with `TAB`: + +| view | | +| --- | --- | +| STORAGE | CSA, SQA, LSQA and the private area, one table per area | +| SYSTEM | CVT system name, host, release, machine, address-space count | +| JOBS | ASID, job name and ASCB address for every address space | | key | | | --- | --- | -| `1`..`4` | CSA, SQA, LSQA, private | -| `a` | all four areas | +| `TAB`, `Shift-TAB` | next / previous view | +| `1`..`4` | inside STORAGE: CSA, SQA, LSQA, private | | `p` | pause/resume refresh | | `r` | collect now | | `+`/`-` | refresh 1..60 s | -| `j`/`k`, `PgUp`/`PgDn`, `g`/`G` | scroll a subpool list | +| `j`/`k`, arrows, `PgUp`/`PgDn`, `g`/`G` | move and scroll the selected table | | `?` | help | | `q` | quit | -The design, including why the data source is what it is and what is not -verified on z/OS, is in [DESIGN.md](DESIGN.md). +Each table remembers its own selection and scroll position, so switching +views does not lose your place. The design, including why the data +sources are what they are, is in [DESIGN.md](DESIGN.md). ## What it is not A snapshot, not an accounting tool: no history, no per-job attribution, no SMF. CSA has a total because `VSMLIST` returns the unallocated holes as well; SQA, LSQA and the private area do not, so those views show -used/free/mapped and no percentage. +used/free/mapped and no percentage. The jobs view does not show CPU time: +`ASCBEJST` does not advance while a process burns CPU (measured), so a +column built on it would lie. |
