Skip to main content
added 32 characters in body
Source Link

The time you use in your question is not a command, but rather a reserved word in . It can be used in two different ways and its output can be customized through the $TIMEFMT parameter. ThereAdditionally, there is also an external command time on macOS (and most other Unix-like OSes), which produces slightly different output.

External Commandcommand time

The time you use in your question is not a command, but rather a reserved word in . It can be used in two different ways and its output can be customized through the $TIMEFMT parameter. There is also an external command time on macOS, which produces slightly different output.

External Command time

The time you use in your question is not a command, but rather a reserved word in . It can be used in two different ways and its output can be customized through the $TIMEFMT parameter. Additionally, there is an external command time on macOS (and most other Unix-like OSes), which produces slightly different output.

External command time

added 1 character in body
Source Link
% command time
% command time sleep 0 
        0.00 real         0.00 user         0.00 sys
% command time -p sleep 0 
real         0.00
user         0.00
sys          0.00
% command time -l sleep 0  # AddShow memory usage
        0.00 real         0.00 user         0.00 sys
              585728  maximum resident set size
                   0  average shared memory size
                   0  average unshared data size
                   0  average unshared stack size
                 160  page reclaims
                   0  page faults
                   0  swaps
                   0  block input operations
                   0  block output operations
                   0  messages sent
                   0  messages received
                   0  signals received
                   0  voluntary context switches
                   1  involuntary context switches
             2198249  instructions retired
             3195521  cycles elapsed
              237568  peak memory footprint
%
% command time
% command time sleep 0 
        0.00 real         0.00 user         0.00 sys
% command time -p sleep 0 
real         0.00
user         0.00
sys          0.00
% command time -l sleep 0  # Add memory usage
        0.00 real         0.00 user         0.00 sys
              585728  maximum resident set size
                   0  average shared memory size
                   0  average unshared data size
                   0  average unshared stack size
                 160  page reclaims
                   0  page faults
                   0  swaps
                   0  block input operations
                   0  block output operations
                   0  messages sent
                   0  messages received
                   0  signals received
                   0  voluntary context switches
                   1  involuntary context switches
             2198249  instructions retired
             3195521  cycles elapsed
              237568  peak memory footprint
%
% command time
% command time sleep 0 
        0.00 real         0.00 user         0.00 sys
% command time -p sleep 0 
real         0.00
user         0.00
sys          0.00
% command time -l sleep 0  # Show memory usage
        0.00 real         0.00 user         0.00 sys
              585728  maximum resident set size
                   0  average shared memory size
                   0  average unshared data size
                   0  average unshared stack size
                 160  page reclaims
                   0  page faults
                   0  swaps
                   0  block input operations
                   0  block output operations
                   0  messages sent
                   0  messages received
                   0  signals received
                   0  voluntary context switches
                   1  involuntary context switches
             2198249  instructions retired
             3195521  cycles elapsed
              237568  peak memory footprint
%
added 2 characters in body
Source Link
  • shell represents the shell in which you executed your time statement. children is a summary of all running processes started from (and still owned by) that shell.
  • user and system show the amount of CPU seconds the above processes spent in user mode and kernel mode, respectively. See https://blog.codinghorror.com/understanding-user-and-kernel-mode/ mode and kernel mode for more info, respectively.
  • cpu shows the combined values of user and system, as a percentage of total CPU time. total shows how long ago the shell or its oldest child process was started (here in minutes:seconds.fraction).
  • shell represents the shell in which you executed your time statement. children is a summary of all running processes started from (and still owned by) that shell.
  • user and system show the amount of CPU seconds the above processes spent in user mode and kernel mode, respectively. See https://blog.codinghorror.com/understanding-user-and-kernel-mode/ for more info.
  • cpu shows the combined values of user and system, as a percentage of total CPU time. total shows how long ago the shell or its oldest child process was started (here in minutes:seconds.fraction).
  • shell represents the shell in which you executed your time statement. children is a summary of all running processes started from (and still owned by) that shell.
  • user and system show the amount of CPU seconds the above processes spent in user mode and kernel mode, respectively.
  • cpu shows the combined values of user and system, as a percentage of total CPU time. total shows how long ago the shell or its oldest child process was started (here in minutes:seconds.fraction).
added 2 characters in body
Source Link
Loading
edited body
Source Link
Loading
added 8 characters in body
Source Link
Loading
Add more explanation
Source Link
Loading
Add more explanation
Source Link
Loading
Add more explanation
Source Link
Loading
Add info about external command `time`
Source Link
Loading
added 25 characters in body
Source Link
Loading
Add example of `time` with arguments
Source Link
Loading
added 1 character in body
Source Link
Loading
Add note about shell ownage
Source Link
Loading
added 7 characters in body
Source Link
Loading
Source Link
Loading