Blame SOURCES/oprofile-xml2.patch

d5df0a
commit 5646afee4c74a6759fc61d11b9203b0f6d60f529
d5df0a
Author: Maynard Johnson <maynardj@us.ibm.com>
d5df0a
Date:   Thu May 29 10:10:41 2014 -0500
d5df0a
d5df0a
    opreport XML: binary-level count field issues
d5df0a
    
d5df0a
    See oprofile bug # 236 (https://sourceforge.net/p/oprofile/bugs/236/).
d5df0a
    
d5df0a
    There are several issues relating to the use of the 'count' element
d5df0a
    defined in opreport.xsd. For example, below is the current schema
d5df0a
    definition for the 'binary' element.  Note the usage of the 'count'
d5df0a
    element:
d5df0a
    
d5df0a
    <xs:element name="binary">
d5df0a
    <xs:complexType>
d5df0a
    <xs:sequence>
d5df0a
    <xs:element minOccurs="1" maxOccurs="1" ref="count"/>
d5df0a
    <xs:element minOccurs="0" maxOccurs="unbounded" ref="symbol"/>
d5df0a
    
d5df0a
    can contain a list of library Modules. -->
d5df0a
    <xs:element minOccurs="0" maxOccurs="unbounded" ref="module"/>
d5df0a
    </xs:sequence>
d5df0a
    <xs:attribute name="name" type="xs:string" use="required"/>
d5df0a
    </xs:complexType>
d5df0a
    </xs:element>
d5df0a
    
d5df0a
    There have been questions from users whether the 'count' element
d5df0a
    associated with the 'binary' element is supposed to represent a
d5df0a
    total count across all modules for the executable or if it is only
d5df0a
    the count for the executable itself (the answer is the latter).
d5df0a
    
d5df0a
    Additionally, it's possible that there may be no samples at all
d5df0a
    for the binary file -- i.e., all samples collected were for module
d5df0a
    elements -- thus, the minOccurs attribute for the 'count' element
d5df0a
    of 'binary' should be '0'.
d5df0a
    
d5df0a
    Finally, using xmllint on a XML instance document created from
d5df0a
    opreport on a profile run that specified "--separate-cpu" identified
d5df0a
    that the instance document was invalid when compared against its
d5df0a
    associated schema file (opreport.xsd). Reviewing the schema, I
d5df0a
    realized that all usages of the 'count' element were wrong insofar
d5df0a
    as the maxOccurs attribute. Instead of being set to '1', maxOccurs
d5df0a
    should be 'unbounded' since we can have multiple 'count' elements
d5df0a
    associated with any given higher level element (e.g., 'binary')
d5df0a
    if there are multiple classes in the profile.  Multiple classes
d5df0a
    will exist for a profile for various reasons -- e.g., profiling with
d5df0a
    '--separate-cpu', or multiple events.
d5df0a
    
d5df0a
    This patch addresses these issues. The major version number of the
d5df0a
    schema is not being changed -- only the minor number.  This is because
d5df0a
    instance documents that previously validated using the old schema
d5df0a
    will still be valid with the new schema.
d5df0a
    
d5df0a
    A testsuite patch is being developed to validate XML instance documents
d5df0a
    for various scenarios.
d5df0a
    
d5df0a
    Signed-off-by: Maynard Johnson <maynardj@us.ibm.com>
d5df0a
d5df0a
diff --git a/doc/opreport.xsd b/doc/opreport.xsd
d5df0a
index 682a0bf..28e3128 100644
d5df0a
--- a/doc/opreport.xsd
d5df0a
+++ b/doc/opreport.xsd
d5df0a
@@ -110,7 +110,7 @@
d5df0a
   <xs:element name="process">
d5df0a
     <xs:complexType>
d5df0a
       <xs:sequence>
d5df0a
-	<xs:element minOccurs="1" maxOccurs="1" ref="count"/>
d5df0a
+        <xs:element minOccurs="1" maxOccurs="unbounded" ref="count"/>
d5df0a
         <xs:element minOccurs="1" maxOccurs="unbounded" ref="thread"/>
d5df0a
       </xs:sequence>
