p4 monitor
Display Perforce process information and control long-running tasks.
Syntax
p4 [g-opts] monitor show [-a -l -e -L -s R | T | P | B | F | I ]p4 [g-opts] monitor terminate idp4 [g-opts] monitor clear [id | all]p4 [g-opts] monitor pause idp4 [g-opts] monitor resume id
Description
p4 monitor allows a system administrator to observe and control Helix server-related processes running on a Helix server machine. Processes are tracked using a dedicated table that is constantly updated. This has a minor impact on server performance.
To use p4 monitor, you must enable monitoring on the
Perforce
service by setting the monitor configurable with p4 configure.
Valid values for the monitor configurable are:
- 0: Server process monitoring off. (Default)
- 1: monitor active commands
- 2: active commands and idle connections
- 3: sames as
2, but also includes connections that failed to initialize (stuck at the Init() phase) - 5: sames as
2, but also includes a list of the files locked by the command for more than one second - 10: same as
5, but also includes lock wait times - 25: sames as
10, except that the list of files locked by the command includes files locked for any duration
Changes to the monitor configurable affect all new
p4 processes that connect to the server. Restarting
the server is not required.
See Enabling process monitoring in Helix Core Server Administrator Guide: Fundamentals.
Command syntax variants provide the following alternatives:
-
(
listlevel access):To list current process information, usep4 monitor show. By default, all processes are listed, but only the command (for example,sync,edit,submit) is shown, without arguments. Use the-s statusoption to restrict the display to processes in the specified state. - (
superlevel access):To show the list of arguments associated with each command, use the-a(arguments) option or-l(long) option. For additional information from the user environment, use the-e(environment) option Use the-Loption to show locked files. -
(operator or
superlevel access): To mark a process for termination, usep4 monitor terminate id. This command requires that the user be an operator or havesuperlevel access.The
p4 monitor terminatecommand does not mark a process for termination unless the process has been running for at least ten seconds. Some commands, such asp4 obliterate, cannot be terminated.To control how often the list of processes is refreshed, see the Configurable,
db.monitor.interval, which is also mentioned in the Support Knowledgebase article, "Fixing a hung Helix server". -
(operator or
superlevel access): To remove an entry from the monitor table, usep4 monitor clear id. You can clear the entire table withp4 monitor clear all. Both of these commands requiresuperlevel access. ( If a command terminates prematurely on the server side, it might be erroneously listed as running. You can clear such processes withp4 monitor clear.)Processes marked as running continue to run to completion even if removed from the monitor table with
p4 monitor clear. -
(operator or
superlevel access): To control the following tasks if they are running too long, use thep4 monitor pauseandp4 monitor resume:
Output format
Each line of p4 monitor output consists of the
following fields:
pid status owner hh:mm:ss command [args]
|
pid |
The process ID under Unix (or thread ID under Windows) |
|
status |
R,
Note
Finish and Background occur only in replica servers. |
|
owner |
The Helix server user name of the user who invoked the command. |
|
hh:mm:ss |
The time elapsed since the command was called. |
|
command [args] |
The command and arguments as received by the Perforce service. |
For example, consider the following output to the p4 monitor
show -L command, which displays information about locked
files:
8764 R user 00:00:00 edit
[server.locks/clients/88,d/ws4(W),db.locks(R),db.rev(R)]
8766 R user 00:00:00 edit
[server.locks/clients/89,d/ws5(W),db.locks(R),db.rev(R)]
8768 R user 00:00:00 monitor
Following pid, status, owner, and time information, this shows two edit
commands that have various files locked, including the client workspace
lock in exclusive mode for the workspaces ws4 and
ws5, and db.locks and db.rev tables in read-only mode.
If you have enabled idle process monitoring (by setting the
monitor configurable to 2), idle processes appear with a
status of R, but with a
command of IDLE.
Some commands (for instance, p4
submit) invoke multiple processes. For example,
dm_CommitSubmit or dm_SubmitChange might appear
in the output of p4 monitor as two separate phases of
the p4 submit
command.
Getting pull thread information for replicas
If you are running a replica with monitoring enabled and you have not
configured the monitor table to be disk-resident, you can run the
following command to get more precise information about what pull threads
are doing. (Remember to set monitor.lsof).
$ p4 monitor show -sB -la -L
Command output would look like this:
31701 B uservice-edge3 00:07:24 pull sleeping 1000 ms
[server.locks/replica/49,d/pull(W)]
Options
You must be an operator or have super access to use the
following options:
|
|
Show all arguments associated with the process (for example,
Helix server user names are truncated to 10 characters, and each line of output is limited to 80 characters. |
|
|
Show environment information, including invoking Helix server application (if known), host IP address, and workspace name. |
|
|
Show all arguments in long form; that is, without truncating user names or the list of command line arguments. |
|
|
Show information about locked files. The information is
collected only for the duration of the Pre-requisites for using this option vary with the platform on which the server is running.
You can use the |
|
|
Restrict the display to processes in the |
|
|
See Global options. |
Usage Notes
| Can File Arguments Use Revision Specifier? | Can File Arguments Use Revision Range? | Minimal Access Level Required |
|---|---|---|
|
No |
No |
|
Examples
|
|
Show
Helix server
process information (commands only). Requires |
|
|
Show arguments and commands, without limits on line length.
Requires |
|
|
Show arguments and commands, limited to 80 characters per line
of output. Requires |
|
|
Instruct the
Perforce
service to mark process 123 for termination. Requires
|
|
|
Clears the monitor table of all entries. Requires
|
Related Commands
|
To turn on monitoring |
|
|
To turn off monitoring |
|
Your search for returned result(s).






