Skip to main content

A simple package to calculate the execution time of certain lines of code

Project description

Install

pip install etime

Usage:-

Execution Time

check_time

timeit wrapper

from et import check_time

@check_time(number=10000, debug = True)
def multiply(x=1000, y=0.828348):
    return x*y

print("Value: ",multiply())

Output:

--------------------------------------------------------------------------
[ multiply -> 10000 iterations] [Elapsed time]: 0.003009455000000001 Sec
--------------------------------------------------------------------------

Value: 828.348

ET

from et import ET

execution_time = ET("info")
"""
    YOUR CODE HERE
"""
execution_time.stop()

Output:

 self  | The execution time = 0:00:00.000158S  | 156000 NS

Example

from et import ET

executiontime = ET("Calculate radians")

import math
input1 = 1234567
y = math.radians(input1)
print(f'\n The input = {input1}, output = {y}')

executiontime.stop()

Output

The input = 1234567, output = 21547.258986468834
Calculate radians  | The execution time = 0:00:00.000102S  | 105000 NS

ETM [Execution Time Manager]

from et import ETM

with ETM() as etm:
    """
    YOUR CODE HERE
    """

Output:

[Started]: 2021-01-19 17:36:39.878058
[End]: 2021-01-19 17:36:39.878538 Sec
[Elapsed time]:  0:00:00.000466 Sec

example

from et import ETM

with ETM() as em:
    import math
    input1 = 1234567
    y = math.radians(input1)
    print(f'\n The input = {input1}, output = {y}')

Output

The input = 1234567, output = 21547.258986468834

[Started]: 2021-01-19 17:36:39.878058
[End]: 2021-01-19 17:36:39.878538 Sec
[Elapsed time]:  0:00:00.000466 Sec

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

etime-0.5.tar.gz (3.3 kB view details)

Uploaded Source

File details

Details for the file etime-0.5.tar.gz.

File metadata

  • Download URL: etime-0.5.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.6

File hashes

Hashes for etime-0.5.tar.gz
Algorithm Hash digest
SHA256 100657970f9febc2bbfeb814fbfee95570745bc75d288af30fd5f2d149e97176
MD5 15456bbe4d81d62e089ff729fe351936
BLAKE2b-256 ffc917626aa697a7de310ff5f9749460d129f6102f1ac3c2d135eead1142a19c

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