| 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 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 | * Naser Ezzati - Initial API and implementation |
| 12 | *************************************************************************** --> |
| 13 | <tmfxml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| 14 | xsi:noNamespaceSchemaLocation="xmlDefinition.xsd"> |
| 15 | |
| 16 | <stateProvider id="kernel.linux.sp" version="1"> |
| 17 | <head> |
| 18 | <traceType id="org.eclipse.linuxtools.lttng2.kernel.tracetype" /> |
| 19 | <label value="Test Condition Operators" /> |
| 20 | </head> |
| 21 | |
| 22 | <!-- StateValues --> |
| 23 | <definedValue name="PROCESS_STATUS_UNKNOWN" value="0" /> |
| 24 | <definedValue name="PROCESS_STATUS_WAIT_BLOCKED" value="1" /> |
| 25 | <definedValue name="PROCESS_STATUS_RUN_USERMODE" value="2" /> |
| 26 | <definedValue name="PROCESS_STATUS_RUN_SYSCALL" value="3" /> |
| 27 | <definedValue name="PROCESS_STATUS_INTERRUPTED" value="5000" /> |
| 28 | <definedValue name="PROCESS_STATUS_WAIT_FOR_CPU" value="10" /> |
| 29 | |
| 30 | <location id="CurrentThread"> |
| 31 | <stateAttribute type="constant" value="Threads" /> |
| 32 | <stateAttribute type="eventField" value="next_tid" /> |
| 33 | </location> |
| 34 | |
| 35 | <eventHandler eventName="sched_switch"> |
| 36 | <stateChange> |
| 37 | <if> |
| 38 | <condition operator="ne"> <!-- operator can also be "eq", "ge", "gt", "le", "lt" --> |
| 39 | <field name="prev_state" /> |
| 40 | <stateValue type="long" value="0" /> |
| 41 | </condition> |
| 42 | </if> |
| 43 | <then> |
| 44 | <stateAttribute type="constant" value="Threads" /> |
| 45 | <stateAttribute type="eventField" value="prev_tid" /> |
| 46 | <stateAttribute type="constant" value="Status" /> |
| 47 | <stateValue type="int" value="$PROCESS_STATUS_WAIT_BLOCKED" /> |
| 48 | </then> |
| 49 | <else> |
| 50 | <stateAttribute type="constant" value="Threads" /> |
| 51 | <stateAttribute type="eventField" value="prev_tid" /> |
| 52 | <stateAttribute type="constant" value="Status" /> |
| 53 | <stateValue type="int" value="$PROCESS_STATUS_WAIT_FOR_CPU" /> |
| 54 | </else> |
| 55 | </stateChange> |
| 56 | |
| 57 | <stateChange> |
| 58 | <if> |
| 59 | <condition operator="gt"> |
| 60 | <field name="next_tid" /> |
| 61 | <stateValue type="long" value="0" /> |
| 62 | </condition> |
| 63 | </if> |
| 64 | <then> |
| 65 | <if> |
| 66 | <condition> <!-- when the operation attribute is not set it is considered as "eq" (equal) --> |
| 67 | <stateAttribute type="location" value="newCurrentThread" /> |
| 68 | <stateAttribute type="constant" value="System_call" /> |
| 69 | <stateValue type="null" /> |
| 70 | </condition> |
| 71 | </if> |
| 72 | <then> |
| 73 | <stateAttribute type="location" value="CurrentCPU" /> |
| 74 | <stateAttribute type="constant" value="Status" /> |
| 75 | <stateValue type="int" value="$CPU_STATUS_RUN_USERMODE" /> |
| 76 | </then> |
| 77 | <else> |
| 78 | <stateAttribute type="location" value="CurrentCPU" /> |
| 79 | <stateAttribute type="constant" value="Status" /> |
| 80 | <stateValue type="int" value="$CPU_STATUS_RUN_SYSCALL" /> |
| 81 | </else> |
| 82 | </then> |
| 83 | </stateChange> |
| 84 | |
| 85 | <stateChange> |
| 86 | <if> |
| 87 | <condition> <!-- when the operation attribute is not set it is considered as "eq" (equal) --> |
| 88 | <stateAttribute type="location" value="CurrentThread" /> |
| 89 | <stateAttribute type="constant" value="System_call" /> |
| 90 | <stateValue type="null" /> |
| 91 | </condition> |
| 92 | </if> |
| 93 | <then> |
| 94 | <stateAttribute type="location" value="CurrentThread" /> |
| 95 | <stateAttribute type="constant" value="Status" /> |
| 96 | <stateValue type="int" value="$PROCESS_STATUS_RUN_USERMODE" /> |
| 97 | </then> |
| 98 | <else> |
| 99 | <stateAttribute type="location" value="CurrentThread" /> |
| 100 | <stateAttribute type="constant" value="Status" /> |
| 101 | <stateValue type="int" value="$PROCESS_STATUS_RUN_SYSCALL" /> |
| 102 | </else> |
| 103 | </stateChange> |
| 104 | </eventHandler> |
| 105 | <eventHandler eventName="irq_handler_exit"> |
| 106 | <stateChange> |
| 107 | <stateAttribute type="location" value="CurrentIRQ" /> |
| 108 | <stateValue type="null" /> |
| 109 | </stateChange> |
| 110 | <stateChange> |
| 111 | <if> |
| 112 | <condition operator="eq"> |
| 113 | <stateAttribute type="location" value="CurrentThread" /> |
| 114 | <stateAttribute type="constant" value="System_call" /> |
| 115 | <stateValue type="null" /> |
| 116 | </condition> |
| 117 | </if> |
| 118 | <then> |
| 119 | <stateAttribute type="location" value="CurrentThread" /> |
| 120 | <stateAttribute type="constant" value="Status" /> |
| 121 | <stateValue type="int" value="$PROCESS_STATUS_RUN_USERMODE" /> |
| 122 | </then> |
| 123 | <else> |
| 124 | <stateAttribute type="location" value="CurrentThread" /> |
| 125 | <stateAttribute type="constant" value="Status" /> |
| 126 | <stateValue type="int" value="$PROCESS_STATUS_RUN_SYSCALL" /> |
| 127 | </else> |
| 128 | </stateChange> |
| 129 | </eventHandler> |
| 130 | </stateProvider> |
| 131 | </tmfxml> |