time: Examples
1
1 1.4 Examples
1 ============
1
1 Run the command 'wc /etc/hosts' and show the default information:
1
1 eg$ time wc /etc/hosts
1 35 111 1134 /etc/hosts
1 0.00user 0.01system 0:00.04elapsed 25%CPU (0avgtext+0avgdata 0maxresident)k
1 1inputs+1outputs (0major+0minor)pagefaults 0swaps
1
1 Run the command 'ls -Fs' and show just the user, system, and wall-clock
1 time:
1
1 eg$ time -f "\t%E real,\t%U user,\t%S sys" ls -Fs
1 total 16
1 1 account/ 1 db/ 1 mail/ 1 run/
1 1 backups/ 1 emacs/ 1 msgs/ 1 rwho/
1 1 crash/ 1 games/ 1 preserve/ 1 spool/
1 1 cron/ 1 log/ 1 quotas/ 1 tmp/
1 0:00.03 real, 0.00 user, 0.01 sys
1
1 Edit the file '.bashrc' and have 'time' append the elapsed time and
1 number of signals to the file 'log', reading the format string from the
1 environment variable 'TIME':
1
1 eg$ export TIME="\t%E,\t%k" # If using bash or ksh
1 eg$ setenv TIME "\t%E,\t%k" # If using csh or tcsh
1 eg$ time -a -o log emacs .bashrc
1 eg$ cat log
1 0:16.55, 726
1
1 Run the command 'sleep 4' and show all of the information about it
1 verbosely:
1
1 eg$ time -v sleep 4
1 Command being timed: "sleep 4"
1 User time (seconds): 0.00
1 System time (seconds): 0.05
1 Percent of CPU this job got: 1%
1 Elapsed (wall clock) time (h:mm:ss or m:ss): 0:04.26
1 Average shared text size (kbytes): 36
1 Average unshared data size (kbytes): 24
1 Average stack size (kbytes): 0
1 Average total size (kbytes): 60
1 Maximum resident set size (kbytes): 32
1 Average resident set size (kbytes): 24
1 Major (requiring I/O) page faults: 3
1 Minor (reclaiming a frame) page faults: 0
1 Voluntary context switches: 11
1 Involuntary context switches: 0
1 Swaps: 0
1 File system inputs: 3
1 File system outputs: 1
1 Socket messages sent: 0
1 Socket messages received: 0
1 Signals delivered: 1
1 Page size (bytes): 4096
1 Exit status: 0
1