RE: [PATCH] Support cProfile profiler

Jon Foster <[email protected]> Thu, 8 Apr 2010 15:54:17 +0100
Newsgroups gmane.comp.version-control.subversion.cvs2svn.devel
Message-ID <[email protected]>
Hi,

Documentation patch attached.

Kind regards,

Jon

-----Original Message-----
From: Michael Haggerty [mailto:[email protected]] 
Sent: 02 April 2010 14:19
To: Jon Foster
Cc: [email protected]
Subject: Re: [PATCH] Support cProfile profiler

Jon Foster wrote:
> According to the Python 2.5 docs, the "hotshot" profiler is
> deprecated and may be removed in a future release of Python.  Those
> docs recommend the "cProfile" profiler, which is new in Python 2.5.
> 
> The attached patch makes cvs2svn use cProfile if available, and fall
> back to the existing hotshot support if cProfile isn't available.
> 
> (Incidentally, profiling shows that the __does_rule_apply_to()
> method in SubtreeSymbolTransform is taking over 40% of cvs2svn's
> total runtime, on my conversion.  Optimization patches to follow).

Looks good, but the docs should be updated too.  grep for "hotshot" to
find the places.

Thanks,
Michael

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________


**********************************************************************
This email and its attachments may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of Cabot Communications Ltd.

If you are not the intended recipient of this email and its attachments, you must take no action based upon them, nor must you copy or show them to anyone.

Cabot Communications Limited
Verona House, Filwood Road, Bristol BS16 3RY, UK
+44 (0) 1179584232

Co. Registered in England number 02817269

Please contact the sender if you believe you have received this email in error.

**********************************************************************


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________

------------------------------------------------------
http://cvs2svn.tigris.org/ds/viewMessage.do?dsForumId=1667&dsMessageId=2522531

To unsubscribe from this discussion, e-mail: [[email protected]].
cvs2svn_cprofile_doc_patch.txt (text/plain, 1.6 KB)
Index: cvs2svn_lib/run_options.py
===================================================================
--- cvs2svn_lib/run_options.py	(revision 5107)
+++ cvs2svn_lib/run_options.py	(working copy)
@@ -837,12 +837,17 @@
         help='prevent the deletion of intermediate files',
         man_help='Prevent the deletion of temporary files.',
         ))
+    prof = 'cProfile'
+    try:
+        import cProfile
+    except ImportError, e:
+        prof = 'hotshot'
     group.add_option(ManOption(
         '--profile',
         action='callback', callback=self.callback_profile,
-        help='profile with \'hotshot\' (into file cvs2svn.hotshot)',
+        help='profile with \'' + prof + '\' (into file cvs2svn.' + prof + ')',
         man_help=(
-            'Profile with \'hotshot\' (into file \\fIcvs2svn.hotshot\\fR).'
+            'Profile with \'' + prof + '\' (into file \\fIcvs2svn.' + prof + '\\fR).'
             ),
         ))
 
Index: www/cvs2svn.html
===================================================================
--- www/cvs2svn.html	(revision 5107)
+++ www/cvs2svn.html	(working copy)
@@ -1203,7 +1203,10 @@
 
   <tr>
     <td align="right"><tt>--profile</tt></td>
-    <td>Dump Python <a href="http://docs.python.org/lib/module-hotshot.html"
+    <td>Dump Python <a href="http://docs.python.org/library/profile.html"
+        >cProfile</a> profiling data to the file <tt>cvs2svn.cProfile</tt>.
+        In Python 2.4 and earlier, if cProfile is not installed, it will
+        instead dump <a href="http://docs.python.org/library/hotshot.html"
         >Hotshot</a> profiling data to the file <tt>cvs2svn.hotshot</tt>.</td>
   </tr>