Commit [5646af]  Maximize  Restore  History

opreport XML: binary-level count field issues

See oprofile bug # 236 (

There are several issues relating to the use of the 'count' element
defined in opreport.xsd. For example, below is the current schema
definition for the 'binary' element. Note the usage of the 'count'

<xs:element name="binary">
<xs:element minOccurs="1" maxOccurs="1" ref="count"/>
<xs:element minOccurs="0" maxOccurs="unbounded" ref="symbol"/>
<!-- When the separate=lib option is used an binary
can contain a list of library Modules. -->
<xs:element minOccurs="0" maxOccurs="unbounded" ref="module"/>
<xs:attribute name="name" type="xs:string" use="required"/>

There have been questions from users whether the 'count' element
associated with the 'binary' element is supposed to represent a
total count across all modules for the executable or if it is only
the count for the executable itself (the answer is the latter).

Additionally, it's possible that there may be no samples at all
for the binary file -- i.e., all samples collected were for module
elements -- thus, the minOccurs attribute for the 'count' element
of 'binary' should be '0'.

Finally, using xmllint on a XML instance document created from
opreport on a profile run that specified "--separate-cpu" identified
that the instance document was invalid when compared against its
associated schema file (opreport.xsd). Reviewing the schema, I
realized that all usages of the 'count' element were wrong insofar
as the maxOccurs attribute. Instead of being set to '1', maxOccurs
should be 'unbounded' since we can have multiple 'count' elements
associated with any given higher level element (e.g., 'binary')
if there are multiple classes in the profile. Multiple classes
will exist for a profile for various reasons -- e.g., profiling with
'--separate-cpu', or multiple events.

This patch addresses these issues. The major version number of the
schema is not being changed -- only the minor number. This is because
instance documents that previously validated using the old schema
will still be valid with the new schema.

A testsuite patch is being developed to validate XML instance documents
for various scenarios.

Signed-off-by: Maynard Johnson <>

Maynard Johnson Maynard Johnson 2014-05-29

changed doc/opreport.xsd
changed libpp/xml_utils.cpp
doc/opreport.xsd Diff Switch to side-by-side view
libpp/xml_utils.cpp Diff Switch to side-by-side view

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks