shithub: wiki.9front.org

Download patch

ref: 816cd76cbdfe5ac1b4caeb85f0231ef4a36294ef
parent: bbc32792b01cd2e597f31d88ee16bd8ace10da1b
author: kvik <kvik@a-b.xyz>
date: Thu Oct 29 12:38:38 EDT 2020

prof: add article from old wiki (thanks Amavect)

--- /dev/null
+++ b/prof.md
@@ -1,0 +1,22 @@
+# prof(1)
+
+Prof(1) is a profiling tool.
+
+The man page was a little ambiguous to me, so here's some examples
+of how to use it.
+
+First, in your mkfile, add `LDFLAGS=-p` after the inclusion of mkone,
+as per `/sys/doc/mkfiles.ps`. Compile. Run, and your program will spit
+out a `prof.pid` file.
+
+If your program complains about a prof error, increase the profsize
+variable as per the man page, or else the prof file will be incorrect.
+
+Then, run `prof 6.out prof.pid`, substituting whatever your program
+or prof file are named. This should spit out call frequencies.
+
+`prof -dr 6.out prof.pid` will spit out a HUGE call tree.
+Get only the important parts (the ones that take >1ms) with regex
+char classes: `prof -dr 6.out prof.pid | grep '[a-z]:[1-9]'`
+
+Happy profiling :)