pprofile + matplotlib = 对Python程序进行分析形成一张热图

网友投稿 820 2022-10-23

pprofile + matplotlib = 对python程序进行分析形成一张热图

pprofile + matplotlib = 对Python程序进行分析形成一张热图

pyheat

Profilers are extremely helpful tools. They help us dig deep into code, find and understand performance bottlenecks. But sometimes we just want to lay back, relax and still get a gist of the hot zones in our code.

A picture is worth a thousand words.

So, instead of presenting the data in tabular form, if presented as a heatmap visualization, it makes comprehending the time distribution in the given program much easier and quicker. That is exactly what is being done here !

Demo

Scroll Demo

Features

Simple CLI interface.No complicated setup.Heatmap visualization to view hot zones in code.Ability to export the heatmap as an image file.Ability to scroll, to help view heatmap of large py files.

Setup

Using pip

pip install py-heat

Directly from the repository

git clone https://github.com/csurfer/pyheat.gitpython pyheat/setup.py install

Usage

As a command

# To view the heatmap.pyheat # To output the heatmap as a file.pyheat --out image_file.pngpyheat --help

As a module

from pyheat import PyHeatph = PyHeat()ph.create_heatmap()# To view the heatmap.ph.show_heatmap()# To output the heatmap as a file.ph.show_heatmap('image_file.png')

Contributing

Bug Reports and Feature Requests

Please use issue tracker for reporting bugs or feature requests.

Development

Pull requests are most welcome.

Buy the developer a cup of coffee!

If you found the utility helpful you can buy me a cup of coffee using

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:#yyds干货盘点# 面试必刷TOP101:单链表的排序
下一篇:HttpClient连接池及重试机制解析
相关文章

 发表评论

暂时没有评论,来抢沙发吧~