Make ipython cProfile-able #193

Closed
wants to merge 1 commit into from

3 participants

@tomspur

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

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

@ellisonbg
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?

@tomspur

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 ipython.py 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 ipython.py.
With using sys.argv[0] instead, it's possible to get a cProfile.
a5680be
@minrk
IPython member

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

python -m cProfile `which ipython`

Brian, should I go ahead and merge this?

@ellisonbg
IPython member

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

@tomspur

Merge branch 'ready_cProfile' of https://github.com/tomspur/ipython

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 https://github.com/tomspur/ipython
closes gh-193
604c8e1
@mattvonrocketstein mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this pull request Nov 3, 2014
@tomspur tomspur Merge branch 'ready_cProfile' of https://github.com/tomspur/ipython
closes gh-193
4ee8792
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment