diff options
author | Duncan Coutts <duncan@well-typed.com> | 2012-02-03 12:20:36 +0000 |
---|---|---|
committer | Duncan Coutts <duncan@well-typed.com> | 2012-04-04 19:10:44 +0100 |
commit | f9c2e8543cabd6661eec17d5be31469455a64e05 (patch) | |
tree | 3275bbb0e2bbcd4d8bd003584d478c0ad1e4c107 /rts/Capability.c | |
parent | 4caef1c42dd5b6e4982e7f07162c9a7edc5a1b0b (diff) | |
download | haskell-f9c2e8543cabd6661eec17d5be31469455a64e05.tar.gz |
Add eventlog/trace stuff for capabilities: create/delete/enable/disable
Now that we can adjust the number of capabilities on the fly, we need
this reflected in the eventlog. Previously the eventlog had a single
startup event that declared a static number of capabilities. Obviously
that's no good anymore.
For compatability we're keeping the EVENT_STARTUP but adding new
EVENT_CAP_CREATE/DELETE. The EVENT_CAP_DELETE is actually just the old
EVENT_SHUTDOWN but renamed and extended (using the existing mechanism
to extend eventlog events in a compatible way). So we now emit both
EVENT_STARTUP and EVENT_CAP_CREATE. One day we will drop EVENT_STARTUP.
Since reducing the number of capabilities at runtime does not really
delete them, it just disables them, then we also have new events for
disable/enable.
The old EVENT_SHUTDOWN was in the scheduler class of events. The new
EVENT_CAP_* events are in the unconditional class, along with the
EVENT_CAPSET_* ones. Knowing when capabilities are created and deleted
is crucial to making sense of eventlogs, you always want those events.
In any case, they're extremely low volume.
Diffstat (limited to 'rts/Capability.c')
-rw-r--r-- | rts/Capability.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/rts/Capability.c b/rts/Capability.c index 63e52b0026..d1184db0ee 100644 --- a/rts/Capability.c +++ b/rts/Capability.c @@ -281,6 +281,7 @@ initCapability( Capability *cap, nat i ) cap->r.rCCCS = NULL; #endif + traceCapCreate(cap); traceCapsetAssignCap(CAPSET_OSPROCESS_DEFAULT, i); traceCapsetAssignCap(CAPSET_CLOCKDOMAIN_DEFAULT, i); #if defined(THREADED_RTS) @@ -843,6 +844,8 @@ tryGrabCapability (Capability *cap, Task *task) * * ------------------------------------------------------------------------- */ +static void traceShutdownCapability (Capability *cap); + void shutdownCapability (Capability *cap, Task *task USED_IF_THREADS, @@ -929,7 +932,7 @@ shutdownCapability (Capability *cap, continue; } - traceEventShutdown(cap); + traceShutdownCapability(cap); RELEASE_LOCK(&cap->lock); break; } @@ -941,12 +944,20 @@ shutdownCapability (Capability *cap, // return via resumeThread() and attempt to grab cap->lock. // closeMutex(&cap->lock); - traceSparkCounters(cap); - -#endif /* THREADED_RTS */ +#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 |