tmf: Extract a method so that the manifest can be embedded in other xml files
[deliverable/tracecompass.git] / org.eclipse.tracecompass.tmf.analysis.xml.core / src / org / eclipse / tracecompass / tmf / analysis / xml / core / module / xmlStateProvider.xsd
CommitLineData
e11e382c
FW
1<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2<!-- ***************************************************************************
3 * Copyright (c) 2014 École Polytechnique de Montréal
4 *
5 * All rights reserved. This program and the accompanying materials are
6 * made available under the terms of the Eclipse Public License v1.0 which
7 * accompanies this distribution, and is available at
8 * http://www.eclipse.org/legal/epl-v10.html
9 *
10 * Contributors:
11 * Florian Wininger - Initial API and implementation
12 *************************************************************************** -->
13<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
14 attributeFormDefault="unqualified" elementFormDefault="qualified">
15
e11e382c 16 <xs:complexType name="stateProvider">
85aa7575
GB
17 <xs:annotation>
18 <xs:documentation>Declares a data-driven state provider which defines how events change the state of attributes of the system. Each state provider defined in XML will become an analysis in TMF.</xs:documentation></xs:annotation>
e11e382c 19 <xs:sequence maxOccurs="1" minOccurs="1">
85aa7575
GB
20 <xs:element maxOccurs="1" minOccurs="0" name="head" type="headProvider" >
21 <xs:annotation>
22 <xs:documentation>Provide meta-information on this state provider, like labels and applicable trace types.</xs:documentation></xs:annotation></xs:element>
23 <xs:element maxOccurs="unbounded" minOccurs="0" name="definedValue" type="definedValue" >
24 <xs:annotation>
25 <xs:documentation>Define a value that maps a string used in the state provider to a numbered value.</xs:documentation></xs:annotation></xs:element>
26 <xs:element maxOccurs="unbounded" minOccurs="0" name="location" type="location" >
27 <xs:annotation>
28 <xs:documentation>Declare shortcuts to frequently used attribute/data locations. For instance, if a path to an often-used attribute is CPUs/{event.some_field}/Threads/Status, it may be a good idea to put this path in a location and then use the location name in the event handlers.</xs:documentation></xs:annotation></xs:element>
29 <xs:element maxOccurs="unbounded" minOccurs="1" name="eventHandler" type="eventHandler" >
30 <xs:annotation>
31 <xs:documentation>Define how a given event will modify the state system being built. For each event in the trace that causes a state change, a event handler should be defined.</xs:documentation></xs:annotation></xs:element>
e11e382c 32 </xs:sequence>
85aa7575
GB
33 <xs:attribute name="id" type="xs:string" use="required" >
34 <xs:annotation>
35 <xs:documentation>The unique ID of this state provider. It will be used to identify the analysis that will be built from this state provider.</xs:documentation></xs:annotation></xs:attribute>
36 <xs:attribute name="version" type="xs:integer" use="required" >
37 <xs:annotation>
38 <xs:documentation>The version ID of this state provider. Whenever the state provider changes so that the resulting state system is different from previous versions, this version number should be bumped.</xs:documentation></xs:annotation></xs:attribute>
e11e382c
FW
39 </xs:complexType>
40
41 <xs:complexType name="headProvider">
85aa7575
GB
42 <xs:annotation>
43 <xs:documentation>Declares the meta-information that can be defined for an XML state provider.</xs:documentation></xs:annotation>
e11e382c
FW
44 <xs:sequence>
45 <xs:element maxOccurs="unbounded" minOccurs="0" name="traceType">
85aa7575
GB
46 <xs:annotation>
47 <xs:documentation>Indicate that the state provider applies to a given trace type.</xs:documentation></xs:annotation>
e11e382c 48 <xs:complexType>
85aa7575
GB
49 <xs:attribute name="id" use="required" >
50 <xs:annotation>
51 <xs:documentation>The ID of the trace type, as declared in a org.eclipse.linuxtools.tmf.core.tracetype extension point or a custom trace parser. For example: "org.eclipse.linuxtools.lttng2.kernel.tracetype" or "org.eclipse.linuxtools.lttng2.ust.tracetype" for respectively LTTng Kernel and LTTng UST traces.</xs:documentation></xs:annotation></xs:attribute>
e11e382c
FW
52 </xs:complexType>
53 </xs:element>
54 <xs:element maxOccurs="1" minOccurs="0" name="label">
85aa7575
GB
55 <xs:annotation>
56 <xs:documentation>Add a label to the state provider. If provided, this text will be the name of the analysis that the user will see in TMF.</xs:documentation></xs:annotation>
e11e382c 57 <xs:complexType>
85aa7575
GB
58 <xs:attribute name="value" >
59 <xs:annotation>
60 <xs:documentation>The text to name this state provider (and the analysis it will generate).</xs:documentation></xs:annotation></xs:attribute>
e11e382c
FW
61 </xs:complexType>
62 </xs:element>
63 </xs:sequence>
64 </xs:complexType>
65
019e49cb 66 <xs:complexType name="eventHandler">
85aa7575
GB
67 <xs:annotation>
68 <xs:documentation>Define how an event modifies the state of the system. There should be one event handler for each event causing a state change.</xs:documentation></xs:annotation>
019e49cb 69 <xs:sequence>
85aa7575
GB
70 <xs:element maxOccurs="unbounded" minOccurs="1" name="stateChange" type="stateChange" >
71 <xs:annotation>
72 <xs:documentation>Define how the state system is modified by the event. An event may cause more than one state change.</xs:documentation></xs:annotation></xs:element>
019e49cb 73 </xs:sequence>
85aa7575
GB
74 <xs:attribute name="eventName" type="xs:string" use="required" >
75 <xs:annotation>
76 <xs:documentation>Name of the event that causes a state change.</xs:documentation></xs:annotation></xs:attribute>
019e49cb
FW
77 <xs:anyAttribute />
78 </xs:complexType>
79
80 <xs:complexType name="stateChange">
85aa7575
GB
81 <xs:annotation>
82 <xs:documentation>Define a change of state in the state system being built.</xs:documentation></xs:annotation>
019e49cb
FW
83 <xs:choice maxOccurs="1" minOccurs="1">
84 <xs:sequence maxOccurs="1" minOccurs="1">
85aa7575
GB
85 <xs:annotation>
86 <xs:documentation>Describe a single attribute assignation. Simply put: a state change where path/to/attribute=value.</xs:documentation></xs:annotation>
87 <xs:element maxOccurs="unbounded" minOccurs="1" name="stateAttribute" type="stateAttribute" >
88 <xs:annotation>
89 <xs:documentation>Explain how to reach an attribute in the state system. It describes the path/to/attribute.</xs:documentation></xs:annotation></xs:element>
90 <xs:element maxOccurs="1" minOccurs="1" name="stateValue" type="stateValue" >
91 <xs:annotation>
92 <xs:documentation>Explain how to obtain the value of the state attribute to modify.</xs:documentation></xs:annotation></xs:element>
019e49cb
FW
93 </xs:sequence>
94 <xs:sequence maxOccurs="1" minOccurs="1">
85aa7575
GB
95 <xs:annotation>
96 <xs:documentation>Describe a conditional state change, where different path conditions may lead to different state changes.</xs:documentation></xs:annotation>
97 <xs:element maxOccurs="1" minOccurs="1" name="if" type="conditionSingle" >
98 <xs:annotation>
99 <xs:documentation>Define the condition to verify.</xs:documentation></xs:annotation></xs:element>
100 <xs:element maxOccurs="1" minOccurs="1" name="then" type="stateChange" >
101 <xs:annotation>
102 <xs:documentation>Define the state change to use if the previous condition is true.</xs:documentation></xs:annotation></xs:element>
103 <xs:element maxOccurs="1" minOccurs="0" name="else" type="stateChange" >
104 <xs:annotation>
105 <xs:documentation>Optionally define the state change to use if the condition is false.</xs:documentation></xs:annotation></xs:element>
019e49cb
FW
106 </xs:sequence>
107 </xs:choice>
108 </xs:complexType>
109
110 <xs:complexType name="condition">
85aa7575
GB
111 <xs:annotation>
112 <xs:documentation>Define a conditional statement. Conditions may use values of the state system or from the event being handled. This element defines a statement in the form of "if (some_path == value)".</xs:documentation></xs:annotation>
019e49cb
FW
113 <xs:sequence maxOccurs="1" minOccurs="1">
114 <xs:choice maxOccurs="1" minOccurs="1">
85aa7575
GB
115 <xs:element maxOccurs="unbounded" minOccurs="1" name="stateAttribute" type="stateAttribute" >
116 <xs:annotation>
117 <xs:documentation>Compare the current value of an attribute of the state system.</xs:documentation></xs:annotation></xs:element>
118 <xs:element maxOccurs="1" minOccurs="1" name="field" type="eventField" >
119 <xs:annotation>
120 <xs:documentation>Compare the value of an event field.</xs:documentation></xs:annotation></xs:element>
019e49cb 121 </xs:choice>
85aa7575
GB
122 <xs:element maxOccurs="1" minOccurs="1" name="stateValue" type="stateValue" >
123 <xs:annotation>
124 <xs:documentation>Define the value to compare to.</xs:documentation></xs:annotation></xs:element>
019e49cb
FW
125 </xs:sequence>
126 <xs:anyAttribute />
127 </xs:complexType>
128
129 <xs:complexType name="conditionSingle">
85aa7575
GB
130 <xs:annotation>
131 <xs:documentation>Define a conditional statement with only one child. From this element, a condition may be composed of other conditional elements to create more complex conditional statements.</xs:documentation></xs:annotation>
019e49cb 132 <xs:choice maxOccurs="1" minOccurs="1">
85aa7575
GB
133 <xs:element name="condition" type="condition" >
134 <xs:annotation>
135 <xs:documentation>Define a condition element, in the form "if (some_path == value)".</xs:documentation></xs:annotation></xs:element>
136 <xs:element name="not" type="conditionSingle" >
137 <xs:annotation>
138 <xs:documentation>Negate the result of the following condition, allowing statements of the form "if (!cond)".</xs:documentation></xs:annotation></xs:element>
139 <xs:element name="and" type="conditionMultiple" >
140 <xs:annotation>
141 <xs:documentation>ANDs 2 conditional statements, allowing statements of the form "if (condA AND condB)"</xs:documentation></xs:annotation></xs:element>
142 <xs:element name="or" type="conditionMultiple" >
143 <xs:annotation>
144 <xs:documentation>ORs 2 conditional statements, allowing statements of the form "if (condA OR condB)"</xs:documentation></xs:annotation></xs:element>
019e49cb
FW
145 </xs:choice>
146 <xs:anyAttribute />
147 </xs:complexType>
148
149 <xs:complexType name="conditionMultiple">
85aa7575
GB
150 <xs:annotation>
151 <xs:documentation>Allows the composition of more than one conditional statements.</xs:documentation></xs:annotation>
019e49cb 152 <xs:sequence maxOccurs="unbounded" minOccurs="1">
85aa7575
GB
153 <xs:element maxOccurs="1" minOccurs="0" name="condition" type="condition" >
154 <xs:annotation>
155 <xs:documentation>Define a condition element, in the form "if (some_path == value)".</xs:documentation></xs:annotation></xs:element>
156 <xs:element maxOccurs="1" minOccurs="0" name="or" type="conditionMultiple" >
157 <xs:annotation>
158 <xs:documentation>ORs 2 conditional statements, allowing statements of the form "if (condA OR condB)"</xs:documentation></xs:annotation></xs:element>
159 <xs:element maxOccurs="1" minOccurs="0" name="and" type="conditionMultiple" >
160 <xs:annotation>
161 <xs:documentation>ANDs 2 conditional statements, allowing statements of the form "if (condA AND condB)"</xs:documentation></xs:annotation></xs:element>
162 <xs:element maxOccurs="1" minOccurs="0" name="not" type="conditionSingle" >
163 <xs:annotation>
164 <xs:documentation>Negate the result of the following condition, allowing statements of the form "if (!cond)".</xs:documentation></xs:annotation></xs:element>
019e49cb
FW
165 </xs:sequence>
166 <xs:anyAttribute />
167 </xs:complexType>
168
169 <xs:complexType name="stateAttribute">
85aa7575
GB
170 <xs:annotation>
171 <xs:documentation>Define a path to an attribute of the state system.</xs:documentation></xs:annotation>
019e49cb 172 <xs:sequence>
85aa7575
GB
173 <xs:element maxOccurs="unbounded" minOccurs="0" name="stateAttribute" type="stateAttribute" >
174 <xs:annotation>
175 <xs:documentation>If the type is a "query", those stateAttribute elements describe the elements of the query.</xs:documentation></xs:annotation></xs:element>
019e49cb
FW
176 </xs:sequence>
177 <xs:attribute name="type" use="required">
85aa7575
GB
178 <xs:annotation>
179 <xs:documentation>The type of path to this attribute. The meaning of those paths type will depend on the context where the stateAttribute is being used. Not all types will make sense everywhere.</xs:documentation></xs:annotation>
019e49cb
FW
180 <xs:simpleType>
181 <xs:restriction base="xs:string">
85aa7575
GB
182 <xs:enumeration value="null" >
183 <xs:annotation>
184 <xs:documentation>This type does not change the current attribute. Whatever attribute was the reference attribute at a given time, it will be returned as is.</xs:documentation></xs:annotation></xs:enumeration>
185 <xs:enumeration value="constant" >
186 <xs:annotation>
187 <xs:documentation>This type identifies the state system attribute by a constant string. For instance, if the first level attribute of the state system is "Threads", then a constant type with "Threads" value should be used.</xs:documentation></xs:annotation></xs:enumeration>
188 <xs:enumeration value="eventField" >
189 <xs:annotation>
190 <xs:documentation>This type identifies the attribute by the value of an event field. Note that the event field corresponds to the attribute name, not its value. For example, if the event has a field called "current_cpu" with a value of "2", "2" would be the attribute name we want.</xs:documentation></xs:annotation></xs:enumeration>
191 <xs:enumeration value="location" >
192 <xs:annotation>
193 <xs:documentation>This type indicates that the path to the attribute is at the specified location. Location simply avoids having to write full path to an attribute each time it is being used, but the location itself is a sequence of stateAttribute elements. For example, if we previously defined a location named "CurrentThead" for path "CPUs/{current_cpu}/CurrentThread", we can use a stateAttribute of type location with "CurrentThread" value.</xs:documentation></xs:annotation></xs:enumeration>
194 <xs:enumeration value="query" >
195 <xs:annotation>
196 <xs:documentation>This type indicates that the path to the attribute is the result of a query. If this type is selected, a sequence of stateAttribute elements needs to be specified for this state attribute. The result of the query is the attribute name of the current element. For example, if the attribute we want is the PID of the current process on CPU 0, that PID can be found through the query "CPUs/0/CurrentThread". The value of this attribute would be, for example, 1234, the attribute we are looking for.</xs:documentation></xs:annotation></xs:enumeration>
019e49cb
FW
197 </xs:restriction>
198 </xs:simpleType>
199 </xs:attribute>
85aa7575
GB
200 <xs:attribute name="value" type="xs:string" >
201 <xs:annotation>
202 <xs:documentation>The value of this state attribute. A value should be specified only if the type is "constant", "eventField" or "location".</xs:documentation></xs:annotation></xs:attribute>
019e49cb
FW
203 </xs:complexType>
204
205 <xs:complexType name="stateValue">
85aa7575
GB
206 <xs:annotation>
207 <xs:documentation>Define a value, that can be assigned to an attribute of the state system.</xs:documentation></xs:annotation>
019e49cb 208 <xs:sequence>
85aa7575
GB
209 <xs:annotation>
210 <xs:documentation>For a "query" value type, a sequence of stateAttributes will define the query whose result is the value.</xs:documentation></xs:annotation>
211 <xs:element maxOccurs="unbounded" minOccurs="0" name="stateAttribute" type="stateAttribute" ></xs:element>
019e49cb
FW
212 </xs:sequence>
213 <xs:attribute name="type" use="required">
85aa7575
GB
214 <xs:annotation>
215 <xs:documentation>The type of this state value. It will describe how to obtain to value and/or what to do with it.</xs:documentation></xs:annotation>
019e49cb
FW
216 <xs:simpleType>
217 <xs:restriction base="xs:string">
85aa7575
GB
218 <xs:enumeration value="null" >
219 <xs:annotation>
220 <xs:documentation>Indicate that the value is a null value.</xs:documentation></xs:annotation></xs:enumeration>
221 <xs:enumeration value="int" >
222 <xs:annotation>
223 <xs:documentation>The value is a constant of type integer.</xs:documentation></xs:annotation></xs:enumeration>
224 <xs:enumeration value="long" >
225 <xs:annotation>
226 <xs:documentation>The value is a constant of type long</xs:documentation></xs:annotation></xs:enumeration>
227 <xs:enumeration value="string" >
228 <xs:annotation>
229 <xs:documentation>The value is a constant of type string</xs:documentation></xs:annotation></xs:enumeration>
230 <xs:enumeration value="eventField" >
231 <xs:annotation>
232 <xs:documentation>The value is the content of an event field. The "value" attribute is the field name. To convert this field to a certain type, attribute "forcedType" may be used.</xs:documentation></xs:annotation></xs:enumeration>
233 <xs:enumeration value="eventName" >
234 <xs:annotation>
235 <xs:documentation>The value is the name of the event.</xs:documentation></xs:annotation></xs:enumeration>
236 <xs:enumeration value="delete" >
237 <xs:annotation>
238 <xs:documentation>Indicate that the attribute the value is to be applied to should be deleted.</xs:documentation></xs:annotation></xs:enumeration>
239 <xs:enumeration value="query" >
240 <xs:annotation>
241 <xs:documentation>The value is the result of a query to the state system. If this type is selected, a sequence of stateAttributes must be defined in this stateValue element.</xs:documentation></xs:annotation></xs:enumeration>
019e49cb
FW
242 </xs:restriction>
243 </xs:simpleType>
244 </xs:attribute>
85aa7575
GB
245 <xs:attribute name="increment" type="xs:boolean" >
246 <xs:annotation>
247 <xs:documentation>Indicate that the current value will be added to any previously available value.</xs:documentation></xs:annotation></xs:attribute>
019e49cb 248 <xs:attribute name="stack">
85aa7575
GB
249 <xs:annotation>
250 <xs:documentation>Indicate that a stack operation will be performed with the value</xs:documentation></xs:annotation>
019e49cb
FW
251 <xs:simpleType>
252 <xs:restriction base="xs:string">
85aa7575
GB
253 <xs:enumeration value="pop">
254 <xs:annotation>
255 <xs:documentation>The value will be popped from the stack</xs:documentation></xs:annotation></xs:enumeration>
256 <xs:enumeration value="push">
257 <xs:annotation>
258 <xs:documentation>The value will be pushed on a stack</xs:documentation></xs:annotation></xs:enumeration>
259 <xs:enumeration value="peek">
260 <xs:annotation>
261 <xs:documentation>The value will be peeked from the top of the stack, but it will stay there</xs:documentation></xs:annotation></xs:enumeration>
019e49cb
FW
262 </xs:restriction>
263 </xs:simpleType>
264 </xs:attribute>
265 <xs:attribute name="forcedType">
85aa7575
GB
266 <xs:annotation>
267 <xs:documentation>Indicate the desired type for the state value. If the value is not already of this type, a conversion will be attempted. The forcedType is used to convert values of event fields.</xs:documentation></xs:annotation>
019e49cb
FW
268 <xs:simpleType>
269 <xs:restriction base="xs:string">
85aa7575
GB
270 <xs:enumeration value="int" >
271 <xs:annotation>
272 <xs:documentation>The value should be an integer</xs:documentation></xs:annotation></xs:enumeration>
273 <xs:enumeration value="long" >
274 <xs:annotation>
275 <xs:documentation>The value should be a long</xs:documentation></xs:annotation></xs:enumeration>
276 <xs:enumeration value="string" >
277 <xs:annotation>
278 <xs:documentation>The value should be a double</xs:documentation></xs:annotation></xs:enumeration>
019e49cb
FW
279 </xs:restriction>
280 </xs:simpleType>
281 </xs:attribute>
85aa7575
GB
282 <xs:attribute name="value" type="xs:string" >
283 <xs:annotation>
284 <xs:documentation>Indicate what the value is. A value should be specified only if the type is int, long, string or event_field. See the documentation on types for information on what to put for value.</xs:documentation></xs:annotation></xs:attribute>
019e49cb
FW
285 </xs:complexType>
286
287 <xs:complexType name="eventField">
85aa7575
GB
288 <xs:annotation>
289 <xs:documentation>This element is used in conditions where the value of an event field is compared to something else. It is not the same as the stateAttribute's type eventField, where the eventField is used as the name for an attribute to the state system.</xs:documentation></xs:annotation>
290 <xs:attribute name="name" type="xs:string" use="required" >
291 <xs:annotation>
292 <xs:documentation>Indicate which field to use.</xs:documentation></xs:annotation></xs:attribute>
019e49cb
FW
293 </xs:complexType>
294
85aa7575 295</xs:schema>
This page took 0.055312 seconds and 5 git commands to generate.