9.7.1 time command (displays the time used to execute a command)
Syntax
time [-p] [command]
Description
This command outputs to the standard error output the amount of time it took to execute a command.
Specifies the command whose execution time is to be output to the standard error output. If command is omitted, the shell's execution time is output. The output formats are as follows.
When command is specified
command-name command-execution-time command-name user-CPU-time command-name system-CPU-time
In Windows, the CPU times of grandchild processes are not included in the command's user CPU time and system CPU time.
When command is omitted
user-CPU-time-of-shell# system-CPU-time-of-shell#
#: Includes CPU time of processes launched from the shell.
In Windows, the CPU times of grandchild processes are not included in the shell's user CPU time and system CPU time.
Arguments
- -p
Specifies that the amounts of execution time, user CPU time, and system CPU time are to be output, each on a separate line.
- command
Specifies the name of the command whose execution time and CPU time are to be output.
Return codes
Return code |
Meaning |
---|---|
Return code of the specified command: 0 when no command is specified. |
Normal termination |
Notes
The results of the time command cannot be redirected to a file other than the standard error output.
The execution results of this command are not output to the job execution log. Note also that this command does not identify whether the job or job step terminated normally or with an error. Refer instead to the execution time that was output to the standard error output and to the execution results of the command that was called.
Example
Output a command's execution time and CPU time.
Contents of the job definition script
time date
Contents of the STDOUT file of the execution job
******** JOB SCOPE STDOUT ******** Thu Jul 7 11:06:38 JST 2011
Contents of the STDERR file of the execution job
******** JOB SCOPE STDERR ******** 0.01s real 0.00s user 0.00s system