MPROF(1) MPROF(1) NAME mprof, wm/mprof - memory profiling limbo programs SYNOPSIS mprof [ -bcMflnve ] [ -m modname ] ... [ cmd arg ... ] wm/mprof [ -e ] [ -m modname ] ... [ cmd arg ... ] DESCRIPTION Mprof is a simple memory profiling tool which calculates the amount of heap memory used on a particular line of limbo source or in a particular limbo function or module. The source in question should be compiled with the -g flag so that the relevant symbol table files exist. In it's simplest form, the memory profiler shows a line number, the current memory in bytes allocated when executing this line, the high water memory in bytes allocated when executing this line and the limbo source. This information is also available at the function and module level. The tk version of the profiler wm/mprof shows this informa- tion in a text widget and colours the lines of source according to the amount of heap memory allocated by the line. The darker the colour, the more memory used. The -b option starts profiling. The -c option clears all profiling statistics and state in the memory profiling device. If any commands are specified to mprof , this is done automatically. It's specific use is to end the accumulation of statistics when profiling inter- actively. See the example below. The -M option shows the memory statistics for each module The -f option shows the memory statistics for each function. The -l option shows the memory statistics for each line. If neither this option nor the -M and -f options are given, -M and -l are assumed. The -n option lists the name of the file along with the line number. The -v option outputs all functions and/or lines even when they do not involve memory allocating or freeing operations. The -m option lists the module names which are to be pro- filed. If none are given, all the modules loaded by the ker- nel will be profiled. The name may be the actual name of the module or its path name. Page 1 Plan 9 (printed 12/22/24) MPROF(1) MPROF(1) The -e option profiles the module that is loaded first in any following command. In this case there is no need to give a -m option as this is added automatically. Any remaining arguments are assumed to specify a command and set of arguments to the command. If this is the case, mprof will automatically start profiling, run the command to com- pletion and then stop profiling before showing the profile statistics. Mprof displays the profile statistics (unless the -b option is being used) according to the output format required. EXAMPLE To profile a particular command mprof /dis/math/parts 10000 wm/mprof /dis/math/parts 10000 To profile the same command but restrict attention to its own module (Partitions). mprof -m Partitions /dis/math/parts 10000 wm/mprof -m Partitions /dis/math/parts 10000 A shorter version of the above mprof -e /dis/math/parts 10000 wm/mprof -e /dis/math/parts 10000 To profile interactively mprof -b -m Polyhedra wm/polyhedra & mprof -M -f -l -n <interact with wm/polyhedra ...> mprof -M -f -l -n wm/mprof mprof -c Note that the output format options ( -M , -f , -l , -n , -v ) are ignored when -b is present. SOURCE /appl/cmd/mprof.b /appl/wm/mprof.b BUGS Can take quite a time to present statistics when profiling all modules in the system. SEE ALSO cprof(1), wm-cprof(1), prof(2), prof(3) Page 2 Plan 9 (printed 12/22/24)