- if (datafile != NULL) {
- count = fread(&profdata,sizeof(profdata),1,datafile);
- if (count != 1) {
- for (count = 0; count < numops; count++)
- profdata.counts[count] = 0.0;
- profdata.runs = 0;
- profdata.startdate = time(0);
- profdata.usrtime = 0;
- profdata.systime = 0;
- profdata.stmts = 0;
- }
- for (count = 0; count < numops; count++)
- profdata.counts[count] += profcnts[count];
- profdata.runs += 1;
- profdata.stmts += stcnt;
- profdata.usrtime += tbuf.usr_time;
- profdata.systime += tbuf.sys_time;
- datafile = freopen(proffile,"w",datafile);
- if (datafile != NULL) {
- fwrite(&profdata,sizeof(profdata),1,datafile);
- fclose(datafile);
- }
- }
-#endif
+ if (datafile == NULL)
+ goto skipprof;
+ count = fread(&profdata,1,sizeof(profdata),datafile);
+ if (count != sizeof(profdata))
+ goto skipprof;
+ for (count = 0; count < NUMOPS; count++)
+ profdata.counts[count] += _profcnts[count];
+ profdata.runs += 1;
+ profdata.stmts += _stcnt;
+ profdata.usrtime += tbuf.usr_time;
+ profdata.systime += tbuf.sys_time;
+ datafile = freopen(proffile,"w",datafile);
+ if (datafile == NULL)
+ goto skipprof;
+ count = fwrite(&profdata,1,sizeof(profdata),datafile);
+ if (count != sizeof(profdata))
+ goto skipprof;
+ fclose(datafile);
+skipprof:
+# endif PROFILE