summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
90d8808)
Previously we did this just for workers, now we do it for the main
thread and for forkOS threads too.
void *cap = rts_lock();
cap = rts_evalLazyIO(cap,(HaskellObj)(void *)mainIO_closure, NULL);
status = rts_getSchedStatus(cap);
void *cap = rts_lock();
cap = rts_evalLazyIO(cap,(HaskellObj)(void *)mainIO_closure, NULL);
status = rts_getSchedStatus(cap);
+ taskTimeStamp(myTask());
// On exit from schedule(), we have a Capability.
releaseCapability(cap);
// On exit from schedule(), we have a Capability.
releaseCapability(cap);
#if defined(THREADED_RTS)
currentUserTime = getThreadCPUTime();
currentElapsedTime = getProcessElapsedTime();
#if defined(THREADED_RTS)
currentUserTime = getThreadCPUTime();
currentElapsedTime = getProcessElapsedTime();
- task->mut_time = 0.0;
- task->mut_etime = 0.0;
- task->gc_time = 0.0;
- task->gc_etime = 0.0;
+ task->mut_time = 0;
+ task->mut_etime = 0;
+ task->gc_time = 0;
+ task->gc_etime = 0;
task->muttimestart = currentUserTime;
task->elapsedtimestart = currentElapsedTime;
#endif
task->muttimestart = currentUserTime;
task->elapsedtimestart = currentElapsedTime;
#endif
+taskTimeStamp (Task *task USED_IF_THREADS)
{
#if defined(THREADED_RTS)
{
#if defined(THREADED_RTS)
Ticks currentElapsedTime, currentUserTime, elapsedGCTime;
Ticks currentElapsedTime, currentUserTime, elapsedGCTime;
- id = osThreadId();
- ASSERT(task->id == id);
- ASSERT(myTask() == task);
-
currentUserTime = getThreadCPUTime();
currentElapsedTime = getProcessElapsedTime();
currentUserTime = getThreadCPUTime();
currentElapsedTime = getProcessElapsedTime();
task->mut_etime =
currentElapsedTime - task->elapsedtimestart - elapsedGCTime;
task->mut_etime =
currentElapsedTime - task->elapsedtimestart - elapsedGCTime;
- if (task->mut_time < 0.0) { task->mut_time = 0.0; }
- if (task->mut_etime < 0.0) { task->mut_etime = 0.0; }
+ if (task->mut_time < 0) { task->mut_time = 0; }
+ if (task->mut_etime < 0) { task->mut_etime = 0; }
+#endif
+}
+
+void
+workerTaskStop (Task *task)
+{
+#if defined(THREADED_RTS)
+ OSThreadId id;
+ id = osThreadId();
+ ASSERT(task->id == id);
+ ASSERT(myTask() == task);
task->stopped = rtsTrue;
tasksRunning--;
}
task->stopped = rtsTrue;
tasksRunning--;
}
// mainly for stats-gathering purposes.
// Requires: sched_mutex.
//
// mainly for stats-gathering purposes.
// Requires: sched_mutex.
//
-void taskStop (Task *task);
+void workerTaskStop (Task *task);
+
+// Record the time spent in this Task.
+// This is called by workerTaskStop() but not by boundTaskExiting(),
+// because it would impose an extra overhead on call-in.
+//
+void taskTimeStamp (Task *task);
// Put the task back on the free list, mark it stopped. Used by
// forkProcess().
// Put the task back on the free list, mark it stopped. Used by
// forkProcess().
#if defined(THREADED_RTS)
#include "OSThreads.h"
#include "RtsUtils.h"
#if defined(THREADED_RTS)
#include "OSThreads.h"
#include "RtsUtils.h"
#if HAVE_STRING_H
#include <string.h>
#if HAVE_STRING_H
#include <string.h>
Capability *cap;
cap = rts_lock();
cap = rts_evalStableIO(cap, (HsStablePtr) entry, NULL);
Capability *cap;
cap = rts_lock();
cap = rts_evalStableIO(cap, (HsStablePtr) entry, NULL);
+ taskTimeStamp(myTask());
rts_unlock(cap);
return NULL;
}
rts_unlock(cap);
return NULL;
}