1 /*- 2 * Copyright (c) 1979, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * %sccs.include.redist.c% 6 */ 7 8 #ifndef lint 9 static char sccsid[] = "@(#)PCEXIT.c 8.1 (Berkeley) 06/06/93"; 10 #endif /* not lint */ 11 12 #include "h00vars.h" 13 #include <sys/time.h> 14 #include <sys/resource.h> 15 PCEXIT(code)16PCEXIT(code) 17 18 int code; 19 { 20 double l; 21 struct rusage ru; 22 23 PCLOSE(GLVL); 24 PFLUSH(); 25 if (_stcnt > 0) { 26 if (getrusage(RUSAGE_SELF, &ru) < 0) 27 exit(code); 28 l = ru.ru_utime.tv_usec; 29 l /= 1000000; 30 l += ru.ru_utime.tv_sec; 31 fprintf(stderr, "\n%1ld %s %04.2f seconds cpu time.\n", 32 _stcnt, "statements executed in", l); 33 } 34 exit(code); 35 } 36