X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=rts%2FRtsStartup.c;h=f2a0dd71c36243d41583b44f7c11a014fc910b74;hb=14591e0d3d238a40d034fb9ddd0ae90688e007eb;hp=3e9fd2a077bda78116b34957164326a6026f5a32;hpb=1cb0eb071f1316d6650f354166506789a2638720;p=ghc-hetmet.git diff --git a/rts/RtsStartup.c b/rts/RtsStartup.c index 3e9fd2a..f2a0dd7 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 #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 */