From patchwork Fri Oct 7 10:09:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 679213 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3sr5P30vq3z9s1h for ; Fri, 7 Oct 2016 21:29:43 +1100 (AEDT) Received: from localhost ([::1]:33735 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bsSPM-0003Zf-1m for incoming@patchwork.ozlabs.org; Fri, 07 Oct 2016 06:29:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44654) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bsS6r-0004R9-Fg for qemu-devel@nongnu.org; Fri, 07 Oct 2016 06:10:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bsS6q-0004mM-52 for qemu-devel@nongnu.org; Fri, 07 Oct 2016 06:10:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42720) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bsS6p-0004mG-Td for qemu-devel@nongnu.org; Fri, 07 Oct 2016 06:10:32 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (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 71F7B4E356; Fri, 7 Oct 2016 10:10:31 +0000 (UTC) Received: from localhost (ovpn-112-51.ams2.redhat.com [10.36.112.51]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u97AATah029599; Fri, 7 Oct 2016 06:10:30 -0400 From: Stefan Hajnoczi To: Date: Fri, 7 Oct 2016 11:09:36 +0100 Message-Id: <1475834979-4980-18-git-send-email-stefanha@redhat.com> In-Reply-To: <1475834979-4980-1-git-send-email-stefanha@redhat.com> References: <1475834979-4980-1-git-send-email-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 07 Oct 2016 10:10:31 +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 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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)