[Git][ghc/ghc][wip/time-profile-tick] Introduce timeProfileTick#
Ben Gamari (@bgamari)
gitlab at gitlab.haskell.org
Thu Nov 16 15:23:34 UTC 2023
Ben Gamari pushed to branch wip/time-profile-tick at Glasgow Haskell Compiler / GHC
Commits:
68699d7f by Ben Gamari at 2023-11-16T10:23:25-05:00
Introduce timeProfileTick#
- - - - -
6 changed files:
- compiler/GHC/Builtin/primops.txt.pp
- compiler/GHC/StgToCmm/Prim.hs
- compiler/GHC/StgToJS/Prim.hs
- rts/PrimOps.cmm
- rts/Proftimer.c
- rts/Proftimer.h
Changes:
=====================================
compiler/GHC/Builtin/primops.txt.pp
=====================================
@@ -3799,6 +3799,12 @@ primop ClearCCSOp "clearCCS#" GenPrimOp
with
out_of_line = True
+primop TimeProfileTickOp "timeProfileTick#" GenPrimOp
+ State# s -> State# s
+ { Register a time profile tick. }
+ with
+ out_of_line = True
+
------------------------------------------------------------------------
section "Info Table Origin"
------------------------------------------------------------------------
=====================================
compiler/GHC/StgToCmm/Prim.hs
=====================================
@@ -1649,6 +1649,7 @@ emitPrimOp cfg primop =
WhereFromOp -> alwaysExternal
GetApStackValOp -> alwaysExternal
ClearCCSOp -> alwaysExternal
+ TimeProfileTickOp -> alwaysExternal
TraceEventOp -> alwaysExternal
TraceEventBinaryOp -> alwaysExternal
TraceMarkerOp -> alwaysExternal
=====================================
compiler/GHC/StgToJS/Prim.hs
=====================================
@@ -979,6 +979,8 @@ genPrim prof bound ty op = case op of
ClearCCSOp -> \[_r] [x] -> PRPrimCall $ ReturnStat (app "h$clearCCS" [x])
+ TimeProfileTickOp -> \[] [] -> PrimInline $ appS "h$timeProfTick" []
+
------------------------------ Eventlog -------------------
TraceEventOp -> \[] [ed,eo] -> PrimInline $ appS "h$traceEvent" [ed,eo]
=====================================
rts/PrimOps.cmm
=====================================
@@ -2957,3 +2957,11 @@ INFO_TABLE_RET(stg_keepAlive_frame, RET_SMALL, KEEP_ALIVE_FRAME_FIELDS(W_,P_, in
{
return (ret);
}
+
+// timeProfileTick# :: IO ()
+stg_timeProfileTickzh ()
+{
+#if defined(PROFILING)
+ ccall timeProfTick(MyCapability());
+#endif
+}
=====================================
rts/Proftimer.c
=====================================
@@ -115,6 +115,16 @@ initProfTimer( void )
uint32_t total_ticks = 0;
+void
+timeProfTick(Capability *cap STG_UNUSED)
+{
+#if defined(PROFILING)
+ CostCentreStack *cccs = RELAXED_LOAD(&cap->r.rCCCS);
+ cccs->time_ticks++;
+ traceProfSampleCostCentre(cap, cccs, total_ticks);
+#endif
+}
+
void
handleProfTick(void)
{
@@ -124,8 +134,7 @@ handleProfTick(void)
uint32_t n;
for (n=0; n < getNumCapabilities(); n++) {
Capability *cap = getCapability(n);
- cap->r.rCCCS->time_ticks++;
- traceProfSampleCostCentre(cap, cap->r.rCCCS, total_ticks);
+ timeProfTick(cap);
}
}
#endif
=====================================
rts/Proftimer.h
=====================================
@@ -10,10 +10,11 @@
#include "BeginPrivate.h"
-void initProfTimer ( void );
-void handleProfTick ( void );
+void initProfTimer ( void );
+void handleProfTick ( void );
void pauseHeapProfTimer ( void );
void resumeHeapProfTimer ( void );
+void timeProfTick ( Capability *cap );
extern bool performHeapProfile;
extern bool performTickySample;
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/68699d7fcbebf5af2f8e7152ba2c992c94da3bba
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/68699d7fcbebf5af2f8e7152ba2c992c94da3bba
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/20231116/3e6d2f6b/attachment-0001.html>
More information about the ghc-commits
mailing list