# psr command

The psr BASIC program displays formatted
output of the status of the currently active UNIX and/or D3 processes.

**For Windows:**Not Supported

## Syntax

```
psr {port.number} {(options}
```

## Parameter(s)

| options | k | Shows only the processes running in D3. |
| --- | --- | --- |
| p | Directs output to system printer via the spooler. | |
| r | Shows only the running processes. | |
| s{n} | Selects the running processes by doing two UNIX ps commands, separated by a specified sampling period n (default 1s), and comparing the CPU usage of the processes. | |
Whenever possible, this command tries to identify the D3
process from the status returned by the UNIX ps command.

If the port number is specified, the output shows
process information related to the D3 process port and its child processes.
This argument supersedes the r and k options.

This command displays:

| PID | UNIX process identification. |
| --- | --- |
| PPID | UNIX process identification of the parent process. |
| TTY | Device name where the process is connected. |
| CPU | Cumulative UNIX CPU time in minutes: seconds, or +n, where n is the number of seconds accumulated in the given sampling period if the (d) option was used. |
| S | UNIX process status: |
| A | Active |
| R | Running |
| S | Suspended |
| T | Terminated |
| W | Waiting for I/O |
| Z | Zombie (defunct) |
| PORT | D3 port number. |
| USER | If the process is connected to the current virtual machine, this is its user-ID. |
| ACCOUNT | If the process is connected to the current virtual machine, this is its master dictionary. |
| STAT | If the process is connected to the current virtual machine, this is its D3 status. |
| MODE/COMMAND | If the process is connected to the current virtual machine, this is the name of the virtual mode it is currently executing. If not, it is the name of the UNIX command it is executing. |
The form psr *port.number* is useful to identify all processes spawned by a D3 process.

The form psr (r allows detecting processes,
which are consuming CPU. By repeating this command after a few second
intervals, it is easy to identify processes looping or having hardware
related problems (for example, too many serial interrupts).

The form psr (sr is an alternative to psr (r to show running processes. It allows taking a sample
on a longer period, thus catching processes running often, but not
for a long time.

CAUTION: The psr command can be intrusive.

## Example(s)

```
psr

PID PPID TTY CPU S PORT USER ACCOUNT STAT MODE/COMMAND
1 0 - 18:08 S init
1973 1 - 1:04 S syncd
3071 L1 10/0 421:23 R d3
3255 1 - 0:01 S errdemon
3762 1 112/0 0:00 S 072 F310 md0:00C
4270 1 108/0 0:00 S 068 F310 md0:00C
4368 1 - 0:00 S srcmstr
5028 4368 - 0:00 S writesrv
5283 1 89/0 0:00 S 057 dm dm F310 tcl.input:000
5615 1 102/0 0:20 S pxproute
6053 1 91/0 0:15 S 059 F310 rdl.getchar:000
6314 4368 - 0:00 S qdaemon
6513 1 2/0 0:00 S 002 F310 rdl.getchar:000
7110 1 0 0:00 S 128 BF10 sp.sleep:040
```
This command takes two samples at 3 second intervals and displays
the time accumulated by the running process. In this example, the
process d3 has consumed 3 seconds (the whole sampling period), which
is an indication of a potential problem.

```
psr (d3

PID PPID TTY CPU S PORT USER ACCOUNT STAT MODE/COMMAND
3071 1 10/0 +3 R d3
```

## See also

- [! command](https://d3codex.com/tcl/exclamation-command/)
- [d3 command](https://d3codex.com/unix/d3-command/)
- [kill command](https://d3codex.com/tcl/kill-command/)
- [pick command](https://d3codex.com/unix/pick-command/)
- [PID](https://d3codex.com/definitions/pid/)
- [pid command](https://d3codex.com/tcl/pid-command/)
- [Port number](https://d3codex.com/definitions/port-number/)
- [where command](https://d3codex.com/tcl/where-command/)

---
Source: https://d3codex.com/tcl/psr-command/ - part of the D3Codex reference.
