Start and stop a python profiler
Project description
startstop
A simple way to start and stop a Python profiler (pyinstument) and view the results in the browser.
Installation
pip install startstop
Usage
from startstop import t, tc, p, pc
Simple timer
t()
# This is where your code goes.
t()
TIMER: 0.024 sec
t(label="your label", precision=2)
# This is where your code goes.
t()
TIMER your label: 0.02 sec
Simple timer as contex manager
with tc():
# This is where your code goes.
TIMER: 0.024 sec
with tc(label="your label", precision=2):
# This is where your code goes.
TIMER your label: 0.02 sec
Profiler
p()
# This is where your code goes.
p()
--> Browser output
p(interval=0.01, async_mode="disabled")
# This is where your code goes.
p()
--> Browser output
Profiler as context manager
with pc():
# This is where your code goes.
--> Browser output
with pc(interval=0.002, async_mode="strict"):
# This is where your code goes.
--> Browser output
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
startstop-1.0.6.tar.gz
(3.7 kB
view hashes)
Built Distribution
Close
Hashes for startstop-1.0.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 19650dcd7cb8a76c15cb1feea3231bf68e9ef6bec6d7ff9edcc7b49ac422f092 |
|
MD5 | 920899b9b3f269fa896d8db2d1e44698 |
|
BLAKE2b-256 | ac5c8e32a96aa7f107202550f313b9545c8c463c47ac79db3979ef4569ffa4f8 |