summaryrefslogtreecommitdiff
path: root/rts/RtsStartup.c
diff options
context:
space:
mode:
authormrchebas@gmail.com <unknown>2006-11-08 17:14:52 +0000
committermrchebas@gmail.com <unknown>2006-11-08 17:14:52 +0000
commitfe07f054d7ae5e10b14d5fed730fe4424dabd587 (patch)
tree37b9be9c87726d5d910e72c195688b029d31a4c5 /rts/RtsStartup.c
parent74a87d705449e2f9ad4021aeebf8149ce35a6a2e (diff)
downloadhaskell-fe07f054d7ae5e10b14d5fed730fe4424dabd587.tar.gz
Addition of PAPI to RTS
This patch still requires the addition of the USE_PAPI define to compile with PAPI. Also, programs must be compiled and linked with the appropriate library flags for papi.
Diffstat (limited to 'rts/RtsStartup.c')
-rw-r--r--rts/RtsStartup.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/rts/RtsStartup.c b/rts/RtsStartup.c
index 3e9fd2a077..f2a0dd71c3 100644
--- a/rts/RtsStartup.c
+++ b/rts/RtsStartup.c
@@ -6,7 +6,9 @@
*
* ---------------------------------------------------------------------------*/
-#include "PosixSource.h"
+// PAPI uses caddr_t, which is not POSIX
+// #include "PosixSource.h"
+
#include "Rts.h"
#include "RtsAPI.h"
#include "RtsUtils.h"
@@ -67,6 +69,10 @@
#include <signal.h>
#endif
+#if USE_PAPI
+#include "Papi.h"
+#endif
+
// Count of how many outstanding hs_init()s there have been.
static int hs_init_count = 0;
@@ -152,7 +158,23 @@ hs_init(int *argc, char **argv[])
argv++; argc--;
#endif
+ /* Initialise the performance tracking library */
+#ifdef USE_PAPI
+ /* Must fix to abort gracefully */
+ if(PAPI_library_init(PAPI_VER_CURRENT) != PAPI_VER_CURRENT)
+ exit(1);
+#ifdef THREADED_RTS
+ {
+ int err;
+ if ((err = PAPI_thread_init(osThreadId)) < 0) {
+ barf("PAPI_thread_init: %d",err);
+ }
+ }
+#endif
+#endif
+
/* Set the RTS flags to default values. */
+
initRtsFlagsDefaults();
/* Call the user hook to reset defaults, if present */