timex(1)


timex -- time a command, report process data and system activity

Synopsis

timex [options] command

Description

The given command is executed; the elapsed time, user time and system time spent in execution are reported in seconds. Optionally, process accounting data for the command and all its children can be listed or summarized, and total system activity during the execution interval can be reported.

The output of timex is written on standard error. timex returns an exit status of 1 if it is used incorrectly, if it is unable to fork, or if it could not exec command. Otherwise, timex returns the exit status of command. Be aware that, because timex returns the exit status of command, if command terminates abnormally, the shell erroneously reports that timex terminated abnormally as well.

The options are:


-p
List process accounting records for command and all its children. This option works only if the process accounting software is installed and /usr/lib/acct/turnacct has been invoked to create /var/adm/pacct. Suboption f, h, k, m, r, and t modify the data items reported. The options are as follows:

-f
Print the fork(2) /exec(2) flag and system exit status columns in the output.

-h
Instead of mean memory size, show the fraction of total available CPU time consumed by the process during its execution. This ``hog factor'' is computed as (total CPU time)/(elapsed time).

-k
Instead of memory size, show total kcore-minutes.

-m
Show mean core size (the default).

-r
Show CPU factor (user time/(system-time + user-time).

-t
Show separate system and user CPU times. The number of blocks read or written and the number of characters transferred are always reported.

-o
Report the total number of blocks read or written and total characters transferred by command and all its children. This option works only if the process accounting software is installed.

-s
Report total system activity (not just that due to command) that occurred during the execution interval of command. All the data items listed in sar(1M) are reported.

References

acctsh(1M), sar(1M), time(1), times(2)

Notices

Process records associated with command are selected from the accounting file /var/adm/pacct by inference, since process genealogy is not available. Background processes having the same user ID, terminal ID, and execution time window will be spuriously included.

The timex call expects that nightly accounting will restart the /var/adm/pacct each day. If accounting is activated, but you do not perform nightly accounting, you should add the line 0 0 * * * > var/adm/pacct to the adm crontab file, so timex can use the accounting options.

Examples

A simple example:
   timex -ops sleep 60

A terminal session of arbitrary complexity can be measured by timing a sub-shell:

   timex -opskmt sh
   

session commands EOT


© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004