SA(VIII)                     6/1/74                      SA(VIII)







NAME

     sa - Shell accounting



SYNOPSIS

     sa [ -abcjlnrstuv ] [ file ]



DESCRIPTION

     When a user logs in, if the Shell is able to open  the  file

     /usr/adm/sha,  then  as  each  command  completes  the Shell

     writes at the end of this file the name of the command,  the

     user,  system,  and real time consumed, and the user ID.  Sa

     reports on, cleans up,  and  generally  maintains  this  and

     other  accounting files.  To turn accounting on and off, the

     accounting file must be created or destroyed externally.



     Sa is able to condense the information in /usr/adm/sha  into

     a  summary  file  /usr/adm/sht which contains a count of the

     number of  times  each  command  was  called  and  the  time

     resources  consumed.  This condensation is desirable because

     on a large system sha can grow by 100 blocks per  day.   The

     summary  file  is  read  before  the accounting file, so the

     reports include all available information.



     If a file name is given as the last argument, that file will

     be  treated  as  the  accounting  file;  sha is the default.

     There are zillions of options:





     a   Place   all   command   names   containing   unprintable

        characters  and  those  used  only  once  under  the name

        ``***other.''



     b   Sort output by sum of user and system  time  divided  by

        number  of  calls.   Default  sort  is by sum of user and

        system times.



     c   Besides total user,  system,  and  real  time  for  each

        command print percentage of total time over all commands.



     j   Instead of total minutes time for  each  category,  give

        seconds per call.



     l   Separate  system  and  user  time;  normally  they   are

        combined.



     n   Sort by number of calls.



     r   Reverse order of sort.



     s   Merge accounting file  into  summary  file  /usr/adm/sht

        when done.



     t   For each command report ratio of real time to the sum of

        user and system times.



     u   Superseding all other flags, print for each  command  in

        the accounting file the day of the year, time, day of the

        week, user ID and command name.



     v   If the next character is a digit n, then type  the  name

        of  each  command  used  n times or fewer.  Await a reply

        from the typewriter; if it begins  with  ``y'',  add  the

        command  to  the  category ``**junk**.''  This is used to

        strip out garbage.



FILES

     /usr/adm/sha    accounting

     /usr/adm/sht    summary



SEE ALSO

     ac (VIII)



BUGS