Skip to main content

tictactoc

Project description

tictactoc

A simple library to be able to control the time that certain parts of the code take

Installation and use

To install this module use:

pip install tictactoc

Run tests to validate:

tictactoc-tests

Usage

from time import sleep
from tictactoc import tictactoc
from tictactoc import plot


# Basic use, start and end.
tictactoc.tic() # Start
print(tictactoc.toc()) # Finish

# Using tac in loops.
# We can do a tac in each iteration. When we finnish the loop, we do a toc skipping this time.

my_loop=["element1","element2","element3"]
tictactoc.tic("my loop")

for element in my_loop:
    sleep(0.1)
    tictactoc.tac("my loop")

result = tictactoc.toc("my loop", skip_toc=True)
print(f"total: {result["total"]}, each iteration: {', '.join(map(str,result["steps"]))}")
{'name': '__default', 'total': 5.0144999477197416e-05, 'steps': [5.0144999477197416e-05]}
total: 0.3002458430000843, each iteration: 0.10008363300039491, 0.10007859500001359, 0.10008361499967577
# Print a plot.
# We can use the return value of toc for draw a plot.

plot.print(result)
========================================
my loop
--------------------
 0 | ###################
 1 | ###################
 2 | #################### !
--------------------
quantile value: 0.10020978839966119
========================================

Credits

Developed and maintained by felipem775. Contributions are welcomed.

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

tictactoc-0.3.0.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

tictactoc-0.3.0-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file tictactoc-0.3.0.tar.gz.

File metadata

  • Download URL: tictactoc-0.3.0.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.19

File hashes

Hashes for tictactoc-0.3.0.tar.gz
Algorithm Hash digest
SHA256 88b2343ec86cbeec552975434d8561eca97d240a0f070a6f4e7dbfb37e3ed078
MD5 19a5cae6315c87e60effe7e5f7689bf1
BLAKE2b-256 a71f9df814e2c9a0a3833eedcf5582b3b8d751e16f3fe3f0ab7f3366e1dbe1a0

See more details on using hashes here.

File details

Details for the file tictactoc-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: tictactoc-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.19

File hashes

Hashes for tictactoc-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f9c8dde2e83c07fa2399e88d04e55023a54c4490d46c3a82a4cc347b6a6f1807
MD5 3fe5c85bb125b142417e1263a1a700f4
BLAKE2b-256 5fe8b33645143f7b0a0bc9bea26088bc8b323e36409dcd2cdf04cbda80e97273

See more details on using hashes here.

Supported by

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