From: Maynard J. <may...@us...> - 2006-02-27 23:54:11
|
Maynard Johnson wrote: Ping. Has anyone had any time to look at this? John, did I answer your questions with the revisions I made? Thanks. -Maynard > John Levon wrote: > >> On Wed, Feb 15, 2006 at 01:05:50PM -0600, Maynard Johnson wrote: >> >> >> >>> Attached is a proposed schema that includes about everything I can >>> think of that a tool may want to extract from OProfile's sample data. >>> >> >> >> Thanks for starting on this. I'm a bit confused by your nested types. I >> would have expected something like: >> >> Process >> Thread >> BinaryImage >> Symbol >> cpu=x name=foo address=x ... event=x count=x >> >> Where if there's no process data we have a Process with a procid of >> "all". >> >> > The proposed schema was based on one we used for some prototyping. In > that prototyping, we always profiled with separate lib and thread, so we > didn't have the "no process data" situation. The updated (attached) > schema corrects this error of omission by adding a Module element to the > Profile element (explained below). > >> Also, why do we need the XList elements? We can just include a number >> of Thread, we don't need ThreadList. >> >> > I've also removed the unnecessary xList elements, added a CPU element, > and corrected some other XML schema newbie mistakes. > > So the definition of the Profile element now includes the following: > - One SampleInfo element - in this context, it holds setup info (e.g., > events being counted, total number of CPUs, etc.) > - One or more SymbolData elements - holds information about a sampled > symbol; intended to be referenced by one or Symbol elements > - One of either: An unbounded number of Process elements; OR an > unbounded number of Module elements. So if the profile data has process > data, then the resultant XML contains Process elements; otherwise, > Module elements. > > The profile heierarchies that can be represented by this schema are: > - Module->Symbol->SymbolData (for profiles with no process data) > - Process->Module->Symbol->SymbolData (for profiles with process data, > but no thread data) > - Process->Thread->Module->Symbol->SymbolData (for profiles with both > process and thread data) > > Maybe the best way to describe the use of the nested types is with an > example. The attached example.xml is a hand-coded XML document that > represents a lib+thread profile of a single process. Open this XML file > with Mozilla (or some other browser that supports XML schema) and then > collapse all of the elements under the tope-level Profile element. > You'll see that Profile contains: > - One SampleInfo element > - Two SymbolData elements (malloc, free) > - One Process element > > Now expand the Process element and collapse the top level elements > within it. Expand SampleInfo and note the Event information it > contains. The sample_count attribute is the total count for that event > for all threads for this process. Now expand one of the Thread elements > and note that it has a Module element for libc.so. The SampleInfo here > gives total sample_counts within the module for this thread. Open the > two Symbol elements within this Module element (for malloc and free) and > note that the sum of their sample_counts equals the sample_counts for > their containing Module. The one interesting aspect of this part of the > schema is how the Symbol elements use the refid attribute to refer to a > previously defined SymbolData element. This is a many-to-one > relationship. For example, the Symbol for "free" has refid=2. If you > look at the other Thread element for this process and find the Symbol > element for "free", you'll see that it, too, has refid=2. Both Symbols > refer to the SymbolData element with id=2. The SymbolData element may > optionally contain Bytes (binary opcode for the symbol) and total > "ticks" at a source line level and VMA level. We chose to structure the > schema this way in our prototyping to limit the size of the resultant > XML. I'm inclined to restructure this a bit and move the Line and > VmaOffsetTickInfo from SymbolData to Symbol so that this would be > per-process or per-thread information. > > Still TBD is adding call graph data. > > Regards, > -Maynard > >> regards >> john >> >> >> > > > ------------------------------------------------------------------------ > > <?xml version="1.0" encoding="UTF-8"?> > > <Profile disassembler="PPC64" platform="Linux-ppc64" title="An Oprofile XML file"> > <SampleInfo> > <Events> > <!-- event and timer mode are logical exclusive --> > <Event Event_ID="PM_INST_FROM_L2_GRP7" unit_mask="0x0" setup_count="10000" sample_count="100" /> > <Event Event_ID="PM_INST_FROM_L35_GRP7" unit_mask="0x0" setup_count="6000" sample_count="50" /> > </Events> > </SampleInfo> > <SymbolData name="malloc" source_file="/usr/local/libc/malloc.c" startingAddress="0x00fc" codeLength="0x7" id="1"> > <SampleInfo> > <Events> > <Event Event_ID="PM_INST_FROM_L2_GRP7" unit_mask="0x0" setup_count="10000" sample_count="60" /> > <Event Event_ID="PM_INST_FROM_L35_GRP7" unit_mask="0x0" setup_count="60000" sample_count="15" /> > </Events> > </SampleInfo> > <!-- obviously, this is not real binary opcode in the Bytes element below --> > <Bytes>0xaaaaaaaaaaaaaa</Bytes> > <Line VmaRange="0x0c-0x13" sourceLine="98" /> > <Line VmaRange="0x2c-0x3d" sourceLine="198" /> > <VmaOffsetTickInfo offset="0x33333"> > <SampleInfo> > <Events> > <Event Event_ID="PM_INST_FROM_L2_GRP7" unit_mask="0x0" setup_count="10000" sample_count="60" /> > <Event Event_ID="PM_INST_FROM_L35_GRP7" unit_mask="0x0" setup_count="60000" sample_count="15" /> > </Events> > </SampleInfo> > </VmaOffsetTickInfo> > </SymbolData> > <SymbolData name="free" source_file="/usr/local/libc/free.c" startingAddress="0x001c" codeLength="0x6" id="2"> > <SampleInfo> > <Events> > <Event Event_ID="PM_INST_FROM_L2_GRP7" unit_mask="0x0" setup_count="10000" sample_count="40" /> > <Event Event_ID="PM_INST_FROM_L35_GRP7" unit_mask="0x0" setup_count="60000" sample_count="35" /> > </Events> > </SampleInfo> > <Bytes>0xbbbbbbbbbbbb</Bytes> > <Line VmaRange="0x0c-0x13" sourceLine="98" /> > <Line VmaRange="0x2c-0x3d" sourceLine="198" /> > <VmaOffsetTickInfo offset="0x33333"> > <SampleInfo> > <Events> > <Event Event_ID="PM_INST_FROM_L2_GRP7" unit_mask="0x0" setup_count="10000" sample_count="40" /> > <Event Event_ID="PM_INST_FROM_L35_GRP7" unit_mask="0x0" setup_count="60000" sample_count="35" /> > </Events> > </SampleInfo> > </VmaOffsetTickInfo> > </SymbolData> > <Process name="/home/richard/test" procid="25566"> > <SampleInfo> > <Events> > <!-- event and timer mode are logical exclusive --> > <Event Event_ID="PM_INST_FROM_L2_GRP7" unit_mask="0x0" setup_count="10000" sample_count="100" /> > <Event Event_ID="PM_INST_FROM_L35_GRP7" unit_mask="0x0" setup_count="6000" sample_count="50" /> > </Events> > </SampleInfo> > <Thread name="/home/richard/test" threadId="25566"> > <SampleInfo> > <Events> > <Event Event_ID="PM_INST_FROM_L2_GRP7" unit_mask="0x0" setup_count="10000" sample_count="70" /> > <Event Event_ID="PM_INST_FROM_L35_GRP7" unit_mask="0x0" setup_count="60000" sample_count="30" /> > </Events> > </SampleInfo> > <Module name="/lib/tls/libc.so.6" disassembler="PPC64"> > <SampleInfo> > <Events> > <Event Event_ID="PM_INST_FROM_L2_GRP7" unit_mask="0x0" setup_count="10000" sample_count="70" /> > <Event Event_ID="PM_INST_FROM_L35_GRP7" unit_mask="0x0" setup_count="60000" sample_count="30" /> > </Events> > </SampleInfo> > <Symbol name="malloc" refid="1"> > <SampleInfo> > <Events> > <Event Event_ID="PM_INST_FROM_L2_GRP7" unit_mask="0x0" setup_count="10000" sample_count="40" /> > <Event Event_ID="PM_INST_FROM_L35_GRP7" unit_mask="0x0" setup_count="60000" sample_count="10" /> > </Events> > </SampleInfo> > </Symbol> > <Symbol name="free" refid="2"> > <SampleInfo> > <Events> > <Event Event_ID="PM_INST_FROM_L2_GRP7" unit_mask="0x0" setup_count="10000" sample_count="30" /> > <Event Event_ID="PM_INST_FROM_L35_GRP7" unit_mask="0x0" setup_count="60000" sample_count="20" /> > </Events> > </SampleInfo> > </Symbol> > > </Module> > </Thread> > > <Thread name="/home/richard/test" threadId="25567"> > <SampleInfo> > <Events> > <Event Event_ID="PM_INST_FROM_L2_GRP7" unit_mask="0x0" setup_count="10000" sample_count="30" /> > <Event Event_ID="PM_INST_FROM_L35_GRP7" unit_mask="0x0" setup_count="60000" sample_count="20" /> > </Events> > </SampleInfo> > <Module name="/lib/tls/libc.so.6" disassembler="PPC64"> > <SampleInfo> > <Events> > <Event Event_ID="PM_INST_FROM_L2_GRP7" unit_mask="0x0" setup_count="10000" sample_count="30" /> > <Event Event_ID="PM_INST_FROM_L35_GRP7" unit_mask="0x0" setup_count="60000" sample_count="20" /> > </Events> > </SampleInfo> > <Symbol name="malloc" refid="1"> > <SampleInfo> > <Events> > <Event Event_ID="PM_INST_FROM_L2_GRP7" unit_mask="0x0" setup_count="10000" sample_count="20" /> > <Event Event_ID="PM_INST_FROM_L35_GRP7" unit_mask="0x0" setup_count="60000" sample_count="5" /> > </Events> > </SampleInfo> > </Symbol> > <Symbol name="free" refid="2"> > <SampleInfo> > <Events> > <Event Event_ID="PM_INST_FROM_L2_GRP7" unit_mask="0x0" setup_count="10000" sample_count="10" /> > <Event Event_ID="PM_INST_FROM_L35_GRP7" unit_mask="0x0" setup_count="60000" sample_count="15" /> > </Events> > </SampleInfo> > </Symbol> > </Module> > </Thread> > </Process> > </Profile> > > > > > > > > > > > > > > > > ------------------------------------------------------------------------ > > <?xml version="1.0" encoding="UTF-8"?> > <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> > <xs:element name="Profile"> > <xs:complexType> > <xs:sequence> > <xs:element maxOccurs="1" minOccurs="1" ref="SampleInfo"/> > <xs:element maxOccurs="unbounded" minOccurs="1" ref="SymbolData"/> > <xs:choice> > <xs:element maxOccurs="unbounded" ref="Process"/> > <xs:element maxOccurs="unbounded" ref="Module"/> > </xs:choice> > </xs:sequence> > <xs:attribute name="disassembler" type="xs:NCName" use="required"/> > <xs:attribute name="platform" use="required"/> > <xs:attribute name="title" type="xs:string" use="required"/> > </xs:complexType> > </xs:element> > > <xs:element name="SampleInfo"> > <xs:complexType> > <xs:choice> > <xs:element maxOccurs="1" ref="TimerTicks"/> > <xs:element maxOccurs="unbounded" ref="Event"/> > </xs:choice> > <xs:attribute name="cpu" type="xs:nonNegativeInteger" use="optional"/> > </xs:complexType> > </xs:element> > > <xs:element name="Event"> > <xs:complexType> > <xs:attribute name="Event_ID" type="xs:Name" use="required"/> > <xs:attribute name="unit_mask" type="xs:string" use="optional"/> > <xs:attribute name="setup_count" type="xs:nonNegativeInteger" use="optional"/> > <xs:attribute name="sample_count" type="xs:nonNegativeInteger" use="optional"/> > </xs:complexType> > </xs:element> > > <xs:element name="TimerTicks"> > <xs:complexType> > <xs:attribute name="RTC_INTERRUPTS" type="xs:nonNegativeInteger"/> > <xs:attribute name="ticks" type="xs:nonNegativeInteger"/> > </xs:complexType> > </xs:element> > > <xs:element name="SymbolData"> > <xs:complexType> > <xs:sequence> > <xs:element maxOccurs="1" minOccurs="1" ref="SampleInfo"/> > <xs:element maxOccurs="unbounded" minOccurs="0" ref="Line"/> > <xs:element maxOccurs="unbounded" minOccurs="0" ref="VmaOffsetTickInfo"/> > <xs:element maxOccurs="1" minOccurs="0" ref="Bytes"/> > </xs:sequence> > <xs:attribute name="name" type="xs:string" use="required"/> > <xs:attribute name="source_file" type="xs:string" use="optional"/> > <xs:attribute name="startingAddress" use="optional"/> > <xs:attribute name="codeLength" type="xs:integer" use="optional"/> > <xs:attribute name="id" type="xs:integer" use="required"/> > </xs:complexType> > </xs:element> > > <xs:element name="Bytes"/> > > <xs:element name="Line"> > <xs:complexType> > <xs:attribute name="VmaRange" type="xs:string" use="required"/> > <xs:attribute name="sourceLine" type="xs:nonNegativeInteger" use="required"/> > </xs:complexType> > </xs:element> > > <xs:element name="VmaOffsetTickInfo"> > <xs:complexType> > <xs:sequence> > <xs:element maxOccurs="1" minOccurs="1" ref="SampleInfo"/> > </xs:sequence> > <xs:attribute name="offset" use="required"/> > </xs:complexType> > </xs:element> > > <xs:element name="Process"> > <xs:complexType> > <xs:sequence> > <xs:element maxOccurs="1" minOccurs="1" ref="SampleInfo"/> > <xs:element maxOccurs="unbounded" minOccurs="0" ref="Module"/> > <xs:element maxOccurs="unbounded" minOccurs="0" ref="Thread"/> > </xs:sequence> > <xs:attribute name="name" type="xs:string" use="required"/> > <xs:attribute name="procid" type="xs:integer" use="required"/> > </xs:complexType> > </xs:element> > > <xs:element name="Thread"> > <xs:complexType> > <xs:sequence> > <xs:element maxOccurs="1" minOccurs="1" ref="SampleInfo"/> > <xs:element maxOccurs="unbounded" minOccurs="1" ref="Module"/> > </xs:sequence> > <xs:attribute name="name" type="xs:string" use="required"/> > <xs:attribute name="threadid" type="xs:integer" use="required"/> > </xs:complexType> > </xs:element> > > <xs:element name="Module"> > <xs:complexType> > <xs:sequence> > <xs:element maxOccurs="1" minOccurs="1" ref="SampleInfo"/> > <xs:element maxOccurs="unbounded" minOccurs="1" ref="Symbol"/> > </xs:sequence> > <xs:attribute name="name" type="xs:string" use="required"/> > <xs:attribute name="disassembler" use="optional"/> > </xs:complexType> > </xs:element> > > <xs:element name="Symbol"> > <xs:complexType> > <xs:sequence> > <xs:element maxOccurs="1" minOccurs="1" ref="SampleInfo"/> > </xs:sequence> > <xs:attribute name="name" type="xs:string" use="required"/> > <xs:attribute name="refid" type="xs:integer" use="required"/> > </xs:complexType> > </xs:element> > </xs:schema> |