cl-format.html
字号:
<div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="cl-format.reference"></a>3.2.燫eference</h2></div></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="cl-format.reference.grammar"></a>3.2.1.燝rammar</h3></div></div></div><p></p><pre class="screen">ProfileDataFile := FormatVersion? Creator? PartData*</pre><p></p><pre class="screen">FormatVersion := "version:" Space* Number "\n"</pre><p></p><pre class="screen">Creator := "creator:" NoNewLineChar* "\n"</pre><p></p><pre class="screen">PartData := (HeaderLine "\n")+ (BodyLine "\n")+</pre><p></p><pre class="screen">HeaderLine := (empty line) | ('#' NoNewLineChar*) | PartDetail | Description | EventSpecification | CostLineDef</pre><p></p><pre class="screen">PartDetail := TargetCommand | TargetID</pre><p></p><pre class="screen">TargetCommand := "cmd:" Space* NoNewLineChar*</pre><p></p><pre class="screen">TargetID := ("pid"|"thread"|"part") ":" Space* Number</pre><p></p><pre class="screen">Description := "desc:" Space* Name Space* ":" NoNewLineChar*</pre><p></p><pre class="screen">EventSpecification := "event:" Space* Name InheritedDef? LongNameDef?</pre><p></p><pre class="screen">InheritedDef := "=" InheritedExpr</pre><p></p><pre class="screen">InheritedExpr := Name | Number Space* ("*" Space*)? Name | InheritedExpr Space* "+" Space* InheritedExpr</pre><p></p><pre class="screen">LongNameDef := ":" NoNewLineChar*</pre><p></p><pre class="screen">CostLineDef := "events:" Space* Name (Space+ Name)* | "positions:" "instr"? (Space+ "line")?</pre><p></p><pre class="screen">BodyLine := (empty line) | ('#' NoNewLineChar*) | CostLine | PositionSpecification | AssoziationSpecification</pre><p></p><pre class="screen">CostLine := SubPositionList Costs?</pre><p></p><pre class="screen">SubPositionList := (SubPosition+ Space+)+</pre><p></p><pre class="screen">SubPosition := Number | "+" Number | "-" Number | "*"</pre><p></p><pre class="screen">Costs := (Number Space+)+</pre><p></p><pre class="screen">PositionSpecification := Position "=" Space* PositionName</pre><p></p><pre class="screen">Position := CostPosition | CalledPosition</pre><p></p><pre class="screen">CostPosition := "ob" | "fl" | "fi" | "fe" | "fn"</pre><p></p><pre class="screen">CalledPosition := " "cob" | "cfl" | "cfn"</pre><p></p><pre class="screen">PositionName := ( "(" Number ")" )? (Space* NoNewLineChar* )?</pre><p></p><pre class="screen">AssoziationSpecification := CallSpezification | JumpSpecification</pre><p></p><pre class="screen">CallSpecification := CallLine "\n" CostLine</pre><p></p><pre class="screen">CallLine := "calls=" Space* Number Space+ SubPositionList</pre><p></p><pre class="screen">JumpSpecification := ...</pre><p></p><pre class="screen">Space := " " | "\t"</pre><p></p><pre class="screen">Number := HexNumber | (Digit)+</pre><p></p><pre class="screen">Digit := "0" | ... | "9"</pre><p></p><pre class="screen">HexNumber := "0x" (Digit | HexChar)+</pre><p></p><pre class="screen">HexChar := "a" | ... | "f" | "A" | ... | "F"</pre><p></p><pre class="screen">Name = Alpha (Digit | Alpha)*</pre><p></p><pre class="screen">Alpha = "a" | ... | "z" | "A" | ... | "Z"</pre><p></p><pre class="screen">NoNewLineChar := all characters without "\n"</pre><p></p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="cl-format.reference.header"></a>3.2.2.燚escription of Header Lines</h3></div></div></div><p>The header has an arbitrary number of lines of the format "key: value". Possible <span class="emphasis"><em>key</em></span> values for the header are:</p><div class="itemizedlist"><ul type="disc"><li><p><code class="computeroutput">version: number</code> [Callgrind]</p><p>This is used to distinguish future profile data formats. A major version of 0 or 1 is supposed to be upwards compatible with Cachegrinds format. It is optional; if not appearing, version 1 is supposed. Otherwise, this has to be the first header line.</p></li><li><p><code class="computeroutput">pid: process id</code> [Callgrind]</p><p>This specifies the process ID of the supervised application for which this profile was generated.</p></li><li><p><code class="computeroutput">cmd: program name + args</code> [Cachegrind]</p><p>This specifies the full command line of the supervised application for which this profile was generated.</p></li><li><p><code class="computeroutput">part: number</code> [Callgrind]</p><p>This specifies a sequentially incremented number for each dump generated, starting at 1.</p></li><li><p><code class="computeroutput">desc: type: value</code> [Cachegrind]</p><p>This specifies various information for this dump. For some types, the semantic is defined, but any description type is allowed. Unknown types should be ignored.</p><p>There are the types "I1 cache", "D1 cache", "L2 cache", which specify parameters used for the cache simulator. These are the only types originally used by Cachegrind. Additionally, Callgrind uses the following types: "Timerange" gives a rough range of the basic block counter, for which the cost of this dump was collected. Type "Trigger" states the reason of why this trace was generated. E.g. program termination or forced interactive dump.</p></li><li><p><code class="computeroutput">positions: [instr] [line]</code> [Callgrind]</p><p>For cost lines, this defines the semantic of the first numbers. Any combination of "instr", "bb" and "line" is allowed, but has to be in this order which corresponds to position numbers at the start of the cost lines later in the file.</p><p>If "instr" is specified, the position is the address of an instruction whose execution raised the events given later on the line. This address is relative to the offset of the binary/shared library file to not have to specify relocation info. For "line", the position is the line number of a source file, which is responsible for the events raised. Note that the mapping of "instr" and "line" positions are given by the debugging line information produced by the compiler.</p><p>This field is optional. If not specified, "line" is supposed only.</p></li><li><p><code class="computeroutput">events: event type abbrevations</code> [Cachegrind]</p><p>A list of short names of the event types logged in this file. The order is the same as in cost lines. The first event type is the second or third number in a cost line, depending on the value of "positions". Callgrind does not add additional cost types. Specify exactly once.</p><p>Cost types from original Cachegrind are: </p><div class="itemizedlist"><ul type="circle"><li><p><span><strong class="command">Ir</strong></span>: Instruction read access</p></li><li><p><span><strong class="command">I1mr</strong></span>: Instruction Level 1 read cache miss</p></li><li><p><span><strong class="command">I2mr</strong></span>: Instruction Level 2 read cache miss</p></li><li><p>...</p></li></ul></div><p> </p></li><li><p><code class="computeroutput">summary: costs</code> [Callgrind]</p><p><code class="computeroutput">totals: costs</code> [Cachegrind]</p><p>The value or the total number of events covered by this trace file. Both keys have the same meaning, but the "totals:" line happens to be at the end of the file, while "summary:" appears in the header. This was added to allow postprocessing tools to know in advance to total cost. The two lines always give the same cost counts.</p></li></ul></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="cl-format.reference.body"></a>3.2.3.燚escription of Body Lines</h3></div></div></div><p>There exist lines<code class="computeroutput">spec=position</code>. The values for positionspecifications are arbitrary strings. When starting with "(" and adigit, it's a string in compressed format. Otherwise it's the realposition string. This allows for file and symbol names as positionstrings, as these never start with "(" + <span class="emphasis"><em>digit</em></span>.The compressed format is either "(" <span class="emphasis"><em>number</em></span> ")"<span class="emphasis"><em>space</em></span> <span class="emphasis"><em>position</em></span> or only "(" <span class="emphasis"><em>number</em></span> ")". The first relates<span class="emphasis"><em>position</em></span> to <span class="emphasis"><em>number</em></span> in thecontext of the given format specification from this line to the end ofthe file; it makes the (<span class="emphasis"><em>number</em></span>) an alias for<span class="emphasis"><em>position</em></span>. Compressed format is alwaysoptional.</p><p>Position specifications allowed:</p><div class="itemizedlist"><ul type="disc"><li><p><code class="computeroutput">ob=</code> [Callgrind]</p><p>The ELF object where the cost of next cost lines happens.</p></li><li><p><code class="computeroutput">fl=</code> [Cachegrind]</p></li><li><p><code class="computeroutput">fi=</code> [Cachegrind]</p></li><li><p><code class="computeroutput">fe=</code> [Cachegrind]</p><p>The source file including the code which is responsible for the cost of next cost lines. "fi="/"fe=" is used when the source file changes inside of a function, i.e. for inlined code.</p></li><li><p><code class="computeroutput">fn=</code> [Cachegrind]</p><p>The name of the function where the cost of next cost lines happens.</p></li><li><p><code class="computeroutput">cob=</code> [Callgrind]</p><p>The ELF object of the target of the next call cost lines.</p></li><li><p><code class="computeroutput">cfl=</code> [Callgrind]</p><p>The source file including the code of the target of the next call cost lines.</p></li><li><p><code class="computeroutput">cfn=</code> [Callgrind]</p><p>The name of the target function of the next call cost lines.</p></li><li><p><code class="computeroutput">calls=</code> [Callgrind]</p><p>The number of nonrecursive calls which are responsible for the cost specified by the next call cost line. This is the cost spent inside of the called function.</p><p>After "calls=" there MUST be a cost line. This is the cost spent in the called function. The first number is the source line from where the call happened.</p></li><li><p><code class="computeroutput">jump=count target position</code> [Callgrind]</p><p>Unconditional jump, executed count times, to the given target position.</p></li><li><p><code class="computeroutput">jcnd=exe.count jumpcount target position</code> [Callgrind]</p><p>Conditional jump, executed exe.count times with jumpcount jumps to the given target position.</p></li></ul></div></div></div></div><div><br><table class="nav" width="100%" cellspacing="3" cellpadding="2" border="0" summary="Navigation footer"><tr><td rowspan="2" width="40%" align="left"><a accesskey="p" href="cg-tech-docs.html"><<
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -