Commit Graph

33 Commits

Author SHA1 Message Date
Skip Montanaro 262fb9256b Allow pstats.Stats creator to specify an alternate to stdout. 2006-04-21 02:31:07 +00:00
Armin Rigo a871ef2b3e Added the cProfile module.
Based on lsprof (patch #1212837) by Brett Rosen and Ted Czotter.
With further editing by Michael Hudson and myself.
History in svn repo: http://codespeak.net/svn/user/arigo/hack/misc/lsprof

* Module/_lsprof.c is the internal C module, Lib/cProfile.py a wrapper.
* pstats.py updated to display cProfile's caller/callee timings if available.
* setup.py and NEWS updated.
* documentation updates in the profiler section:
   - explain the differences between the three profilers that we have now
   - profile and cProfile can use a unified documentation, like (c)Pickle
   - mention that hotshot is "for specialized usage" now
   - removed references to the "old profiler" that no longer exists
* test updates:
   - extended test_profile to cover delicate cases like recursion
   - added tests for the caller/callee displays
   - added test_cProfile, performing the same tests for cProfile
* TO-DO:
   - cProfile gives a nicer name to built-in, particularly built-in methods,
     which could be backported to profile.
   - not tested on Windows recently!
2006-02-08 12:53:56 +00:00
Raymond Hettinger 6c92d76abc Removed deprecated method from pstats. 2004-12-05 03:28:00 +00:00
Walter Dörwald 70a6b49821 Replace backticks with repr() or "%r"
From SF patch #852334.
2004-02-12 17:35:32 +00:00
Fred Drake 9c43910a27 - add a dump_stats() method similar to that of the profile.Profile class
- don't use "file" as the name of local variables
2003-05-14 14:28:09 +00:00
Guido van Rossum 68468eba63 Get rid of many apply() calls. 2003-02-27 20:14:51 +00:00
Raymond Hettinger e0d4972acc Replaced .keys() with dictionary iterators 2002-06-02 18:55:56 +00:00
Raymond Hettinger 32200aeac6 Replaced obsolete stat module constants with equivalent attributes 2002-06-01 19:51:15 +00:00
Raymond Hettinger 16e3c427f3 Replace boolean test with is None. 2002-06-01 16:07:16 +00:00
Raymond Hettinger 54f0222547 SF 563203. Replaced 'has_key()' with 'in'. 2002-06-01 14:18:47 +00:00
Tim Peters 281084f798 Put the deprecated .ignore() method back where it was. 2001-10-08 06:28:18 +00:00
Tim Peters 7d01685738 Widespread random code cleanup.
Most of this code was old enough to vote.  Examples of cleanups:

+ Backslashes were used for line continuation even inside unclosed
  bracket structures, from back in the days that was still needed.

+ There was no use of % formats, and e.g. the old fpformat module was
  still used to format floats "by hand" in conjunction with rjust().

+ There was even use of a do-nothing .ignore() method to tack on to the
  end of a chain of method calls, else way back when Python would print
  the non-None result (as it does now in an interactive session -- it
  *used* to do that in batch mode too).

+ Perhaps controversial (although I can't imagine why for real <wink>),
  used augmented assignment where helpful.  Stuff like

      self.total_calls = self.total_calls + other.total_calls

  is just plain harder to follow than

      self.total_calls += other.total_calls
2001-10-08 06:13:19 +00:00
Andrew M. Kuchling 77f9caf633 Remove unused variable (PyChecker) 2001-08-13 14:52:37 +00:00
Martin v. Löwis 27c430e54e Patch #445538: add completion for pstats.py sort cmd. 2001-07-30 10:21:13 +00:00
Martin v. Löwis 66b6e192b9 Patch #416224: add readline completion to cmd.Cmd. 2001-07-28 14:44:03 +00:00
Martin v. Löwis 22adac50cb Patch #416220: Fix misplaced paren. 2001-06-07 05:49:05 +00:00
Fred Drake e8187615e2 When guarding an import, only catch ImportError. 2001-05-11 19:21:41 +00:00
Eric S. Raymond 53b809d673 Added more help, and recovery from misspelled sort key arguments. 2001-04-26 07:32:38 +00:00
Eric S. Raymond 3c1858a589 Should resolve [ #416039 ] pstats browser crashes. 2001-04-14 15:16:05 +00:00
Eric S. Raymond 9cb98572af Import readline when possible to make the commaninterpreter UI nicer. 2001-04-14 01:48:41 +00:00
Tim Peters 613b2222cf Whitespace normalization. 2001-04-13 05:37:27 +00:00
Eric S. Raymond 4f3980d3cb Added a test main to the pstats library that can help you browse profile dumps. 2001-04-13 00:23:01 +00:00
Skip Montanaro c62c81e013 __all__ for several more modules 2001-02-12 02:00:42 +00:00
Eric S. Raymond 373c55e510 String method conversion. 2001-02-09 08:25:29 +00:00
Tim Peters 2344fae6d0 Whitespace normalization. 2001-01-15 00:50:52 +00:00
Thomas Wouters 7e47402264 Spelling fixes supplied by Rob W. W. Hooft. All these are fixes in either
comments, docstrings or error messages. I fixed two minor things in
test_winreg.py ("didn't" -> "Didn't" and "Didnt" -> "Didn't").

There is a minor style issue involved: Guido seems to have preferred English
grammar (behaviour, honour) in a couple places. This patch changes that to
American, which is the more prominent style in the source. I prefer English
myself, so if English is preferred, I'd be happy to supply a patch myself ;)
2000-07-16 12:04:32 +00:00
Guido van Rossum 54f22ed30b More trivial comment -> docstring transformations by Ka-Ping Yee,
who writes:

Here is batch 2, as a big collection of CVS context diffs.
Along with moving comments into docstrings, i've added a
couple of missing docstrings and attempted to make sure more
module docstrings begin with a one-line summary.

I did not add docstrings to the methods in profile.py for
fear of upsetting any careful optimizations there, though
i did move class documentation into class docstrings.

The convention i'm using is to leave credits/version/copyright
type of stuff in # comments, and move the rest of the descriptive
stuff about module usage into module docstrings.  Hope this is
okay.
2000-02-04 15:10:34 +00:00
Guido van Rossum dabcd0040c Fix mysterious references to jprofile that were in the source since
its creation.  I'm assuming these were once valid references to "Jim
Roskind's profile"...
1999-04-13 04:24:22 +00:00
Guido van Rossum c8d36284f3 Give in to Timmy's Tedious Tab Theorem. 1998-03-23 15:31:22 +00:00
Guido van Rossum 9694fcab53 Convert all remaining *simple* cases of regex usage to re usage. 1997-10-22 21:00:49 +00:00
Guido van Rossum 2861f4ec6e Open files in binary mode (Jack) 1997-10-08 15:23:23 +00:00
Guido van Rossum 4f399fb642 more robust coding, adapted for mac 1995-09-30 16:48:54 +00:00
Guido van Rossum adb3105ec4 Companion module for new profile.py 1994-06-23 11:42:52 +00:00