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();
setProgArgv(*argc,*argv);
}
+#ifdef USE_PAPI
+ papi_init();
+#endif
+
/* initTracing must be after setupRtsFlags() */
initTracing();
{
bdescr *bd;
nat init_sp;
- Capability *cap = &MainCapability;
+ Capability *cap;
+
+ cap = rts_lock();
if (hs_init_count <= 0) {
barf("hs_add_root() must be called after hs_init()");
// ToDo: make this work in the presence of multiple hs_add_root()s.
initProfiling2();
+ rts_unlock(cap);
+
// ditto.
#if defined(THREADED_RTS)
ioManagerStart();