Blame SOURCES/oprofile-xml2.patch

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