GNU Info

Info Node: (time.info)Examples

(time.info)Examples


Next: Accuracy Prev: Redirecting Up: Resource Measurement
Enter node , (file) or (file)node

Examples
========

Run the command `wc /etc/hosts' and show the default information:

     eg$ time wc /etc/hosts
           35     111    1134 /etc/hosts
     0.00user 0.01system 0:00.04elapsed 25%CPU (0avgtext+0avgdata 0maxresident)k
     1inputs+1outputs (0major+0minor)pagefaults 0swaps

Run the command `ls -Fs' and show just the user, system, and wall-clock
time:

     eg$ time -f "\t%E real,\t%U user,\t%S sys" ls -Fs
     total 16
     1 account/      1 db/           1 mail/         1 run/
     1 backups/      1 emacs/        1 msgs/         1 rwho/
     1 crash/        1 games/        1 preserve/     1 spool/
     1 cron/         1 log/          1 quotas/       1 tmp/
             0:00.03 real,   0.00 user,      0.01 sys

Edit the file `.bashrc' and have `time' append the elapsed time and
number of signals to the file `log', reading the format string from the
environment variable `TIME':

     eg$ export TIME="\t%E,\t%k" # If using bash or ksh
     eg$ setenv TIME "\t%E,\t%k" # If using csh or tcsh
     eg$ time -a -o log emacs .bashrc
     eg$ cat log
             0:16.55,        726

Run the command `sleep 4' and show all of the information about it
verbosely:

     eg$ time -v sleep 4
             Command being timed: "sleep 4"
             User time (seconds): 0.00
             System time (seconds): 0.05
             Percent of CPU this job got: 1%
             Elapsed (wall clock) time (h:mm:ss or m:ss): 0:04.26
             Average shared text size (kbytes): 36
             Average unshared data size (kbytes): 24
             Average stack size (kbytes): 0
             Average total size (kbytes): 60
             Maximum resident set size (kbytes): 32
             Average resident set size (kbytes): 24
             Major (requiring I/O) page faults: 3
             Minor (reclaiming a frame) page faults: 0
             Voluntary context switches: 11
             Involuntary context switches: 0
             Swaps: 0
             File system inputs: 3
             File system outputs: 1
             Socket messages sent: 0
             Socket messages received: 0
             Signals delivered: 1
             Page size (bytes): 4096
             Exit status: 0


automatically generated by info2www version 1.2.2.9