1*1720Smckusick /* Copyright (c) 1979 Regents of the University of California */
2*1720Smckusick 
3*1720Smckusick static char sccsid[] = "@(#)PMFLUSH.c 1.1 10/30/80";
4*1720Smckusick 
5*1720Smckusick #include "h00vars.h"
6*1720Smckusick 
7*1720Smckusick PMFLUSH(cntrs, rtns)
8*1720Smckusick 
9*1720Smckusick 	long	cntrs;	/* total number of counters (stmt + routine) */
10*1720Smckusick 	long	rtns;	/* number of func and proc counters */
11*1720Smckusick {
12*1720Smckusick 	register FILE	*filep;
13*1720Smckusick 
14*1720Smckusick 	_pcpcount[0] = 0426;
15*1720Smckusick 	_pcpcount[1] = time();
16*1720Smckusick 	_pcpcount[2] = cntrs;
17*1720Smckusick 	_pcpcount[3] = rtns;
18*1720Smckusick 	filep = fopen(PXPFILE, "w");
19*1720Smckusick 	if (filep == NULL)
20*1720Smckusick 		goto ioerr;
21*1720Smckusick 	fwrite(&_pcpcount[0], cntrs + 1, sizeof(long), filep);
22*1720Smckusick 	if (ferror(filep))
23*1720Smckusick 		goto ioerr;
24*1720Smckusick 	fclose(filep);
25*1720Smckusick 	if (!ferror(filep))
26*1720Smckusick 		return;
27*1720Smckusick ioerr:
28*1720Smckusick 	perror(PXPFILE);
29*1720Smckusick }
30