Fixed uninitialised FunBind fun_tick field
[ghc-hetmet.git] / rts / RtsFlags.c
index 7b8a4d1..ddc1928 100644 (file)
@@ -301,6 +301,11 @@ void initRtsFlagsDefaults(void)
 
     RtsFlags.TraceFlags.timestamp      = rtsFalse;
     RtsFlags.TraceFlags.sched          = rtsFalse;
+
+#ifdef USE_PAPI
+    /* By default no special measurements taken */
+    RtsFlags.PapiFlags.eventType        = 0;
+#endif
 }
 
 static const char *
@@ -449,6 +454,16 @@ usage_text[] = {
 #if defined(GRAN)  /* ToDo: fill in decent Docu here */
 "  -b...     All GranSim options start with -b; see GranSim User's Guide for details",
 #endif
+#if defined(USE_PAPI)
+"  -aX       CPU performance counter measurements using PAPI",
+"            (use with the -s<file> option).  X is one of:",
+"",
+/* "            y - cycles", */
+"            1 - level 1 cache misses",
+"            2 - level 2 cache misses",
+"            b - branch mispredictions",
+"            s - stalled cycles",
+#endif
 "",
 "RTS options may also be specified using the GHCRTS environment variable.",
 "",
@@ -647,6 +662,27 @@ error = rtsTrue;
                }
                break;
 
+#ifdef USE_PAPI
+             case 'a':
+               switch(rts_argv[arg][2]) {
+               case '1':
+                 RtsFlags.PapiFlags.eventType = PAPI_FLAG_CACHE_L1;
+                 break;
+               case '2':
+                 RtsFlags.PapiFlags.eventType = PAPI_FLAG_CACHE_L2;
+                 break;
+               case 'b':
+                 RtsFlags.PapiFlags.eventType = PAPI_FLAG_BRANCH;
+                 break;
+               case 's':
+                 RtsFlags.PapiFlags.eventType = PAPI_FLAG_STALLS;
+                 break;
+               default:
+                 bad_option( rts_argv[arg] );
+               }
+               break;
+#endif
+
              case 'B':
                RtsFlags.GcFlags.ringBell = rtsTrue;
                break;