90700c69faff5a302218048b36d0616e91162133
[deliverable/tracecompass.git] / tmf / org.eclipse.tracecompass.tmf.analysis.xml.core.tests / test_xml_files / test_valid / test_valid_pattern.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <tmfxml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3 xsi:noNamespaceSchemaLocation="xmlDefinition.xsd">
4 <!-- ***************************************************************************
5 * Copyright (c) 2016 Ericsson
6 *
7 * All rights reserved. This program and the accompanying materials are
8 * made available under the terms of the Eclipse Public License v1.0 which
9 * accompanies this distribution, and is available at
10 * http://www.eclipse.org/legal/epl-v10.html
11 *************************************************************************** -->
12 <pattern version="0" id="xml syscall abstraction provider">
13 <head>
14 <traceType id="org.eclipse.linuxtools.lttng2.kernel.tracetype" />
15 <label value="xml syscall abstraction provider" />
16 </head>
17
18 <!-- STORED FIELDS -->
19
20 <storedField id="filename"/>
21 <storedField id="fd"/>
22 <storedField id="ret" alias="ret"/>
23 <storedField id="flags" alias="flags"/>
24 <storedField id="offset" alias="offset"/>
25 <storedField id="fd_in" alias="fd_in"/>
26 <storedField id="fd_out" alias="fd_out"/>
27 <storedField id="uservaddr" alias="uservaddr"/>
28 <storedField id="upeer_sockaddr" alias="upeer_sockaddr"/>
29
30 <!-- SHORTCUTS -->
31
32 <!-- Shorcut for the current running thread attribute -->
33 <location id="CurrentThread">
34 <stateAttribute type="constant" value="Threads" />
35 <stateAttribute type="query">
36 <stateAttribute type="constant" value="CPUs" />
37 <stateAttribute type="eventField" value="cpu" />
38 <stateAttribute type="constant" value="Current_thread" />
39 </stateAttribute>
40 </location>
41 <!-- Shorcut for the current CPU attribute -->
42 <location id="CurrentCPU">
43 <stateAttribute type="constant" value="CPUs" />
44 <stateAttribute type="eventField" value="cpu" />
45 </location>
46
47 <!-- The attribute initial specifies the FSMs that will be instanciated at the beginning of the analysis -->
48 <patternHandler initial="sched_switch:syscall">
49
50 <!-- CONDITIONS -->
51
52 <!-- This condition check if the current running thread PID is 1311 -->
53 <test id="tid_8998">
54 <if>
55 <condition>
56 <stateValue type="query">
57 <stateAttribute type="location" value="CurrentCPU" />
58 <stateAttribute type="constant" value="Current_thread" />
59 </stateValue>
60 <stateValue type="long" value="8998" />
61 </condition>
62 </if>
63 </test>
64 <!-- Test this : if ( !(1 ns < ts < 3 ns) || ((ts -state.syscall_entry_x.ts) < 3 ns) ) -->
65 <test id="time_condition">
66 <if>
67 <or>
68 <not>
69 <condition>
70 <timerange unit="ns">
71 <in begin="1" end="3" />
72 </timerange>
73 </condition>
74 </not>
75 <condition>
76 <elapsedTime unit="ns">
77 <less since="syscall_entry_x" value="3" />
78 </elapsedTime>
79 </condition>
80 </or>
81 </if>
82 </test>
83 <!-- Test if the current running thread PID is equal to the current scenario thread -->
84 <test id="thread_thread">
85 <if>
86 <condition>
87 <stateValue type="query" >
88 <stateAttribute type="location" value="CurrentCPU" />
89 <stateAttribute type="constant" value="Current_thread" />
90 </stateValue>
91 <stateValue type="query">
92 <stateAttribute type="constant" value="#CurrentScenario" />
93 <stateAttribute type="constant" value="thread" />
94 </stateValue>
95 </condition>
96 </if>
97 </test>
98
99 <!-- ACTIONS -->
100
101 <!-- Generates three state changes in the state system -->
102 <action id="sys_x_founded">
103 <!-- Save the name of the system call executed under the current scenario path-->
104 <stateChange>
105 <stateAttribute type="constant" value="#CurrentScenario" />
106 <stateAttribute type="constant" value="syscall" />
107 <stateAttribute type="constant" value="name" />
108 <stateValue type="eventName"/>
109 </stateChange>
110 <!-- Save the value of the CPU under the current scenario path -->
111 <stateChange>
112 <stateAttribute type="constant" value="#CurrentScenario" />
113 <stateAttribute type="constant" value="cpu" />
114 <stateValue type="eventField" value="cpu"/>
115 </stateChange>
116 <!-- Save the value of the current thread PID under the current scenario path -->
117 <stateChange>
118 <stateAttribute type="constant" value="#CurrentScenario" />
119 <stateAttribute type="constant" value="thread" />
120 <stateValue type="query">
121 <stateAttribute type="location" value="CurrentCPU" />
122 <stateAttribute type="constant" value="Current_thread" />
123 </stateValue>
124 </stateChange>
125 </action>
126
127 <!-- Generate a pattern segment -->
128 <action id="exit_syscall_founded">
129 <!-- Generate a pattern segment with the name of the system call of the current scenario-->
130 <segment>
131 <segType>
132 <segName>
133 <stateValue type="query">
134 <stateAttribute type="constant" value="#CurrentScenario" />
135 <stateAttribute type="constant" value="syscall" />
136 <stateAttribute type="constant" value="name" />
137 </stateValue>
138 </segName>
139 </segType>
140 </segment>
141 </action>
142
143 <!-- FSMs -->
144
145 <!-- System call FSM
146 Declare an FSM to match all the system calls on thread 1311.
147 The FSM will generate pattern segments that will represent the system calls found
148 -->
149 <fsm id="syscall" initial="wait_syscall_entry_x">
150 <!-- Validate that PID == 1311 before going to the initial state -->
151 <initial>
152 <transition cond="tid_8998" target="wait_syscall_entry_x" />
153 </initial>
154 <state id="wait_syscall_entry_x">
155 <!-- The state will stay here until we have a "syscall_entry_*" event -->
156 <transition event="syscall_entry_*" target="syscall_entry_x" action="sys_x_founded" saveStoredFields="true"/>
157 </state>
158 <state id="syscall_entry_x" >
159 <!-- The state will stay here until we have a "syscall_exit_*" event -->
160 <transition event="syscall_exit_*" cond="thread_thread" target="syscall_exit_x" action="exit_syscall_founded" saveStoredFields="true" clearStoredFields="true"/>
161 </state>
162 <!-- The state will stay here forever -->
163 <final id="syscall_exit_x"/>
164 </fsm>
165
166 <!-- SCHED_SWITCH FSM ACTIONS -->
167 <!-- Update the value of the current running thread -->
168 <action id="update Current_thread">
169 <stateChange>
170 <stateAttribute type="location" value="CurrentCPU" />
171 <stateAttribute type="constant" value="Current_thread" />
172 <stateValue type="eventField" value="next_tid" />
173 </stateChange>
174 </action>
175 <!-- sched_switch fsm
176 Declare an FSM to update the value of the current thread running.
177 The FSM will generate a state change to update the current thread, each time that it will meet a sched_switch event.
178 -->
179 <fsm id="sched_switch" multiple="false">
180 <!-- if event.name != sched_switch, no processing will be done -->
181 <precondition event="sched_switch"/>
182 <initial>
183 <transition target="sched_switch"/>
184 </initial>
185 <state id="sched_switch">
186 <!-- The state will stay here forever and execute the action "update current thread" each time a sched_switch event will be meet-->
187 <transition target="sched_switch" action="update Current_thread" />
188 </state>
189 </fsm>
190 </patternHandler>
191 </pattern>
192 </tmfxml>
This page took 0.036664 seconds and 4 git commands to generate.