/* -----------------------------------------------------------------------------
- * $Id: Stats.c,v 1.39 2001/11/26 16:54:22 simonmar Exp $
+ * $Id: Stats.c,v 1.44 2002/02/06 01:21:40 sof Exp $
*
* (c) The GHC Team, 1998-1999
*
#endif
#ifdef PROFILING
-#define PROF_VAL(x) x
+#define PROF_VAL(x) (x)
#else
#define PROF_VAL(x) 0
#endif
{
getTimes();
MutElapsedStamp = CurrentElapsedTime;
- MutElapsedTime = CurrentElapsedTime - GCe_tot_time - InitElapsedStamp;
+ MutElapsedTime = CurrentElapsedTime - GCe_tot_time -
+ PROF_VAL(RPe_tot_time + HCe_tot_time) - InitElapsedStamp;
if (MutElapsedTime < 0) { MutElapsedTime = 0; } /* sometimes -0.00 */
-
+
/* for SMP, we don't know the mutator time yet, we have to inspect
* all the running threads to find out, and they haven't stopped
* yet. So we just timestamp MutUserTime at this point so we can
stats for this thread into the task_ids struct for that thread.
-------------------------------------------------------------------------- */
-#ifdef SMP
+#if defined(SMP)
void
stat_workerStop(void)
{
nat i;
pthread_t me = pthread_self();
+ getTimes();
+
for (i = 0; i < RtsFlags.ParFlags.nNodes; i++) {
if (task_ids[i].id == me) {
- task_ids[i].mut_time = usertime() - task_ids[i].gc_time;
- task_ids[i].mut_etime = elapsedtime()
+ task_ids[i].mut_time = CurrentUserTime - task_ids[i].gc_time;
+ task_ids[i].mut_etime = CurrentElapsedTime
- GCe_tot_time
- task_ids[i].elapsedtimestart;
if (task_ids[i].mut_time < 0.0) { task_ids[i].mut_time = 0.0; }
}
#endif
+#if defined(SMP)
+long int stat_getElapsedTime ()
+{
+ getTimes();
+ return CurrentElapsedTime;
+}
+#endif
+
/* -----------------------------------------------------------------------------
Called at the end of execution
}
fflush(sf);
- fclose(sf);
+ if (sf != stderr) {
+ fclose(sf);
+ }
}
}