trace: [tracetool] Explicitly identify public backends
authorLluís Vilanova <vilanova@ac.upc.edu>
Tue, 5 Mar 2013 13:47:26 +0000 (14:47 +0100)
committerStefan Hajnoczi <stefanha@redhat.com>
Thu, 28 Mar 2013 13:19:57 +0000 (14:19 +0100)
Public backends are those printed by "--list-backends" and thus considered valid
by the configure script.

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
scripts/tracetool.py
scripts/tracetool/backend/__init__.py
scripts/tracetool/backend/dtrace.py
scripts/tracetool/backend/simple.py
scripts/tracetool/backend/stderr.py
scripts/tracetool/backend/ust.py

index c003cf6..a79ec0f 100755 (executable)
@@ -90,8 +90,8 @@ def main(args):
             arg_format = arg
 
         elif opt == "--list-backends":
-            backends = tracetool.backend.get_list()
-            out(", ".join([ b for b,_ in backends ]))
+            public_backends = tracetool.backend.get_list(only_public = True)
+            out(", ".join([ b for b,_ in public_backends ]))
             sys.exit(0)
         elif opt == "--check-backend":
             check_backend = True
index be43472..f0314ee 100644 (file)
@@ -17,6 +17,16 @@ considered its short description.
 All backends must generate their contents through the 'tracetool.out' routine.
 
 
+Backend attributes
+------------------
+
+========= ====================================================================
+Attribute Description
+========= ====================================================================
+PUBLIC    If exists and is set to 'True', the backend is considered "public".
+========= ====================================================================
+
+
 Backend functions
 -----------------
 
@@ -42,7 +52,7 @@ import os
 import tracetool
 
 
-def get_list():
+def get_list(only_public = False):
     """Get a list of (name, description) pairs."""
     res = [("nop", "Tracing disabled.")]
     modnames = []
@@ -57,6 +67,10 @@ def get_list():
             continue
         module = module[1]
 
+        public = getattr(module, "PUBLIC", False)
+        if only_public and not public:
+            continue
+
         doc = module.__doc__
         if doc is None:
             doc = ""
index ad5eb3b..e31bc79 100644 (file)
@@ -16,6 +16,9 @@ __email__      = "stefanha@linux.vnet.ibm.com"
 from tracetool import out
 
 
+PUBLIC = True
+
+
 PROBEPREFIX = None
 
 def _probeprefix():
index e4b4a7f..ac864f3 100644 (file)
@@ -15,6 +15,10 @@ __email__      = "stefanha@linux.vnet.ibm.com"
 
 from tracetool import out
 
+
+PUBLIC = True
+
+
 def is_string(arg):
     strtype = ('const char*', 'char*', 'const char *', 'char *')
     if arg.lstrip().startswith(strtype):
index 917fde7..a10fbb8 100644 (file)
@@ -16,6 +16,9 @@ __email__      = "stefanha@linux.vnet.ibm.com"
 from tracetool import out
 
 
+PUBLIC = True
+
+
 def c(events):
     out('#include "trace.h"',
         '',
index 31a2ff0..ea36995 100644 (file)
@@ -16,6 +16,9 @@ __email__      = "stefanha@linux.vnet.ibm.com"
 from tracetool import out
 
 
+PUBLIC = True
+
+
 def c(events):
     out('#include <ust/marker.h>',
         '#undef mutex_lock',