Using the acctcom command

The acctcom command displays historical data on CPU usage if the accounting system is activated.

Activate accounting only if absolutely needed because starting the accounting system puts a measurable overhead on the system. To activate the accounting system, do the following:

  1. Create an empty accounting file:
    # touch acctfile
  2. Turn on accounting:
    # /usr/sbin/acct/accton acctfile
  3. Allow accounting to run for a while and then turn off accounting:
    # /usr/sbin/acct/accton
  4. Display what accounting captured, as follows:
    # /usr/sbin/acct/acctcom acctfile
    COMMAND                      START    END          REAL      CPU     MEAN
    NAME       USER     TTYNAME  TIME     TIME       (SECS)   (SECS)  SIZE(K)
    #accton    root     pts/2   19:57:18 19:57:18     0.02     0.02   184.00
    #ps        root     pts/2   19:57:19 19:57:19     0.19     0.17    35.00
    #ls        root     pts/2   19:57:20 19:57:20     0.09     0.03   109.00
    #ps        root     pts/2   19:57:22 19:57:22     0.19     0.17    34.00
    #accton    root     pts/2   20:04:17 20:04:17     0.00     0.00     0.00
    #who       root     pts/2   20:04:19 20:04:19     0.02     0.02     0.00
If you reuse the same file, you can see when the newer processes were started by looking for the accton process (this was the process used to turn off accounting the first time).