PROPHET/OS

NAME

top: the machine while it runs

SYNOPSIS

top [proc|locks|net|filter|volumes|disk|guard|sys|conf|selbsttest] [ms]

DESCRIPTION

The machine while it runs. System resources stand on top, and below them one of eight tabs:

proc      the processes, with the kernel and background threads in gray
locks     the kernel locks with their wait share
net       the network, as three tables
filter    the packet filter, as three more
volumes   the mounted file systems
disk      the block devices
guard     what the kernel books about its own borders
sys       the modules with their holders and the provider chains

F2 to F6, F8, F9, F11 and Tab switch between them. A hidden tab is not read at all: asking the kernel for the lock table costs something, and paying for a table nobody is looking at is the kind of cost that only shows up under load.

The network tab

Three tables under one tab, each with its column head on top and its list below it:

Cards       one row per card: link, address, gateway, sent, received,
            dropped
Addresses   one row per address: the card that carries it, the
            netmask, and where the address came from
Routes      one row per route: destination, mask, gateway, card,
            metric, and where the route came from

Under them stand the details of the chosen card: model, hardware address, speed, link changes, the frames per second in both directions. Up and Down choose a card, and the choice hangs on the card, not on the row number: it stays where it is when the list comes back in another order.

The same numbers net prints, and they come from the same place. What the machine lets through instead of how it is attached is the tab filter, and the command of that name shows the same thing as lines.

The filter tab

Three tables under one tab, and the wall answers three questions in this order:

Rules         one row per rule, in the order the kernel keeps them,
              because the first matching one decides: action,
              direction, card, protocol, from, to, port, and the
              hits. A rule with zero hits has never taken hold, and
              that is usually the row somebody is looking for
Connections   one row per connection the filter holds: protocol,
              both sides with their port, packets, and how long ago
              the last packet came, against the deadline of that
              protocol
Smoothing     one row per `scrub` line: card, direction, the largest
              piece it allows, the smallest lifetime it leaves, the
              do-not-fragment bit, and how many packets it has
              touched

Under them two rows: what went through, what was blocked, what was smoothed, how many connections are held of how many, and what holds when no rule matches. Below that the last pass over the connections (seen, expired, crooked, stayed). It is the **last** one, not a fresh one: a pass drops what has expired, so a view that triggered it would change the machine by being looked at. firewall -sweep asks for one.

Every number comes out of a topic of the information page, so the same way runs and mounts read theirs. Reading the rules over the calls of the net block needed the right to change the firewall default, because one call does both; the tab does not carry that right any more.

The argument picks the tab to start on, the number sets the refresh interval in milliseconds. It fills the whole screen and redraws continuously; q leaves.

The columns of the process list

PID PPID   the run and the one that started it. The column is as
           wide as the largest identifier in the list, never
           narrower than five
USER       the owner, `sys` for a kernel or background thread
S          R on a core, W waiting for one, S sleeping on its own
           timer, I waiting for a message, Z dead, H historic
CPU%       share of the last tick, MEM the memory the run holds
TIME       the time this row really computed, for a process and for
           a thread alike
AGE        since when it has been running. Only a live process
           reports a start, so a finished run and a thread show a
           dash
CAPS       one letter per right, a dot where it is missing
Good NoR   calls that went through, calls refused for a missing
Bad        right, calls that carried a foreign pointer
Program    the name, and behind it the reason if it is not running

A - means zero, a + means the number does not fit this column. A column that has no room falls out whole rather than writing into its neighbour, and in this order: the age first, then the three counters, then the rights. On eighty columns the counters and the age are not shown; both durations stand side by side as soon as the screen is wide enough for all of the columns.

The letters of CAPS, in the order of the bits:

o output    c colour    e commands  v version   t time
r read      w write     d directory i info      S screen
C control   P checks    M memory    z random    K keys
X start     B block     I identity  Q channel   L login
T console   N net

Keys

F1          this help
F2 .. F6    proc, locks, net, volumes, disk
F8, F9      guard, sys
F11         filter, the packet filter
Tab         steps to the next tab, in a circle
F7          find by name in the process list
Esc         clear the search, and quit when none stands
Up/Down     choose a row, PgUp/PgDn a page, Home/End the ends
+ / -       refresh faster / slower
s / S       the sort column / its direction
q, F10      quit

Escape clears before it quits: as long as something is being typed or a search stands, it takes that away and the view stays.

The process list is the same source runs reads, so the two cannot disagree.

Settings

Three of them, and they stand in a file, not in the kernel:

bars      shape of the bars: full, upper, lower, pipes, line, double
mem       per-process memory: size or percent
history   seconds a finished run stays in the list, 0 is off. No
          more of them stand at once than the table has places; one
          that finds none does not stand

Read in three steps, and the user's own file wins:

<home>/.top.conf            the user's own, if it is there
/system/config/top.conf     otherwise the one that shipped
in the program              otherwise the default

top conf prints all three with the step each came from (own, system, default). They are read once per tick, so an edit reaches a running top without restarting it.

The probe in the shell

top selbsttest says in one line whether a full process table evicts the oldest entry and not the newest, and returns. The same claim stands as top.full_table_evicts_the_oldest in the check area top.

EXAMPLE

top running on ProphetOS
top running on ProphetOS

SEE ALSO

runs, memory, mounts, disks, net, filter