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.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.4.0.tar.gz (16.6 kB view details)

Uploaded Source

Built Distribution

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

tictactoc-0.4.0-py3-none-any.whl (18.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tictactoc-0.4.0.tar.gz
  • Upload date:
  • Size: 16.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for tictactoc-0.4.0.tar.gz
Algorithm Hash digest
SHA256 a808b65efd032fa709d46f62a7e8424178f264823f526bffff5d4f7f3992d1ff
MD5 d613a41de1b8deca2ddd7d8a1ba044c7
BLAKE2b-256 ec667f8a6ee42c3a275e2922ee0627d91e71f39d6f3f62e71ef2b0e4f0342ef2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tictactoc-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 18.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for tictactoc-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 500895497a8cb460836c20440e488acff7460a78d32f06db91b6999dbbdbf310
MD5 5f8b05c0eab7d9c5e4c9cf2ca1c36511
BLAKE2b-256 bf61e0c654cf48a7553865e11fae6c7da9df9c0b2020302ca19f0456df9aa8f3

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