X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=rts%2FRtsStartup.c;h=c2f765a9bef7f1e701d3a2fec68f918921ff28e0;hb=6feeea5a596026e3416ec6dcd5cae6fecaeb2e27;hp=67430dc6855c44a7f6abbcfb2c3b18c08597adf0;hpb=d5934bbb856aa0aa620c9b2e0fa51c90a1a5a048;p=ghc-hetmet.git diff --git a/rts/RtsStartup.c b/rts/RtsStartup.c index 67430dc..c2f765a 100644 --- a/rts/RtsStartup.c +++ b/rts/RtsStartup.c @@ -6,13 +6,14 @@ * * ---------------------------------------------------------------------------*/ -#include "PosixSource.h" +// PAPI uses caddr_t, which is not POSIX +// #include "PosixSource.h" + #include "Rts.h" #include "RtsAPI.h" #include "RtsUtils.h" #include "RtsFlags.h" #include "OSThreads.h" -#include "Storage.h" /* initStorage, exitStorage */ #include "Schedule.h" /* initScheduler */ #include "Stats.h" /* initStats */ #include "STM.h" /* initSTM */ @@ -30,6 +31,7 @@ #include "Trace.h" #include "RtsTypeable.h" #include "Stable.h" +#include "Hpc.h" #if defined(RTS_GTK_FRONTPANEL) #include "FrontPanel.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,32 @@ hs_init(int *argc, char **argv[]) argv++; argc--; #endif + /* Initialise the performance tracking library */ +#ifdef USE_PAPI + { + int ver; + if ((ver = PAPI_library_init(PAPI_VER_CURRENT)) != PAPI_VER_CURRENT) { + if (ver > 0) { + errorBelch("PAPI_library_init: wrong version: %x", ver); + stg_exit(EXIT_FAILURE); + } else { + sysErrorBelch("PAPI_library_init"); + stg_exit(EXIT_FAILURE); + } + } + } +#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 */