parallel cost-centre profiling
hferreiro at udc.es
Thu Jun 10 13:06:08 EDT 2010
I manage to make it work with one capability. That is, now the CCCS is
stored per capability but I can't enable parallel profiling because
the stacks are still shared.
Now I wanted to have one instance of each stack and cost centre per
capability, so that I can track the behaviour of each capability
independently. Doing that is easy in the runtime system but I found
out that I also have to change the code generator in the same way. I
need "emitCostCentreDecl" and "costCentreStackDecl" to declare an
array of structs instead of a single struct. Can someone help me with
2010/6/4 Henrique Ferreiro <hferreiro at udc.es>:
> Hi again!
> I need some help with this.
> 2010/3/17 Simon Marlow <marlowsd at gmail.com>:
>> On 16/03/2010 19:34, Henrique Ferreiro wrote:
>>> I am trying to make cost centre profiling work in the threaded rts
>>> build in order to use that information to better understand parallel
>>> 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 tried adding a new register CCCS to StgRegTable in stg/Regs.h but
> there is too much hidden knowledge in the code and it isn't working.
> I got to the point where I have changed every reference to the global
> variable to this register. The problem is that it isn't getting
> updated. Debugging a bit it seems that the register is used as it
> should (the calls to PushCostCentre and AppendCCS from the generated
> code use the correct value in CCCS) but it isn't getting stored in the
> register table because every time the timer is called, the value
> stored is CCS_SYSTEM, the one used in initialization.
> I tried to mimic how the other registers are implemented but there is
> no documentation at all so I wasn't sure what was exactly required.
> Could someone tell where exactly I have to change things or should I
> post my changes and ask about specific details?
More information about the Cvs-ghc