<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="generator" content="AsciiDoc 8.6.8">
<title>MLtonRusage</title>
<link rel="stylesheet" href="./asciidoc.css" type="text/css">
<link rel="stylesheet" href="./pygments.css" type="text/css">


<script type="text/javascript" src="./asciidoc.js"></script>
<script type="text/javascript">
/*<![CDATA[*/
asciidoc.install();
/*]]>*/
</script>
<link rel="stylesheet" href="./mlton.css" type="text/css"/>
</head>
<body class="article">
<div id="banner">
<div id="banner-home">
<a href="./Home">MLton 20130715</a>
</div>
</div>
<div id="header">
<h1>MLtonRusage</h1>
</div>
<div id="content">
<div id="preamble">
<div class="sectionbody">
<div class="listingblock">
<div class="content"><div class="highlight"><pre><span class="k">signature</span><span class="w"> </span><span class="n">MLTON_RUSAGE</span><span class="w"> </span><span class="p">=</span><span class="w"></span>
<span class="w">   </span><span class="k">sig</span><span class="w"></span>
<span class="w">      </span><span class="k">type</span><span class="w"> </span><span class="n">t</span><span class="w"> </span><span class="p">=</span><span class="w"> </span><span class="p">{</span><span class="n">utime</span><span class="p">:</span><span class="w"> </span><span class="n">Time</span><span class="p">.</span><span class="n">time</span><span class="p">,</span><span class="w"> </span><span class="cm">(* user time *)</span><span class="w"></span>
<span class="w">                </span><span class="n">stime</span><span class="p">:</span><span class="w"> </span><span class="n">Time</span><span class="p">.</span><span class="n">time</span><span class="p">}</span><span class="w"> </span><span class="cm">(* system time *)</span><span class="w"></span>

<span class="w">      </span><span class="k">val</span><span class="w"> </span><span class="n">measureGC</span><span class="p">:</span><span class="w"> </span><span class="n">bool</span><span class="w"> </span><span class="p">-&gt;</span><span class="w"> </span><span class="n">unit</span><span class="w"></span>
<span class="w">      </span><span class="k">val</span><span class="w"> </span><span class="n">rusage</span><span class="p">:</span><span class="w"> </span><span class="n">unit</span><span class="w"> </span><span class="p">-&gt;</span><span class="w"> </span><span class="p">{</span><span class="n">children</span><span class="p">:</span><span class="w"> </span><span class="n">t</span><span class="p">,</span><span class="w"> </span><span class="n">gc</span><span class="p">:</span><span class="w"> </span><span class="n">t</span><span class="p">,</span><span class="w"> </span><span class="n">self</span><span class="p">:</span><span class="w"> </span><span class="n">t</span><span class="p">}</span><span class="w"></span>
<span class="w">   </span><span class="k">end</span><span class="w"></span>
</pre></div></div></div>
<div class="ulist"><ul>
<li>
<p>
<span class="monospaced">type t</span>
</p>
<div class="paragraph"><p>corresponds to a subset of the C <span class="monospaced">struct rusage</span>.</p></div>
</li>
<li>
<p>
<span class="monospaced">measureGC b</span>
</p>
<div class="paragraph"><p>controls whether garbage collection time is separately measured during
program execution.  This affects the behavior of both <span class="monospaced">rusage</span> and
<span class="monospaced">Timer.checkCPUTimes</span>, both of which will return gc times of zero with
<span class="monospaced">measureGC false</span>.  Garbage collection time is always measured when
either <span class="monospaced">gc-messages</span> or <span class="monospaced">gc-summary</span> is given as a
<a href="RunTimeOptions">runtime system option</a>.</p></div>
</li>
<li>
<p>
<span class="monospaced">rusage ()</span>
</p>
<div class="paragraph"><p>corresponds to the C <span class="monospaced">getrusage</span> function.  It returns the resource
usage of the exited children, the garbage collector, and the process
itself.  The <span class="monospaced">self</span> component includes the usage of the <span class="monospaced">gc</span>
component, regardless of whether <span class="monospaced">measureGC</span> is <span class="monospaced">true</span> or <span class="monospaced">false</span>.  If
<span class="monospaced">rusage</span> is used in a program, either directly, or indirectly via the
<span class="monospaced">Timer</span> structure, then <span class="monospaced">measureGC true</span> is automatically called at
the start of the program (it can still be disable by user code later).</p></div>
</li>
</ul></div>
</div>
</div>
</div>
<div id="footnotes"><hr></div>
<div id="footer">
<div id="footer-text">
</div>
<div id="footer-badges">
</div>
</div>
</body>
</html>
