summaryrefslogtreecommitdiff
path: root/rts/Capability.c
diff options
context:
space:
mode:
authorDuncan Coutts <duncan@well-typed.com>2012-02-22 01:41:29 +0000
committerDuncan Coutts <duncan@well-typed.com>2012-04-04 19:10:45 +0100
commite88f1625a234e5316e903f84ae4d3349fec4bf3d (patch)
treec14e04e4d7c22811f829a6097a98970d6b139db0 /rts/Capability.c
parenta3cdefd21b3e818accf9db22da72b216685c1b19 (diff)
downloadhaskell-e88f1625a234e5316e903f84ae4d3349fec4bf3d.tar.gz
Move trace of cap delete from shutdownCapability to freeCapability
Will let us do final per-cap trace events from stat_exit(). Otherwise we would end up with eventlogs with events for caps that have already been deleted.
Diffstat (limited to 'rts/Capability.c')
-rw-r--r--rts/Capability.c28
1 files changed, 7 insertions, 21 deletions
diff --git a/rts/Capability.c b/rts/Capability.c
index 564953b662..7b1a110b2f 100644
--- a/rts/Capability.c
+++ b/rts/Capability.c
@@ -845,10 +845,8 @@ tryGrabCapability (Capability *cap, Task *task)
*
* ------------------------------------------------------------------------- */
-static void traceShutdownCapability (Capability *cap);
-
void
-shutdownCapability (Capability *cap,
+shutdownCapability (Capability *cap USED_IF_THREADS,
Task *task USED_IF_THREADS,
rtsBool safe USED_IF_THREADS)
{
@@ -933,7 +931,7 @@ shutdownCapability (Capability *cap,
continue;
}
- traceShutdownCapability(cap);
+ traceSparkCounters(cap);
RELEASE_LOCK(&cap->lock);
break;
}
@@ -944,23 +942,9 @@ shutdownCapability (Capability *cap,
// threads performing foreign calls that will eventually try to
// return via resumeThread() and attempt to grab cap->lock.
// closeMutex(&cap->lock);
-
-#else /* THREADED_RTS */
- traceShutdownCapability(cap);
#endif
}
-static void
-traceShutdownCapability (Capability *cap)
-{
-#if defined(THREADED_RTS)
- traceSparkCounters(cap);
-#endif
- traceCapsetRemoveCap(CAPSET_OSPROCESS_DEFAULT, cap->no);
- traceCapsetRemoveCap(CAPSET_CLOCKDOMAIN_DEFAULT, cap->no);
- traceCapDelete(cap);
-}
-
void
shutdownCapabilities(Task *task, rtsBool safe)
{
@@ -969,9 +953,6 @@ shutdownCapabilities(Task *task, rtsBool safe)
ASSERT(task->incall->tso == NULL);
shutdownCapability(&capabilities[i], task, safe);
}
- traceCapsetDelete(CAPSET_OSPROCESS_DEFAULT);
- traceCapsetDelete(CAPSET_CLOCKDOMAIN_DEFAULT);
-
#if defined(THREADED_RTS)
ASSERT(checkSparkCountInvariant());
#endif
@@ -985,6 +966,9 @@ freeCapability (Capability *cap)
#if defined(THREADED_RTS)
freeSparkPool(cap->sparks);
#endif
+ traceCapsetRemoveCap(CAPSET_OSPROCESS_DEFAULT, cap->no);
+ traceCapsetRemoveCap(CAPSET_CLOCKDOMAIN_DEFAULT, cap->no);
+ traceCapDelete(cap);
}
void
@@ -998,6 +982,8 @@ freeCapabilities (void)
#else
freeCapability(&MainCapability);
#endif
+ traceCapsetDelete(CAPSET_OSPROCESS_DEFAULT);
+ traceCapsetDelete(CAPSET_CLOCKDOMAIN_DEFAULT);
}
/* ---------------------------------------------------------------------------