memory_profiler:监视Python代码的内存使用情况

时间:2021-02-20 11:40:07
【文件属性】:
文件名称:memory_profiler:监视Python代码的内存使用情况
文件大小:145KB
文件格式:ZIP
更新时间:2021-02-20 11:40:07
Python 内存分析器 这是一个python模块,用于监视进程的内存消耗以及逐行分析python程序的内存消耗。 它是一个纯python模块,取决于模块。 安装 通过pip安装: $ pip install -U memory_profiler 该软件包也可以在。 要从源代码安装,请下载软件包,解压缩并键入: $ python setup.py install 用法 逐行内存使用 逐行内存使用模式的用法与用法相同:首先使用装饰要配置的@profile ,然后使用特殊脚本运行脚本(在这种情况下,使用Python解释器)。 在下面的示例中,我们创建一个简单的函数my_func ,该函数分配列表a , b然后删除b : @profile def my_func(): a = [1] * (10 ** 6) b = [2] * (2 * 10 ** 7) del b
【文件预览】:
memory_profiler-master
----MANIFEST.in(53B)
----README.rst(17KB)
----COPYING(2KB)
----mprof.py(32KB)
----images()
--------flamegraph.png(61KB)
--------trend_slope.png(56KB)
----memory_profiler.py(45KB)
----examples()
--------multiprocessing_example.py(1KB)
--------numpy_example.py(398B)
--------plot_memory.py(391B)
--------reporting_logger.py(841B)
--------example.py(177B)
--------example_undecorated.py(185B)
--------reporting_file.py(336B)
----.travis.yml(267B)
----README_DEV.rst(275B)
----test()
--------test_loop_decorated.py(453B)
--------test_mprofile.py(959B)
--------test_increment_display.py(2KB)
--------test_loop.py(422B)
--------test_exit_code.py(1KB)
--------test_tracemalloc.py(1KB)
--------__init__.py(22B)
--------test_as.py(104B)
--------test_gen.py(1KB)
--------test_exception.py(267B)
--------test_func.py(170B)
--------test_precision_import.py(842B)
--------test_unicode.py(242B)
--------test_memory_usage.py(2KB)
--------test_stream_unicode.py(293B)
--------test_precision_command_line.py(748B)
--------test_attributes.py(254B)
--------test_mprof.py(463B)
--------test_nested.py(427B)
--------test_global.py(69B)
--------test_import.py(179B)
--------test_async.py(298B)
----setup.py(1KB)
----Makefile(784B)
----.gitignore(138B)

网友评论