Profiling programs ================== 1. SGI a) Gather data. No special release or compilation/link options required. Run program using ssrun: % ssrun - E.g.: % ssrun -usertime gtr -rcp find Option -usertime represents one of many possible experiments. It seems to be the most useful. Refer to the ssrun man page for other possibilities. This command will create a profile data file (gtr.usertime.* in the above example. b) Analyze/display data. Profile data is analyzed using prof (see prof man page): % prof Output is sent to standard output. I find it useful to pipe the output through the kai demangler (edg_decode) and formatting tool "cut" to limit the length of the lines before redirecting to a file: % prof | edg_decode | cut -c1-120 > prof.out Here are some useful options: - Flat profile of functions sorted by exclusive time usage. -inclusive - Flat profile of functions sorted by inclusive time usage. -b - Butterfly report. Reports on inclusive time used by caller and called functions for each function. The butterfly report is the most interesting and useful. Option -b can be combined with -inclusive. 2. Linux a) Gather data. Program and libraries must be compiled and linked with option -pg. Thus, a special d0library release is required. Run the program as you normally would. A file gmon.out is created. Here are Paul Russo's instructions for setting up release t00.86.00.maxopt on linux: % setup D0RunII t00.86.00.maxopt % cd % newrel -t t00.86.00.maxopt % cd % srt_setup -a SRT_QUAL=maxopt % d0setwa b) Analyze/display data. Profile data is analyzed using gprof (see gprof man page). % gprof E.g. % gprof -c `which gtr` | edg_decode | cut -c1-120 > gprof.out Option -c tells gprof to trace times usage of parent and child functions (similar to prof butterfly report). I tried gprof on release t00.82.00.maxopt, which was supposedly compiled with -pg. However, I was unable to get a report with inclusive time information. This the linux profile was not very useful. However, release t00.82.00.maxopt is known to have been compiled with different incompatible options in different builds. This may or may not account for the lack of usefulness of the linux profile.