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