On 16/03/2010 19:34, Henrique Ferreiro wrote:
Hello!

I am trying to make cost centre profiling work in the threaded rts
build in order to use that information to better understand parallel
behaviour.

Currently I am learning about the internals of GHC and I am thinking
about how this could be done. The main blocker is that the current
cost centre stack is a shared global variable. The simplest solution I
came up with is to convert it to a thread local variable. The problem
would be how to access it from the global timer.

Yes, basically what you want to do is put CCCS into the StgRegs structure, which will make it thread-local. In the timer signal you want to bump the counters for the CCCS on each Capability - so just iterate through the array of Capabilities and bump each one.

I'm sure this isn't all that needs to be done, though. The cost-center stack data structure probably needs some locks; perhaps one global lock will do for a start. The danger here is that contention in the profiling subsystem will obscure the real profilng results you were trying to obtain.

Keep us posted!

Cheers,
        Simon

As I don't have the full picture yet, I would greatly appreciate if
some of you could give me some advice on how to tackle this problem.
Would it be possible to use thread local storage for this? Is there a
better design?

_______________________________________________
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to