[Python-checkins] python/dist/src/Lib pstats.py,1.28,1.29

fdrake@users.sourceforge.net fdrake@users.sourceforge.net
Wed, 14 May 2003 07:28:11 -0700


Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1:/tmp/cvs-serv29578

Modified Files:
	pstats.py 
Log Message:
- add a dump_stats() method similar to that of the profile.Profile class
- don't use "file" as the name of local variables


Index: pstats.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/pstats.py,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -d -r1.28 -r1.29
*** pstats.py	27 Feb 2003 20:14:38 -0000	1.28
--- pstats.py	14 May 2003 14:28:09 -0000	1.29
***************
*** 159,162 ****
--- 159,170 ----
          return self
  
+     def dump_stats(self, filename):
+         """Write the profile data to a file we know how to load back."""
+         f = file(filename, 'wb')
+         try:
+             marshal.dump(self.stats, f)
+         finally:
+             f.close()
+ 
      # list the tuple indices and directions for sorting,
      # along with some printable description
***************
*** 441,446 ****
  
  def func_strip_path(func_name):
!     file, line, name = func_name
!     return os.path.basename(file), line, name
  
  def func_get_function_name(func):
--- 449,454 ----
  
  def func_strip_path(func_name):
!     filename, line, name = func_name
!     return os.path.basename(filename), line, name
  
  def func_get_function_name(func):