diff options
author | CoprDistGit <infra@openeuler.org> | 2023-05-31 07:12:15 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2023-05-31 07:12:15 +0000 |
commit | 5239e096373e5c7c65bb684490b0e86e84257875 (patch) | |
tree | 4eeda60749e4346ee38993ee6148d215370eb8f5 | |
parent | d4e5e4ceae4d74567b8ae0f65880dae8d60f9172 (diff) |
automatic import of python-mprofile
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | python-mprofile.spec | 444 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 446 insertions, 0 deletions
@@ -0,0 +1 @@ +/mprofile-0.0.15.tar.gz diff --git a/python-mprofile.spec b/python-mprofile.spec new file mode 100644 index 0000000..d9437d6 --- /dev/null +++ b/python-mprofile.spec @@ -0,0 +1,444 @@ +%global _empty_manifest_terminate_build 0 +Name: python-mprofile +Version: 0.0.15 +Release: 1 +Summary: A low-overhead memory profiler. +License: MIT +URL: http://github.com/timpalpant/mprofile +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/f9/06/a2a99bd3caf8daa6ce17154a19a2e05412496379f49cf28f654033072d4c/mprofile-0.0.15.tar.gz +BuildArch: noarch + + +%description +[](https://pypi.org/project/mprofile/) +[](https://travis-ci.org/timpalpant/mprofile) + + +[](https://pypistats.org/packages/mprofile) +[](https://github.com/psf/black) + +# mprofile + +A low-overhead sampling memory profiler for Python, derived from [heapprof](https://github.com/humu/heapprof), with an interface similar to [tracemalloc](https://pytracemalloc.readthedocs.io). +mprofile attempts to give results comparable to tracemalloc, but uses statistical sampling to lower memory and CPU overhead. The sampling algorithm is the one used by [tcmalloc](https://github.com/gperftools/gperftools) and Golang heap profilers. + +## Installation & usage + +1. Install the profiler package using PyPI: + + ```shell + pip3 install mprofile + ``` + +2. Enable the profiler in your application, get a snapshot of (sampled) memory usage: + + ```python + import mprofile + + mprofile.start(sample_rate=128 * 1024) + snap = mprofile.take_snapshot() + ``` + +See the [tracemalloc](https://docs.python.org/3/library/tracemalloc.html) for API documentation. The API and objects returned by mprofile are compatible. + +## Compatibility + +mprofile is compatible with Python >= 3.4. +It can also be used with earlier versions of Python, but you must build CPython from source and apply the [pytracemalloc patches](https://pytracemalloc.readthedocs.io/install.html#manual-installation). + +## Benchmarks + +We are primarily interested in profiling the memory usage of webservers, so used the `tornado_http` benchmark from pyperformance to estimate overhead. +mprofile has similar performance to tracemalloc when comprehensively tracing all allocations, but when statistical sampling is used, the overhead is significantly reduced. +In addition, mprofile interns call stacks in a tree data structure that reduces memory overhead of storing the traces. + +With the recommended setting of `sample_rate=128kB`, we observe ~5% slow down in the `tornado_http` benchmark. + +TODO: Run the full [pyperformance](https://pyperformance.readthedocs.io) suite of benchmarks. + +### Baseline +``` +Python 2.7.16, no profiling: +tornado_http: Mean +- std dev: 664 ms +- 30 ms +Maximum resident set size (kbytes): 39176 +``` + +### tracemalloc +``` +Python 2.7.16, tracemallocframes=128: +tornado_http: Mean +- std dev: 1.74 sec +- 0.04 sec +Maximum resident set size (kbytes): 43752 + +# Saving only one frame in each stack trace rather than full call stacks. +Python 2.7.16, tracemallocframes=1: +tornado_http: Mean +- std dev: 960 ms +- 30 ms +Maximum resident set size (kbytes): 40000 +``` + +### mprofile +``` +Python 2.7.16, mprofileframes=128, mprofilerate=1 (i.e. tracemalloc): +tornado_http: Mean +- std dev: 1.78 sec +- 0.05 sec +Maximum resident set size (kbytes): 40588 + +Python 2.7.16, mprofileframes=128, mprofilerate=1024: +tornado_http: Mean +- std dev: 888 ms +- 28 ms +Maximum resident set size (kbytes): 39752 + +Python 2.7.16, mprofileframes=128, mprofilerate=128 * 1024: +tornado_http: Mean +- std dev: 700 ms +- 26 ms +Maximum resident set size (kbytes): 39388 + +# Saving only one frame in each stack trace rather than full call stacks. +Python 2.7.16, mprofileframes=1, mprofilerate=1 (i.e. tracemalloc): +tornado_http: Mean +- std dev: 890 ms +- 19 ms +Maximum resident set size (kbytes): 40152 + +Python 2.7.16, mprofileframes=1, mprofilerate=1024: +tornado_http: Mean +- std dev: 738 ms +- 24 ms +Maximum resident set size (kbytes): 39568 + +Python 2.7.16, mprofileframes=1, mprofilerate=128 * 1024: +tornado_http: Mean +- std dev: 678 ms +- 22 ms +Maximum resident set size (kbytes): 39328 +``` + +## Developer notes + +Run the unit tests: +``` +bazel test --test_output=streamed //src:profiler_test +``` + +Run the benchmarks: +``` +bazel test -c opt --test_output=streamed //src:profiler_bench +``` + +Run the end-to-end (Python) tests: +``` +bazel test --config asan --test_output=streamed //test:* +``` + +Run tests with ASAN and UBSAN: +``` +bazel test --config asan --test_output=streamed //src:* //test:* +``` + +# Contributing + +Pull requests and issues are welcomed! + +# License + +mprofile is released under the [MIT License](https://opensource.org/licenses/MIT) and incorporates code from [heapprof](https://github.com/humu/heapprof), which is also released under the MIT license. + + + + +%package -n python3-mprofile +Summary: A low-overhead memory profiler. +Provides: python-mprofile +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-mprofile +[](https://pypi.org/project/mprofile/) +[](https://travis-ci.org/timpalpant/mprofile) + + +[](https://pypistats.org/packages/mprofile) +[](https://github.com/psf/black) + +# mprofile + +A low-overhead sampling memory profiler for Python, derived from [heapprof](https://github.com/humu/heapprof), with an interface similar to [tracemalloc](https://pytracemalloc.readthedocs.io). +mprofile attempts to give results comparable to tracemalloc, but uses statistical sampling to lower memory and CPU overhead. The sampling algorithm is the one used by [tcmalloc](https://github.com/gperftools/gperftools) and Golang heap profilers. + +## Installation & usage + +1. Install the profiler package using PyPI: + + ```shell + pip3 install mprofile + ``` + +2. Enable the profiler in your application, get a snapshot of (sampled) memory usage: + + ```python + import mprofile + + mprofile.start(sample_rate=128 * 1024) + snap = mprofile.take_snapshot() + ``` + +See the [tracemalloc](https://docs.python.org/3/library/tracemalloc.html) for API documentation. The API and objects returned by mprofile are compatible. + +## Compatibility + +mprofile is compatible with Python >= 3.4. +It can also be used with earlier versions of Python, but you must build CPython from source and apply the [pytracemalloc patches](https://pytracemalloc.readthedocs.io/install.html#manual-installation). + +## Benchmarks + +We are primarily interested in profiling the memory usage of webservers, so used the `tornado_http` benchmark from pyperformance to estimate overhead. +mprofile has similar performance to tracemalloc when comprehensively tracing all allocations, but when statistical sampling is used, the overhead is significantly reduced. +In addition, mprofile interns call stacks in a tree data structure that reduces memory overhead of storing the traces. + +With the recommended setting of `sample_rate=128kB`, we observe ~5% slow down in the `tornado_http` benchmark. + +TODO: Run the full [pyperformance](https://pyperformance.readthedocs.io) suite of benchmarks. + +### Baseline +``` +Python 2.7.16, no profiling: +tornado_http: Mean +- std dev: 664 ms +- 30 ms +Maximum resident set size (kbytes): 39176 +``` + +### tracemalloc +``` +Python 2.7.16, tracemallocframes=128: +tornado_http: Mean +- std dev: 1.74 sec +- 0.04 sec +Maximum resident set size (kbytes): 43752 + +# Saving only one frame in each stack trace rather than full call stacks. +Python 2.7.16, tracemallocframes=1: +tornado_http: Mean +- std dev: 960 ms +- 30 ms +Maximum resident set size (kbytes): 40000 +``` + +### mprofile +``` +Python 2.7.16, mprofileframes=128, mprofilerate=1 (i.e. tracemalloc): +tornado_http: Mean +- std dev: 1.78 sec +- 0.05 sec +Maximum resident set size (kbytes): 40588 + +Python 2.7.16, mprofileframes=128, mprofilerate=1024: +tornado_http: Mean +- std dev: 888 ms +- 28 ms +Maximum resident set size (kbytes): 39752 + +Python 2.7.16, mprofileframes=128, mprofilerate=128 * 1024: +tornado_http: Mean +- std dev: 700 ms +- 26 ms +Maximum resident set size (kbytes): 39388 + +# Saving only one frame in each stack trace rather than full call stacks. +Python 2.7.16, mprofileframes=1, mprofilerate=1 (i.e. tracemalloc): +tornado_http: Mean +- std dev: 890 ms +- 19 ms +Maximum resident set size (kbytes): 40152 + +Python 2.7.16, mprofileframes=1, mprofilerate=1024: +tornado_http: Mean +- std dev: 738 ms +- 24 ms +Maximum resident set size (kbytes): 39568 + +Python 2.7.16, mprofileframes=1, mprofilerate=128 * 1024: +tornado_http: Mean +- std dev: 678 ms +- 22 ms +Maximum resident set size (kbytes): 39328 +``` + +## Developer notes + +Run the unit tests: +``` +bazel test --test_output=streamed //src:profiler_test +``` + +Run the benchmarks: +``` +bazel test -c opt --test_output=streamed //src:profiler_bench +``` + +Run the end-to-end (Python) tests: +``` +bazel test --config asan --test_output=streamed //test:* +``` + +Run tests with ASAN and UBSAN: +``` +bazel test --config asan --test_output=streamed //src:* //test:* +``` + +# Contributing + +Pull requests and issues are welcomed! + +# License + +mprofile is released under the [MIT License](https://opensource.org/licenses/MIT) and incorporates code from [heapprof](https://github.com/humu/heapprof), which is also released under the MIT license. + + + + +%package help +Summary: Development documents and examples for mprofile +Provides: python3-mprofile-doc +%description help +[](https://pypi.org/project/mprofile/) +[](https://travis-ci.org/timpalpant/mprofile) + + +[](https://pypistats.org/packages/mprofile) +[](https://github.com/psf/black) + +# mprofile + +A low-overhead sampling memory profiler for Python, derived from [heapprof](https://github.com/humu/heapprof), with an interface similar to [tracemalloc](https://pytracemalloc.readthedocs.io). +mprofile attempts to give results comparable to tracemalloc, but uses statistical sampling to lower memory and CPU overhead. The sampling algorithm is the one used by [tcmalloc](https://github.com/gperftools/gperftools) and Golang heap profilers. + +## Installation & usage + +1. Install the profiler package using PyPI: + + ```shell + pip3 install mprofile + ``` + +2. Enable the profiler in your application, get a snapshot of (sampled) memory usage: + + ```python + import mprofile + + mprofile.start(sample_rate=128 * 1024) + snap = mprofile.take_snapshot() + ``` + +See the [tracemalloc](https://docs.python.org/3/library/tracemalloc.html) for API documentation. The API and objects returned by mprofile are compatible. + +## Compatibility + +mprofile is compatible with Python >= 3.4. +It can also be used with earlier versions of Python, but you must build CPython from source and apply the [pytracemalloc patches](https://pytracemalloc.readthedocs.io/install.html#manual-installation). + +## Benchmarks + +We are primarily interested in profiling the memory usage of webservers, so used the `tornado_http` benchmark from pyperformance to estimate overhead. +mprofile has similar performance to tracemalloc when comprehensively tracing all allocations, but when statistical sampling is used, the overhead is significantly reduced. +In addition, mprofile interns call stacks in a tree data structure that reduces memory overhead of storing the traces. + +With the recommended setting of `sample_rate=128kB`, we observe ~5% slow down in the `tornado_http` benchmark. + +TODO: Run the full [pyperformance](https://pyperformance.readthedocs.io) suite of benchmarks. + +### Baseline +``` +Python 2.7.16, no profiling: +tornado_http: Mean +- std dev: 664 ms +- 30 ms +Maximum resident set size (kbytes): 39176 +``` + +### tracemalloc +``` +Python 2.7.16, tracemallocframes=128: +tornado_http: Mean +- std dev: 1.74 sec +- 0.04 sec +Maximum resident set size (kbytes): 43752 + +# Saving only one frame in each stack trace rather than full call stacks. +Python 2.7.16, tracemallocframes=1: +tornado_http: Mean +- std dev: 960 ms +- 30 ms +Maximum resident set size (kbytes): 40000 +``` + +### mprofile +``` +Python 2.7.16, mprofileframes=128, mprofilerate=1 (i.e. tracemalloc): +tornado_http: Mean +- std dev: 1.78 sec +- 0.05 sec +Maximum resident set size (kbytes): 40588 + +Python 2.7.16, mprofileframes=128, mprofilerate=1024: +tornado_http: Mean +- std dev: 888 ms +- 28 ms +Maximum resident set size (kbytes): 39752 + +Python 2.7.16, mprofileframes=128, mprofilerate=128 * 1024: +tornado_http: Mean +- std dev: 700 ms +- 26 ms +Maximum resident set size (kbytes): 39388 + +# Saving only one frame in each stack trace rather than full call stacks. +Python 2.7.16, mprofileframes=1, mprofilerate=1 (i.e. tracemalloc): +tornado_http: Mean +- std dev: 890 ms +- 19 ms +Maximum resident set size (kbytes): 40152 + +Python 2.7.16, mprofileframes=1, mprofilerate=1024: +tornado_http: Mean +- std dev: 738 ms +- 24 ms +Maximum resident set size (kbytes): 39568 + +Python 2.7.16, mprofileframes=1, mprofilerate=128 * 1024: +tornado_http: Mean +- std dev: 678 ms +- 22 ms +Maximum resident set size (kbytes): 39328 +``` + +## Developer notes + +Run the unit tests: +``` +bazel test --test_output=streamed //src:profiler_test +``` + +Run the benchmarks: +``` +bazel test -c opt --test_output=streamed //src:profiler_bench +``` + +Run the end-to-end (Python) tests: +``` +bazel test --config asan --test_output=streamed //test:* +``` + +Run tests with ASAN and UBSAN: +``` +bazel test --config asan --test_output=streamed //src:* //test:* +``` + +# Contributing + +Pull requests and issues are welcomed! + +# License + +mprofile is released under the [MIT License](https://opensource.org/licenses/MIT) and incorporates code from [heapprof](https://github.com/humu/heapprof), which is also released under the MIT license. + + + + +%prep +%autosetup -n mprofile-0.0.15 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-mprofile -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Wed May 31 2023 Python_Bot <Python_Bot@openeuler.org> - 0.0.15-1 +- Package Spec generated @@ -0,0 +1 @@ +8ccfa9c642d8648adf30aa7fd3d2f9bd mprofile-0.0.15.tar.gz |