ghc-events icon indicating copy to clipboard operation
ghc-events copied to clipboard

ProfSampleCostCentre in the eventlog file carries a CapNo instead of a Capset

Open nfrisby opened this issue 2 years ago • 2 comments

I think the first field of ProfSampleCostCentre should be profCap :: !CapNo instead of profCapset :: !Capset.

https://github.com/haskell/ghc-events/blob/0fb2c177b781f505b04472511f2e2f2c6c1ae021/src/GHC/RTS/EventTypes.hs#L437-L442

https://github.com/haskell/ghc-events/blob/85b91298a28e69b0bd9d4ffb8f1de4138e4f93a2/src/GHC/RTS/Events/Binary.hs#L895-L914

https://github.com/ghc/ghc/blob/73b22ff196160036ac10b762bf3a363fa8a451ad/rts/eventlog/EventLog.c#L1317-L1340 has

void postProfSampleCostCentre(Capability *cap,
                              CostCentreStack *stack,
                              StgWord64 tick)
{
    /* SNIP */
    postEventHeader(&eventBuf, EVENT_PROF_SAMPLE_COST_CENTRE);
    postPayloadSize(&eventBuf, len);
    postWord32(&eventBuf, cap->no);                                                /* THIS IS THE NOTABLE LINE */
    postWord64(&eventBuf, tick);
    /* SNIP */
}
  • This seems to be an inconsistency between ghc master and ghc-events master -- I haven't done the due diligence to check wheter ghc master has changed this recently, eg.

  • Or perhaps there's an implicit assumption that CapNo i is the sole member of Capset i?

So either there's a mismatch that should be fixed or I think it's deserving of a comment on profCapset. Thanks!

nfrisby avatar May 06 '22 20:05 nfrisby

Yeah that indeed looks like a mismatch that should be fixed.

@mpickering Apparently you wrote both implementations in 9f00d38 and in https://github.com/ghc/ghc/commit/17987a4b665d4a270b1bebba1f61d67887f2653c. Was this intentional?

maoe avatar May 11 '22 10:05 maoe

I think it's probably a mistake.

mpickering avatar May 11 '22 10:05 mpickering