X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=rts%2Fsm%2FGC.c;h=f248a75a394f8ebbb33177079bb223687dbf1b20;hb=a84385fa752d8fa800a2155cce95f47c68b74e2b;hp=2fc3f4dd9b3a030fbeb9ee61ee6d1f0483f38bd9;hpb=bf4d6a58a1079b944ffc4bdd41d57403a7727046;p=ghc-hetmet.git diff --git a/rts/sm/GC.c b/rts/sm/GC.c index 2fc3f4d..f248a75 100644 --- a/rts/sm/GC.c +++ b/rts/sm/GC.c @@ -40,6 +40,7 @@ #include "RetainerProfile.h" #include "RaiseAsync.h" #include "Sparks.h" +#include "Papi.h" #include "GC.h" #include "Compact.h" @@ -873,6 +874,10 @@ alloc_gc_thread (gc_thread *t, int n) init_gc_thread(t); +#ifdef USE_PAPI + t->papi_events = -1; +#endif + t->steps = stgMallocBytes(RtsFlags.GcFlags.generations * sizeof(step_workspace *), "initialise_gc_thread"); @@ -1011,7 +1016,20 @@ gc_thread_mainloop (void) gct->wakeup = rtsFalse; if (gct->exit) break; +#ifdef USE_PAPI + // start performance counters in this thread... + if (gct->papi_events == -1) { + papi_init_eventset(&gct->papi_events); + } + papi_thread_start_gc_count(gct->papi_events); +#endif + gc_thread_work(); + +#ifdef USE_PAPI + // count events in this thread towards the GC totals + papi_thread_stop_gc_count(gct->papi_events); +#endif } } #endif