trace: added ability to comment out events in the list
authorAlexey Kardashevskiy <aik@ozlabs.ru>
Thu, 14 Jun 2012 04:41:40 +0000 (14:41 +1000)
committerStefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Thu, 19 Jul 2012 10:30:37 +0000 (11:30 +0100)
It is convenient for debug to be able to switch on/off some events easily.
The only possibility now is to remove event name from the file completely
and type it again when we want it back.

The patch adds '#' symbol handling as a comment specifier.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
trace/control.c

index 4c5527d20adafcf667a1d4265a10b5b60efdd4ac..22d5863eebfc23454b4e7aee45f20bc518b514e5 100644 (file)
@@ -27,6 +27,9 @@ void trace_backend_init_events(const char *fname)
         size_t len = strlen(line_buf);
         if (len > 1) {              /* skip empty lines */
             line_buf[len - 1] = '\0';
+            if ('#' == line_buf[0]) { /* skip commented lines */
+                continue;
+            }
             if (!trace_event_set_state(line_buf, true)) {
                 fprintf(stderr,
                         "error: trace event '%s' does not exist\n", line_buf);