Skip to content
Snippets Groups Projects
Commit 44af57de authored by Matthew Pickering's avatar Matthew Pickering Committed by Marge Bot
Browse files

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
parent ae683454
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......
......@@ -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) \
......
......@@ -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;
......
......@@ -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);
......
......@@ -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_HEAP_NOCTR(bytes)\
TICK_BUMP(ALLOC_RTS_ctr);\
TICK_BUMP_BY(ALLOC_RTS_tot,n);
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment