Skip to main content

A simple but robust package to time any function

Project description

Package Description

timeN is a simple package that contains a customizable @timen decorator which times how long it takes (in milliseconds) for the decorated function to run n times

Usage

The timen decorator is quite simple to use. it can be imported by simply importing the timeN package with

import timeN

From there, the timeN decorator can be used like any other decorator, with the exception that you must end the decorator in parentheses since it takes optional parameters

@timeN()
def foo():
    print("Hello World")

Output:

Hello World
...
Hello World
foo took 2.0 milliseconds to run 10 times

The 2 optional parameters are: n (number of times to run the function) and round_to (number decimal places to round the final result to).

@timeN(100, 5)
def foo():
    print("Hello World")

Output:

Hello World
...
Hello World
foo took 11.99365 milliseconds to run 100 times

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

timeN-1.1.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

timeN-1.1-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file timeN-1.1.tar.gz.

File metadata

  • Download URL: timeN-1.1.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.18

File hashes

Hashes for timeN-1.1.tar.gz
Algorithm Hash digest
SHA256 9c0bc1112a754511ae6eed0f28504bbfb8a1388542b72cde3118713ed72db945
MD5 6e56dd668632de73b9beda207c93fa9e
BLAKE2b-256 f6e24fb1fdfe755905c1ab74c971eb317e8677b4142224adb5adce3a5fbbe511

See more details on using hashes here.

File details

Details for the file timeN-1.1-py3-none-any.whl.

File metadata

  • Download URL: timeN-1.1-py3-none-any.whl
  • Upload date:
  • Size: 3.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.18

File hashes

Hashes for timeN-1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1c889fd5a49fbe89a95df23fbaa4aca3b0a8e5c17ba440c63b99cce513790704
MD5 c4d6630d14df1307c3e046c0f0c590d3
BLAKE2b-256 8b493b81123c50d5bb418a3aaba65531031e4c2977b74cb19f0cf0fc2c3d61d1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page