iPython lprun 不打印输出
iPython lprun not printing output
我不知道这里发生了什么,所以我想问问你们。
我刚刚在 Mac OSX 10.10.2
上安装了 iPython 3.1
在 iPython 中,我尝试了我的函数但没有结果,但这里有一个例子:
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
在这种情况下,我期待正常的 cProfile 类型输出,显示 运行 的行以及每行花费的时间。我做错了什么?!
谢谢!
使用-f
标志逐行输出:
%lprun -f rn rn()
输出:
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
我不知道这里发生了什么,所以我想问问你们。
我刚刚在 Mac OSX 10.10.2
上安装了 iPython 3.1在 iPython 中,我尝试了我的函数但没有结果,但这里有一个例子:
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
在这种情况下,我期待正常的 cProfile 类型输出,显示 运行 的行以及每行花费的时间。我做错了什么?!
谢谢!
使用-f
标志逐行输出:
%lprun -f rn rn()
输出:
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