Barry Warsaw | bb779ec | 1997-01-16 23:55:38 +0000 | [diff] [blame] | 1 | Purify (tm) and Quantify (tm) are commercial software quality |
| 2 | assurance tools available from Pure Atria Corporation |
| 3 | <http://www.pureatria.com/>. Purify is essentially a memory access |
| 4 | verifier and leak detector; Quantify is a C level profiler. The rest |
| 5 | of this file assumes you generally know how to use Purify and |
| 6 | Quantify, and that you have installed valid licenses for these |
| 7 | products. If you don't have them installed, you can ignore the |
| 8 | following since it won't help you a bit! |
| 9 | |
| 10 | You can easily build a Purify or Quantify instrumented version of the |
| 11 | Python interpreter by passing the LINKCC variable to the make command |
| 12 | at the top of the Python tree: |
| 13 | |
| 14 | make LINKCC='purify gcc' |
| 15 | |
| 16 | This assumes that the `purify' program is on your $PATH, and that you |
| 17 | are using gcc as your C compiler. Note that you can't Purify and |
| 18 | Quantify the interpreter (or any program) at the same time. |
| 19 | |
| 20 | Now, just run the interpreter as you normally would. If you're |
| 21 | running it in place (i.e. not installed), you may find it helpful to |
| 22 | set your PYTHONPATH environment variable. E.g., in Bourne Shell, on a |
| 23 | Solaris 2.x machine: |
| 24 | |
| 25 | % PYTHONPATH=./Lib:./Lib/sunos5:./Lib/tkinter:./Modules ./python |
| 26 | |
| 27 | When running the regression test (make test), I have found it useful |
| 28 | to set my PURIFYOPTIONS environment variable using the following shell |
| 29 | function. Check out the Purify documentation for details: |
| 30 | |
| 31 | p() { |
| 32 | chainlen='-chain-length=12' |
| 33 | ignoresigs='-ignore-signals="SIGHUP,SIGINT,SIGQUIT,SIGILL,SIGTRAP,SIGAVRT,SIGEMT,SIGFPE,SIGKILL,SIGBUS,SIGSEGV,SIGPIPE,SIGTERM,SIGUSR1,SIGUSR2,SIGPOLL,SIGXCPU,SIGXFSZ,SIGFREEZE,SIGTHAW,SIGRTMIN,SIGRTMAX"' |
| 34 | followchild='-follow-child-processes=yes' |
| 35 | threads='-max-threads=50' |
| 36 | export PURIFYOPTIONS="$chainlen $ignoresigs $followchild $threads" |
| 37 | echo $PURIFYOPTIONS |
| 38 | } |
| 39 | |
| 40 | Note that you may want to crank -chain-length up even further. A |
| 41 | value of 20 should get you the entire stack up into the Python C code |
| 42 | in all situations. |
| 43 | |
| 44 | With the regression test, you'll probably get a gabillion UMR errors, |
| 45 | and a few MLK errors. I think most of these can be safely suppressed |
| 46 | by putting the following in your .purify file: |
| 47 | |
| 48 | suppress umr ...; "socketmodule.c" |
| 49 | suppress umr ...; time_strftime |
| 50 | suppress umr ...; "dbmmodule.c" |
| 51 | suppress umr ...; "gdbmmodule.c" |
| 52 | suppress umr ...; "grpmodule.c" |
| 53 | suppress umr ...; "nismodule.c" |
| 54 | suppress umr ...; "pwdmodule.c" |
| 55 | |
| 56 | This will still leave you (currently) with a few UMR and MLK reports. |
| 57 | For now, don't worry about them. We'll be evaluating these as time |
| 58 | goes on, and correcting them as appropriate. |
| 59 | |
| 60 | Using Purify or Quantify in this way will give you coarse grained |
| 61 | reports on the whole Python interpreter. You can actually get more |
| 62 | fine grained control over both by linking with the optional `pure' |
| 63 | module, which exports (most of) the Purify and Quantify C API's into |
| 64 | Python. To link in this module (it must be statically linked), edit |
| 65 | your Modules/Setup file for your site, and rebuild the interpreter. |
| 66 | You might want to check out the comments in the Modules/puremodule.c |
| 67 | file for some idiosyncrasies. |
| 68 | |
| 69 | Using this module, you can actually profile or leak test a small |
| 70 | section of code, instead of the whole interpreter. Using this in |
| 71 | conjuction with pdb.py, dbx, or the profiler.py module really gives |
| 72 | you quite a bit of introspective power. |