Add dtrace lib
authorRoman Leshchinskiy <rl@cse.unsw.edu.au>
Thu, 29 Oct 2009 13:42:49 +0000 (13:42 +0000)
committerRoman Leshchinskiy <rl@cse.unsw.edu.au>
Thu, 29 Oct 2009 13:42:49 +0000 (13:42 +0000)
dtrace/Makefile [new file with mode: 0644]
dtrace/dph-trace.c [new file with mode: 0644]
dtrace/dph-trace.d [new file with mode: 0644]

diff --git a/dtrace/Makefile b/dtrace/Makefile
new file mode 100644 (file)
index 0000000..2a69fcb
--- /dev/null
@@ -0,0 +1,10 @@
+libdph-trace.dylib: dph-trace.h dph-trace.c
+       gcc -dynamiclib -o $@ -current_version 1.0 -compatibility_version 1.0 dph-trace.c
+       install_name_tool -id `pwd`/libdph-trace.dylib $@
+
+%.h: %.d
+       dtrace -h -s $^
+
+clean:
+       rm -f libdph-trace.dylib dph-trace.h dph-trace.o
+
diff --git a/dtrace/dph-trace.c b/dtrace/dph-trace.c
new file mode 100644 (file)
index 0000000..db8a1c5
--- /dev/null
@@ -0,0 +1,14 @@
+#include "dph-trace.h"
+
+void dph_loop_entry(char *s)
+{
+  if( HASKELL_DPH_LOOP_ENTRY_ENABLED() )
+    HASKELL_DPH_LOOP_ENTRY(s);
+}
+
+void dph_loop_exit(char *s)
+{
+  if( HASKELL_DPH_LOOP_EXIT_ENABLED() )
+    HASKELL_DPH_LOOP_EXIT(s);
+}
+
diff --git a/dtrace/dph-trace.d b/dtrace/dph-trace.d
new file mode 100644 (file)
index 0000000..832b3b5
--- /dev/null
@@ -0,0 +1,5 @@
+provider haskell {
+  probe dph__loop__entry(char*);
+  probe dph__loop__exit(char*);
+};
+