共用方式為


2.2.4.2.2.4.3.6 unary_expr

The unary_expr complex type<61> represents a condition to be evaluated upon firing an XEvent. The condition is a composite Boolean expression over fields of the XEvent or global XEvent object. The Boolean expression can contain not, and, and or operators. The leaf predicate of Boolean expressions is composed of:

  • A comparator. A list of supported comparators along with descriptions can be retrieved by using the DISCOVER_XEVENT_OBJECTS<62> command.

  • A reference to the event field or global state.

  • The value to which the event field is to be compared.

        <xs:complexType name="pred_leaf">
             <xs:sequence>
                  <xs:element name="comparator">
                       <xs:complexType>
                            <xs:attributeGroup ref="objectNames"/>
                       </xs:complexType>
                  </xs:element>
                  <xs:choice>
                    <xs:element name="event">
                         <xs:complexType>
                           <xs:attributeGroup ref="objectNames"/>
                                <xs:attribute name="field" type="xs:string"/>
                         </xs:complexType>
                    </xs:element>
                       <xs:element name="global">
                            <xs:complexType>
                                 <xs:attributeGroup ref="objectNames"/>
                            </xs:complexType>
                       </xs:element>
                  </xs:choice>
                  <xs:element name="value"></xs:element>
             </xs:sequence>
        </xs:complexType>
        <xs:complexType name="unary_expr">
             <xs:choice>
                  <xs:element name="not" type="unary_expr"></xs:element>
                  <xs:element name="and" type="boolean_expr"></xs:element>
                  <xs:element name="or" type="boolean_expr"></xs:element>
                  <xs:element name="leaf" type="pred_leaf"></xs:element>
             </xs:choice>
        </xs:complexType>
        <xs:complexType name="boolean_expr">
             <xs:sequence>
                  <xs:choice>
                       <xs:element name="and" type="boolean_expr"></xs:element>
                       <xs:element name="or" type="boolean_expr"></xs:element>
                       <xs:element name="not" type="unary_expr"></xs:element>
                       <xs:element name="leaf" type="pred_leaf"></xs:element>
                  </xs:choice>
                  <xs:choice maxOccurs="1" minOccurs="1">
                       <xs:element name="and" type="boolean_expr"></xs:element>
                       <xs:element name="or" type="boolean_expr"></xs:element>
                       <xs:element name="not" type="unary_expr"></xs:element>
                       <xs:element name="leaf" type="pred_leaf"></xs:element>
                  </xs:choice>
             </xs:sequence>
        </xs:complexType>
    

The following are examples of Boolean expressions:

 <predicate>
     <and>
         <leaf>
            <comparator name="equal_uint64" package="package0" />
            <event name="Event4" package="TESTPKG" field="m1" />
            <value>1</value>
        </leaf>
        <leaf>
             <comparator name="equal_uint64" package="package0" />
             <event name="Event4" package="TESTPKG" field="m1" />
             <value>2</value>
         </leaf>
     </and>
 </predicate>
  
 <predicate>
     <leaf>
         <comparator name="greater_than_equal_int64" package="package0"></comparator>
         <event name="Event0" field="I16"/>
         <value>20</value>
     </leaf>
 </predicate>