About Python performance-related test Cprofile library

Source: Internet
Author: User

http://blog.csdn.net/gzlaiyonghao/article/details/1483728

Collect a great God's introduction to this question. I will not do more pollution. There are also two enhanced libraries that can be used to generate a graph analysis of the. prof file for Cprofile output.

One is Snakeviz one is Gprof2dot the second figure generates something very cool ... But it's not the first one to be practical.

In the process of using both, there is actually a custom report module used. Pstats

Import CProfile  from Import Stats cprofile.run ('xxx ()'"xxx.prof") p = pstats. Stats ("xxx.prof") p.sort_stats ("Time") ). Print_stats ()

If you want to see something that lasts Io, there's actually a trick.

You can try to use Cprofile.run in your code and generate a file

Then use Ipython to read this file to generate the corresponding report long can see the corresponding data.

About Python performance-related test Cprofile library

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.