diff mbox series

[RFC,10/21] qom/cpu: add a cpu_exit trace event

Message ID 20181005154910.3099-11-alex.bennee@linaro.org
State New
Headers show
Series Trace updates and plugin RFC | expand

Commit Message

Alex Bennée Oct. 5, 2018, 3:48 p.m. UTC
This is useful for tracing cpu_exit events where we signal the CPU to
come back to the main loop.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

---
 qom/cpu.c        | 3 +++
 qom/trace-events | 4 ++++
 2 files changed, 7 insertions(+)

-- 
2.17.1

Comments

Richard Henderson Oct. 6, 2018, 6:51 p.m. UTC | #1
On 10/5/18 8:48 AM, Alex Bennée wrote:
> This is useful for tracing cpu_exit events where we signal the CPU to

> come back to the main loop.

> 

> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

> ---

>  qom/cpu.c        | 3 +++

>  qom/trace-events | 4 ++++

>  2 files changed, 7 insertions(+)


Reviewed-by: Richard Henderson <richard.henderson@linaro.org>



r~
diff mbox series

Patch

diff --git a/qom/cpu.c b/qom/cpu.c
index 92599f3541..5a77ff6acd 100644
--- a/qom/cpu.c
+++ b/qom/cpu.c
@@ -19,6 +19,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "trace.h"
 #include "qapi/error.h"
 #include "qemu-common.h"
 #include "qom/cpu.h"
@@ -111,6 +112,8 @@  void cpu_reset_interrupt(CPUState *cpu, int mask)
 
 void cpu_exit(CPUState *cpu)
 {
+    trace_cpu_exit(cpu, cpu->cpu_index);
+
     atomic_set(&cpu->exit_request, 1);
     /* Ensure cpu_exec will see the exit request after TCG has exited.  */
     smp_wmb();
diff --git a/qom/trace-events b/qom/trace-events
index 5d86fbf019..1162dd86fe 100644
--- a/qom/trace-events
+++ b/qom/trace-events
@@ -1,5 +1,9 @@ 
 # See docs/devel/tracing.txt for syntax documentation.
 
+# qom/cpu.c
+# cpu_exit events
+cpu_exit(void *cpu, int id) "cpu:%p id:%d"
+
 # qom/object.c
 object_dynamic_cast_assert(const char *type, const char *target, const char *file, int line, const char *func) "%s->%s (%s:%d:%s)"
 object_class_dynamic_cast_assert(const char *type, const char *target, const char *file, int line, const char *func) "%s->%s (%s:%d:%s)"