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': 1.8840000848285854e-06, 'steps': [1.8840000848285854e-06]}
total: 2.2079411439999603, each iteration: 0.5419861169993965, 0.5843896450005559, 0.3017711920001602, 0.4091919909997159, 0.3706021990001318
# Print a plot.
# We can use the return value of toc for draw a plot.

plot.print(result)
========================================
my loop
--------------------
 0 | ##################     0.54
 1 | #################### ! 0.58
 2 | ##########             0.30
 3 | ##############         0.41
 4 | ############           0.37
--------------------
quantile value: 0.5504668225996283
========================================

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

Uploaded Source

Built Distribution

tictactoc-0.3.1-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for tictactoc-0.3.1.tar.gz
Algorithm Hash digest
SHA256 c2892baf595c5fba72d3cbaf3d0803638632e788ed8798429ed7192884cb6104
MD5 860bc8a643a177f16992734a7c35b233
BLAKE2b-256 bd829c17e424068a7ea939cccd40756cbaa814c323539c3f932656fb969093f4

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for tictactoc-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 95bce8c9ce179225f64611e1319939799a3130a0c17504269cf1180ffb704b86
MD5 50ca8f0d42c4d288de98e9c1f29d79ea
BLAKE2b-256 3da4db97625383ceeacac6dd1f234a7769c4bf83fd1d8b5499f4a843cdc5b449

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