mlprof(1)
π mlprof(1) β the manual, but make it a group chat
okay so bestie, you know that thing where your MLton-compiled program is out here being slow or hogging memory and you're like "who did this"? mlprof is the friend who snitches. It's a General Commands Manual page, and I'm about to explain the whole thing to you with zero skips, no cap. π
β¨ NAME β¨
mlprof β display profiling information for a MLton-compiled executable
πΈ SYNOPSIS πΈ
mlprof [option ...] a.out [mlmon.out ...]
π¦ DESCRIPTION π¦
mlprof extracts information from an executable compiled by MLton with -profile alloc or -profile time, plus the resulting mlmon.out file that got produced when you ran that executable. That's the whole vibe. π
The output of mlprof starts with an initial line that tells you the total amount of CPU time or bytes allocated. Iconic opener. After that, source functions get listed along with the percentage of that total that they used, in decreasing order β so the biggest culprit is right there at the top, main character energy, no hiding. π
If the program was compiled with -profile-stack true, mlprof will display the time spent or bytes allocated while the function was on the stack and in GC, in addition to the time or bytes that the function is directly responsible for. So you get the receipts and the receipts' receipts. π§Ύ
With multiple mlmon.out files, mlprof will sum the profiling information. Math bestie behavior. β¨
π OPTIONS π
-call-graphfile β Write a call graph containing the table data to a dot file. See the MLton User Guide for details. π-graph-titlestring β Set the call-graph title. Name your graph, let it have a personality. π·οΈ-gray{false|true}β Gray call-graph nodes according to stack %. This only makes sense if the executable was compiled-profile-stack true. Context matters, bestie. π©Ά-keepexp β Only show functions specified by exp. For details on the allowed expressions, see the MLton User Guide. Multiple-keepexpressions are not allowed. Pick one, we're not doing a whole roster. π ββοΈ-mlmonfile β Process the list of whitespace-separatedmlmon.outfiles found in the specified file. Bulk energy. π-raw{false|true}β Show the raw counts in addition to the percentages. Numbers on numbers. π’-show-line{false|true}β Show the file and line for each function. Location reveal, very sleuth. π-splitregexp β Treat duplicates of functions whose name matches regexp as different functions. Breaking them up so they can each shine separately. π-threshx β An abbreviation for-keep '(thresh x)', which only prints information about functions whose percentage is greater than or equal to x, where0 <= x <= 100.0. Filter out the small fry. π-tolerant{false|true}β Print a warning about brokenmlmon.outfiles, but do not exit. Forgiving queen. It warns and then keeps it moving. π«Ά
heads up bestie:-graygenuinely only makes sense if you compiled with-profile-stack trueβ otherwise you're graying things by a number that isn't there. And-keepwill not let you stack multiple expressions, periodt.
π SEE ALSO π
mlton(1) and the MLton Guide. Go read them, they're the lore. π
and that's the whole page, bestie!! πβ¨πΈπ¦ This was mlprof(1) from the General Commands Manual, last touched December 30, 2024 β so go profile something and find out which function is being messy. Slay. π
π
π¦ where this page comes from
- arch rolling: mlton 20241230-1 Β· HPND AND MIT
- nixos 26.05: isabelle 2025-2
- nixos 26.05: mlton 20241230
- nixos 26.05: mlton-HEAD
- nixpkgs unstable: isabelle 2025-2
- nixpkgs unstable: mlton 20241230
- nixpkgs unstable: mlton-HEAD
- ubuntu resolute: mlton-tools 20241230+git20251029+dfsg-5 Β· HPND
- ubuntu stonking: mlton-tools 20241230+git20251029+dfsg-5 Β· HPND
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms