tictectoc
Tic Tec Toc timing for Python.
How to install
pip install tictectoc
TicTecToc
- TicToc
import time
from tictectoc import TicTecToc
t = TicTecToc()
t.tic()
time.sleep(1)
t.toc() # print '[TTT:default] Elapsed time is 0:00:01'
t.tic()
time.sleep(2)
t.toc() # print '[TTT:default] Elapsed time is 0:00:02'
- TicTecToc
import time
from tictectoc import TicTecToc
t = TicTecToc()
for i in range(10):
t.tic()
time.sleep(1)
t.tec()
t.toc() # print '[TTT:default] Elapsed time is 0:00:10'
- (a) TicTecToc with more than 1 timers
import time
from tictectoc import TicTecToc
t = TicTecToc()
t2 = TicTecToc('timer2')
for i in range(10):
t.tic('timer0')
t.tic('timer1')
t.tic(100)
t2.tic()
time.sleep(1)
t.tec('timer0')
t.tec('timer1')
t.tec(100)
t2.tec()
t.toc('timer0') # print '[TTT:timer0] Elapsed time is 0:00:10'
t.toc('timer1') # print '[TTT:timer1] Elapsed time is 0:00:10'
t.toc(100) # print '[TTT:100] Elapsed time is 0:00:10'
t2.toc() # print '[TTT:timer2] Elapsed time is 0:00:10'
- global instance 'ttt'
import time
from tictectoc import ttt
for i in range(10):
ttt.tic()
time.sleep(1)
ttt.tec()
ttt.toc() # print '[TTT:default] Elapsed time is 0:00:10'
- global function 'tic, tec, toc'
import time
from tictectoc import tic, tec, toc
for i in range(10):
tic()
time.sleep(1)
tec()
toc() # print '[TTT:default] Elapsed time is 0:00:10'
- abbreviation
import time
from tictectoc import TicTecToc
t = TicTecToc()
for i in range(10):
t.i()
time.sleep(1)
t.e()
t.o() # print '[TTT:default] Elapsed time is 0:00:10'
import time
from tictectoc import ttt
for i in range(10):
ttt.i()
time.sleep(1)
ttt.e()
ttt.o() # print '[TTT:default] Elapsed time is 0:00:10'
import time
from tictectoc import i, e, o
for i in range(10):
i()
time.sleep(1)
e()
o() # print '[TTT:default] Elapsed time is 0:00:10'
- decorator
import time
from tictectoc import ttt
@ttt.dec('timer0')
def function(n=10):
for i in range(n):
time.sleep(1)
function() # print '[TTT:timer0] Elapsed time is 0:00:10'
import time
from tictectoc import dec
@dec('timer0')
def function(n=1):
for i in range(n):
time.sleep(1)
function() # print '[TTT:timer0] Elapsed time is 0:00:10'
- (a) with statement
import time
from tictectoc import TicTecToc
with TicTecToc():
for i in range(10):
time.sleep(1)
# print '[TTT::default] Elapsed time is 0:00:10'
import time
from tictectoc import ttt
with ttt:
for i in range(10):
time.sleep(1)
# print '[TTT::default] Elapsed time is 0:00:10'
- (b) double with
import time
from tictectoc import TicTecToc
with TicTecToc('timer0'):
with TicTecToc('timer1'):
time.sleep(10)
time.sleep(10)
# print '[TTT::timer1] Elapsed time is 0:00:10'
# print '[TTT::timer0] Elapsed time is 0:00:20'
Metadata
Release files for tictectoc 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tictectoc-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for tictectoc-0.2.0-py3-none-any.whl |
Release files / tictectoc-0.2.0-py3-none-any.whl
| Download URL | tictectoc-0.2.0-py3-none-any.whl |
|---|---|
| Size | 3.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3443de3867e0c4cc866f38381cd48c0a4d3d401009330f665c53a4c22b006e23
|
|
BLAKE2b-256 checksum How to use checksums |
984ee7a0cb64142c242a5b4c75b1548b3f3276b199abebbd271e318832375b00
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.8.8
|
Security for tictectoc 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.