From patchwork Fri Jan 15 16:38:42 2016 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: 8043251 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id CBA039F6FA for ; Fri, 15 Jan 2016 16:41:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 40FC320426 for ; Fri, 15 Jan 2016 16:41:22 +0000 (UTC) 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.kernel.org (Postfix) with ESMTPS id 907AF203F4 for ; Fri, 15 Jan 2016 16:41:21 +0000 (UTC) Received: from localhost ([::1]:47990 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aK7RB-0004nw-0r for patchwork-qemu-devel@patchwork.kernel.org; Fri, 15 Jan 2016 11:41:21 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39719) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aK7Oi-0000SG-Mx for qemu-devel@nongnu.org; Fri, 15 Jan 2016 11:38:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aK7Oe-0004Wk-LP for qemu-devel@nongnu.org; Fri, 15 Jan 2016 11:38:48 -0500 Received: from roura.ac.upc.es ([147.83.33.10]:58121) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aK7Od-0004Wa-Uq for qemu-devel@nongnu.org; Fri, 15 Jan 2016 11:38:44 -0500 Received: from gw-2.ac.upc.es (gw-2.ac.upc.es [147.83.30.8]) by roura.ac.upc.es (8.13.8/8.13.8) with ESMTP id u0FEx8r2029664; Fri, 15 Jan 2016 15:59:08 +0100 Received: from localhost (unknown [84.88.51.85]) by gw-2.ac.upc.es (Postfix) with ESMTPSA id 12893766; Fri, 15 Jan 2016 17:38:43 +0100 (CET) From: =?utf-8?b?TGx1w61z?= Vilanova To: qemu-devel@nongnu.org Date: Fri, 15 Jan 2016 17:38:42 +0100 Message-Id: <145287592254.11400.6186375064145174040.stgit@localhost> X-Mailer: git-send-email 2.6.4 In-Reply-To: <145287587081.11400.4178335509020334684.stgit@localhost> References: <145287587081.11400.4178335509020334684.stgit@localhost> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-MIME-Autoconverted: from 8bit to quoted-printable by roura.ac.upc.es id u0FEx8r2029664 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 147.83.33.10 Cc: Stefan Hajnoczi , Eduardo Habkost , Stefan Hajnoczi Subject: [Qemu-devel] [PATCH v4 9/9] trace: [tcg] Generate TCG code to trace guest events on a per-vCPU basis 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Events with the 'tcg' and 'vcpu' properties will: * Trace the translation-time event ('*_trans'). * Generate TCG code to call a function that traces the execution-time event ('*_exec') iff the event is enabled for that vCPU. Signed-off-by: LluĂ­s Vilanova --- scripts/tracetool/format/tcg_h.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/tracetool/format/tcg_h.py b/scripts/tracetool/format/tcg_h.py index acaa963..42f3b1c 100644 --- a/scripts/tracetool/format/tcg_h.py +++ b/scripts/tracetool/format/tcg_h.py @@ -32,7 +32,7 @@ def generate(events, backend): for e in events: # just keep one of them - if "tcg-trans" not in e.properties: + if "tcg-exec" not in e.properties: continue # get the original event definition @@ -52,7 +52,11 @@ def generate(events, backend): if "disable" not in e.properties: out(' %(name_trans)s(%(argnames_trans)s);', - ' gen_helper_%(name_exec)s(%(argnames_exec)s);', + ' if (%(cond)s) {', + ' gen_helper_%(name_exec)s(%(argnames_exec)s);', + ' }', + cond='trace_event_get_cpu_state(_cpu, TRACE_%s)' % e.event_exec.name.upper() + if "vcpu" in e.properties else "true", name_trans=e.event_trans.api(e.QEMU_TRACE), name_exec=e.event_exec.api(e.QEMU_TRACE), argnames_trans=", ".join(e.event_trans.args.names()),