Terminal: time command use

The command was born to know the time used by a command, but with the GNU Version it is possible to have more informations on other resources (memory, I/O or IPC). As you can find tiping man time on a terminal the command syntax is the follow:

time [options] command [arguments...]

where the available option is only -p to use the command in the traditional format, so with the output as follow:Statusbar configuration of wmfs windows manager

real %e
user %U
sys %S

If you want to use the command as utility in the GNU Version the options are:

-f FORMAT, –format=FORMAT
Specify output format, possibly overriding the format specified in the environment variable TIME.

-p, –portability
Use the portable output format.

-o FILE, –output=FILE
Do not send the results to stderr, but overwrite the specified file.

-a, –append
(Used together with -o.) Do not overwrite but append.

-v, –verbose
Give very verbose output about all the program knows about.

 

While the possible arguments, always in GNU Version, are:

  • To use for TIME
    %E Elapsed real time (in [hours:]minutes:seconds).%e (Not in tcsh.) Elapsed real time (in seconds).%S Total number of CPU-seconds that the process spent in kernel mode.

    %U Total number of CPU-seconds that the process spent in user mode.

    %P Percentage of the CPU that this job got, computed as (%U + %S) / %E.

  • To use for MEMORY
    %M Maximum resident set size of the process during its lifetime, in Kbytes.%t (Not in tcsh.) Average resident set size of the process, in Kbytes.%K Average total (data+stack+text) memory use of the process, in Kbytes.

    %D Average size of the process’s unshared data area, in Kbytes.

    %p (Not in tcsh.) Average size of the process’s unshared stack space, in Kbytes.

    %X Average size of the process’s shared text space, in Kbytes.

    %Z (Not in tcsh.) System’s page size, in bytes. This is a per-system constant, but varies between systems.

    %F Number of major page faults that occurred while the process was running. These are faults where the page has to be read in from disk.

    %R Number of minor, or recoverable, page faults. These are faults for pages that are not valid but which have not yet been claimed by other virtual pages. Thus the data in the page is still valid but the system tables must be updated.

    %W Number of times the process was swapped out of main memory.

    %c Number of times the process was context-switched involuntarily (because the time slice expired).

    %w Number of waits: times that the program was context-switched voluntarily, for instance while waiting for an I/O operation to complete.

  • To use for I/O
    %I Number of filesystem inputs by the process.%O Number of filesystem outputs by the process.%r Number of socket messages received by the process.

    %s Number of socket messages sent by the process.

    %k Number of signals delivered to the process.

    %C (Not in tcsh.) Name and command-line arguments of the command being timed.

    %x (Not in tcsh.) Exit status of the command.

About Daniele Dalla Torre

I'm a Civil Engineering student but I love to learn everything about technology, from the basics to the new frontiers! Here my gpg public key!

3 thoughts on “Terminal: time command use

Leave a Reply

Your email address will not be published.

*