home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / languages / perl / scripts-convex / profiling / perldb.doc < prev    next >
Encoding:
Internet Message Format  |  1993-07-14  |  2.1 KB

  1. Path: convex!bcm!cs.utexas.edu!sun-barr!cronkite.Central.Sun.COM!jethro!exodus!joe.Eng.Sun.COM!petolino
  2. From: petolino@joe.Eng.Sun.COM (Joe Petolino)
  3. Newsgroups: comp.lang.perl
  4. Subject: Re: perl profiler?
  5. Message-ID: <18678@exodus.Eng.Sun.COM>
  6. Date: 20 Aug 1991 01:23:56 GMT
  7. References: <7898@male.EBay.Sun.COM> <18507@exodus.Eng.Sun.COM>
  8. Sender: news@exodus.Eng.Sun.COM
  9. Organization: Sun Microsystems, Mt. View, Ca.
  10. Lines: 536
  11.  
  12. In response to several e-mail inquiries, and by permission of the author,
  13. I'm posting Ray Lischner's profiler.  Things to look out for: the decription
  14. in the mail uses different names for things than the code does (e.g.
  15. &DB'perlprof is really &DB'profile).  It doesn't work in old versions of
  16. perl.  I had better luck using the PERLDB environment variable (as Camel
  17. book suggests) rather than 'perl -I' .
  18.  
  19. -Joe
  20.  
  21. ----- Begin Forwarded Message -----
  22.  
  23. >From lisch@sysserver1.mentor.com Mon Aug 12 15:43:00 1991
  24. Date: Mon, 12 Aug 91 15:44:11 PDT
  25. From: Ray Lischner <lisch@sysserver1.mentor.com>
  26. To: petolino@joe.Eng.Sun.COM (Joe Petolino)
  27. Subject: perl profiler?
  28.  
  29. >>>>> On 11 Aug 91 22:24:00 GMT, petolino@joe.Eng.Sun.COM (Joe Petolino) said:
  30. Joe> (Apologies if this has been discussed before)
  31. Joe> The camel book suggests modifying perldb.pl to implement a profiler.  Has
  32. Joe> anyone done this?  Is it available for general use?
  33.  
  34. I tried to work on one, but it isn't very pretty.  I tried to make it
  35. work with a new switch to perl, -m, but I gave up because it wasn't clear
  36. to me where Perl exits the program.  Instead, make sure your script has
  37. the line:
  38.  
  39.     &DB'perlprof if defined &DB'perlprof;
  40.  
  41. where the script exists, e.g., at the end.
  42.  
  43. I invoke the script as follows:
  44.  
  45.     perl -I/dir/where/the/perlprof/perldb.pl/lives -d script ...
  46.  
  47. The file "perlmon.out" is created in the working directory that is current
  48. when the script exits, so watch out for chdir()s in the script.
  49.  
  50. Then run pprof to get a pretty listing of the information.
  51.  
  52. I'm not sure what to do with evals, and the measurements add a lot of
  53. overhead, but the information can still be useful.  I have successfully
  54. used the information to locate bottlenecks.  Good luck.
  55.  
  56. Ray Lischner
  57.  
  58.  
  59.