Values and locations do not have to be defined at the beginning of the file.
They should however precede any eventHandler related to it.
Change-Id: I27ce894f03b093d180d651a00325608228308273
Signed-off-by: Geneviève Bastien <gbastien+lttng@versatic.net>
Reviewed-on: https://git.eclipse.org/r/64139
Reviewed-by: Hudson CI
Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Tested-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- ***************************************************************************
+* Copyright (c) 2016 École Polytechnique de Montréal
+*
+* All rights reserved. This program and the accompanying materials are
+* made available under the terms of the Eclipse Public License v1.0 which
+* accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/epl-v10.html
+*************************************************************************** -->
+<tmfxml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="xmlDefinition.xsd">
+
+ <stateProvider id="test.element.placement" version="1">
+
+ <location id="CurrentWorker">
+ <stateAttribute type="constant" value="Worker" />
+ <stateAttribute type="eventField" value="workerno" />
+ </location>
+
+ <!-- StateValues -->
+ <definedValue name="WORKING" value="3" />
+ <eventHandler eventName="start">
+ <stateChange>
+ <stateAttribute type="location" value="CurrentWorker" />
+ <stateValue type="int" value="$WORKING" />
+ </stateChange>
+ </eventHandler>
+
+ <definedValue name="NO_FOLLOWING_EVENT_HANDLER" value="5" />
+ <location id="NoFollowingEventHandler">
+ <stateAttribute type="constant" value="Wrong" />
+ <stateAttribute type="eventField" value="place" />
+ </location>
+ </stateProvider>
+</tmfxml>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- ***************************************************************************
+* Copyright (c) 2016 École Polytechnique de Montréal
+*
+* All rights reserved. This program and the accompanying materials are
+* made available under the terms of the Eclipse Public License v1.0 which
+* accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/epl-v10.html
+*************************************************************************** -->
+<tmfxml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="xmlDefinition.xsd">
+
+ <stateProvider id="test.element.placement" version="1">
+
+ <location id="CurrentWorker">
+ <stateAttribute type="constant" value="Worker" />
+ <stateAttribute type="eventField" value="workerno" />
+ </location>
+
+ <!-- StateValues -->
+ <definedValue name="WORKING" value="3" />
+ <eventHandler eventName="start">
+ <stateChange>
+ <stateAttribute type="location" value="CurrentWorker" />
+ <stateValue type="int" value="$WORKING" />
+ </stateChange>
+ </eventHandler>
+
+ <definedValue name="WAIT" value="4" />
+ <eventHandler eventName="wait">
+ <stateChange>
+ <stateAttribute type="location" value="CurrentWorker" />
+ <stateValue type="int" value="$WAIT" />
+ </stateChange>
+ </eventHandler>
+
+ <definedValue name="IDLE" value="5" />
+ <eventHandler eventName="awake">
+ <stateChange>
+ <stateAttribute type="location" value="CurrentWorker" />
+ <stateValue type="int" value="$IDLE" />
+ </stateChange>
+ </eventHandler>
+ </stateProvider>
+</tmfxml>
\ No newline at end of file
<xs:element maxOccurs="1" minOccurs="0" name="head" type="headProvider" >
<xs:annotation>
<xs:documentation>Provide meta-information on this state provider, like labels and applicable trace types.</xs:documentation></xs:annotation></xs:element>
- <xs:element maxOccurs="unbounded" minOccurs="0" name="definedValue" type="definedValue" >
- <xs:annotation>
- <xs:documentation>Define a value that maps a string used in the state provider to a numbered value.</xs:documentation></xs:annotation></xs:element>
- <xs:element maxOccurs="unbounded" minOccurs="0" name="location" type="location" >
- <xs:annotation>
- <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>
- <xs:element maxOccurs="unbounded" minOccurs="1" name="eventHandler" type="eventHandler" >
- <xs:annotation>
- <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>
+ <xs:sequence maxOccurs="unbounded" minOccurs="1">
+ <xs:choice maxOccurs="unbounded" minOccurs="0">
+ <xs:element maxOccurs="unbounded" minOccurs="0" name="definedValue" type="definedValue" >
+ <xs:annotation>
+ <xs:documentation>Define a value that maps a string used in the state provider to a numbered value.</xs:documentation></xs:annotation></xs:element>
+ <xs:element maxOccurs="unbounded" minOccurs="0" name="location" type="location" >
+ <xs:annotation>
+ <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>
+ </xs:choice>
+ <xs:element maxOccurs="unbounded" minOccurs="1" name="eventHandler" type="eventHandler" >
+ <xs:annotation>
+ <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>
+ </xs:sequence>
</xs:sequence>
<xs:attribute name="id" type="xs:string" use="required" >
<xs:annotation>