From patchwork Thu Dec 20 22:30:00 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Llu=C3=ADs_Vilanova?= X-Patchwork-Id: 207720 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id B4E8B2C0092 for ; Fri, 21 Dec 2012 09:34:58 +1100 (EST) Received: from localhost ([::1]:38655 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tlohc-0006Nl-1j for incoming@patchwork.ozlabs.org; Thu, 20 Dec 2012 17:34:56 -0500 Received: from eggs.gnu.org ([208.118.235.92]:46043) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TlohT-0006NF-4Y for qemu-devel@nongnu.org; Thu, 20 Dec 2012 17:34:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TlohR-0005wd-AU for qemu-devel@nongnu.org; Thu, 20 Dec 2012 17:34:47 -0500 Received: from roura.ac.upc.edu ([147.83.33.10]:55979 helo=roura.ac.upc.es) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tlocw-0004q8-NC for qemu-devel@nongnu.org; Thu, 20 Dec 2012 17:30:06 -0500 Received: from gw.ac.upc.edu (gw.ac.upc.es [147.83.30.3]) by roura.ac.upc.es (8.13.8/8.13.8) with ESMTP id qBKMU0Ia017710; Thu, 20 Dec 2012 23:30:00 +0100 Received: from localhost (unknown [84.88.51.85]) by gw.ac.upc.edu (Postfix) with ESMTP id E21706B01A5; Thu, 20 Dec 2012 23:29:59 +0100 (CET) From: =?utf-8?b?TGx1w61z?= Vilanova To: qemu-devel@nongnu.org Date: Thu, 20 Dec 2012 23:30:00 +0100 Message-Id: <20121220222959.22814.30338.stgit@fimbulvetr.bsc.es> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <20121220222948.22814.56660.stgit@fimbulvetr.bsc.es> References: <20121220222948.22814.56660.stgit@fimbulvetr.bsc.es> User-Agent: StGit/0.16 MIME-Version: 1.0 X-MIME-Autoconverted: from 8bit to quoted-printable by roura.ac.upc.es id qBKMU0Ia017710 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 147.83.33.10 Cc: Blue Swirl , Stefan Hajnoczi Subject: [Qemu-devel] [PATCH v7 2/8] trace: [tracetool] Explicitly identify public backends X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Public backends are those printed by "--list-backends" and thus considered valid by the configure script. Signed-off-by: LluĂ­s Vilanova --- scripts/tracetool.py | 4 ++-- scripts/tracetool/backend/__init__.py | 16 +++++++++++++++- scripts/tracetool/backend/dtrace.py | 3 +++ scripts/tracetool/backend/simple.py | 4 ++++ scripts/tracetool/backend/stderr.py | 3 +++ scripts/tracetool/backend/ust.py | 3 +++ 6 files changed, 30 insertions(+), 3 deletions(-) diff --git a/scripts/tracetool.py b/scripts/tracetool.py index c003cf6..a79ec0f 100755 --- a/scripts/tracetool.py +++ b/scripts/tracetool.py @@ -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 diff --git a/scripts/tracetool/backend/__init__.py b/scripts/tracetool/backend/__init__.py index be43472..f0314ee 100644 --- a/scripts/tracetool/backend/__init__.py +++ b/scripts/tracetool/backend/__init__.py @@ -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 = "" diff --git a/scripts/tracetool/backend/dtrace.py b/scripts/tracetool/backend/dtrace.py index ad5eb3b..e31bc79 100644 --- a/scripts/tracetool/backend/dtrace.py +++ b/scripts/tracetool/backend/dtrace.py @@ -16,6 +16,9 @@ __email__ = "stefanha@linux.vnet.ibm.com" from tracetool import out +PUBLIC = True + + PROBEPREFIX = None def _probeprefix(): diff --git a/scripts/tracetool/backend/simple.py b/scripts/tracetool/backend/simple.py index e4b4a7f..ac864f3 100644 --- a/scripts/tracetool/backend/simple.py +++ b/scripts/tracetool/backend/simple.py @@ -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): diff --git a/scripts/tracetool/backend/stderr.py b/scripts/tracetool/backend/stderr.py index 917fde7..a10fbb8 100644 --- a/scripts/tracetool/backend/stderr.py +++ b/scripts/tracetool/backend/stderr.py @@ -16,6 +16,9 @@ __email__ = "stefanha@linux.vnet.ibm.com" from tracetool import out +PUBLIC = True + + def c(events): out('#include "trace.h"', '', diff --git a/scripts/tracetool/backend/ust.py b/scripts/tracetool/backend/ust.py index 31a2ff0..ea36995 100644 --- a/scripts/tracetool/backend/ust.py +++ b/scripts/tracetool/backend/ust.py @@ -16,6 +16,9 @@ __email__ = "stefanha@linux.vnet.ibm.com" from tracetool import out +PUBLIC = True + + def c(events): out('#include ', '#undef mutex_lock',