11720Smckusick /* Copyright (c) 1979 Regents of the University of California */
21720Smckusick 
3*3017Smckusic static char sccsid[] = "@(#)PMFLUSH.c 1.3 03/07/81";
41720Smckusick 
51720Smckusick #include "h00vars.h"
61720Smckusick 
72126Smckusic PMFLUSH(cntrs, rtns, bufaddr)
81720Smckusick 
92126Smckusic 	long cntrs;	/* total number of counters (stmt + routine) */
102126Smckusic 	long rtns;	/* number of func and proc counters */
112126Smckusic 	long *bufaddr;	/* address of count buffers */
121720Smckusick {
131720Smckusick 	register FILE	*filep;
141720Smckusick 
152126Smckusic 	bufaddr[0] = 0426;
16*3017Smckusic 	time(&bufaddr[1]);
172126Smckusic 	bufaddr[2] = cntrs;
182126Smckusic 	bufaddr[3] = rtns;
191720Smckusick 	filep = fopen(PXPFILE, "w");
201720Smckusick 	if (filep == NULL)
211720Smckusick 		goto ioerr;
22*3017Smckusic 	fwrite(bufaddr, (int)(cntrs + 1), sizeof(long), filep);
231720Smckusick 	if (ferror(filep))
241720Smckusick 		goto ioerr;
251720Smckusick 	fclose(filep);
261720Smckusick 	if (!ferror(filep))
271720Smckusick 		return;
281720Smckusick ioerr:
291720Smckusick 	perror(PXPFILE);
301720Smckusick }
31