mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-27 04:13:53 -06:00
trace: Conditionally trace events based on their per-vCPU state
Events with the 'vcpu' property are conditionally emitted according to their per-vCPU state. Other events are emitted normally based on their global tracing state. Note that the per-vCPU condition check applies to all tracing backends. Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
parent
4815185902
commit
40b9cd25f7
6 changed files with 57 additions and 29 deletions
|
@ -23,21 +23,36 @@ def generate(events, backend):
|
|||
'#define TRACE__GENERATED_TRACERS_H',
|
||||
'',
|
||||
'#include "qemu-common.h"',
|
||||
'#include "trace/control.h"',
|
||||
'')
|
||||
|
||||
backend.generate_begin(events)
|
||||
|
||||
for e in events:
|
||||
if "vcpu" in e.properties:
|
||||
trace_cpu = next(iter(e.args))[1]
|
||||
cond = "trace_event_get_vcpu_state(%(cpu)s,"\
|
||||
" TRACE_%(id)s,"\
|
||||
" TRACE_VCPU_%(id)s)"\
|
||||
% dict(
|
||||
cpu=trace_cpu,
|
||||
id=e.name.upper())
|
||||
else:
|
||||
cond = "true"
|
||||
|
||||
out('',
|
||||
'static inline void %(api)s(%(args)s)',
|
||||
'{',
|
||||
' if (%(cond)s) {',
|
||||
api=e.api(),
|
||||
args=e.args)
|
||||
args=e.args,
|
||||
cond=cond)
|
||||
|
||||
if "disable" not in e.properties:
|
||||
backend.generate(e)
|
||||
|
||||
out('}')
|
||||
out(' }',
|
||||
'}')
|
||||
|
||||
backend.generate_end(events)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue