Re: [PATCH] Support cProfile profiler
Oswald Buddenhagen <[email protected]> Wed, 31 Mar 2010 15:15:21 +0200
| Newsgroups | gmane.comp.version-control.subversion.cvs2svn.devel |
|---|---|
| Message-ID | <[email protected]> |
On Wed, Mar 31, 2010 at 12:27:17PM +0100, Jon Foster wrote:
> + try:
> + import cProfile
> + except ImportError:
> + # Old version of Python without cProfile. Use hotshot instead.
> + import hotshot
> + prof = hotshot.Profile('cvs2svn.hotshot')
> + prof.runcall(pass_manager.run, run_options)
> + prof.close()
> + else:
>
hmm. while this does the correct thing (putting as little as possible
into the try block), tearing apart the functional block sure looks weird.
so much for the elegance of exceptions ...
i have no opinion - just observing ...
> + # Recent version of Python (2.5+) with cProfile.
> + def run_with_profiling():
> + pass_manager.run(run_options)
> + cProfile.runctx('run_with_profiling()', globals(), locals(), 'cvs2svn.cProfile')
------------------------------------------------------
http://cvs2svn.tigris.org/ds/viewMessage.do?dsForumId=1667&dsMessageId=2467713
To unsubscribe from this discussion, e-mail: [[email protected]].