xml: bug 484257: allow to define values anywhere in the file
[deliverable/tracecompass.git] / tmf / 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<!-- ***************************************************************************
b39b8c5b 3 * Copyright (c) 2014 École Polytechnique de Montréal and others
e11e382c
FW
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>
f91c03f0
GB
23 <xs:sequence maxOccurs="unbounded" minOccurs="1">
24 <xs:choice maxOccurs="unbounded" minOccurs="0">
25 <xs:element maxOccurs="unbounded" minOccurs="0" name="definedValue" type="definedValue" >
26 <xs:annotation>
27 <xs:documentation>Define a value that maps a string used in the state provider to a numbered value.</xs:documentation></xs:annotation></xs:element>
28 <xs:element maxOccurs="unbounded" minOccurs="0" name="location" type="location" >
29 <xs:annotation>
30 <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>
31 </xs:choice>
32 <xs:element maxOccurs="unbounded" minOccurs="1" name="eventHandler" type="eventHandler" >
33 <xs:annotation>
34 <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>
35 </xs:sequence>
e11e382c 36 </xs:sequence>
85aa7575
GB
37 <xs:attribute name="id" type="xs:string" use="required" >
38 <xs:annotation>
39 <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>
40 <xs:attribute name="version" type="xs:integer" use="required" >
41 <xs:annotation>
42 <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
43 </xs:complexType>
44
45 <xs:complexType name="headProvider">
85aa7575
GB
46 <xs:annotation>
47 <xs:documentation>Declares the meta-information that can be defined for an XML state provider.</xs:documentation></xs:annotation>
e11e382c
FW
48 <xs:sequence>
49 <xs:element maxOccurs="unbounded" minOccurs="0" name="traceType">
85aa7575
GB
50 <xs:annotation>
51 <xs:documentation>Indicate that the state provider applies to a given trace type.</xs:documentation></xs:annotation>
e11e382c 52 <xs:complexType>
85aa7575
GB
53 <xs:attribute name="id" use="required" >
54 <xs:annotation>
55 <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
56 </xs:complexType>
57 </xs:element>
58 <xs:element maxOccurs="1" minOccurs="0" name="label">
85aa7575
GB
59 <xs:annotation>
60 <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 61 <xs:complexType>
85aa7575
GB
62 <xs:attribute name="value" >
63 <xs:annotation>
64 <xs:documentation>The text to name this state provider (and the analysis it will generate).</xs:documentation></xs:annotation></xs:attribute>
e11e382c
FW
65 </xs:complexType>
66 </xs:element>
67 </xs:sequence>
68 </xs:complexType>
69
019e49cb 70 <xs:complexType name="eventHandler">
85aa7575
GB
71 <xs:annotation>
72 <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 73 <xs:sequence>
85aa7575
GB
74 <xs:element maxOccurs="unbounded" minOccurs="1" name="stateChange" type="stateChange" >
75 <xs:annotation>
76 <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 77 </xs:sequence>
85aa7575
GB
78 <xs:attribute name="eventName" type="xs:string" use="required" >
79 <xs:annotation>
80 <xs:documentation>Name of the event that causes a state change.</xs:documentation></xs:annotation></xs:attribute>
019e49cb
FW
81 <xs:anyAttribute />
82 </xs:complexType>
83
84 <xs:complexType name="stateChange">
85aa7575
GB
85 <xs:annotation>
86 <xs:documentation>Define a change of state in the state system being built.</xs:documentation></xs:annotation>
019e49cb
FW
87 <xs:choice maxOccurs="1" minOccurs="1">
88 <xs:sequence maxOccurs="1" minOccurs="1">
85aa7575
GB
89 <xs:annotation>
90 <xs:documentation>Describe a single attribute assignation. Simply put: a state change where path/to/attribute=value.</xs:documentation></xs:annotation>
91 <xs:element maxOccurs="unbounded" minOccurs="1" name="stateAttribute" type="stateAttribute" >
92 <xs:annotation>
93 <xs:documentation>Explain how to reach an attribute in the state system. It describes the path/to/attribute.</xs:documentation></xs:annotation></xs:element>
94 <xs:element maxOccurs="1" minOccurs="1" name="stateValue" type="stateValue" >
95 <xs:annotation>
96 <xs:documentation>Explain how to obtain the value of the state attribute to modify.</xs:documentation></xs:annotation></xs:element>
019e49cb
FW
97 </xs:sequence>
98 <xs:sequence maxOccurs="1" minOccurs="1">
85aa7575
GB
99 <xs:annotation>
100 <xs:documentation>Describe a conditional state change, where different path conditions may lead to different state changes.</xs:documentation></xs:annotation>
101 <xs:element maxOccurs="1" minOccurs="1" name="if" type="conditionSingle" >
102 <xs:annotation>
103 <xs:documentation>Define the condition to verify.</xs:documentation></xs:annotation></xs:element>
104 <xs:element maxOccurs="1" minOccurs="1" name="then" type="stateChange" >
105 <xs:annotation>
106 <xs:documentation>Define the state change to use if the previous condition is true.</xs:documentation></xs:annotation></xs:element>
107 <xs:element maxOccurs="1" minOccurs="0" name="else" type="stateChange" >
108 <xs:annotation>
109 <xs:documentation>Optionally define the state change to use if the condition is false.</xs:documentation></xs:annotation></xs:element>
019e49cb
FW
110 </xs:sequence>
111 </xs:choice>
112 </xs:complexType>
113
114 <xs:complexType name="condition">
85aa7575
GB
115 <xs:annotation>
116 <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>
b39b8c5b
JCK
117 <xs:choice>
118 <xs:sequence>
119 <xs:choice maxOccurs="1" minOccurs="1">
120 <xs:element maxOccurs="unbounded" minOccurs="1" name="stateAttribute" type="stateAttribute" >
121 <xs:annotation>
122 <xs:documentation>Compare the current value of an attribute of the state system.</xs:documentation></xs:annotation></xs:element>
123 <xs:element maxOccurs="1" minOccurs="1" name="field" type="eventField" >
124 <xs:annotation>
125 <xs:documentation>Compare the value of an event field.</xs:documentation></xs:annotation></xs:element>
126 </xs:choice>
127 <xs:element maxOccurs="1" minOccurs="1" name="stateValue" type="stateValue" >
85aa7575 128 <xs:annotation>
b39b8c5b
JCK
129 <xs:documentation>Define the value to compare to.</xs:documentation></xs:annotation></xs:element>
130 </xs:sequence>
131 <xs:sequence>
132 <xs:element maxOccurs="2" minOccurs="2" name="stateValue" type="stateValue"/>
133 </xs:sequence>
134 </xs:choice>
5ddeee68
NE
135
136 <xs:attribute name="operator" default="eq">
137 <xs:annotation>
138 <xs:documentation>Indicate that a comparison operation will be performed with the value</xs:documentation></xs:annotation>
139 <xs:simpleType>
140 <xs:restriction base="xs:string">
141 <xs:enumeration value="eq">
142 <xs:annotation>
143 <xs:documentation>The operation type is to check if two values are equal</xs:documentation></xs:annotation></xs:enumeration>
144 <xs:enumeration value="ne">
145 <xs:annotation>
146 <xs:documentation>The operation type is to check if two values are not equal</xs:documentation></xs:annotation></xs:enumeration>
147 <xs:enumeration value="ge">
148 <xs:annotation>
149 <xs:documentation>The operation type is to check if the first value is greater than or equal the second one</xs:documentation></xs:annotation></xs:enumeration>
150 <xs:enumeration value="gt">
151 <xs:annotation>
152 <xs:documentation>The operation type is to check if the first value is greater than the second one</xs:documentation></xs:annotation></xs:enumeration>
153 <xs:enumeration value="le">
154 <xs:annotation>
155 <xs:documentation>The operation type is to check if the first value is smaller than or equal the second one</xs:documentation></xs:annotation></xs:enumeration>
156 <xs:enumeration value="lt">
157 <xs:annotation>
158 <xs:documentation>The operation type is to check if the first value is smaller than the second one</xs:documentation></xs:annotation></xs:enumeration>
159 </xs:restriction>
160 </xs:simpleType>
161 </xs:attribute>
162
019e49cb
FW
163 </xs:complexType>
164
165 <xs:complexType name="conditionSingle">
85aa7575
GB
166 <xs:annotation>
167 <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 168 <xs:choice maxOccurs="1" minOccurs="1">
85aa7575
GB
169 <xs:element name="condition" type="condition" >
170 <xs:annotation>
171 <xs:documentation>Define a condition element, in the form "if (some_path == value)".</xs:documentation></xs:annotation></xs:element>
172 <xs:element name="not" type="conditionSingle" >
173 <xs:annotation>
174 <xs:documentation>Negate the result of the following condition, allowing statements of the form "if (!cond)".</xs:documentation></xs:annotation></xs:element>
175 <xs:element name="and" type="conditionMultiple" >
176 <xs:annotation>
177 <xs:documentation>ANDs 2 conditional statements, allowing statements of the form "if (condA AND condB)"</xs:documentation></xs:annotation></xs:element>
178 <xs:element name="or" type="conditionMultiple" >
179 <xs:annotation>
180 <xs:documentation>ORs 2 conditional statements, allowing statements of the form "if (condA OR condB)"</xs:documentation></xs:annotation></xs:element>
019e49cb
FW
181 </xs:choice>
182 <xs:anyAttribute />
183 </xs:complexType>
184
185 <xs:complexType name="conditionMultiple">
85aa7575
GB
186 <xs:annotation>
187 <xs:documentation>Allows the composition of more than one conditional statements.</xs:documentation></xs:annotation>
019e49cb 188 <xs:sequence maxOccurs="unbounded" minOccurs="1">
85aa7575
GB
189 <xs:element maxOccurs="1" minOccurs="0" name="condition" type="condition" >
190 <xs:annotation>
191 <xs:documentation>Define a condition element, in the form "if (some_path == value)".</xs:documentation></xs:annotation></xs:element>
192 <xs:element maxOccurs="1" minOccurs="0" name="or" type="conditionMultiple" >
193 <xs:annotation>
194 <xs:documentation>ORs 2 conditional statements, allowing statements of the form "if (condA OR condB)"</xs:documentation></xs:annotation></xs:element>
195 <xs:element maxOccurs="1" minOccurs="0" name="and" type="conditionMultiple" >
196 <xs:annotation>
197 <xs:documentation>ANDs 2 conditional statements, allowing statements of the form "if (condA AND condB)"</xs:documentation></xs:annotation></xs:element>
198 <xs:element maxOccurs="1" minOccurs="0" name="not" type="conditionSingle" >
199 <xs:annotation>
200 <xs:documentation>Negate the result of the following condition, allowing statements of the form "if (!cond)".</xs:documentation></xs:annotation></xs:element>
019e49cb
FW
201 </xs:sequence>
202 <xs:anyAttribute />
203 </xs:complexType>
204
205 <xs:complexType name="stateAttribute">
85aa7575
GB
206 <xs:annotation>
207 <xs:documentation>Define a path to an attribute of the state system.</xs:documentation></xs:annotation>
019e49cb 208 <xs:sequence>
85aa7575
GB
209 <xs:element maxOccurs="unbounded" minOccurs="0" name="stateAttribute" type="stateAttribute" >
210 <xs:annotation>
211 <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
212 </xs:sequence>
213 <xs:attribute name="type" use="required">
85aa7575
GB
214 <xs:annotation>
215 <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
216 <xs:simpleType>
217 <xs:restriction base="xs:string">
85aa7575
GB
218 <xs:enumeration value="null" >
219 <xs:annotation>
220 <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>
221 <xs:enumeration value="constant" >
222 <xs:annotation>
223 <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>
224 <xs:enumeration value="eventField" >
225 <xs:annotation>
226 <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>
597168fc
NE
227 <xs:enumeration value="eventName" >
228 <xs:annotation>
229 <xs:documentation>This type identifies the attribute as the name of an event.</xs:documentation></xs:annotation></xs:enumeration>
85aa7575
GB
230 <xs:enumeration value="location" >
231 <xs:annotation>
232 <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>
233 <xs:enumeration value="query" >
234 <xs:annotation>
235 <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
236 </xs:restriction>
237 </xs:simpleType>
238 </xs:attribute>
85aa7575
GB
239 <xs:attribute name="value" type="xs:string" >
240 <xs:annotation>
241 <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
242 </xs:complexType>
243
244 <xs:complexType name="stateValue">
85aa7575
GB
245 <xs:annotation>
246 <xs:documentation>Define a value, that can be assigned to an attribute of the state system.</xs:documentation></xs:annotation>
019e49cb 247 <xs:sequence>
85aa7575
GB
248 <xs:annotation>
249 <xs:documentation>For a "query" value type, a sequence of stateAttributes will define the query whose result is the value.</xs:documentation></xs:annotation>
250 <xs:element maxOccurs="unbounded" minOccurs="0" name="stateAttribute" type="stateAttribute" ></xs:element>
019e49cb
FW
251 </xs:sequence>
252 <xs:attribute name="type" use="required">
85aa7575
GB
253 <xs:annotation>
254 <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
255 <xs:simpleType>
256 <xs:restriction base="xs:string">
85aa7575
GB
257 <xs:enumeration value="null" >
258 <xs:annotation>
259 <xs:documentation>Indicate that the value is a null value.</xs:documentation></xs:annotation></xs:enumeration>
260 <xs:enumeration value="int" >
261 <xs:annotation>
262 <xs:documentation>The value is a constant of type integer.</xs:documentation></xs:annotation></xs:enumeration>
263 <xs:enumeration value="long" >
264 <xs:annotation>
265 <xs:documentation>The value is a constant of type long</xs:documentation></xs:annotation></xs:enumeration>
266 <xs:enumeration value="string" >
267 <xs:annotation>
268 <xs:documentation>The value is a constant of type string</xs:documentation></xs:annotation></xs:enumeration>
269 <xs:enumeration value="eventField" >
270 <xs:annotation>
271 <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>
272 <xs:enumeration value="eventName" >
273 <xs:annotation>
274 <xs:documentation>The value is the name of the event.</xs:documentation></xs:annotation></xs:enumeration>
275 <xs:enumeration value="delete" >
276 <xs:annotation>
277 <xs:documentation>Indicate that the attribute the value is to be applied to should be deleted.</xs:documentation></xs:annotation></xs:enumeration>
278 <xs:enumeration value="query" >
279 <xs:annotation>
280 <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
281 </xs:restriction>
282 </xs:simpleType>
283 </xs:attribute>
85aa7575
GB
284 <xs:attribute name="increment" type="xs:boolean" >
285 <xs:annotation>
286 <xs:documentation>Indicate that the current value will be added to any previously available value.</xs:documentation></xs:annotation></xs:attribute>
019e49cb 287 <xs:attribute name="stack">
85aa7575
GB
288 <xs:annotation>
289 <xs:documentation>Indicate that a stack operation will be performed with the value</xs:documentation></xs:annotation>
019e49cb
FW
290 <xs:simpleType>
291 <xs:restriction base="xs:string">
85aa7575
GB
292 <xs:enumeration value="pop">
293 <xs:annotation>
294 <xs:documentation>The value will be popped from the stack</xs:documentation></xs:annotation></xs:enumeration>
295 <xs:enumeration value="push">
296 <xs:annotation>
297 <xs:documentation>The value will be pushed on a stack</xs:documentation></xs:annotation></xs:enumeration>
298 <xs:enumeration value="peek">
299 <xs:annotation>
300 <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
301 </xs:restriction>
302 </xs:simpleType>
303 </xs:attribute>
304 <xs:attribute name="forcedType">
85aa7575
GB
305 <xs:annotation>
306 <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
307 <xs:simpleType>
308 <xs:restriction base="xs:string">
85aa7575
GB
309 <xs:enumeration value="int" >
310 <xs:annotation>
311 <xs:documentation>The value should be an integer</xs:documentation></xs:annotation></xs:enumeration>
312 <xs:enumeration value="long" >
313 <xs:annotation>
314 <xs:documentation>The value should be a long</xs:documentation></xs:annotation></xs:enumeration>
315 <xs:enumeration value="string" >
316 <xs:annotation>
317 <xs:documentation>The value should be a double</xs:documentation></xs:annotation></xs:enumeration>
019e49cb
FW
318 </xs:restriction>
319 </xs:simpleType>
320 </xs:attribute>
85aa7575
GB
321 <xs:attribute name="value" type="xs:string" >
322 <xs:annotation>
323 <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
324 </xs:complexType>
325
326 <xs:complexType name="eventField">
85aa7575
GB
327 <xs:annotation>
328 <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>
329 <xs:attribute name="name" type="xs:string" use="required" >
330 <xs:annotation>
331 <xs:documentation>Indicate which field to use.</xs:documentation></xs:annotation></xs:attribute>
019e49cb
FW
332 </xs:complexType>
333
85aa7575 334</xs:schema>
This page took 0.093742 seconds and 5 git commands to generate.