xref: /csrg-svn/usr.bin/pascal/libpc/PCEXIT.c (revision 40865)
1*40865Sbostic /*-
2*40865Sbostic  * Copyright (c) 1979 The Regents of the University of California.
3*40865Sbostic  * All rights reserved.
4*40865Sbostic  *
5*40865Sbostic  * %sccs.include.redist.c%
6*40865Sbostic  */
71671Smckusick 
8*40865Sbostic #ifndef lint
9*40865Sbostic static char sccsid[] = "@(#)PCEXIT.c	1.2 (Berkeley) 04/09/90";
10*40865Sbostic #endif /* not lint */
111671Smckusick 
121671Smckusick #include "h00vars.h"
131671Smckusick 
141671Smckusick PCEXIT(code)
151671Smckusick 
161671Smckusick 	int	code;
171671Smckusick {
181671Smckusick 	struct	{
191671Smckusick 		long	usr_time;
201671Smckusick 		long	sys_time;
211671Smckusick 		long	child_usr_time;
221671Smckusick 		long	child_sys_time;
231671Smckusick 		} tbuf;
241671Smckusick 	double l;
251671Smckusick 
261671Smckusick 	PCLOSE(GLVL);
271671Smckusick 	PFLUSH();
281671Smckusick 	if (_stcnt > 0) {
291671Smckusick 		times(&tbuf);
301671Smckusick 		l = tbuf.usr_time;
311671Smckusick 		l = l / HZ;
321671Smckusick 		fprintf(stderr, "\n%1ld %s %04.2f seconds cpu time.\n",
331671Smckusick 				_stcnt, "statements executed in", l);
341671Smckusick 	}
351671Smckusick 	exit(code);
361671Smckusick }
37