summaryrefslogtreecommitdiff
path: root/rts/PrimOps.cmm
diff options
context:
space:
mode:
authorDuncan Coutts <duncan@well-typed.com>2012-10-15 00:52:32 +0100
committerDuncan Coutts <duncan@well-typed.com>2012-10-15 12:28:29 +0100
commita609027da31c7c9103d8b9741ba3fc6807b7b7b9 (patch)
treed0e5340b10ef2d2e3935c3d682e3b35e4737d1ac /rts/PrimOps.cmm
parent8af2d940c786136a29a061fa9542e39f65e6d6fb (diff)
downloadhaskell-a609027da31c7c9103d8b9741ba3fc6807b7b7b9.tar.gz
Add a new traceMarker# primop for use in profiling output
In time-based profiling visualisations (e.g. heap profiles and ThreadScope) it would be useful to be able to mark particular points in the execution and have those points in time marked in the visualisation. The traceMarker# primop currently emits an event into the eventlog. In principle it could be extended to do something in the heap profiling too.
Diffstat (limited to 'rts/PrimOps.cmm')
-rw-r--r--rts/PrimOps.cmm25
1 files changed, 25 insertions, 0 deletions
diff --git a/rts/PrimOps.cmm b/rts/PrimOps.cmm
index 1a531b2149..fb46cee0b5 100644
--- a/rts/PrimOps.cmm
+++ b/rts/PrimOps.cmm
@@ -2034,3 +2034,28 @@ stg_traceEventzh ( W_ msg )
return ();
}
+// Same code as stg_traceEventzh above but a different kind of event
+// Before changing this code, read the comments in the impl above
+stg_traceMarkerzh ( W_ msg )
+{
+#if defined(TRACING) || defined(DEBUG)
+
+ ccall traceUserMarker(MyCapability() "ptr", msg "ptr");
+
+#elif defined(DTRACE)
+
+ W_ enabled;
+
+#if !defined(solaris2_TARGET_OS)
+ (enabled) = ccall __dtrace_isenabled$HaskellEvent$user__marker$v1();
+#else
+ enabled = 1;
+#endif
+ if (enabled != 0) {
+ ccall dtraceUserMarkerWrapper(MyCapability() "ptr", msg "ptr");
+ }
+
+#endif
+ return ();
+}
+