QEMU-Devel Archive on lore.kernel.org
 help / color / Atom feed
From: "Lluís Vilanova" <vilanova@ac.upc.edu>
To: qemu-devel@nongnu.org
Cc: Stefan Hajnoczi <stefanha@gmail.com>,
	Eduardo Habkost <ehabkost@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>
Subject: [Qemu-devel] [PATCH v4 9/9] trace: [tcg] Generate TCG code to trace guest events on a per-vCPU basis
Date: Fri, 15 Jan 2016 17:38:42 +0100
Message-ID: <145287592254.11400.6186375064145174040.stgit@localhost> (raw)
In-Reply-To: <145287587081.11400.4178335509020334684.stgit@localhost>

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 <vilanova@ac.upc.edu>
---
 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()),

      parent reply index

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-15 16:37 [Qemu-devel] [PATCH v4 0/9] trace: Per-vCPU tracing states Lluís Vilanova
2016-01-15 16:37 ` [Qemu-devel] [PATCH v4 1/9] trace: Add support for vCPU pointers in trace events Lluís Vilanova
2016-01-15 16:38 ` [Qemu-devel] [PATCH v4 2/9] trace: Add 'vcpu' event property Lluís Vilanova
2016-01-15 16:38 ` [Qemu-devel] [PATCH v4 3/9] trace: [tcg] Identify events with the 'vcpu' property Lluís Vilanova
2016-01-15 16:38 ` [Qemu-devel] [PATCH v4 4/9] exec: [tcg] Refactor flush of per-CPU virtual TB cache Lluís Vilanova
2016-01-15 16:38 ` [Qemu-devel] [PATCH v4 5/9] exec: [tcg] Use multiple physical TB caches Lluís Vilanova
2016-01-15 16:38 ` [Qemu-devel] [PATCH v4 6/9] exec: [tcg] Track which vCPU is performing translation and execution Lluís Vilanova
2016-01-15 16:38 ` [Qemu-devel] [PATCH v4 7/9] disas: Remove unused macro '_' Lluís Vilanova
2016-01-15 16:38 ` [Qemu-devel] [PATCH v4 8/9] trace: [tcg] Add per-vCPU tracing states for events with the 'vcpu' property Lluís Vilanova
2016-01-18 10:50   ` Paolo Bonzini
2016-01-18 11:55     ` Lluís Vilanova
2016-01-19 22:06   ` Eric Blake
2016-01-15 16:38 ` Lluís Vilanova [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=145287592254.11400.6186375064145174040.stgit@localhost \
    --to=vilanova@ac.upc.edu \
    --cc=ehabkost@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.com \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

QEMU-Devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/qemu-devel/0 qemu-devel/git/0.git
	git clone --mirror https://lore.kernel.org/qemu-devel/1 qemu-devel/git/1.git
	git clone --mirror https://lore.kernel.org/qemu-devel/2 qemu-devel/git/2.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 qemu-devel qemu-devel/ https://lore.kernel.org/qemu-devel \
		qemu-devel@nongnu.org
	public-inbox-index qemu-devel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.nongnu.qemu-devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git