1b1069b52SDavid Greenman.\" 2b1069b52SDavid Greenman.\" Copyright (c) 1994 Christopher G. Demetriou 3b1069b52SDavid Greenman.\" All rights reserved. 4b1069b52SDavid Greenman.\" 5b1069b52SDavid Greenman.\" Redistribution and use in source and binary forms, with or without 6b1069b52SDavid Greenman.\" modification, are permitted provided that the following conditions 7b1069b52SDavid Greenman.\" are met: 8b1069b52SDavid Greenman.\" 1. Redistributions of source code must retain the above copyright 9b1069b52SDavid Greenman.\" notice, this list of conditions and the following disclaimer. 10b1069b52SDavid Greenman.\" 2. Redistributions in binary form must reproduce the above copyright 11b1069b52SDavid Greenman.\" notice, this list of conditions and the following disclaimer in the 12b1069b52SDavid Greenman.\" documentation and/or other materials provided with the distribution. 13b1069b52SDavid Greenman.\" 3. All advertising materials mentioning features or use of this software 14b1069b52SDavid Greenman.\" must display the following acknowledgement: 15b1069b52SDavid Greenman.\" This product includes software developed by Christopher G. Demetriou. 16b1069b52SDavid Greenman.\" 3. The name of the author may not be used to endorse or promote products 17b1069b52SDavid Greenman.\" derived from this software without specific prior written permission 18b1069b52SDavid Greenman.\" 19b1069b52SDavid Greenman.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 20b1069b52SDavid Greenman.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 21b1069b52SDavid Greenman.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 22b1069b52SDavid Greenman.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 23b1069b52SDavid Greenman.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 24b1069b52SDavid Greenman.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25b1069b52SDavid Greenman.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26b1069b52SDavid Greenman.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27b1069b52SDavid Greenman.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 28b1069b52SDavid Greenman.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29b1069b52SDavid Greenman.\" 30*8209febbSSergio Carlavilla Delgado.Dd February 14, 2020 31b1069b52SDavid Greenman.Dt SA 8 326b5da6e2SDavid Greenman.Os 33b1069b52SDavid Greenman.Sh NAME 34b1069b52SDavid Greenman.Nm sa 35b1069b52SDavid Greenman.Nd print system accounting statistics 36b1069b52SDavid Greenman.Sh SYNOPSIS 37e97407b4SRuslan Ermilov.Nm 38b1069b52SDavid Greenman.Op Fl abcdDfijkKlmnqrstu 395f6f6b29SDiomidis Spinellis.Op Fl P Ar file 405f6f6b29SDiomidis Spinellis.Op Fl U Ar file 41b1069b52SDavid Greenman.Op Fl v Ar cutoff 42b1069b52SDavid Greenman.Op Ar 43b1069b52SDavid Greenman.Sh DESCRIPTION 44b1069b52SDavid GreenmanThe 4519112792SPhilippe Charnier.Nm 46b1069b52SDavid Greenmanutility reports on, cleans up, 47b1069b52SDavid Greenmanand generally maintains system 48b1069b52SDavid Greenmanaccounting files. 49b1069b52SDavid Greenman.Pp 50490d5836SPhilippe CharnierThe 51490d5836SPhilippe Charnier.Nm 52490d5836SPhilippe Charnierutility is able to condense the information in 53b1069b52SDavid Greenman.Pa /var/account/acct 54b1069b52SDavid Greenmaninto the summary files 55b1069b52SDavid Greenman.Pa /var/account/savacct 56b1069b52SDavid Greenmanand 57b1069b52SDavid Greenman.Pa /var/account/usracct , 58b1069b52SDavid Greenmanwhich contain system statistics according 59b1069b52SDavid Greenmanto command name and login id, respectively. 60b1069b52SDavid GreenmanThis condensation is desirable because on a 61b1069b52SDavid Greenmanlarge system, 62b1069b52SDavid Greenman.Pa /var/account/acct 63b1069b52SDavid Greenmancan grow by hundreds of blocks per day. 64b1069b52SDavid GreenmanThe summary files are normally read before 65b1069b52SDavid Greenmanthe accounting file, so that reports include 66b1069b52SDavid Greenmanall available information. 67b1069b52SDavid Greenman.Pp 68b1069b52SDavid GreenmanIf file names are supplied, they are read instead of 69906c1e27SMike Pritchard.Pa /var/account/acct . 70b1069b52SDavid GreenmanAfter each file is read, if the summary 71b1069b52SDavid Greenmanfiles are being updated, an updated summary will 7207bfccd7SRuslan Ermilovbe saved to disk. 7307bfccd7SRuslan ErmilovOnly one report is printed, 74b1069b52SDavid Greenmanafter the last file is processed. 75b1069b52SDavid Greenman.Pp 76b1069b52SDavid GreenmanThe labels used in the output indicate the following, except 77b1069b52SDavid Greenmanwhere otherwise specified by individual options: 78b1069b52SDavid Greenman.Bl -tag -width k*sec 79b1069b52SDavid Greenman.It Dv avio 80b1069b52SDavid GreenmanAverage number of I/O operations per execution 81b1069b52SDavid Greenman.It Dv cp 82b1069b52SDavid GreenmanSum of user and system time, in minutes 83b1069b52SDavid Greenman.It Dv cpu 84b1069b52SDavid GreenmanSame as 85b1069b52SDavid Greenman.Dv cp 86b1069b52SDavid Greenman.It Dv k 87b1069b52SDavid GreenmanCPU-time averaged core usage, in 1k units 88b1069b52SDavid Greenman.It Dv k*sec 89b1069b52SDavid GreenmanCPU storage integral, in 1k-core seconds 90b1069b52SDavid Greenman.It Dv re 91b1069b52SDavid GreenmanReal time, in minutes 92b1069b52SDavid Greenman.It Dv s 93b1069b52SDavid GreenmanSystem time, in minutes 94b1069b52SDavid Greenman.It Dv tio 95b1069b52SDavid GreenmanTotal number of I/O operations 96b1069b52SDavid Greenman.It Dv u 97b1069b52SDavid GreenmanUser time, in minutes 98b1069b52SDavid Greenman.El 99b1069b52SDavid Greenman.Pp 100b1069b52SDavid GreenmanThe options to 10119112792SPhilippe Charnier.Nm 102b1069b52SDavid Greenmanare: 103b1069b52SDavid Greenman.Bl -tag -width Ds 104b1069b52SDavid Greenman.It Fl a 105b1069b52SDavid GreenmanList all command names, including those containing unprintable 10607bfccd7SRuslan Ermilovcharacters and those used only once. 10707bfccd7SRuslan ErmilovBy default, 10819112792SPhilippe Charnier.Nm 109b1069b52SDavid Greenmanplaces all names containing unprintable characters and 110b1069b52SDavid Greenmanthose used only once under the name ``***other''. 111b1069b52SDavid Greenman.It Fl b 112b1069b52SDavid GreenmanIf printing command statistics, sort output by the sum of user and system 113b1069b52SDavid Greenmantime divided by number of calls. 114b1069b52SDavid Greenman.It Fl c 115b1069b52SDavid GreenmanIn addition to the number of calls and the user, system and real times 116b1069b52SDavid Greenmanfor each command, print their percentage of the total over all commands. 117b1069b52SDavid Greenman.It Fl d 118b1069b52SDavid GreenmanIf printing command statistics, sort by the average number of disk 11907bfccd7SRuslan ErmilovI/O operations. 12007bfccd7SRuslan ErmilovIf printing user statistics, print the average number of 121b1069b52SDavid Greenmandisk I/O operations per user. 122b1069b52SDavid Greenman.It Fl D 123b1069b52SDavid GreenmanIf printing command statistics, sort and print by the total number 124b1069b52SDavid Greenmanof disk I/O operations. 125b1069b52SDavid Greenman.It Fl f 126b1069b52SDavid GreenmanForce no interactive threshold comparison with the 127b1069b52SDavid Greenman.Fl v 128b1069b52SDavid Greenmanoption. 129b1069b52SDavid Greenman.It Fl i 130b1069b52SDavid GreenmanDo not read in the summary files. 131b1069b52SDavid Greenman.It Fl j 132b1069b52SDavid GreenmanInstead of the total minutes per category, give seconds per call. 133b1069b52SDavid Greenman.It Fl k 134b1069b52SDavid GreenmanIf printing command statistics, sort by the cpu-time average memory 13507bfccd7SRuslan Ermilovusage. 13607bfccd7SRuslan ErmilovIf printing user statistics, print the cpu-time average 137b1069b52SDavid Greenmanmemory usage. 138b1069b52SDavid Greenman.It Fl K 139b1069b52SDavid GreenmanIf printing command statistics, print and sort by the cpu-storage integral. 140b1069b52SDavid Greenman.It Fl l 141b1069b52SDavid GreenmanSeparate system and user time; normally they are combined. 142b1069b52SDavid Greenman.It Fl m 143b1069b52SDavid GreenmanPrint per-user statistics rather than per-command statistics. 144b1069b52SDavid Greenman.It Fl n 145b1069b52SDavid GreenmanSort by number of calls. 1465f6f6b29SDiomidis Spinellis.It Fl P Ar file 1475f6f6b29SDiomidis SpinellisUse the specified 1485f6f6b29SDiomidis Spinellis.Ar file 1495f6f6b29SDiomidis Spinellisfor accessing the per-command accounting summary database, 1505f6f6b29SDiomidis Spinellisinstead of the default 1515f6f6b29SDiomidis Spinellis.Pa /var/account/savacct . 152b1069b52SDavid Greenman.It Fl q 153b1069b52SDavid GreenmanCreate no output other than error messages. 154b1069b52SDavid Greenman.It Fl r 155b1069b52SDavid GreenmanReverse order of sort. 156b1069b52SDavid Greenman.It Fl s 157b1069b52SDavid GreenmanTruncate the accounting files when done and merge their data 158b1069b52SDavid Greenmaninto the summary files. 159b1069b52SDavid Greenman.It Fl t 160b1069b52SDavid GreenmanFor each command, report the ratio of real time to the sum 161b1069b52SDavid Greenmanof user and system cpu times. 162b1069b52SDavid GreenmanIf the cpu time is too small to report, ``*ignore*'' appears in 163b1069b52SDavid Greenmanthis field. 1645f6f6b29SDiomidis Spinellis.It Fl U Ar file 1655f6f6b29SDiomidis SpinellisUse the specified 1665f6f6b29SDiomidis Spinellis.Ar file 1675f6f6b29SDiomidis Spinellisfor accessing the per-user accounting summary database, 1685f6f6b29SDiomidis Spinellisinstead of the default 1695f6f6b29SDiomidis Spinellis.Pa /var/account/usracct . 170b1069b52SDavid Greenman.It Fl u 171b1069b52SDavid GreenmanSuperseding all other flags, for each entry 172b1069b52SDavid Greenmanin the accounting file, print the user ID, total seconds of cpu usage, 173b1069b52SDavid Greenmantotal memory usage, number of I/O operations performed, and 174b1069b52SDavid Greenmancommand name. 175b1069b52SDavid Greenman.It Fl v Ar cutoff 176b1069b52SDavid GreenmanFor each command used 177b1069b52SDavid Greenman.Ar cutoff 178b1069b52SDavid Greenmantimes or fewer, print the command name and await a reply 17907bfccd7SRuslan Ermilovfrom the terminal. 18007bfccd7SRuslan ErmilovIf the reply begins with ``y'', add 18107bfccd7SRuslan Ermilovthe command to the category ``**junk**''. 18207bfccd7SRuslan ErmilovThis flag is 183b1069b52SDavid Greenmanused to strip garbage from the report. 184b1069b52SDavid Greenman.El 185b1069b52SDavid Greenman.Pp 18607bfccd7SRuslan ErmilovBy default, per-command statistics will be printed. 18707bfccd7SRuslan ErmilovThe number of 188b1069b52SDavid Greenmancalls, the total elapsed time in minutes, total cpu and user time 189b1069b52SDavid Greenmanin minutes, average number of I/O operations, and CPU-time 19007bfccd7SRuslan Ermilovaveraged core usage will be printed. 19107bfccd7SRuslan ErmilovIf the 192b1069b52SDavid Greenman.Fl m 193b1069b52SDavid Greenmanoption is specified, per-user statistics will be printed, including 194b1069b52SDavid Greenmanthe user name, the number of commands invoked, total cpu time used 195b1069b52SDavid Greenman(in minutes), total number of I/O operations, and CPU storage integral 19607bfccd7SRuslan Ermilovfor each user. 19707bfccd7SRuslan ErmilovIf the 198b1069b52SDavid Greenman.Fl u 199b1069b52SDavid Greenmanoption is specified, the uid, user and system time (in seconds), 200b1069b52SDavid GreenmanCPU storage integral, I/O usage, and command name will be printed 201b1069b52SDavid Greenmanfor each entry in the accounting data file. 202b1069b52SDavid Greenman.Pp 203b1069b52SDavid GreenmanIf the 204b1069b52SDavid Greenman.Fl u 205b1069b52SDavid Greenmanflag is specified, all flags other than 206b1069b52SDavid Greenman.Fl q 20707bfccd7SRuslan Ermilovare ignored. 20807bfccd7SRuslan ErmilovIf the 209b1069b52SDavid Greenman.Fl m 210b1069b52SDavid Greenmanflag is specified, only the 211b1069b52SDavid Greenman.Fl b , 212b1069b52SDavid Greenman.Fl d , 213b1069b52SDavid Greenman.Fl i , 214b1069b52SDavid Greenman.Fl k , 215b1069b52SDavid Greenman.Fl q , 216b1069b52SDavid Greenmanand 217b1069b52SDavid Greenman.Fl s 218b1069b52SDavid Greenmanflags are honored. 219b1069b52SDavid Greenman.Sh FILES 220b1069b52SDavid Greenman.Bl -tag -width /var/account/usracct -compact 221b1069b52SDavid Greenman.It Pa /var/account/acct 222b1069b52SDavid Greenmanraw accounting data file 223b1069b52SDavid Greenman.It Pa /var/account/savacct 224b1069b52SDavid Greenmanper-command accounting summary database 225b1069b52SDavid Greenman.It Pa /var/account/usracct 226b1069b52SDavid Greenmanper-user accounting summary database 227b1069b52SDavid Greenman.El 22859a3c79dSRuslan Ermilov.Sh EXIT STATUS 22959a3c79dSRuslan Ermilov.Ex -std 230b1069b52SDavid Greenman.Sh SEE ALSO 231bfd34a4aSWolfram Schneider.Xr lastcomm 1 , 232b1069b52SDavid Greenman.Xr acct 5 , 233bfd34a4aSWolfram Schneider.Xr ac 8 , 234bfd34a4aSWolfram Schneider.Xr accton 8 235*8209febbSSergio Carlavilla Delgado.Sh HISTORY 236*8209febbSSergio Carlavilla Delgado.Nm 237*8209febbSSergio Carlavilla Delgadofirst appeared in 238*8209febbSSergio Carlavilla Delgado.At v5 . 239*8209febbSSergio Carlavilla Delgado.Nm 240*8209febbSSergio Carlavilla Delgadowas rewritten for 241*8209febbSSergio Carlavilla Delgado.Nx 0.9a 242*8209febbSSergio Carlavilla Delgadofrom the specification provided by various systems' manual pages. 2430b31f1f7SUlrich Spörlein.Sh AUTHORS 24401c2b8acSBaptiste Daroussin.An Chris G. Demetriou Aq Mt cgd@postgres.berkeley.edu 245b1069b52SDavid Greenman.Sh CAVEATS 246b1069b52SDavid GreenmanWhile the behavior of the options in this version of 24719112792SPhilippe Charnier.Nm 248b1069b52SDavid Greenmanwas modeled after the original version, there are some intentional 24907bfccd7SRuslan Ermilovdifferences and undoubtedly some unintentional ones as well. 25007bfccd7SRuslan ErmilovIn 251b1069b52SDavid Greenmanparticular, the 252b1069b52SDavid Greenman.Fl q 253b1069b52SDavid Greenmanoption has been added, and the 254b1069b52SDavid Greenman.Fl m 255b1069b52SDavid Greenmanoption now understands more options than it used to. 256b1069b52SDavid Greenman.Pp 257b1069b52SDavid GreenmanThe formats of the summary files created by this version of 25819112792SPhilippe Charnier.Nm 259a67e435cSChris Costelloare very different from the those used by the original version. 260b1069b52SDavid GreenmanThis is not considered a problem, however, because the accounting record 261b1069b52SDavid Greenmanformat has changed as well (since user ids are now 32 bits). 26259a3c79dSRuslan Ermilov.Sh BUGS 26359a3c79dSRuslan ErmilovThe number of options to this program is absurd, especially considering 26436a142c4SRuslan Ermilovthat there is not much logic behind their lettering. 26559a3c79dSRuslan Ermilov.Pp 26659a3c79dSRuslan ErmilovThe field labels should be more consistent. 26759a3c79dSRuslan Ermilov.Pp 26859a3c79dSRuslan ErmilovThe VM system does not record the CPU storage integral. 269