/* Copyright (c) 1979 Regents of the University of California */
static char sccsid
[] = "@(#)utilities.c 1.4 %G%";
# define proffile "/vb/grad/mckusick/px/profile/pcnt.out"
double counts
[NUMOPS
]; /* instruction counts */
long runs
; /* number of interpreter runs */
long startdate
; /* date profile started */
long usrtime
; /* total user time consumed */
long systime
; /* total system time consumed */
double stmts
; /* number of pascal stmts executed */
datafile
= fopen(proffile
,"r");
count
= fread(&profdata
,1,sizeof(profdata
),datafile
);
if (count
!= sizeof(profdata
))
for (count
= 0; count
< NUMOPS
; count
++)
profdata
.counts
[count
] += _profcnts
[count
];
profdata
.stmts
+= _stcnt
;
profdata
.usrtime
+= tbuf
.usr_time
;
profdata
.systime
+= tbuf
.sys_time
;
datafile
= freopen(proffile
,"w",datafile
);
count
= fwrite(&profdata
,1,sizeof(profdata
),datafile
);
if (count
!= sizeof(profdata
))
"\n%1ld statements executed in %04.2f seconds cpu time.\n",
register struct disp
*mydp
;
register struct stack
*ap
;
fputs("Program was not executed.\n",stderr
);
fputs("\n\tInterrupted in \"",stderr
);
else if (errnum
== PHALT
)
fputs("\n\tHalted in \"",stderr
);
fputs("\n\tError in \"",stderr
);
i
= linum
- (((ap
)->entry
)->offset
& 0177777);
fprintf(stderr
,"%s\"",(ap
->entry
)->name
);
fprintf(stderr
,"+%D near line %D.",i
,linum
);
if (mydp
<= &_display
.frame
[1]){
fputs("\tCalled by \"",stderr
);
PMFLUSH(_cntrs
, _rtns
, _pcpcount
);
fputs("Execution terminated",stderr
);
fputs(" abnormally",stderr
);