No project description provided
Project description
Hand profiler
Install
$ pip install handprofiler
Example of use
from time import sleep
from random import random
from handprofiler import Profiler
@Profiler.track('foo')
def foo():
for _ in range(2):
token = Profiler.start('in foo')
sleep(random())
Profiler.stop(token)
@Profiler.track('bar')
def bar():
for _ in range(3):
sleep(0.3+random()*0.001)
def zoo():
for _ in range(4):
token = Profiler.start('in zoo')
sleep(random()*3)
Profiler.stop(token)
bar()
zoo()
foo()
foo()
Profiler.printstats()
Profiler.clear()
total=0:00:01.772223 avg=0:00:00.443055±0:00:00.316111 runs=4 in zoo
total=0:00:01.768178 avg=0:00:00.884089±0:00:00.006843 runs=2 foo
total=0:00:01.766944 avg=0:00:00.441736±0:00:00.247907 runs=4 in foo
total=0:00:00.902467 avg=0:00:00.902467±0:00:00 runs=1 bar
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
handprofiler-0.0.2.tar.gz
(3.4 kB
view hashes)
Built Distribution
Close
Hashes for handprofiler-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a0c80d4ad531a65f16e2e945aaec29300fb6d934c08bf4a00af00c40de8279ff |
|
MD5 | babe6c53fffe5c59b0551900dc9e301a |
|
BLAKE2b-256 | 41aff5e3934b995f5a06b6a8b7fd419836fbc8a00a2e6fed3f9e989731e27bd5 |