haskell / ghc-events

Library and tool for parsing .eventlog files from GHC
http://www.haskell.org/haskellwiki/ThreadScope
Other
33 stars 33 forks source link

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

Closed nfrisby closed 1 month ago

nfrisby commented 2 years ago

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 */
}

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

maoe commented 2 years ago

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?

mpickering commented 2 years ago

I think it's probably a mistake.