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: 568220 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 CCBE6140BF9 for ; Sat, 16 Jan 2016 03:41:35 +1100 (AEDT) Received: from localhost ([::1]:47993 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aK7RN-0005QL-Vh for incoming@patchwork.ozlabs.org; Fri, 15 Jan 2016 11:41:33 -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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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()),