The Wayback Machine - https://web.archive.org/web/20260306031629/https://github.com/Kludex/simpletiming
Skip to content

Kludex/simpletiming

Folders and files

NameName
Last commit message
Last commit date

Latest commit

�?

History

11 Commits
�?
�?
�?
�?
�?
�?
�?
�?
�?
�?
�?
�?
�?
�?
�?
�?
�?
�?
�?
�?
�?
�?

Repository files navigation

Simple Timing

Latest Commit
Package version

Installation

pip install simpletiming

Usage

As decorator

from simpletiming import Timer
from time import sleep

@Timer(name="Potato")
def potato():
    sleep(1)

potato()

# Elapsed time: 1.0011 seconds

As object

timer = Timer()

timer.start()
sleep(1)
timer.stop()

# Elapsed time 1.0011 seconds

As context manager

with Timer(message="Elapsed time: {minutes:0.4f} minutes"):
    sleep(1)

# Elapsed time: 0.0167 minutes

On all class methods

@Timer(name="MyClass", message="{name}: {seconds:0.4f} seconds")
class MyClass:
    def potato(self):
        sleep(1)

obj = MyClass()
obj.potato()

# MyClass: 1.0011 seconds

License

This project is licensed under the terms of the MIT license.

About

Time your functions in a smart way! ~ Highly Inspired by codetiming 🎉

Resources

License

Security policy

Stars

Watchers

Forks

Sponsor this project

 

Contributors