Small timing tool to run performance analysis
Project description
tepet
TEmporal PErformance Tool
25-cent term for a 5-cent concept!
What is this
tepet is a small utility to help you understand and track execution time of your code. You could write it anytime, but why do this every other day?
Usage
Can be used as a context manager
from tepet import PerfTimer
with PerfTimer():
print('doing stuff...')
# Output:
#
# > 2020 May 31 20:11:49 +0000 ==== started
# > doing stuff...
# > 2020 May 31 20:11:49 +0000 ==== elapsed 0.00000 seconds
and a function decorator
from tepet import PerfTimer
@PerfTimer()
def work():
print("working...")
work()
# Output:
#
# > 2020 May 31 20:14:25 +0000 ==== started
# > working...
# > 2020 May 31 20:14:25 +0000 ==== elapsed 0.00001 seconds
Also, can be used in production environments for naive tracking:
from tepet import Timer
def printer(seconds):
print(f'code block 1: {seconds:.5f} elapsed')
with Timer(printer):
...
# Output:
# > code block 1: 0.00000 elapsed
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
tepet-0.1.0.tar.gz
(5.5 kB
view hashes)
Built Distribution
tepet-0.1.0-py3-none-any.whl
(3.7 kB
view hashes)