Add new RTS flags for tracing:
authorSimon Marlow <simonmar@microsoft.com>
Thu, 8 Jun 2006 13:01:01 +0000 (13:01 +0000)
committerSimon Marlow <simonmar@microsoft.com>
Thu, 8 Jun 2006 13:01:01 +0000 (13:01 +0000)
  -vs       Trace scheduler events (see also -Ds with -debug)
  -vt       Time-stamp trace messages

the intention is that we will pipe the -vs output into a
profile-generating tool.  This commit includes the flags only,
functionality to follow.

includes/RtsFlags.h
rts/RtsFlags.c

index 11d9dbc..ccf170f 100644 (file)
@@ -289,6 +289,10 @@ struct TICKY_FLAGS {
     FILE   *tickyFile;
 };
 
     FILE   *tickyFile;
 };
 
+struct TRACE_FLAGS {
+    rtsBool sched;             /* trace scheduler events for profiling */
+    rtsBool timestamp;          /* add timestamps to traces */
+};
 
 /* Put them together: */
 
 
 /* Put them together: */
 
@@ -300,6 +304,7 @@ typedef struct _RTS_FLAGS {
     struct COST_CENTRE_FLAGS CcFlags;
     struct PROFILING_FLAGS   ProfFlags;
     struct TICKY_FLAGS      TickyFlags;
     struct COST_CENTRE_FLAGS CcFlags;
     struct PROFILING_FLAGS   ProfFlags;
     struct TICKY_FLAGS      TickyFlags;
+    struct TRACE_FLAGS       TraceFlags;
 
 #if defined(THREADED_RTS) || defined(PAR)
     struct PAR_FLAGS   ParFlags;
 
 #if defined(THREADED_RTS) || defined(PAR)
     struct PAR_FLAGS   ParFlags;
index 78c8d2a..7e836af 100644 (file)
@@ -1,8 +1,7 @@
-
 /* -----------------------------------------------------------------------------
  *
  * (c) The AQUA Project, Glasgow University, 1994-1997
 /* -----------------------------------------------------------------------------
  *
  * (c) The AQUA Project, Glasgow University, 1994-1997
- * (c) The GHC Team, 1998-1999
+ * (c) The GHC Team, 1998-2006
  *
  * Functions for parsing the argument list.
  *
  *
  * Functions for parsing the argument list.
  *
@@ -299,6 +298,9 @@ void initRtsFlagsDefaults(void)
     RtsFlags.TickyFlags.showTickyStats  = rtsFalse;
     RtsFlags.TickyFlags.tickyFile       = NULL;
 #endif
     RtsFlags.TickyFlags.showTickyStats  = rtsFalse;
     RtsFlags.TickyFlags.tickyFile       = NULL;
 #endif
+
+    RtsFlags.TraceFlags.timestamp      = rtsFalse;
+    RtsFlags.TraceFlags.sched          = rtsFalse;
 }
 
 static const char *
 }
 
 static const char *
@@ -396,6 +398,9 @@ usage_text[] = {
 "                (0 or no argument means switch as often as possible)",
 "                the default is .02 sec; resolution is .02 sec",
 "",
 "                (0 or no argument means switch as often as possible)",
 "                the default is .02 sec; resolution is .02 sec",
 "",
+"  -vs       Trace scheduler events (see also -Ds with -debug)",
+"  -vt       Time-stamp trace messages",
+"",
 #if defined(DEBUG)
 "  -Ds  DEBUG: scheduler",
 "  -Di  DEBUG: interpreter",
 #if defined(DEBUG)
 "  -Ds  DEBUG: scheduler",
 "  -Di  DEBUG: interpreter",
@@ -1027,7 +1032,7 @@ error = rtsTrue;
                }
                ) break;
 
                }
                ) break;
 
-           case 'q':
+             case 'q':
                    switch (rts_argv[arg][2]) {
                    case '\0':
                        errorBelch("incomplete RTS option: %s",rts_argv[arg]);
                    switch (rts_argv[arg][2]) {
                    case '\0':
                        errorBelch("incomplete RTS option: %s",rts_argv[arg]);
@@ -1089,6 +1094,27 @@ error = rtsTrue;
                }
                ) break;
 
                }
                ) break;
 
+             /* =========== TRACING ---------=================== */
+
+             case 'v':
+                switch(rts_argv[arg][2]) {
+               case '\0':
+                   errorBelch("incomplete RTS option: %s",rts_argv[arg]);
+                   error = rtsTrue;
+                   break;
+               case 't':
+                   RtsFlags.TraceFlags.timestamp = rtsTrue;
+                   break;
+               case 's':
+                   RtsFlags.TraceFlags.sched = rtsTrue;
+                   break;
+               default:
+                   errorBelch("unknown RTS option: %s",rts_argv[arg]);
+                   error = rtsTrue;
+                   break;
+               }
+                break;
+
              /* =========== EXTENDED OPTIONS =================== */
 
               case 'x': /* Extend the argument space */
              /* =========== EXTENDED OPTIONS =================== */
 
               case 'x': /* Extend the argument space */