[Git][ghc/ghc][master] rts: Ensure we dump new Cost Centres added by freshly loaded objects to the eventlog.
Marge Bot (@marge-bot)
gitlab at gitlab.haskell.org
Sun Sep 22 06:34:32 UTC 2024
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
ca67d7cb by Zubin Duggal at 2024-09-22T02:34:06-04:00
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/ca67d7cbc328c8e991e82f6cf1f3f75c403eed67
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/ca67d7cbc328c8e991e82f6cf1f3f75c403eed67
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/20240922/61ba39df/attachment-0001.html>
More information about the ghc-commits
mailing list