[GHC] #7818: Cost of STACK object should be attributed to CCCS at time of thread creation

#7818: Cost of STACK object should be attributed to CCCS at time of thread creation -----------------------------+---------------------------------------------- Reporter: ezyang | Owner: ezyang Type: task | Status: new Priority: normal | Component: Profiling Version: 7.7 | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: None/Unknown | Blockedby: Blocking: | Related: -----------------------------+---------------------------------------------- Right now, we always charge STACK objects to the SYSTEM cost centre. I think it makes more sense for us to charge them to the CCCS responsible for creating the thread: it’s more specific and we don’t really lose anything in the trade (it’s easy to ask for a per-closure-type profile). Here’s a strawman patch (obviously this doesn’t do anything when not compiling the profiling way.) Are there any objections? {{{ diff --git a/rts/Threads.c b/rts/Threads.c index b617616..76ac705 100644 --- a/rts/Threads.c +++ b/rts/Threads.c @@ -84,7 +84,7 @@ createThread(Capability *cap, W_ size) stack_size = round_to_mblocks(size - sizeofW(StgTSO)); stack = (StgStack *)allocate(cap, stack_size); TICK_ALLOC_STACK(stack_size); - SET_HDR(stack, &stg_STACK_info, CCS_SYSTEM); + SET_HDR(stack, &stg_STACK_info, cap->r.rCCCS); stack->stack_size = stack_size - sizeofW(StgStack); stack->sp = stack->stack + stack->stack_size; stack->dirty = 1; @@ -575,7 +575,11 @@ threadStackOverflow (Capability *cap, StgTSO *tso) chunk_size * sizeof(W_)); new_stack = (StgStack*) allocate(cap, chunk_size); - SET_HDR(new_stack, &stg_STACK_info, CCS_SYSTEM); +#ifdef PROFILING + SET_HDR(new_stack, &stg_STACK_info, old_stack->header.prof.ccs); +#else + SET_HDR(new_stack, &stg_STACK_info, CCCS_SYSTEM); +#endif TICK_ALLOC_STACK(chunk_size); new_stack->dirty = 0; // begin clean, we'll mark it dirty below }}} -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7818 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7818: Cost of STACK object should be attributed to CCCS at time of thread creation ---------------------------------+------------------------------------------ Reporter: ezyang | Owner: ezyang Type: task | Status: new Priority: normal | Milestone: Component: Profiling | Version: 7.7 Keywords: | Os: Unknown/Multiple Architecture: Unknown/Multiple | Failure: None/Unknown Difficulty: Unknown | Testcase: Blockedby: | Blocking: Related: | ---------------------------------+------------------------------------------ Changes (by simonpj): * difficulty: => Unknown Comment: No objections from me. If you don't hear from Simon in a few days, go ahead and commit. I'm sure you've thought about it mroe than anyone else! Thanks Edward. Simon -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7818#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7818: Cost of STACK object should be attributed to CCCS at time of thread creation ---------------------------------+------------------------------------------ Reporter: ezyang | Owner: ezyang Type: task | Status: new Priority: normal | Milestone: 7.8.1 Component: Profiling | Version: 7.7 Keywords: | Os: Unknown/Multiple Architecture: Unknown/Multiple | Failure: None/Unknown Difficulty: Unknown | Testcase: Blockedby: | Blocking: Related: | ---------------------------------+------------------------------------------ Changes (by igloo): * milestone: => 7.8.1 -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7818#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7818: Cost of STACK object should be attributed to CCCS at time of thread
creation
---------------------------------+------------------------------------------
Reporter: ezyang | Owner: ezyang
Type: task | Status: new
Priority: normal | Milestone: 7.8.1
Component: Profiling | Version: 7.7
Keywords: | Os: Unknown/Multiple
Architecture: Unknown/Multiple | Failure: None/Unknown
Difficulty: Unknown | Testcase:
Blockedby: | Blocking:
Related: |
---------------------------------+------------------------------------------
Comment(by ezyang@…):
commit 5724ea01c943bbc78b6c8b6bfa01a5d026d42f5a
{{{
Author: Edward Z. Yang

#7818: Cost of STACK object should be attributed to CCCS at time of thread creation -------------------------------+-------------------------------------------- Reporter: ezyang | Owner: ezyang Type: task | Status: closed Priority: normal | Milestone: 7.8.1 Component: Profiling | Version: 7.7 Resolution: fixed | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: None/Unknown | Difficulty: Unknown Testcase: | Blockedby: Blocking: | Related: -------------------------------+-------------------------------------------- Changes (by ezyang): * status: new => closed * resolution: => fixed -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7818#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC