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