From patchwork Wed Oct 12 08:47:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 9372297 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5584560487 for ; Wed, 12 Oct 2016 09:14:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4459B293FF for ; Wed, 12 Oct 2016 09:14:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3904529402; Wed, 12 Oct 2016 09:14:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0395F293FF for ; Wed, 12 Oct 2016 09:14:16 +0000 (UTC) Received: from localhost ([::1]:60169 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1buFc7-0004ZD-Kx for patchwork-qemu-devel@patchwork.kernel.org; Wed, 12 Oct 2016 05:14:15 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33164) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1buFDO-00006w-PD for qemu-devel@nongnu.org; Wed, 12 Oct 2016 04:48:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1buFDI-0002Sj-SU for qemu-devel@nongnu.org; Wed, 12 Oct 2016 04:48:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58138) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1buFDI-0002SZ-Lz for qemu-devel@nongnu.org; Wed, 12 Oct 2016 04:48:36 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 24D3490E64; Wed, 12 Oct 2016 08:48:36 +0000 (UTC) Received: from localhost (ovpn-112-40.ams2.redhat.com [10.36.112.40]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u9C8mXCq016383; Wed, 12 Oct 2016 04:48:35 -0400 From: Stefan Hajnoczi To: Date: Wed, 12 Oct 2016 10:47:35 +0200 Message-Id: <1476262058-13936-18-git-send-email-stefanha@redhat.com> In-Reply-To: <1476262058-13936-1-git-send-email-stefanha@redhat.com> References: <1476262058-13936-1-git-send-email-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 12 Oct 2016 08:48:36 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL v2 17/20] trace: push reading of events up a level to tracetool main X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Stefan Hajnoczi Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: "Daniel P. Berrange" Move the reading of events out of the 'tracetool.generate' method and into tracetool.main, so that the latter is not tied to generating from a single source of events. Reviewed-by: Stefan Hajnoczi Reviewed-by: LluĂ­s Vilanova Signed-off-by: Daniel P. Berrange Message-id: 1475588159-30598-19-git-send-email-berrange@redhat.com Signed-off-by: Stefan Hajnoczi --- scripts/tracetool.py | 4 +++- scripts/tracetool/__init__.py | 8 +++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/tracetool.py b/scripts/tracetool.py index 7b82959..6accbbf 100755 --- a/scripts/tracetool.py +++ b/scripts/tracetool.py @@ -129,8 +129,10 @@ def main(args): if probe_prefix is None: probe_prefix = ".".join(["qemu", target_type, target_name]) + events = tracetool.read_events(sys.stdin) + try: - tracetool.generate(sys.stdin, arg_format, arg_backends, + tracetool.generate(events, arg_format, arg_backends, binary=binary, probe_prefix=probe_prefix) except tracetool.TracetoolError as e: error_opt(str(e)) diff --git a/scripts/tracetool/__init__.py b/scripts/tracetool/__init__.py index bf01e93..ac2cb8f 100644 --- a/scripts/tracetool/__init__.py +++ b/scripts/tracetool/__init__.py @@ -364,14 +364,14 @@ def try_import(mod_name, attr_name=None, attr_default=None): return False, None -def generate(fevents, format, backends, +def generate(events, format, backends, binary=None, probe_prefix=None): """Generate the output for the given (format, backends) pair. Parameters ---------- - fevents : file - Event description file. + events : list + list of Event objects to generate for format : str Output format name. backends : list @@ -401,6 +401,4 @@ def generate(fevents, format, backends, tracetool.backend.dtrace.BINARY = binary tracetool.backend.dtrace.PROBEPREFIX = probe_prefix - events = read_events(fevents) - tracetool.format.generate(events, format, backend)