#define _INCLUDE_HPUX_SOURCE
#endif
+#ifdef solaris2_TARGET_OS
+#define __EXTENSIONS__
+#endif
+
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
from getrusage() for Solaris -- SOF
*/
#if solaris2_TARGET_OS
-#undef __STRICT_ANSI__ /* oh, dear */
#include <sys/fcntl.h>
#include <sys/signal.h>
#include <sys/procfs.h>
StgDouble time = usertime();
StgDouble etime = elapsedtime();
+ /* avoid divide by zero if time is measured as 0.00 seconds -- SDM */
+ if (time == 0.0) time = 0.0001;
+ if (etime == 0.0) etime = 0.0001;
+
+
if (RTSflags.GcFlags.giveStats) {
fprintf(sf, "%8ld\n\n", alloc*sizeof(W_));
}
fprintf(sf, " %%GC time %5.1f%% (%.1f%% elapsed)\n\n",
GC_tot_time*100./time, GCe_tot_time*100./etime);
- ullong_format_string((ullong)(GC_tot_alloc*sizeof(W_)/(time - GC_tot_time)), temp, rtsTrue/*commas*/);
+ if (time - GC_tot_time == 0.0)
+ ullong_format_string((ullong)0, temp, rtsTrue/*commas*/);
+ else
+ ullong_format_string((ullong)(GC_tot_alloc*sizeof(W_)/(time - GC_tot_time)),
+ temp, rtsTrue/*commas*/);
+
fprintf(sf, " Alloc rate %s bytes per MUT second\n\n", temp);
fprintf(sf, " Productivity %5.1f%% of total user, %.1f%% of total elapsed\n\n",