xref: /openbmc/qemu/qapi/trace.json (revision b6235a75)
1# -*- mode: python -*-
2# vim: filetype=python
3#
4# Copyright (C) 2011-2016 Lluís Vilanova <vilanova@ac.upc.edu>
5#
6# This work is licensed under the terms of the GNU GPL, version 2 or later.
7# See the COPYING file in the top-level directory.
8
9##
10# = Tracing
11##
12
13##
14# @TraceEventState:
15#
16# State of a tracing event.
17#
18# @unavailable: The event is statically disabled.
19#
20# @disabled: The event is dynamically disabled.
21#
22# @enabled: The event is dynamically enabled.
23#
24# Since: 2.2
25##
26{ 'enum': 'TraceEventState',
27  'data': ['unavailable', 'disabled', 'enabled'] }
28
29##
30# @TraceEventInfo:
31#
32# Information of a tracing event.
33#
34# @name: Event name.
35#
36# @state: Tracing state.
37#
38# @vcpu: Whether this is a per-vCPU event (since 2.7).
39#
40# An event is per-vCPU if it has the "vcpu" property in the
41# "trace-events" files.
42#
43# Since: 2.2
44##
45{ 'struct': 'TraceEventInfo',
46  'data': {'name': 'str', 'state': 'TraceEventState', 'vcpu': 'bool'} }
47
48##
49# @trace-event-get-state:
50#
51# Query the state of events.
52#
53# @name: Event name pattern (case-sensitive glob).
54#
55# @vcpu: The vCPU to query (any by default; since 2.7).
56#
57# Returns: a list of @TraceEventInfo for the matching events
58#
59# An event is returned if:
60#
61# - its name matches the @name pattern, and
62# - if @vcpu is given, the event has the "vcpu" property.
63#
64# Therefore, if @vcpu is given, the operation will only match per-vCPU
65# events, returning their state on the specified vCPU. Special case:
66# if @name is an exact match, @vcpu is given and the event does not
67# have the "vcpu" property, an error is returned.
68#
69# Since: 2.2
70#
71# Example:
72#
73# -> { "execute": "trace-event-get-state",
74#      "arguments": { "name": "qemu_memalign" } }
75# <- { "return": [ { "name": "qemu_memalign", "state": "disabled", "vcpu": false } ] }
76##
77{ 'command': 'trace-event-get-state',
78  'data': {'name': 'str', '*vcpu': 'int'},
79  'returns': ['TraceEventInfo'] }
80
81##
82# @trace-event-set-state:
83#
84# Set the dynamic tracing state of events.
85#
86# @name: Event name pattern (case-sensitive glob).
87#
88# @enable: Whether to enable tracing.
89#
90# @ignore-unavailable: Do not match unavailable events with @name.
91#
92# @vcpu: The vCPU to act upon (all by default; since 2.7).
93#
94# An event's state is modified if:
95#
96# - its name matches the @name pattern, and
97# - if @vcpu is given, the event has the "vcpu" property.
98#
99# Therefore, if @vcpu is given, the operation will only match per-vCPU
100# events, setting their state on the specified vCPU. Special case: if
101# @name is an exact match, @vcpu is given and the event does not have
102# the "vcpu" property, an error is returned.
103#
104# Since: 2.2
105#
106# Example:
107#
108# -> { "execute": "trace-event-set-state",
109#      "arguments": { "name": "qemu_memalign", "enable": true } }
110# <- { "return": {} }
111##
112{ 'command': 'trace-event-set-state',
113  'data': {'name': 'str', 'enable': 'bool', '*ignore-unavailable': 'bool',
114           '*vcpu': 'int'} }
115