A simple code profiling library.
Project description
Profiler
A python package providing simple profiling tools and reports.
Installation
Run
pip install profilerpy
or
pip install git+https://github.com/Rahgooy/profiler.git@master
Usage
Methods
Profiler can be used as a wrapper for the files. For example:
from profilerpy import profile
@profile
def add(a, b):
return a + b
Code blocks
Another usage is for profiling a block of code:
from profilerpy import default_profiler
# Some line of code
default_profiler.start('Price calculator')
# Price calculator codes
default_profiler.finish('Price calculator')
Print summary
Finally you can print the profiling summary
default_profiler.print_profile()
Multiple profilers
This package uses dafult_profiler by default. However, you can use multiple instances of the profiler class.
For example:
from profilerpy import Profiler, profile
priceProfiler = Profiler() # Profile the codes related to calculating price
userProfiler = Profiler() # Profile the codes related to the user management
# Some lines of code
userProfiler.start('Find user')
# Find user codes
userProfile.finish('Find user')
# ...
default_profiler.start('Price calculator')
# Price calculator codes
default_profiler.finish('Price calculator')
@profile('update_user', profiler=userProfiler)
def update_user(user):
pass
Functions with custom names
@profile('FancyName')
def method1():
pass
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file profilerpy-0.2.tar.gz.
File metadata
- Download URL: profilerpy-0.2.tar.gz
- Upload date:
- Size: 3.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.23.0 setuptools/47.1.1.post20200604 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b303efe05a8d62fc7e879d39220603bb14e0772b6ea043e0a5f3871486c40bbf
|
|
| MD5 |
8419a5e14cb0c69bdac642c03a0e8dd2
|
|
| BLAKE2b-256 |
281e394c4f1981a5f834aeb970cfe1504ef7118e8d39ccc7557f7f64a86757ff
|
File details
Details for the file profilerpy-0.2-py3-none-any.whl.
File metadata
- Download URL: profilerpy-0.2-py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.23.0 setuptools/47.1.1.post20200604 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ffc500ce46df8a7113d25afdba19dfb4d5e089ac66b36b312c8d94b48eb237fe
|
|
| MD5 |
f46a53bd8c8f0e6c5cdb0de39821cc7f
|
|
| BLAKE2b-256 |
c62be0742d9439979e7744cc029866a9ddf0dfa6466c5e64b9a0322da9eda48a
|