<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="generator" content="AsciiDoc 8.6.10">
<title>Profiling</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 20201002</a>
</div>
</div>
<div id="header">
<h1>Profiling</h1>
</div>
<div id="content">
<div id="preamble">
<div class="sectionbody">
<div class="paragraph"><p>With MLton and <span class="monospaced">mlprof</span>, you can profile your program to find out
bytes allocated, execution counts, or time spent in each function.  To
profile you program, compile with <span class="monospaced">-profile <em>kind</em></span>, where <em>kind</em>
is one of <span class="monospaced">alloc</span>, <span class="monospaced">count</span>, or <span class="monospaced">time</span>.  Then, run the executable,
which will write an <span class="monospaced">mlmon.out</span> file when it finishes.  You can then
run <span class="monospaced">mlprof</span> on the executable and the <span class="monospaced">mlmon.out</span> file to see the
performance data.</p></div>
<div class="paragraph"><p>Here are the three kinds of profiling that MLton supports.</p></div>
<div class="ulist"><ul>
<li>
<p>
<a href="ProfilingAllocation">ProfilingAllocation</a>
</p>
</li>
<li>
<p>
<a href="ProfilingCounts">ProfilingCounts</a>
</p>
</li>
<li>
<p>
<a href="ProfilingTime">ProfilingTime</a>
</p>
</li>
</ul></div>
</div>
</div>
<div class="sect1">
<h2 id="_next_steps">Next steps</h2>
<div class="sectionbody">
<div class="ulist"><ul>
<li>
<p>
<a href="CallGraph">CallGraph</a>s to visualize profiling data.
</p>
</li>
<li>
<p>
<a href="HowProfilingWorks">HowProfilingWorks</a>
</p>
</li>
<li>
<p>
<a href="MLmon">MLmon</a>
</p>
</li>
<li>
<p>
<a href="MLtonProfile">MLtonProfile</a> to selectively profile parts of your program.
</p>
</li>
<li>
<p>
<a href="ProfilingTheStack">ProfilingTheStack</a>
</p>
</li>
<li>
<p>
<a href="ShowProf">ShowProf</a>
</p>
</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>
