This directory contains a simple (contrived) application that uses mpr.

This file (README) contains a sequence of commands whose output may help you
understand how to use mpr.

See ../DOC for further documentation on mpr.

--

To create the test program

	% CCFLAGS=-g make

To create a memory profile of the test program "tst" in file "log"

	% MPRPC=`mprpc tst` MPRFI="cat >log" ./tst

To view log file after mapping the call chain to function names

	% mpr tst <log

	or

	% mpr tst log

To view log file after mapping the call chain to function names and file
names

	% mpr -f tst <log

To view log file after mapping the call chain to function names, file names
and line numbers

	% mpr -f -l tst <log

To view log file after mapping the call chain to function names, and file
names and line numbers only for source files tst.c and bar.c

	% mpr -F tst.c,bar.c -l tst <log

To view log file after mapping the call chain to function names, file names
and line numbers, ignoring functions named "xmalloc" and "xrealloc" in the
call chain

	% mpr -f -l -ixmalloc,xrealloc tst <log

To view memory allocation requests grouped by a function name call chain of
length 1

	% mpr tst <log | mprcc

To view memory allocation requests grouped by a function name and file name
call chain of length 1

	% mpr -f tst <log | mprcc

To view memory allocation requests grouped by a function name, file name and
line number call chain of length 1

	% mpr -f -l tst <log | mprcc

To view memory allocation requests grouped by a function name, file name and
line number call chain of length 3

	% mpr -f -l tst <log | mprcc -c3

To view memory allocation requests grouped by a function name call chain of
length 3, ignoring functions named "xmalloc" and "xrealloc" in the call chain

	% mpr -ixmalloc,xrealloc tst <log | mprcc -c3

To view memory allocation requests grouped by a function name, file name and
line number call chain of length 3, ignoring functions named "xmalloc" and
"xrealloc" in the call chain

	% mpr -f -l -ixmalloc,xrealloc tst <log | mprcc -c3

To view memory allocation requests grouped by size

	% mprsz <log

To view memory leaks

	% mprlk <log | mpr tst

To view memory leaks grouped by a function name call chain of length 1

	% mprlk <log | mpr tst | mprcc

To view memory leaks grouped by a function name, file name and line number
call chain of length 3

	% mprlk <log | mpr -f -l tst | mprcc -c3

To view memory leaks grouped by a function name, file name and line number
call chain of length 3, ignoring functions named "xmalloc" and "xrealloc" in
the call chain

	% mprlk <log | mpr -f -l -ixmalloc,xrealloc tst | mprcc -c3

To view memory leaks grouped by size

	% mprlk <log | mprsz

To view a memory allocation histogram with '*' indicating a 1k block

	% mprhi <log

To view a memory allocation histogram with '*' indicating a 4k block

	% mprhi -b4096 <log

To find the maximum amt of memory (within 1k) that was allocated at any point
during the life of the program

	% mprhi <log | awk '{if (length>m) m=length} END {print m}'

To view a "verbose" memory allocation histogram, with '*' indicating a
2k block, and a function name call chain of length 6

	% mpr tst <log | mprhi -c6 -b2048

To view a "verbose" memory allocation histogram, with '*' indicating a
2k block and a function name, file name and line number call chain of length 6,
ignoring functions named "xmalloc" and "xrealloc" in the call chain

	% mpr -f -l -ixmalloc,xrealloc tst <log | mprhi -c6 -b2048
