Make ipython cProfile-able #193

wants to merge 1 commit into from

3 participants


To get a cProfile of ipython inside of the git repo you could run:
"python -m cProfile"

Currently file is wrongly detected and it crashes, after this commit, you get a proper cProfile.

IPython member

I know this script is designed to just start ipython from the top-level source dir, but won't this mean that the script will no longer work if curdir is not the top-level source dir? That may be OK though. Can we make it work both ways?


Ha, I found another way (althought, it looks like a hack^^).

This works now both ways (but doesn't look nice anymore at least for me).

@tomspur tomspur Make cProfile-able
When using __file__ on startup and cProfile in the same time, __file__
is defined as the __file__ of cProfile and not the local
With using sys.argv[0] instead, it's possible to get a cProfile.
IPython member

This fix does work for me in and out of the directory with, but the following has always worked for me:

python -m cProfile `which ipython`

Brian, should I go ahead and merge this?

IPython member

I haven't testing this, but it looks fine.


Merge branch 'ready_cProfile' of

closed by 604c8e1

@markvoorhies markvoorhies pushed a commit to markvoorhies/ipython that referenced this pull request Apr 21, 2011
@tomspur tomspur Merge branch 'ready_cProfile' of
closes gh-193
@mattvonrocketstein mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this pull request Nov 3, 2014
@tomspur tomspur Merge branch 'ready_cProfile' of
closes gh-193
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment