ptime - Man Page

time a command

Synopsis

ptime command [arg]...
ptime -p pidlist

Description

Without the -p option, invoke the given command with the given arguments, and when the command completes, write timing statistics to standard error.

With the -p option, display a snapshot of accumulated timing statistics for the specified processes.

When /proc/[pid]/schedstat is available, the output includes nanosecond-precision scheduling statistics: cpu (on-CPU run time), lat (run-queue wait time), and slp (all other sleep time, computed as real minus cpu minus lat), along with each component's percentage of real time. A trailing * indicates the value is from a lower-precision source; percentages remain relative to real. With -p, real and slp carry a trailing * because the process start time from /proc is recorded in clock ticks (typically 10ms granularity). The user and sys values always carry a trailing * because they are derived from clock-tick counters when reading from /proc, or microsecond-precision rusage when timing a command directly. These values may not sum exactly to cpu.

Options

-p pidlist

Display a snapshot of timing statistics for the specified processes. The pidlist is a list of process IDs separated by commas, whitespace, or any combination of the two (e.g., "1,2", "1, 2", "1 2").

Operands

command

The command to execute.

arg

Arguments to the command.

pidlist

A list of process IDs separated by commas, whitespace, or any combination of the two. A /proc/pid path may also be used, allowing shell expansions like /proc/* to target all processes on the system.

Exit Status

If the command is invoked successfully, ptime(1) returns the exit status of the command. If the command is terminated by a signal, ptime(1) returns 128 plus the signal number. If the command is not found, ptime(1) returns 127. If the command is found but cannot be invoked, ptime(1) returns 126. If an error occurs in ptime(1) itself, ptime(1) returns 1.

Files

/proc/pid/*

Process information and control files.

See Also

time(1), proc(5)

Info

March 2026 ptime 0.2.22