[Git][ghc/ghc][master] 2 commits: rts: Define ticky macro stubs
Marge Bot (@marge-bot)
gitlab at gitlab.haskell.org
Wed May 24 16:43:30 UTC 2023
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
44af57de by Matthew Pickering at 2023-05-24T12:43:08-04:00
rts: Define ticky macro stubs
These macros have long been undefined which has meant we were missing
reporting these allocations in ticky profiles.
The most critical missing definition was TICK_ALLOC_HEAP_NOCTR which was
missing all the RTS calls to allocate, this leads to a the overall
ALLOC_RTS_tot number to be severaly underreported.
Of particular interest though is the ALLOC_STACK_ctr and ALLOC_STACK_tot
counters which are useful to tracking stack allocations.
Fixes #23421
- - - - -
b2dabe3a by Matthew Pickering at 2023-05-24T12:43:08-04:00
rts: ticky: Rename TICK_ALLOC_HEAP_NOCTR to TICK_ALLOC_RTS
This macro increments the ALLOC_HEAP_tot and ALLOC_HEAP_ctr so it makes
more sense to name it after that rather than the suffix NOCTR, whose
meaning has been lost to the mists of time.
- - - - -
7 changed files:
- rts/RaiseAsync.c
- rts/RtsSymbols.c
- rts/Threads.c
- rts/Ticky.c
- rts/include/Cmm.h
- rts/include/stg/Ticky.h
- rts/sm/Storage.c
Changes:
=====================================
rts/RaiseAsync.c
=====================================
@@ -877,7 +877,7 @@ raiseAsync(Capability *cap, StgTSO *tso, StgClosure *exception,
write_barrier(); // XXX: Necessary?
SET_HDR(ap,&stg_AP_STACK_info,
((StgClosure *)frame)->header.prof.ccs /* ToDo */);
- TICK_ALLOC_UP_THK(WDS(words+1),0);
+ TICK_ALLOC_UP_THK(AP_STACK_sizeW(words),0);
//IF_DEBUG(scheduler,
// debugBelch("sched: Updating ");
@@ -927,7 +927,7 @@ raiseAsync(Capability *cap, StgTSO *tso, StgClosure *exception,
}
SET_HDR(ap,&stg_AP_STACK_NOUPD_info,stack->header.prof.ccs);
- TICK_ALLOC_SE_THK(WDS(words+1),0);
+ TICK_ALLOC_SE_THK(AP_STACK_sizeW(words),0);
stack->sp = sp;
threadStackUnderflow(cap,tso);
@@ -963,7 +963,7 @@ raiseAsync(Capability *cap, StgTSO *tso, StgClosure *exception,
// handler in this frame.
//
raise = (StgThunk *)allocate(cap,sizeofW(StgThunk)+1);
- TICK_ALLOC_SE_THK(WDS(1),0);
+ TICK_ALLOC_SE_THK(sizeofW(StgThunk)+1,0);
SET_HDR(raise,&stg_raise_info,cf->header.prof.ccs);
raise->payload[0] = exception;
=====================================
rts/RtsSymbols.c
=====================================
@@ -402,9 +402,9 @@ extern char **environ;
SymI_HasProto(ALLOC_PAP_gds) \
SymI_HasProto(ALLOC_PAP_slp) \
SymI_HasProto(ALLOC_TSO_ctr) \
- SymI_HasProto(ALLOC_TSO_adm) \
- SymI_HasProto(ALLOC_TSO_gds) \
- SymI_HasProto(ALLOC_TSO_slp) \
+ SymI_HasProto(ALLOC_TSO_tot) \
+ SymI_HasProto(ALLOC_STACK_ctr) \
+ SymI_HasProto(ALLOC_STACK_tot) \
SymI_HasProto(RET_NEW_ctr) \
SymI_HasProto(RET_OLD_ctr) \
SymI_HasProto(RET_UNBOXED_TUP_ctr) \
=====================================
rts/Threads.c
=====================================
@@ -89,7 +89,7 @@ createThread(Capability *cap, W_ size)
stack->marking = 0;
tso = (StgTSO *)allocate(cap, sizeofW(StgTSO));
- TICK_ALLOC_TSO();
+ TICK_ALLOC_TSO(sizeofW(StgTSO));
SET_HDR(tso, &stg_TSO_info, CCS_SYSTEM);
// Always start with the compiled code evaluator
@@ -873,7 +873,7 @@ StgMutArrPtrs *listThreads(Capability *cap)
StgMutArrPtrs *arr =
(StgMutArrPtrs *)allocate(cap, sizeofW(StgMutArrPtrs) + size);
SET_HDR(arr, &stg_MUT_ARR_PTRS_DIRTY_info, CCS_SYSTEM);
- TICK_ALLOC_PRIM(sizeofW(StgMutArrPtrs), n, 0);
+ TICK_ALLOC_PRIM(sizeofW(StgMutArrPtrs), size, 0);
arr->ptrs = n_threads;
arr->size = size;
=====================================
rts/Ticky.c
=====================================
@@ -260,6 +260,12 @@ PrintTickyInfo(void)
PR_CTR(ALLOC_PRIM_gds);
PR_CTR(ALLOC_PRIM_slp);
+ PR_CTR(ALLOC_TSO_ctr);
+ PR_CTR(ALLOC_TSO_tot);
+
+ PR_CTR(ALLOC_STACK_ctr);
+ PR_CTR(ALLOC_STACK_tot);
+
PR_CTR(ENT_VIA_NODE_ctr);
PR_CTR(ENT_STATIC_CON_ctr);
PR_CTR(ENT_DYN_CON_ctr);
=====================================
rts/include/Cmm.h
=====================================
@@ -414,7 +414,7 @@
TICK_BUMP(HEAP_CHK_ctr); \
Hp = Hp + (bytes); \
if (Hp > HpLim) { HpAlloc = (bytes); failure; } \
- TICK_ALLOC_HEAP_NOCTR(bytes);
+ TICK_ALLOC_RTS(bytes);
#define ALLOC_PRIM_WITH_CUSTOM_FAILURE(bytes,failure) \
HEAP_CHECK(bytes,failure) \
@@ -435,7 +435,7 @@
#define HP_CHK_GEN_TICKY(bytes) \
HP_CHK_GEN(bytes); \
- TICK_ALLOC_HEAP_NOCTR(bytes);
+ TICK_ALLOC_RTS(bytes);
#define HP_CHK_P(bytes, fun, arg) \
HEAP_CHECK(bytes, GC_PRIM_P(fun,arg))
@@ -444,7 +444,7 @@
// -NSF March 2013
#define ALLOC_P_TICKY(bytes, fun, arg) \
HP_CHK_P(bytes); \
- TICK_ALLOC_HEAP_NOCTR(bytes);
+ TICK_ALLOC_RTS(bytes);
#define CHECK_GC() \
(bdescr_link(CurrentNursery) == NULL || \
@@ -789,7 +789,7 @@
TICK_BUMP(UPD_CON_IN_NEW_ctr); \
TICK_HISTO(UPD_CON_IN_NEW,n)
-#define TICK_ALLOC_HEAP_NOCTR(bytes) \
+#define TICK_ALLOC_RTS(bytes) \
TICK_BUMP(ALLOC_RTS_ctr); \
TICK_BUMP_BY(ALLOC_RTS_tot,bytes)
=====================================
rts/include/stg/Ticky.h
=====================================
@@ -170,9 +170,10 @@ EXTERN StgInt ALLOC_PAP_gds INIT(0);
EXTERN StgInt ALLOC_PAP_slp INIT(0);
EXTERN StgInt ALLOC_TSO_ctr INIT(0);
-EXTERN StgInt ALLOC_TSO_adm INIT(0);
-EXTERN StgInt ALLOC_TSO_gds INIT(0);
-EXTERN StgInt ALLOC_TSO_slp INIT(0);
+EXTERN StgInt ALLOC_TSO_tot INIT(0);
+
+EXTERN StgInt ALLOC_STACK_ctr INIT(0);
+EXTERN StgInt ALLOC_STACK_tot INIT(0);
EXTERN StgInt RET_NEW_ctr INIT(0);
EXTERN StgInt RET_OLD_ctr INIT(0);
@@ -215,15 +216,37 @@ EXTERN StgInt RET_UNBOXED_TUP_hst[TICKY_BIN_COUNT] INIT({0});
#define TICK_BUMP(ctr) TICK_BUMP_BY(ctr,1)
-#define TICK_ALLOC_PRIM(x,y,z) // FIXME: update counter
#define TICK_UPD_OLD_IND() TICK_BUMP(UPD_OLD_IND_ctr)
#define TICK_UPD_NEW_IND() TICK_BUMP(UPD_NEW_IND_ctr)
#define TICK_UPD_SQUEEZED() TICK_BUMP(UPD_SQUEEZED_ctr)
-#define TICK_ALLOC_HEAP_NOCTR(bytes) // FIXME: update counter
-#define TICK_GC_FAILED_PROMOTION() // FIXME: update counter
-#define TICK_ALLOC_TSO() // FIXME: update counter
-#define TICK_ALLOC_STACK(g) // FIXME: update counter
-#define TICK_ALLOC_UP_THK(g,s) // FIXME: update counter
-#define TICK_ALLOC_SE_THK(g,s) // FIXME: update counter
+#define TICK_ALLOC_PRIM(hdr,goods,slop)\
+ TICK_BUMP(ALLOC_PRIM_ctr);\
+ TICK_BUMP_BY(ALLOC_PRIM_adm,hdr);\
+ TICK_BUMP_BY(ALLOC_PRIM_gds,goods);\
+ TICK_BUMP_BY(ALLOC_PRIM_slp,slop);
+
+#define TICK_GC_FAILED_PROMOTION() TICK_BUMP(GC_FAILED_PROMOTION_ctr)
+
+#define TICK_ALLOC_TSO(n)\
+ TICK_BUMP(ALLOC_TSO_ctr);\
+ TICK_BUMP_BY(ALLOC_TSO_tot,n);
+
+#define TICK_ALLOC_STACK(n)\
+ TICK_BUMP(ALLOC_STACK_ctr);\
+ TICK_BUMP_BY(ALLOC_STACK_tot,n);
+
+#define TICK_ALLOC_UP_THK(g,s)\
+ TICK_BUMP(ALLOC_UP_THK_ctr);\
+ TICK_BUMP_BY(ALLOC_THK_gds,g);\
+ TICK_BUMP_BY(ALLOC_THK_slp,s);\
+
+#define TICK_ALLOC_SE_THK(g,s)\
+ TICK_BUMP(ALLOC_SE_THK_ctr);\
+ TICK_BUMP_BY(ALLOC_THK_gds,g);\
+ TICK_BUMP_BY(ALLOC_THK_slp,s);\
+
+#define TICK_ALLOC_RTS(bytes)\
+ TICK_BUMP(ALLOC_RTS_ctr);\
+ TICK_BUMP_BY(ALLOC_RTS_tot,n);
#endif
=====================================
rts/sm/Storage.c
=====================================
@@ -996,7 +996,7 @@ move_STACK (StgStack *src, StgStack *dest)
void
accountAllocation(Capability *cap, W_ n)
{
- TICK_ALLOC_HEAP_NOCTR(WDS(n));
+ TICK_ALLOC_RTS(WDS(n));
CCS_ALLOC(cap->r.rCCCS,n);
if (cap->r.rCurrentTSO != NULL) {
// cap->r.rCurrentTSO->alloc_limit -= n*sizeof(W_)
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/ae683454e66913ad735269b09f89a49cf6a7101d...b2dabe3a845f0068e40396fd82a8d97b29896564
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/ae683454e66913ad735269b09f89a49cf6a7101d...b2dabe3a845f0068e40396fd82a8d97b29896564
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/20230524/762a81d5/attachment-0001.html>
More information about the ghc-commits
mailing list