d5df0a
       <xs:attribute name="pid" type="xs:integer" use="required"/>
d5df0a
@@ -121,7 +121,7 @@
d5df0a
   <xs:element name="thread">
d5df0a
     <xs:complexType>
d5df0a
       <xs:sequence>
d5df0a
-		<xs:element minOccurs="1" maxOccurs="1" ref="count"/>
d5df0a
+        <xs:element minOccurs="1" maxOccurs="unbounded" ref="count"/>
d5df0a
         <xs:element minOccurs="1" maxOccurs="unbounded" ref="module"/>
d5df0a
       </xs:sequence>
d5df0a
       <xs:attribute name="tid" type="xs:integer" use="required"/>
d5df0a
@@ -131,10 +131,13 @@
d5df0a
   <xs:element name="binary">
d5df0a
     <xs:complexType>
d5df0a
       <xs:sequence>
d5df0a
-		<xs:element minOccurs="1" maxOccurs="1" ref="count"/>
d5df0a
+        <xs:element minOccurs="0" maxOccurs="unbounded" ref="count"/>
d5df0a
+        
d5df0a
+             as a module.  The count value here is the number of samples
d5df0a
+             just for the binary file module, which may be zero.  -->
d5df0a
         <xs:element minOccurs="0" maxOccurs="unbounded" ref="symbol"/>
d5df0a
-        
d5df0a
-		     can contain a list of library Modules.  -->
d5df0a
+        
d5df0a
+             can contain a list of library Modules.  -->
d5df0a
         <xs:element minOccurs="0" maxOccurs="unbounded" ref="module"/>
d5df0a
       </xs:sequence>
d5df0a
       <xs:attribute name="name" type="xs:string" use="required"/>
d5df0a
@@ -144,7 +147,7 @@
d5df0a
   <xs:element name="module">
d5df0a
     <xs:complexType>
d5df0a
       <xs:sequence>
d5df0a
-		<xs:element minOccurs="0" maxOccurs="1" ref="count"/>
d5df0a
+        <xs:element minOccurs="0" maxOccurs="unbounded" ref="count"/>
d5df0a
         <xs:element minOccurs="1" maxOccurs="unbounded" ref="symbol"/>
d5df0a
       </xs:sequence>
d5df0a
       <xs:attribute name="name" type="xs:string" use="required"/>
d5df0a
@@ -203,7 +206,7 @@
d5df0a
       <xs:sequence>
d5df0a
         <xs:element minOccurs="0" maxOccurs="1" ref="callers"/>
d5df0a
         <xs:element minOccurs="0" maxOccurs="1" ref="callees"/>
d5df0a
-        <xs:element minOccurs="0" maxOccurs="1" ref="count"/>
d5df0a
+        <xs:element minOccurs="0" maxOccurs="unbounded" ref="count"/>
d5df0a
       </xs:sequence>
d5df0a
 	  
d5df0a
       <xs:attribute name="idref" type="xs:nonNegativeInteger" use="required"/>
d5df0a
diff --git a/libpp/xml_utils.cpp b/libpp/xml_utils.cpp
d5df0a
index 942b236..5f1a3a1 100644
d5df0a
--- a/libpp/xml_utils.cpp
d5df0a
+++ b/libpp/xml_utils.cpp
d5df0a
@@ -245,11 +245,11 @@ void xml_utils::add_option(tag_t tag, bool value)
d5df0a
 void xml_utils::output_xml_header(string const & command_options,
d5df0a
                        string const & cpu_info, string const & events)
d5df0a
 {
d5df0a
-	// the integer portion indicates the schema version and should change
d5df0a
+	// The integer portion indicates the schema version and should change
d5df0a
 	// both here and in the schema file when major changes are made to
d5df0a
-	// the schema.  changes to opreport, or minor changes to the schema
d5df0a
+	// the schema.  Changes to opreport, or minor changes to the schema
d5df0a
 	// can be indicated by changes to the fraction part.
d5df0a
-	string const schema_version = "3.0";
d5df0a
+	string const schema_version = "3.1";
d5df0a
 
d5df0a
 	// This is the XML version, not schema version.
d5df0a
 	string const xml_header = "";