Issue
I don't know what's going on here, so thought I would ask you guys.
I just installed iPython 3.1 on Mac OSX 10.10.2
In iPython I tried my function with no results, but here is an example:
In [21]: def rn():
....: for ix in range(0,100): print ix
....:
In [22]: %lprun rn()
0
1
2
3
4
....
98
99
Timer unit: 1e-06 s
In this type of situation I'm expecting a normal cProfile type output, showing the lines that ran and how long each one took. What am I doing wrong?!
Thanks!
Solution
Use the -f
flag to get line by line output:
%lprun -f rn rn()
Output:
In [13]: %lprun -f rn rn()
0
1
2
3
4
5
...
94
95
96
97
98
99
Timer unit: 1e-06 s
Total time: 0.000933 s
File: <ipython-input-4-00cddd5336b9>
Function: rn at line 1
Line # Hits Time Per Hit % Time Line Contents
==============================================================
1 def rn():
2 101 933 9.2 100.0 for ix in range(0,100): print ix
Answered By - Padraic Cunningham
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.