This file is indexed.

/usr/share/doc/racket/profile/index.html is in racket-doc 6.7-3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"/><title>Profile: Statistical Profiler</title><link rel="stylesheet" type="text/css" href="../scribble.css" title="default"/><link rel="stylesheet" type="text/css" href="../racket.css" title="default"/><link rel="stylesheet" type="text/css" href="../manual-style.css" title="default"/><link rel="stylesheet" type="text/css" href="../manual-racket.css" title="default"/><link rel="stylesheet" type="text/css" href="../doc-site.css" title="default"/><script type="text/javascript" src="../scribble-common.js"></script><script type="text/javascript" src="../manual-racket.js"></script><script type="text/javascript" src="../doc-site.js"></script><script type="text/javascript" src="../local-redirect/local-redirect.js"></script><script type="text/javascript" src="../local-redirect/local-user-redirect.js"></script><!--[if IE 6]><style type="text/css">.SIEHidden { overflow: hidden; }</style><![endif]--></head><body id="doc-racket-lang-org"><div class="tocset"><div class="tocview"><div class="tocviewlist tocviewlisttopspace"><div class="tocviewtitle"><table cellspacing="0" cellpadding="0"><tr><td style="width: 1em;"><a href="javascript:void(0);" title="Expand/Collapse" class="tocviewtoggle" onclick="TocviewToggle(this,&quot;tocview_0&quot;);">&#9658;</a></td><td></td><td><a href="" class="tocviewselflink" data-pltdoc="x">Profile:<span class="mywbr"> &nbsp;</span> Statistical Profiler</a></td></tr></table></div><div class="tocviewsublistonly" style="display: none;" id="tocview_0"><table cellspacing="0" cellpadding="0"><tr><td align="right">1&nbsp;</td><td><a href="#%28part._.Toplevel_.Interface%29" class="tocviewlink" data-pltdoc="x">Toplevel Interface</a></td></tr><tr><td align="right">2&nbsp;</td><td><a href="#%28part._sampler%29" class="tocviewlink" data-pltdoc="x">Collecting Profile Information</a></td></tr><tr><td align="right">3&nbsp;</td><td><a href="#%28part._analyzer%29" class="tocviewlink" data-pltdoc="x">Analyzing Profile Data</a></td></tr><tr><td align="right">4&nbsp;</td><td><a href="#%28part._renderers%29" class="tocviewlink" data-pltdoc="x">Profile Renderers</a></td></tr></table></div></div></div><div class="tocsub"><table class="tocsublist" cellspacing="0"><tr><td><span class="tocsublinknumber"></span><a href="#%28part._top%29" class="tocsubseclink" data-pltdoc="x">Profile:<span class="mywbr"> &nbsp;</span> Statistical Profiler</a></td></tr><tr><td><span class="tocsublinknumber">1<tt>&nbsp;</tt></span><a href="#%28part._.Toplevel_.Interface%29" class="tocsubseclink" data-pltdoc="x">Toplevel Interface</a></td></tr><tr><td><a href="#%28def._%28%28lib._profile%2Fmain..rkt%29._profile-thunk%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">profile-<wbr></wbr>thunk</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._profile%2Fmain..rkt%29._profile%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">profile</span></span></a></td></tr><tr><td><span class="tocsublinknumber">2<tt>&nbsp;</tt></span><a href="#%28part._sampler%29" class="tocsubseclink" data-pltdoc="x">Collecting Profile Information</a></td></tr><tr><td><a href="#%28def._%28%28lib._profile%2Fsampler..rkt%29._create-sampler%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">create-<wbr></wbr>sampler</span></span></a></td></tr><tr><td><span class="tocsublinknumber">3<tt>&nbsp;</tt></span><a href="#%28part._analyzer%29" class="tocsubseclink" data-pltdoc="x">Analyzing Profile Data</a></td></tr><tr><td><a href="#%28def._%28%28lib._profile%2Fanalyzer..rkt%29._analyze-samples%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">analyze-<wbr></wbr>samples</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._profile%2Fanalyzer..rkt%29._profile%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">profile</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._profile%2Fanalyzer..rkt%29._node%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">node</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._profile%2Fanalyzer..rkt%29._edge%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">edge</span></span></a></td></tr><tr><td><span class="tocsublinknumber">4<tt>&nbsp;</tt></span><a href="#%28part._renderers%29" class="tocsubseclink" data-pltdoc="x">Profile Renderers</a></td></tr><tr><td><span class="tocsublinknumber">4.1<tt>&nbsp;</tt></span><a href="#%28part._.Textual_.Rendering%29" class="tocsubseclink" data-pltdoc="x">Textual Rendering</a></td></tr><tr><td><a href="#%28def._%28%28lib._profile%2Frender-text..rkt%29._render%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym">render</span></a></td></tr><tr><td><span class="tocsublinknumber">4.2<tt>&nbsp;</tt></span><a href="#%28part._.Graph_.Rendering%29" class="tocsubseclink" data-pltdoc="x">Graph Rendering</a></td></tr><tr><td><a href="#%28def._%28%28lib._profile%2Frender-graphviz..rkt%29._render%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym">render</span></a></td></tr></table></div></div><div class="maincolumn"><div class="main"><div class="versionbox"><span class="version">6.7</span></div><div class="navsettop"><span class="navleft"><form class="searchform"><input class="searchbox" style="color: #888;" type="text" value="...search manuals..." title="Enter a search string to search the manuals" onkeypress="return DoSearchKey(event, this, &quot;6.7&quot;, &quot;../&quot;);" onfocus="this.style.color=&quot;black&quot;; this.style.textAlign=&quot;left&quot;; if (this.value == &quot;...search manuals...&quot;) this.value=&quot;&quot;;" onblur="if (this.value.match(/^ *$/)) { this.style.color=&quot;#888&quot;; this.style.textAlign=&quot;center&quot;; this.value=&quot;...search manuals...&quot;; }"/></form>&nbsp;&nbsp;<a href="../index.html" title="up to the documentation top" data-pltdoc="x" onclick="return GotoPLTRoot(&quot;6.7&quot;);">top</a></span><span class="navright">&nbsp;&nbsp;<span class="nonavigation">&larr; prev</span>&nbsp;&nbsp;<a href="../index.html" title="up to the documentation top" data-pltdoc="x" onclick="return GotoPLTRoot(&quot;6.7&quot;);">up</a>&nbsp;&nbsp;<span class="nonavigation">next &rarr;</span></span>&nbsp;</div><h2 x-source-module="(lib &quot;profile/scribblings/profile.scrbl&quot;)" x-source-pkg="profile-doc" x-part-tag="&quot;top&quot;"><a name="(part._top)"></a><a name="(part._.Profile__.Statistical_.Profiler)"></a>Profile: Statistical Profiler</h2><p>The <a href="#%28mod-path._profile%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">profile</span></a> collection implements a statistical profiler.  The
profiling is done by running a background thread that collects stack snapshots
either via <span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=contmarks.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._continuation-mark-set-%7E3econtext%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">continuation-mark-set-&gt;context</a></span> or via <a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=errortrace&amp;rel=index.html&amp;version=6.7" class="Sq" data-pltdoc="x">Errortrace</a>, meaning that the
result is an estimate of the execution costs.</p><p>When using <span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=contmarks.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._continuation-mark-set-%7E3econtext%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">continuation-mark-set-&gt;context</a></span>, it is limited to the kind
of information that <span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=contmarks.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._continuation-mark-set-%7E3econtext%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">continuation-mark-set-&gt;context</a></span> produces (most
notably being limited to functions calls, and subject to compiler
optimizations); but the result is often useful. In practice, since this method
does not require recompilation of your source and has very little runtime
overhead, it can be used for longer runs which compensates for these limits.</p><p>When using <a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=errortrace&amp;rel=index.html&amp;version=6.7" class="Sq" data-pltdoc="x">Errortrace</a>, profiles are more
precise and more fine-grained (expression-level instead of function-level) but
profiling has higher overhead and recompilation may be necessary.</p><table cellspacing="0" cellpadding="0"><tr><td><p><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><a href="#%28part._.Toplevel_.Interface%29" class="toptoclink" data-pltdoc="x">1<span class="hspace">&nbsp;</span>Toplevel Interface</a></p></td></tr><tr><td><p><span class="hspace"></span></p></td></tr><tr><td><p><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><a href="#%28part._sampler%29" class="toptoclink" data-pltdoc="x">2<span class="hspace">&nbsp;</span>Collecting Profile Information</a></p></td></tr><tr><td><p><span class="hspace"></span></p></td></tr><tr><td><p><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><a href="#%28part._analyzer%29" class="toptoclink" data-pltdoc="x">3<span class="hspace">&nbsp;</span>Analyzing Profile Data</a></p></td></tr><tr><td><p><span class="hspace"></span></p></td></tr><tr><td><p><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><a href="#%28part._renderers%29" class="toptoclink" data-pltdoc="x">4<span class="hspace">&nbsp;</span>Profile Renderers</a></p></td></tr><tr><td><p><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a href="#%28part._.Textual_.Rendering%29" class="toclink" data-pltdoc="x">4.1<span class="hspace">&nbsp;</span>Textual Rendering</a></p></td></tr><tr><td><p><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a href="#%28part._.Graph_.Rendering%29" class="toclink" data-pltdoc="x">4.2<span class="hspace">&nbsp;</span>Graph Rendering</a></p></td></tr></table><h3 x-source-module="(lib &quot;profile/scribblings/profile.scrbl&quot;)" x-source-pkg="profile-doc" x-part-tag="&quot;Toplevel_Interface&quot;">1<tt>&nbsp;</tt><a name="(part._.Toplevel_.Interface)"></a><a name="(mod-path._profile)"></a>Toplevel Interface</h3><p><a name="(idx._(gentag._0._(lib._profile/scribblings/profile..scrbl)))"></a>The profiler can be invoked directly from the command-line using the
<span class="stt">raco profile</span> command, which takes a file name as argument, and runs the
profiler on the <span class="RktSym">main</span> submodule of that file (if it exists), or on the
module itself (if there is no <span class="RktSym">main</span> submodule).

To allow control over its behavior, <span class="stt">raco profile</span> accepts flags that
correspond to those of <span class="RktSym"><a href="#%28def._%28%28lib._profile%2Fmain..rkt%29._profile-thunk%29%29" class="RktValLink" data-pltdoc="x">profile-thunk</a></span> below.</p><p><table cellspacing="0" cellpadding="0" class="defmodule"><tr><td align="left"><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&amp;version=6.7" class="RktStxLink Sq" data-pltdoc="x">require</a></span><span class="stt"> </span><a href="#%28mod-path._profile%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">profile</span></a><span class="RktPn">)</span></td><td align="right"><span class="RpackageSpec"><span class="Smaller">&nbsp;package:</span> <span class="stt">profile-lib</span></span></td></tr></table></p><p>This module provides one procedure and one macro that are convenient
high-level entry points for profiling expressions.  It abstracts over
details that are available through other parts of the library, and is
intended as a convenient tool for profiling code.</p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><table cellspacing="0" cellpadding="0" class="prototype RForeground"><tr><td valign="top"><span class="RktPn">(</span><a name="(def._((lib._profile/main..rkt)._profile-thunk))"></a><span title="Provided from: profile | Package: profile-lib"><span class="RktSym"><a href="#%28def._%28%28lib._profile%2Fmain..rkt%29._profile-thunk%29%29" class="RktValDef RktValLink" data-pltdoc="x">profile-thunk</a></span></span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="RktVar">thunk</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="hspace">&nbsp;</span></td></tr><tr><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="hspace">&nbsp;</span>[</td><td valign="top"><span class="RktPn">#:delay</span><span class="hspace">&nbsp;</span><span class="RktVar">delay</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="hspace">&nbsp;</span></td></tr><tr><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="RktPn">#:repeat</span><span class="hspace">&nbsp;</span><span class="RktVar">iterations</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="hspace">&nbsp;</span></td></tr><tr><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="RktPn">#:threads</span><span class="hspace">&nbsp;</span><span class="RktVar">threads?</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="hspace">&nbsp;</span></td></tr><tr><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="RktPn">#:render</span><span class="hspace">&nbsp;</span><span class="RktVar">renderer</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="hspace">&nbsp;</span></td></tr><tr><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="RktPn">#:periodic-renderer</span><span class="hspace">&nbsp;</span><span class="RktVar">periodic-renderer</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="hspace">&nbsp;</span></td></tr><tr><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="RktPn">#:use-errortrace?</span><span class="hspace">&nbsp;</span><span class="RktVar">use-errortrace?</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="hspace">&nbsp;</span></td></tr><tr><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="RktPn">#:order</span><span class="hspace">&nbsp;</span><span class="RktVar">order</span>]<span class="RktPn">)</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top">&rarr;</td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._any%252Fc%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">any/c</a></span></td></tr></table></blockquote></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">thunk</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=function-contracts.html%23%2528form._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._-%7E3e%2529%2529&amp;version=6.7" class="RktStxLink Sq" data-pltdoc="x"><span class="nobreak">-&gt;</span></a></span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._any%252Fc%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">any/c</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">delay</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._%7E3e%7E3d%252Fc%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">&gt;=/c</a></span><span class="hspace">&nbsp;</span><span class="RktVal">0.0</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>=<span class="hspace">&nbsp;</span><span class="RktVal">0.05</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">iterations</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=number-types.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._exact-nonnegative-integer%7E3f%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">exact-nonnegative-integer?</a></span><span class="hspace">&nbsp;</span>=<span class="hspace">&nbsp;</span><span class="RktVal">1</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">threads?</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._any%252Fc%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">any/c</a></span><span class="hspace">&nbsp;</span>=<span class="hspace">&nbsp;</span><span class="RktVal">#f</span></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="argcontract"><tr><td valign="top"><span class="hspace">&nbsp;&nbsp;</span></td><td valign="top"><span class="RktVar">renderer</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top">:</td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=function-contracts.html%23%2528form._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._-%7E3e%2529%2529&amp;version=6.7" class="RktStxLink Sq" data-pltdoc="x"><span class="nobreak">-&gt;</span></a></span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="#%28def._%28%28lib._profile%2Fanalyzer..rkt%29._profile~3f%29%29" class="RktValLink" data-pltdoc="x">profile?</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">topological</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">self</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">total</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._any%252Fc%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">any/c</a></span><span class="RktPn">)</span></td></tr><tr><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top">=</td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="RktSym"><a href="#%28def._%28%28lib._profile%2Frender-text..rkt%29._render%29%29" class="RktValLink" data-pltdoc="x">text:render</a></span></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="argcontract"><tr><td valign="top"><span class="hspace">&nbsp;&nbsp;</span></td><td valign="top"><span class="RktVar">periodic-renderer</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top">:</td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace">&nbsp;</span><span class="RktVal">#f</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._list%252Fc%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">list/c</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._%7E3e%7E3d%252Fc%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">&gt;=/c</a></span><span class="hspace">&nbsp;</span><span class="RktVal">0.0</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=function-contracts.html%23%2528form._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._-%7E3e%2529%2529&amp;version=6.7" class="RktStxLink Sq" data-pltdoc="x"><span class="nobreak">-&gt;</span></a></span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="#%28def._%28%28lib._profile%2Fanalyzer..rkt%29._profile~3f%29%29" class="RktValLink" data-pltdoc="x">profile?</a></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">topological</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">self</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">total</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._any%252Fc%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">any/c</a></span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top">=</td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="RktVal">#f</span></td></tr></table></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">use-errortrace?</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._any%252Fc%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">any/c</a></span><span class="hspace">&nbsp;</span>=<span class="hspace">&nbsp;</span><span class="RktVal">#f</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">order</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">topological</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">self</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">total</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>=<span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">topological</span></td></tr></table></blockquote></div><div class="SIntrapara">Executes the given <span class="RktVar">thunk</span> and collect profiling data during
execution, eventually analyzing and rendering this. Returns the value
of the profiled expression.
Keyword arguments can customize the profiling:
</div><div class="SIntrapara"><ul><li><p>The profiler works by starting a &ldquo;sampler&rdquo; thread to
periodically collect stack snapshots (using
<span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=contmarks.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._continuation-mark-set-%7E3econtext%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">continuation-mark-set-&gt;context</a></span>).  To determine the
frequency of these collections, the sampler thread sleeps
<span class="RktVar">delay</span> seconds between collections.  Note that this is will
be close, but not identical to, the frequency in which data is
actually sampled.  (The <span class="RktVar">delay</span> value is passed on to
<span class="RktSym"><a href="#%28def._%28%28lib._profile%2Fsampler..rkt%29._create-sampler%29%29" class="RktValLink" data-pltdoc="x">create-sampler</a></span>, which creates the sampler thread.)</p></li><li><p>Due to the statistical nature of the profiler, longer executions
result in more accurate analysis.  You can specify a number of
<span class="RktVar">iterations</span> to repeat the <span class="RktVar">thunk</span> to collect more
data.</p></li><li><p>Normally, the sampler collects only snapshots of the
<span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=threads.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._current-thread%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">current-thread</a></span>&rsquo;s stack.  Profiling a computation that
creates threads will therefore lead to bad analysis: the timing
results will be correct, but because the profiler is unaware of
other threads the observed time will be suspiciously small, and work
done in other threads will not be included in the results.  To track
all threads, specify a non-<span class="RktVal">#f</span> value for the
<span class="RktVar">threads?</span> argument&#8212;<wbr></wbr>this will execute the computation in a
fresh custodian, and keep track of all threads under this
custodian.</p></li><li><p>Once the computation is done and the sampler is stopped, the
accumulated data is analyzed (by <span class="RktSym"><a href="#%28def._%28%28lib._profile%2Fanalyzer..rkt%29._analyze-samples%29%29" class="RktValLink" data-pltdoc="x">analyze-samples</a></span>) and the
resulting profile value is sent to the <span class="RktVar">renderer</span> function.
See <a href="#%28part._renderers%29" data-pltdoc="x">Profile Renderers</a> for available renderers.</p></li><li><p>To provide feedback information during execution, specify a
<span class="RktVar">periodic-renderer</span>.  This should be a list holding a delay
time (in seconds) and a renderer function.  The delay determines the
frequency in which the renderer is called, and it should be larger
than the sampler delay (usually much larger since it can involve
more noticeable overhead, and it is intended for a human observer).</p></li><li><p><div class="SIntrapara">When <span class="RktVar">use-errortrace?</span> is not <span class="RktVal">#f</span>, more accurate stack
snapshots are captured using <a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=errortrace&amp;rel=index.html&amp;version=6.7" class="Sq" data-pltdoc="x">Errortrace</a>. Note that when this
is provided, it will only profile uncompiled files and files compiled while
using <span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=errortrace&amp;rel=errortrace-library.html%23%2528def._%2528%2528lib._errortrace%252Ferrortrace-lib..rkt%2529._errortrace-compile-handler%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">errortrace-compile-handler</a></span>, and the profiled program must be
run using </div><div class="SIntrapara"><span class="hspace">&nbsp;&nbsp;</span><span class="stt">racket -l errortrace -t program.rkt</span></div><div class="SIntrapara"> Removing compiled
files (with extension <span class="stt">.zo</span>) is sufficient to enable this.</div></p></li><li><p>The <span class="RktVar">order</span> value is passed to the <span class="RktVar">renderer</span> to control the
order of its output. By default, entries in the profile are sorted
topologically, but they can also be sorted by the time an entry is on top of
the stack (<span class="RktVal">'</span><span class="RktVal">self</span>) or appears anywhere on the stack (<span class="RktVal">'</span><span class="RktVal">total</span>).
Some renderers may ignore this option.</p></li></ul></div></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>syntax</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(form._((lib._profile/main..rkt)._profile))"></a><span title="Provided from: profile | Package: profile-lib"><span class="RktSym"><a href="#%28form._%28%28lib._profile%2Fmain..rkt%29._profile%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">profile</a></span></span><span class="hspace">&nbsp;</span><span class="RktVar">expr</span><span class="hspace">&nbsp;</span><span class="RktVar">keyword-arguments</span><span class="hspace">&nbsp;</span><span class="RktMeta">...</span><span class="RktPn">)</span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">A macro version of <span class="RktSym"><a href="#%28def._%28%28lib._profile%2Fmain..rkt%29._profile-thunk%29%29" class="RktValLink" data-pltdoc="x">profile-thunk</a></span>.  Keyword arguments can be
specified as in a function call: they can appear before and/or after
the expression to be profiled.</div></p><h3 x-source-module="(lib &quot;profile/scribblings/profile.scrbl&quot;)" x-source-pkg="profile-doc" x-part-tag="&quot;sampler&quot;">2<tt>&nbsp;</tt><a name="(part._sampler)"></a><a name="(mod-path._profile/sampler)"></a>Collecting Profile Information</h3><p><table cellspacing="0" cellpadding="0" class="defmodule"><tr><td align="left"><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&amp;version=6.7" class="RktStxLink Sq" data-pltdoc="x">require</a></span><span class="stt"> </span><a href="#%28mod-path._profile%2Fsampler%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">profile/sampler</span></a><span class="RktPn">)</span></td><td align="right"><span class="RpackageSpec"><span class="Smaller">&nbsp;package:</span> <span class="stt">profile-lib</span></span></td></tr></table></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><table cellspacing="0" cellpadding="0" class="prototype RForeground"><tr><td valign="top"><span class="RktPn">(</span><a name="(def._((lib._profile/sampler..rkt)._create-sampler))"></a><span title="Provided from: profile/sampler | Package: profile-lib"><span class="RktSym"><a href="#%28def._%28%28lib._profile%2Fsampler..rkt%29._create-sampler%29%29" class="RktValDef RktValLink" data-pltdoc="x">create-sampler</a></span></span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="RktVar">to-track</span></td><td valign="top"><span class="hspace">&nbsp;</span></td></tr><tr><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="RktVar">delay</span></td><td valign="top"><span class="hspace">&nbsp;</span></td></tr><tr><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="hspace">&nbsp;</span>[</td><td valign="top"><span class="RktVar">super-cust</span></td><td valign="top"><span class="hspace">&nbsp;</span></td></tr><tr><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="RktVar">custom-keys</span></td><td valign="top"><span class="hspace">&nbsp;</span></td></tr><tr><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="RktPn">#:use-errortrace?</span><span class="hspace">&nbsp;</span><span class="RktVar">use-errortrace?</span>]<span class="RktPn">)</span></td><td valign="top"><span class="hspace">&nbsp;</span></td></tr></table></blockquote></td></tr><tr><td><span class="hspace">&nbsp;</span>&rarr;<span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=symbols.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._symbol%7E3f%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">symbol?</a></span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._any%252Fc%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">any/c</a></span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">. </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=function-contracts.html%23%2528form._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._-%7E3e%252A%2529%2529&amp;version=6.7" class="RktStxLink Sq" data-pltdoc="x"><span class="nobreak">-&gt;</span>*</a></span><span class="RktPn"> .</span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._any%252Fc%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">any/c</a></span><span class="RktPn">)</span></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="argcontract"><tr><td valign="top"><span class="hspace">&nbsp;&nbsp;</span></td><td valign="top"><span class="RktVar">to-track</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top">:</td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=threads.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._thread%7E3f%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">thread?</a></span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=custodians.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._custodian%7E3f%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">custodian?</a></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._listof%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">listof</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=threads.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._thread%7E3f%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">thread?</a></span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=custodians.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._custodian%7E3f%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">custodian?</a></span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr></table></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">delay</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._%7E3e%7E3d%252Fc%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">&gt;=/c</a></span><span class="hspace">&nbsp;</span><span class="RktVal">0.0</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">super-cust</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=custodians.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._custodian%7E3f%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">custodian?</a></span><span class="hspace">&nbsp;</span>=<span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=custodians.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._current-custodian%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">current-custodian</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">custom-keys</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._listof%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">listof</a></span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._any%252Fc%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">any/c</a></span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>=<span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">use-errortrace?</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._any%252Fc%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">any/c</a></span><span class="hspace">&nbsp;</span>=<span class="hspace">&nbsp;</span><span class="RktVal">#f</span></td></tr></table></blockquote></div><div class="SIntrapara">Creates a stack-snapshot collector thread, which tracks the given
<span class="RktVar">to-track</span> value every <span class="RktVar">delay</span> seconds.  The
<span class="RktVar">to-track</span> value can be either a thread (track just that
thread), a custodian (track all threads managed by the custodian), or
a list of threads and/or custodians.  If a custodian is given, it must
be subordinate to <span class="RktVar">super-cust</span>, which defaults to the current
custodian.</div></p><p>When <span class="RktVar">custom-keys</span> are provided, the sampler takes snapshots of the
continuation marks corresponding to the given keys, in addition to taking
snapshots of the stack.</p><p>When <span class="RktVar">use-errortrace?</span> is not <span class="RktVal">#f</span>, the <span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=errortrace&amp;rel=Errortrace_Key.html%23%2528def._%2528%2528lib._errortrace%252Ferrortrace-key..rkt%2529._errortrace-key%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">errortrace-key</a></span> is
used to sample snapshots instead of the implicit key used by
<span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=contmarks.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._continuation-mark-set-%7E3econtext%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">continuation-mark-set-&gt;context</a></span>.</p><p><div class="SIntrapara">The resulting value is a controller function, which consumes a message
consisting of a symbol and an optional argument, and can affect the
sampler.  The following messages are currently supported:
</div><div class="SIntrapara"><ul><li><p><span class="RktVal">'</span><span class="RktVal">pause</span> and <span class="RktVal">'</span><span class="RktVal">resume</span> will stop or resume
snapshot collection.  These messages can be nested.  Note that the
thread will continue running&#8212;<wbr></wbr>it will just stop collecting
snapshots.</p></li><li><p><span class="RktVal">'</span><span class="RktVal">stop</span> kills the sampler thread.  It should be called
when no additional data should be collected.  (This is currently
irreversible: there is no message to start a new sampler thread.)</p></li><li><p><span class="RktVal">'</span><span class="RktVal">set-tracked!</span> with a value will change the tracked
object(s) which were initially specified as the <span class="RktVar">to-track</span>
argument.</p></li><li><p><span class="RktVal">'</span><span class="RktVal">set-tracked!</span> with a numeric value will change the
delay that the sampler is taking between snapshots.  Note that
although changing this means that the snapshots are not uniformly
distributed, the results will still be correct: the cpu time between
samples is taken into account when the collected data is analyzed.</p></li><li><p>A <span class="RktVal">'</span><span class="RktVal">get-snapshots</span> message will make the controller return
the currently collected data.  Note that this can be called multiple
times, each call will return the data that is collected up to that
point in time.  In addition, it can be (and usually is) called after
the sampler was stopped.</p><p>The value that is returned should be considered as an undocumented
internal detail of the profiler, intended to be sent to
<span class="RktSym"><a href="#%28def._%28%28lib._profile%2Fanalyzer..rkt%29._analyze-samples%29%29" class="RktValLink" data-pltdoc="x">analyze-samples</a></span> for analysis.  The reason this is not done
automatically, is that a future extension might allow you to combine
several sampler results, making it possible to combine a profile
analysis from several individual runs, possibly from different
machines.</p></li><li><p>Finally, a <span class="RktVal">'</span><span class="RktVal">get-custom-snapshots</span> message will make the
controller return the currently collected snapshots corresponding to
<span class="RktVar">custom-keys</span>. This returns a list of samples, where each sample
is a list of vectors of marks in the same format as the output of
<span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=contmarks.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._continuation-mark-set-%7E3elist%252A%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">continuation-mark-set-&gt;list*</a></span>.</p></li></ul></div></p><h3 x-source-module="(lib &quot;profile/scribblings/profile.scrbl&quot;)" x-source-pkg="profile-doc" x-part-tag="&quot;analyzer&quot;">3<tt>&nbsp;</tt><a name="(part._analyzer)"></a><a name="(mod-path._profile/analyzer)"></a>Analyzing Profile Data</h3><p><table cellspacing="0" cellpadding="0" class="defmodule"><tr><td align="left"><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&amp;version=6.7" class="RktStxLink Sq" data-pltdoc="x">require</a></span><span class="stt"> </span><a href="#%28mod-path._profile%2Fanalyzer%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">profile/analyzer</span></a><span class="RktPn">)</span></td><td align="right"><span class="RpackageSpec"><span class="Smaller">&nbsp;package:</span> <span class="stt">profile-lib</span></span></td></tr></table></p><p>Once a profile run is done and the results are collected, the next
step is to analyze the data.  In this step sample times are computed
and summed, a call-graph representing observed function calls is
built, and per-node and per-edge information is created.  This is the
job of the main function provided by <span class="RktSym">profile/analyzer</span>.</p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._profile/analyzer..rkt)._analyze-samples))"></a><span title="Provided from: profile/analyzer | Package: profile-lib"><span class="RktSym"><a href="#%28def._%28%28lib._profile%2Fanalyzer..rkt%29._analyze-samples%29%29" class="RktValDef RktValLink" data-pltdoc="x">analyze-samples</a></span></span><span class="hspace">&nbsp;</span><span class="RktVar">raw-sample-data</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>&rarr;<span class="hspace">&nbsp;</span><span class="RktSym"><a href="#%28def._%28%28lib._profile%2Fanalyzer..rkt%29._profile~3f%29%29" class="RktValLink" data-pltdoc="x">profile?</a></span></p></blockquote></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">raw-sample-data</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._any%252Fc%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">any/c</a></span></td></tr></table></blockquote></div><div class="SIntrapara">This function consumes the raw result of the
<a href="#%28part._sampler%29" data-pltdoc="x">sampler</a> (given in an undocumented form), analyzes
it, and returns a <span class="RktSym"><a href="#%28def._%28%28lib._profile%2Fanalyzer..rkt%29._profile%29%29" class="RktValLink" data-pltdoc="x">profile</a></span> value holding the analyzed results.
Without this function, the results of the sampler should be considered
meaningless.</div></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>struct</p></div></div><table cellspacing="0" cellpadding="0" class="RForeground"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=define-struct.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._struct%2529%2529&amp;version=6.7" class="RktStxLink Sq" data-pltdoc="x">struct</a></span></td><td><span class="hspace">&nbsp;</span></td><td><span class="nobreak"><a name="(def._((lib._profile/analyzer..rkt)._profile-*-node))"></a><a name="(def._((lib._profile/analyzer..rkt)._profile-nodes))"></a><a name="(def._((lib._profile/analyzer..rkt)._profile-thread-times))"></a><a name="(def._((lib._profile/analyzer..rkt)._profile-sample-number))"></a><a name="(def._((lib._profile/analyzer..rkt)._profile-cpu-time))"></a><a name="(def._((lib._profile/analyzer..rkt)._profile-total-time))"></a><a name="(def._((lib._profile/analyzer..rkt)._profile~3f))"></a><a name="(def._((lib._profile/analyzer..rkt)._struct~3aprofile))"></a><a name="(def._((lib._profile/analyzer..rkt)._profile))"></a><span title="Provided from: profile/analyzer | Package: profile-lib"><span class="RktSym"><a href="#%28def._%28%28lib._profile%2Fanalyzer..rkt%29._profile%29%29" class="RktValDef RktValLink" data-pltdoc="x">profile</a></span></span></span></td><td><span class="hspace">&nbsp;</span><span class="RktPn">(</span></td><td><span class="nobreak"><span class="RktSym">total-time</span></span></td></tr><tr><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="RktSym">cpu-time</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="RktSym">sample-number</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="RktSym">thread-times</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="RktSym">nodes</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="RktSym">*-node</span><span class="RktPn">))</span></td></tr></table></blockquote></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktSym">total-time</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=number-types.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._exact-nonnegative-integer%7E3f%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">exact-nonnegative-integer?</a></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktSym">cpu-time</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=number-types.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._exact-nonnegative-integer%7E3f%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">exact-nonnegative-integer?</a></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktSym">sample-number</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=number-types.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._exact-nonnegative-integer%7E3f%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">exact-nonnegative-integer?</a></span></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="argcontract"><tr><td valign="top"><span class="hspace">&nbsp;&nbsp;</span></td><td valign="top"><span class="RktSym">thread-times</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top">:</td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._listof%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">listof</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=pairs.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._cons%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">cons</a></span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=number-types.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._exact-nonnegative-integer%7E3f%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">exact-nonnegative-integer?</a></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=number-types.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._exact-nonnegative-integer%7E3f%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">exact-nonnegative-integer?</a></span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr></table></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktSym">nodes</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._listof%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">listof</a></span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="#%28def._%28%28lib._profile%2Fanalyzer..rkt%29._node~3f%29%29" class="RktValLink" data-pltdoc="x">node?</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktSym">*-node</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="#%28def._%28%28lib._profile%2Fanalyzer..rkt%29._node~3f%29%29" class="RktValLink" data-pltdoc="x">node?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Represents an analyzed profile result.</div></p><ul><li><p><span class="RktSym">total-time</span> is the total observed time (in milliseconds)
included in the profile run.  This can be different from the actual
time the profiling took, due to unaccounted-for time spent in
untracked threads.  (E.g., time spent in the sampler thread
itself.)</p></li><li><p><span class="RktSym">cpu-time</span> is the actual cpu time consumed by the process
during the profiler&rsquo;s work.</p></li><li><p><span class="RktSym">sample-number</span> holds the number of samples taken during
the profile.  This can be used to compute the average time frame
each of the input samples represented.</p></li><li><p><span class="RktSym">thread-times</span> holds an association list mapping thread
identifiers to cpu time for the corresponding threads.  As samples
are collected, each thread that is observed is assigned a small
integer identifier.  These identifiers are listed for each function
call, and the total time spent in each thread is in this field.</p></li><li><p><span class="RktSym">nodes</span> is a list of nodes representing all observed functions
(or, when using Errortrace, expressions).  These nodes are the components of
the call-graph that the analyzer assembles (see the <span class="RktSym"><a href="#%28def._%28%28lib._profile%2Fanalyzer..rkt%29._edge%29%29" class="RktValLink" data-pltdoc="x">edge</a></span> field).
The nodes are sorted by a topological top-to-bottom sort, and by decreasing
total amount of time (time spent either in the function or in its callees) as
a secondary key.  It does not include the special <span class="RktSym">*-node</span>.</p></li><li><p><span class="RktSym">*-node</span> holds a &ldquo;special&rdquo; root node value that is
constructed for every call graph.  This node is used as the caller
for all top-level function nodes and as the callee for all leaf
nodes.  It can therefore be used to start a recursive scan of the
call graph.  In addition, the times associated with its &ldquo;callers&rdquo;
and &ldquo;callees&rdquo; actually represent the time these functions spent
being the root of the computation or its leaf.  (This can be
different from a node&rsquo;s &ldquo;self&rdquo; time, since it is divided by the
number of instances a function had on the stack in each sample&#8212;<wbr></wbr>so
for recursive functions this value is always different from the
&ldquo;self&rdquo; time.)</p></li></ul><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>struct</p></div></div><p class="RForeground"><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=define-struct.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._struct%2529%2529&amp;version=6.7" class="RktStxLink Sq" data-pltdoc="x">struct</a></span><span class="stt"> </span><a name="(def._((lib._profile/analyzer..rkt)._node-callees))"></a><a name="(def._((lib._profile/analyzer..rkt)._node-callers))"></a><a name="(def._((lib._profile/analyzer..rkt)._node-self))"></a><a name="(def._((lib._profile/analyzer..rkt)._node-total))"></a><a name="(def._((lib._profile/analyzer..rkt)._node-thread-ids))"></a><a name="(def._((lib._profile/analyzer..rkt)._node-src))"></a><a name="(def._((lib._profile/analyzer..rkt)._node-id))"></a><a name="(def._((lib._profile/analyzer..rkt)._node~3f))"></a><a name="(def._((lib._profile/analyzer..rkt)._struct~3anode))"></a><a name="(def._((lib._profile/analyzer..rkt)._node))"></a><span title="Provided from: profile/analyzer | Package: profile-lib"><span class="RktSym"><a href="#%28def._%28%28lib._profile%2Fanalyzer..rkt%29._node%29%29" class="RktValDef RktValLink" data-pltdoc="x">node</a></span></span><span class="stt"> </span><span class="RktPn">(</span><span class="RktSym">id</span><span class="stt"> </span><span class="RktSym">src</span><span class="stt"> </span><span class="RktSym">thread-ids</span><span class="stt"> </span><span class="RktSym">total</span><span class="stt"> </span><span class="RktSym">self</span><span class="stt"> </span><span class="RktSym">callers</span><span class="stt"> </span><span class="RktSym">callees</span><span class="RktPn">)</span><span class="RktPn">)</span></p></blockquote></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktSym">id</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace">&nbsp;</span><span class="RktVal">#f</span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=symbols.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._symbol%7E3f%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">symbol?</a></span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._any%252Fc%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">any/c</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktSym">src</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace">&nbsp;</span><span class="RktVal">#f</span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=exns.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._srcloc%7E3f%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">srcloc?</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktSym">thread-ids</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._listof%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">listof</a></span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=number-types.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._exact-nonnegative-integer%7E3f%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">exact-nonnegative-integer?</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktSym">total</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=number-types.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._exact-nonnegative-integer%7E3f%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">exact-nonnegative-integer?</a></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktSym">self</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=number-types.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._exact-nonnegative-integer%7E3f%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">exact-nonnegative-integer?</a></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktSym">callers</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._listof%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">listof</a></span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="#%28def._%28%28lib._profile%2Fanalyzer..rkt%29._edge~3f%29%29" class="RktValLink" data-pltdoc="x">edge?</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktSym">callees</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._listof%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">listof</a></span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="#%28def._%28%28lib._profile%2Fanalyzer..rkt%29._edge~3f%29%29" class="RktValLink" data-pltdoc="x">edge?</a></span><span class="RktPn">)</span></td></tr></table></blockquote></div><div class="SIntrapara">Represents a function call (or, when using Errortrace, expression) node in the
call graph of an analyzed profile result.</div></p><ul><li><p>The <span class="RktSym">id</span> and <span class="RktSym">src</span> fields hold a symbol naming the function
(in <span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=contmarks.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._continuation-mark-set-%7E3econtext%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">continuation-mark-set-&gt;context</a></span> mode) or an S-expression stub (in
Errortrace mode), and/or its source location as a <span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=exns.html%23%2528def._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._srcloc%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">srcloc</a></span> value.
This is the same as the results of <span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=contmarks.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._continuation-mark-set-%7E3econtext%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">continuation-mark-set-&gt;context</a></span>,
so at most one of these can be <span class="RktVal">#f</span>, except for the special
<span class="RktSym">*-node</span> (see the <span class="RktSym"><a href="#%28def._%28%28lib._profile%2Fanalyzer..rkt%29._profile%29%29" class="RktValLink" data-pltdoc="x">profile</a></span> struct) that can be identified by
both being <span class="RktVal">#f</span>.</p></li><li><p><span class="RktSym">thread-ids</span> holds a list of thread identifiers that were
observed executing this function.</p></li><li><p><span class="RktSym">total</span> holds the total time (in milliseconds) that this function
(or expression) was anywhere on the stack.  It is common to see a few
toplevel functions that have close to a 100% total time, but otherwise small
<span class="RktSym">self</span> times&#8212;<wbr></wbr>these functions are the ones that initiate the actual
work, but they don&rsquo;t do any hard work directly.</p></li><li><p><span class="RktSym">self</span> holds the total time (in milliseconds) that this function
(or expression) was observed as the leaf of the stack.  It represents the
actual work done by this function, rather than the <span class="RktSym">total</span> time spent
by both the function and its callees.</p></li><li><p><span class="RktSym">callers</span> and <span class="RktSym">callees</span> hold the list of callers and
callees or, in Errortrace modes, expressions that step to or from the current
expression.  The nodes are not actually held in these lists, instead,
<span class="RktSym"><a href="#%28def._%28%28lib._profile%2Fanalyzer..rkt%29._edge%29%29" class="RktValLink" data-pltdoc="x">edge</a></span> values are used&#8212;<wbr></wbr>and provide information specific to each edge
in the call-graph.</p></li></ul><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>struct</p></div></div><p class="RForeground"><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=define-struct.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._struct%2529%2529&amp;version=6.7" class="RktStxLink Sq" data-pltdoc="x">struct</a></span><span class="stt"> </span><a name="(def._((lib._profile/analyzer..rkt)._edge-callee-time))"></a><a name="(def._((lib._profile/analyzer..rkt)._edge-callee))"></a><a name="(def._((lib._profile/analyzer..rkt)._edge-caller-time))"></a><a name="(def._((lib._profile/analyzer..rkt)._edge-caller))"></a><a name="(def._((lib._profile/analyzer..rkt)._edge-total))"></a><a name="(def._((lib._profile/analyzer..rkt)._edge~3f))"></a><a name="(def._((lib._profile/analyzer..rkt)._struct~3aedge))"></a><a name="(def._((lib._profile/analyzer..rkt)._edge))"></a><span title="Provided from: profile/analyzer | Package: profile-lib"><span class="RktSym"><a href="#%28def._%28%28lib._profile%2Fanalyzer..rkt%29._edge%29%29" class="RktValDef RktValLink" data-pltdoc="x">edge</a></span></span><span class="stt"> </span><span class="RktPn">(</span><span class="RktSym">total</span><span class="stt"> </span><span class="RktSym">caller</span><span class="stt"> </span><span class="RktSym">caller-time</span><span class="stt"> </span><span class="RktSym">callee</span><span class="stt"> </span><span class="RktSym">callee-time</span><span class="RktPn">)</span><span class="RktPn">)</span></p></blockquote></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktSym">total</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=number-types.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._exact-nonnegative-integer%7E3f%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">exact-nonnegative-integer?</a></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktSym">caller</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="#%28def._%28%28lib._profile%2Fanalyzer..rkt%29._node~3f%29%29" class="RktValLink" data-pltdoc="x">node?</a></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktSym">caller-time</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=number-types.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._exact-nonnegative-integer%7E3f%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">exact-nonnegative-integer?</a></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktSym">callee</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="#%28def._%28%28lib._profile%2Fanalyzer..rkt%29._node~3f%29%29" class="RktValLink" data-pltdoc="x">node?</a></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktSym">callee-time</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=number-types.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._exact-nonnegative-integer%7E3f%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">exact-nonnegative-integer?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Represents an edge between two function call nodes in the call graph of an
analyzed profile result or, in Errortrace mode, an edge corresponding to an
evaluation step between two expressions.</div></p><ul><li><p><span class="RktSym">total</span> is analogous to the <span class="RktSym">total</span> field of a
<span class="RktSym"><a href="#%28def._%28%28lib._profile%2Fanalyzer..rkt%29._node%29%29" class="RktValLink" data-pltdoc="x">node</a></span> value: the total time that this edge was anywhere on
the stack.</p></li><li><p><span class="RktSym">caller</span> and <span class="RktSym">callee</span> hold the two nodes that are
connected by this edge.</p></li><li><p><span class="RktSym">caller-time</span> and <span class="RktSym">callee-time</span> hold the time
spent on this edge from the caller&rsquo;s or the callee&rsquo;s perspective.
These times are different from each other (as well as from the total
time) because the sums that make them are each divided by the number
of times the caller or the callee was on the stack.</p><p>To understand this difference, consider a stack snapshot holding
<span class="stt">A </span><span class="stt">&rarr;</span><span class="stt"> B </span><span class="stt">&rarr;</span><span class="stt"> B </span><span class="stt">&rarr;</span><span class="stt"> B </span><span class="stt">&rarr;</span><span class="stt"> A</span>, and representing a
second of observed cpu time.  For this sample, the <span class="stt">A </span><span class="stt">&rarr;</span><span class="stt"> B</span>
edge is charged by a whole second for its total time (the same goes
for the <span class="stt">A </span><span class="stt">&rarr;</span><span class="stt"> A</span> edge, for example).  Its caller time is
charged 1/2 second because <span class="stt">A</span> appears twice in this stack
snapshot (in the other half, <span class="stt">A</span> is charged for being a leaf &#8212;<wbr></wbr>
the caller of the special <span class="RktSym">*-node</span>), and its callee time is
charged 1/3 respectively.</p></li></ul><h3 x-source-module="(lib &quot;profile/scribblings/profile.scrbl&quot;)" x-source-pkg="profile-doc" x-part-tag="&quot;renderers&quot;">4<tt>&nbsp;</tt><a name="(part._renderers)"></a>Profile Renderers</h3><p>After collecting the profile samples and analyzing the data, the last
step of the profiling process is to render the results.  The profile
collection provides several renderers, each providing a rendering
function that consumes a <span class="RktSym"><a href="#%28def._%28%28lib._profile%2Fanalyzer..rkt%29._profile%29%29" class="RktValLink" data-pltdoc="x">profile</a></span> instance.  See the
<a href="#%28part._analyzer%29" data-pltdoc="x">analyzer</a> section for a description of the
<span class="RktSym"><a href="#%28def._%28%28lib._profile%2Fanalyzer..rkt%29._profile%29%29" class="RktValLink" data-pltdoc="x">profile</a></span> struct if you want to implement a new renderer.</p><h4 x-source-module="(lib &quot;profile/scribblings/profile.scrbl&quot;)" x-source-pkg="profile-doc" x-part-tag="&quot;Textual_Rendering&quot;">4.1<tt>&nbsp;</tt><a name="(part._.Textual_.Rendering)"></a><a name="(mod-path._profile/render-text)"></a>Textual Rendering</h4><p><table cellspacing="0" cellpadding="0" class="defmodule"><tr><td align="left"><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&amp;version=6.7" class="RktStxLink Sq" data-pltdoc="x">require</a></span><span class="stt"> </span><a href="#%28mod-path._profile%2Frender-text%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">profile/render-text</span></a><span class="RktPn">)</span></td><td align="right"><span class="RpackageSpec"><span class="Smaller">&nbsp;package:</span> <span class="stt">profile-lib</span></span></td></tr></table></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><table cellspacing="0" cellpadding="0" class="prototype RForeground"><tr><td valign="top"><span class="RktPn">(</span><a name="(def._((lib._profile/render-text..rkt)._render))"></a><span title="Provided from: profile/render-text | Package: profile-lib"><span class="RktSym"><span class="RktSymDef RktSym">render</span></span></span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="RktVar">profile-data</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="hspace">&nbsp;</span></td></tr><tr><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="hspace">&nbsp;</span>[</td><td valign="top"><span class="RktVar">order</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="hspace">&nbsp;</span></td></tr><tr><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="RktPn">#:truncate-source</span><span class="hspace">&nbsp;</span><span class="RktVar">truncate-source</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="hspace">&nbsp;</span></td></tr><tr><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="RktPn">#:hide-self</span><span class="hspace">&nbsp;</span><span class="RktVar">hide-self%</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="hspace">&nbsp;</span></td></tr><tr><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="RktPn">#:hide-subs</span><span class="hspace">&nbsp;</span><span class="RktVar">hide-subs%</span>]<span class="RktPn">)</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top">&rarr;</td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=void.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._void%7E3f%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">void?</a></span></td></tr></table></blockquote></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">profile-data</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="#%28def._%28%28lib._profile%2Fanalyzer..rkt%29._profile~3f%29%29" class="RktValLink" data-pltdoc="x">profile?</a></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">order</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">topological</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">self</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">total</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>=<span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">topological</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">truncate-source</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=number-types.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._exact-nonnegative-integer%7E3f%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">exact-nonnegative-integer?</a></span><span class="hspace">&nbsp;</span>=<span class="hspace">&nbsp;</span><span class="RktVal">50</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">hide-self%</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._between%252Fc%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">between/c</a></span><span class="hspace">&nbsp;</span><span class="RktVal">0</span><span class="hspace">&nbsp;</span><span class="RktVal">1</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>=<span class="hspace">&nbsp;</span><span class="RktVal">1/100</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">hide-subs%</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._between%252Fc%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">between/c</a></span><span class="hspace">&nbsp;</span><span class="RktVal">0</span><span class="hspace">&nbsp;</span><span class="RktVal">1</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>=<span class="hspace">&nbsp;</span><span class="RktVal">1/50</span></td></tr></table></blockquote></div><div class="SIntrapara">Prints the given <span class="RktSym"><a href="#%28def._%28%28lib._profile%2Fanalyzer..rkt%29._profile%29%29" class="RktValLink" data-pltdoc="x">profile</a></span> results as a textual table.</div></p><p>The printout begins with general information about the profile,
followed by a table with an entry for each node in the call graph.
The entries are displayed in a topological order by default (roughly, since the
graph can have cycles).  This means that it is usually easy to find
the callers and callees of a function in its close environment.</p><p><div class="SIntrapara">Each row in the table has the following format:
</div><div class="SIntrapara"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="hspace">&nbsp;&nbsp;</span><span class="stt"></span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="stt">B [M1] M2%</span></p></td></tr><tr><td><p><span class="hspace">&nbsp;&nbsp;</span><span class="stt">[N1] N2(N3%) N4(N5%)</span><span class="hspace">&nbsp;&nbsp;</span><span class="stt">A ...path/to/source.rkt:12:34</span></p></td></tr><tr><td><p><span class="hspace">&nbsp;&nbsp;</span><span class="stt"></span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="stt">C [M3] M4%</span></p></td></tr></table></div><div class="SIntrapara">with the following meaning of the numbers and labels:</div></p><ul><li><p><span class="stt">A</span> &#8212;<wbr></wbr> the name of the function (or a stub of the expression) that
this node represents, followed by the source location for the function if it
is known.  The name can be &ldquo;???&rdquo; for anonymous functions, which will be
identified with their source location.</p></li><li><p><span class="stt">N1</span> &#8212;<wbr></wbr> an integer label associated with this node in the
printout.  This label is used to mark references to this function/expression,
since symbolic names are not unique (and they can be missing or very
long).  The labels are assigned from the top.</p></li><li><p><span class="stt">N2</span> &#8212;<wbr></wbr> the time (in milliseconds) that this function/expression has
been anywhere in a stack snapshot.  This is the total time that the
execution was somewhere in this function/expression or in its callees.
(Corresponds to the <span class="RktSym"><a href="#%28def._%28%28lib._profile%2Fanalyzer..rkt%29._node-total%29%29" class="RktValLink" data-pltdoc="x">node-total</a></span> field.)</p></li><li><p><span class="stt">N3</span> &#8212;<wbr></wbr> this is the percentage of the node&rsquo;s total time
(<span class="stt">N2</span>) from the total observed time of the profile.  An entry
with a 100% refers to a function/expression that was active throughout
the whole execution.</p></li><li><p><span class="stt">N4</span> &#8212;<wbr></wbr> the time (in milliseconds) that this function/expression has
been at the top of the stack snapshot.  This is the time that this
function/expression was itself doing work rather than calling other
functions/expressions. (Corresponds to the <span class="RktSym"><a href="#%28def._%28%28lib._profile%2Fanalyzer..rkt%29._node-self%29%29" class="RktValLink" data-pltdoc="x">node-self</a></span> field.)</p></li><li><p><span class="stt">N5</span> &#8212;<wbr></wbr> this is the percentage of <span class="stt">N4</span> out of the total
observed time of the profile.  Functions/expressions with high values here can
be good candidates for optimization, But, of course, they can
represent doing real work for a caller that needs to be optimized.</p></li><li><p><span class="stt">B</span> and <span class="stt">C</span> &#8212;<wbr></wbr> these are labels for the callers and
callees of the function/expression.  Any number of callers and callees can
appear here (including 0).  The function/expression itself can also appear in
both places if it is (non-tail) recursive.</p></li><li><p><span class="stt">M1</span> and <span class="stt">M3</span> &#8212;<wbr></wbr> the index numbers for <span class="stt">B</span> and
<span class="stt">C</span>.  They can be used to disambiguate functions with the same
name, as well as a quick way to find the corresponding entry in the
table.</p></li><li><p><span class="stt">M2</span> and <span class="stt">M4</span> &#8212;<wbr></wbr> the percentages of the time <span class="stt">A</span> spent
being called by <span class="stt">B</span> and calling <span class="stt">C</span>.  These percentages
represent the time that this edge was found on a stack snapshot,
divided by the number of occurrences of <span class="stt">A</span> on the same snapshot.
The number is the percentage of these times out of <span class="stt">N2</span>, the
total time <span class="stt">A</span> has been active.</p><p>The total percentages for the all caller and for all callees should
be close to 100% minus the time <span class="stt">A</span> was the leaf or the root.</p><p>These values correspond to the <span class="RktSym"><a href="#%28def._%28%28lib._profile%2Fanalyzer..rkt%29._edge-caller-time%29%29" class="RktValLink" data-pltdoc="x">edge-caller-time</a></span> and
<span class="RktSym"><a href="#%28def._%28%28lib._profile%2Fanalyzer..rkt%29._edge-callee-time%29%29" class="RktValLink" data-pltdoc="x">edge-callee-time</a></span> fields; see the documentation for further
details.</p></li></ul><p><div class="SIntrapara">The function has a few keyword arguments to customize its output:
</div><div class="SIntrapara"><ul><li><p>The <span class="RktVar">truncate-source</span> argument determines the length that
the source string should take (together with its label).</p></li><li><p><span class="RktVar">hide-self%</span> and <span class="RktVar">hide-subs%</span> control hiding some
of the nodes.  A node is hidden if its self time (<span class="stt">N3</span> in the
above example) is smaller than <span class="RktVar">hide-self%</span> <span style="font-style: italic">and</span> if all
places where it occurs as a caller or a callee have percentages that
are smaller than <span class="RktVar">hide-subs%</span>.  The reason for requiring both
conditions is to avoid having &ldquo;dangling references&rdquo; to hidden
nodes.</p></li><li><p>The <span class="RktVar">order</span> argument determines the order in which entries
appear in the output. If <span class="RktVar">order</span> is <span class="RktVal">'</span><span class="RktVal">topological</span> (the default),
entries are sorted topologically, grouping callers and callees close together.
If <span class="RktVar">order</span> is <span class="RktVal">'</span><span class="RktVal">self</span>, entries are sorted by how often
they appear at the top of a stack snapshot. If <span class="RktVar">order</span> is <span class="RktVal">'</span><span class="RktVal">total</span>,
entries are sorted by how often they appear anywhere in a stack snapshot.</p></li></ul></div></p><h4 x-source-module="(lib &quot;profile/scribblings/profile.scrbl&quot;)" x-source-pkg="profile-doc" x-part-tag="&quot;Graph_Rendering&quot;">4.2<tt>&nbsp;</tt><a name="(part._.Graph_.Rendering)"></a><a name="(mod-path._profile/render-graphviz)"></a>Graph Rendering</h4><p><table cellspacing="0" cellpadding="0" class="defmodule"><tr><td align="left"><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&amp;version=6.7" class="RktStxLink Sq" data-pltdoc="x">require</a></span><span class="stt"> </span><a href="#%28mod-path._profile%2Frender-graphviz%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">profile/render-graphviz</span></a><span class="RktPn">)</span></td><td align="right"><span class="RpackageSpec"><span class="Smaller">&nbsp;package:</span> <span class="stt">profile-lib</span></span></td></tr></table></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><table cellspacing="0" cellpadding="0" class="prototype RForeground"><tr><td valign="top"><span class="RktPn">(</span><a name="(def._((lib._profile/render-graphviz..rkt)._render))"></a><span title="Provided from: profile/render-graphviz | Package: profile-lib"><span class="RktSym"><span class="RktSymDef RktSym">render</span></span></span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="RktVar">profile-data</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="hspace">&nbsp;</span></td></tr><tr><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="hspace">&nbsp;</span>[</td><td valign="top"><span class="RktVar">order</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="hspace">&nbsp;</span></td></tr><tr><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="RktPn">#:hide-self</span><span class="hspace">&nbsp;</span><span class="RktVar">hide-self%</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="hspace">&nbsp;</span></td></tr><tr><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="RktPn">#:hide-subs</span><span class="hspace">&nbsp;</span><span class="RktVar">hide-subs%</span>]<span class="RktPn">)</span></td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top">&rarr;</td><td valign="top"><span class="hspace">&nbsp;</span></td><td valign="top"><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=void.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._void%7E3f%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">void?</a></span></td></tr></table></blockquote></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">profile-data</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="#%28def._%28%28lib._profile%2Fanalyzer..rkt%29._profile~3f%29%29" class="RktValLink" data-pltdoc="x">profile?</a></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">order</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">topological</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">self</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">total</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>=<span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">topological</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">hide-self%</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._between%252Fc%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">between/c</a></span><span class="hspace">&nbsp;</span><span class="RktVal">0</span><span class="hspace">&nbsp;</span><span class="RktVal">1</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>=<span class="hspace">&nbsp;</span><span class="RktVal">1/100</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">hide-subs%</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._between%252Fc%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">between/c</a></span><span class="hspace">&nbsp;</span><span class="RktVal">0</span><span class="hspace">&nbsp;</span><span class="RktVal">1</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>=<span class="hspace">&nbsp;</span><span class="RktVal">1/50</span></td></tr></table></blockquote></div><div class="SIntrapara">Prints the given <span class="RktSym"><a href="#%28def._%28%28lib._profile%2Fanalyzer..rkt%29._profile%29%29" class="RktValLink" data-pltdoc="x">profile</a></span> results as a Graphviz directed
graph.</div></p><p>This is an experimental module, provided mostly as a proof-of-concept.
It renders the profile&rsquo;s call-graph as a graph representation for one
of the Graphviz tools to render.  Nodes are colored according to their
&lsquo;self&rsquo; percentages, and edges.</p><p>The keyword arguments control hiding nodes in the same way as with the
textual renderer. The <span class="RktVar">order</span> argument is ignored.</p><div class="navsetbottom"><span class="navleft"><form class="searchform"><input class="searchbox" style="color: #888;" type="text" value="...search manuals..." title="Enter a search string to search the manuals" onkeypress="return DoSearchKey(event, this, &quot;6.7&quot;, &quot;../&quot;);" onfocus="this.style.color=&quot;black&quot;; this.style.textAlign=&quot;left&quot;; if (this.value == &quot;...search manuals...&quot;) this.value=&quot;&quot;;" onblur="if (this.value.match(/^ *$/)) { this.style.color=&quot;#888&quot;; this.style.textAlign=&quot;center&quot;; this.value=&quot;...search manuals...&quot;; }"/></form>&nbsp;&nbsp;<a href="../index.html" title="up to the documentation top" data-pltdoc="x" onclick="return GotoPLTRoot(&quot;6.7&quot;);">top</a></span><span class="navright">&nbsp;&nbsp;<span class="nonavigation">&larr; prev</span>&nbsp;&nbsp;<a href="../index.html" title="up to the documentation top" data-pltdoc="x" onclick="return GotoPLTRoot(&quot;6.7&quot;);">up</a>&nbsp;&nbsp;<span class="nonavigation">next &rarr;</span></span>&nbsp;</div></div></div><div id="contextindicator">&nbsp;</div></body></html>