[Git][ghc/ghc][wip/24148] rts: Ensure we dump new Cost Centres added by freshly loaded objects to the eventlog.
Zubin (@wz1000)
gitlab at gitlab.haskell.org
Wed Aug 7 06:47:15 UTC 2024
Zubin pushed to branch wip/24148 at Glasgow Haskell Compiler / GHC
Commits:
18d0e560 by Zubin Duggal at 2024-08-07T12:17:08+05:30
rts: Ensure we dump new Cost Centres added by freshly loaded objects to the eventlog.
To do this, we keep track of the ID of the last cost centre we dumped in DUMPED_CC_ID,
and call dumpCostCentresToEventLog from refreshProfilingCCSs, which will dump all the new
cost centres up to the one we already dumped in DUMPED_CC_ID.
Fixes #24148
- - - - -
1 changed file:
- rts/Profiling.c
Changes:
=====================================
rts/Profiling.c
=====================================
@@ -46,6 +46,7 @@ static Arena *prof_arena;
static unsigned int CC_ID = 1;
static unsigned int CCS_ID = 1;
+static unsigned int DUMPED_CC_ID = 0; // we have dumped all CCs up to this id to the eventlog
/* Globals for opening the profiling log file(s)
*/
@@ -138,10 +139,11 @@ dumpCostCentresToEventLog(void)
{
#if defined(PROFILING)
CostCentre *cc, *next;
- for (cc = CC_LIST; cc != NULL; cc = next) {
+ for (cc = CC_LIST; cc != NULL && cc->ccID != DUMPED_CC_ID; cc = next) {
next = cc->link;
traceHeapProfCostCentre(cc->ccID, cc->label, cc->module,
cc->srcloc, cc->is_caf);
+ DUMPED_CC_ID = cc->ccID < DUMPED_CC_ID ? DUMPED_CC_ID : cc->ccID;
}
#endif
}
@@ -193,8 +195,6 @@ void initProfiling (void)
if (RtsFlags.CcFlags.doCostCentres) {
initTimeProfiling();
}
-
- traceInitEvent(dumpCostCentresToEventLog);
}
@@ -205,6 +205,7 @@ void initProfiling (void)
void refreshProfilingCCSs (void)
{
ACQUIRE_LOCK(&ccs_mutex);
+ traceInitEvent(dumpCostCentresToEventLog);
// make CCS_MAIN the parent of all the pre-defined CCSs.
CostCentreStack *next;
for (CostCentreStack *ccs = CCS_LIST; ccs != NULL; ) {
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/18d0e5606ad23b6deee17b0ee63a176286da592a
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/18d0e5606ad23b6deee17b0ee63a176286da592a
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20240807/48a7f679/attachment-0001.html>
More information about the ghc-commits
mailing list