一个简单的python程序内存分析器。

pyprofyler的Python项目详细描述


Pyprofyler

一个简单的python程序内存分析器。

安装:

sudo pip3 install git+https://github.com/AlyShmahell/PyProfyler

sudo pip3 install pyprofyler

示例:

frompyprofylerimportPyProfylerdefwrapped_function():array=[]foriinrange(1,1000000):array.append(i)returnarray@PyProfylerdefdecorated_function():a_list=[]foriinrange(1,1000000):a_list.append(i)returna_listif__name__=='__main__':###############################################    Profiling a function by wrapping it     ###############################################wrapped_profile=PyProfyler(wrapped_function)# "Not Profiled Yet" Messageprint(wrapped_profile)result=wrapped_profile()# Profile Message, through __str__print(wrapped_profile)# Function Execution Resultprint(f"execution result: {result[10]}")# Profile Message, through __getitem__print(wrapped_profile['profile'])###############################################      Profiling a decorated function        ################################################ "Not Profiled Yet" Messageprint(decorated_function)result=decorated_function()# Profile Message, through __str__print(decorated_function)# Function Execution Resultprint(f"execution result: {result[10]}")# Profile Message, through __getitem__print(decorated_function['profile'])

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java什么会导致程序在它似乎拥有的监视器上被阻止?   java Android studio设置视图的背景色   java我可以保存一个文本文件而不给用户修改它的能力吗?   pdfbox PDFBOX2。0:java堆堆栈错误   java是维护和操作AllowList的有效方法   JAVAsql。SQLException:找不到适合jdbc的驱动程序:mysql://localhost:3306/asd性爱   如何使用java。lang.NullPointerException:void 安卓。支持v7。应用程序。ActionBar。setElevation(float)“”在空对象引用上'   java调试空指针异常   java正则表达式,以按令牌的特定匹配项拆分,同时忽略其他匹配项   java为JPanel设置边框上的笔划   并发@Schedule方法的java行为   如何在Java中使用泛型与语言运算符和泛型类扩展数   java Rhino Javascript如何为异常堆栈跟踪标记字符串源   运行可执行jar时发生java错误,无法找到或加载主类