line_profiler
function前標(biāo)上 @profile
kernprof -l -v aaa.py
Line:文件中的行號(hào)。
Hits:性能分析時(shí)代碼執(zhí)行的次數(shù)。
Time:一段代碼執(zhí)行的總時(shí)間,由計(jì)數(shù)器決定。 單位:1e-06 s, 1微秒
Per Hit:執(zhí)行一段代碼平均消耗時(shí)間。
% Time:執(zhí)行一段代碼時(shí)間消耗比例。
python模塊-cProfile和line_profiler(性能分析器)_loco_python-CSDN博客_cprofile
memory_profiler
查看內(nèi)存
from memory_profiler import profile
function前標(biāo)上 @profile
對象引用
brew安裝 graphviz
pip 安裝 graphviz, xdot