From 6c4f009687c4e39e774b8e60013409573193d145 2006-11-24 15:37:21 From: vivainio Date: 2006-11-24 15:37:21 Subject: [PATCH] Kirill Smelkov patch: try to use 'cProfile' instead of the slower pure python 'profile' module --- diff --git a/IPython/Magic.py b/IPython/Magic.py index 6f2a838..b1c8a1f 100644 --- a/IPython/Magic.py +++ b/IPython/Magic.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """Magic functions for InteractiveShell. -$Id: Magic.py 1922 2006-11-21 20:56:48Z vivainio $""" +$Id: Magic.py 1927 2006-11-24 15:37:21Z vivainio $""" #***************************************************************************** # Copyright (C) 2001 Janko Hauser and @@ -36,11 +36,16 @@ from cStringIO import StringIO from getopt import getopt,GetoptError from pprint import pprint, pformat -# profile isn't bundled by default in Debian for license reasons +# cProfile was added in Python2.5 try: - import profile,pstats + import cProfile as profile + import pstats except ImportError: - profile = pstats = None + # profile isn't bundled by default in Debian for license reasons + try: + import profile,pstats + except ImportError: + profile = pstats = None # Homebrewed import IPython diff --git a/doc/manual_base.lyx b/doc/manual_base.lyx index 2085389..e52ce4a 100644 --- a/doc/manual_base.lyx +++ b/doc/manual_base.lyx @@ -438,11 +438,15 @@ Profiler support. profile.run() \family default ) or complete programs under the profiler's control. - While this is possible with the standard + While this is possible with standard +\family typewriter +cProfile +\family default + or \family typewriter profile \family default - module, IPython wraps this functionality with magic commands (see + modules, IPython wraps this functionality with magic commands (see \family typewriter `%prun' \family default