Time code using syntax similar to tic and toc in MATLAB
Project description
pytictoc contains a class TicToc which replicates the functionality of MATLAB’s tic and toc for easily timing sections of code. Under the hood, pytictoc uses Python’s time.perf_counter() on Python 3.3 and above and time.clock() on earlier versions.
INSTALLATION
pytictoc can be installed and updated via conda or pip.
pip
pip install pytictoc pip install pytictoc --upgrade
conda
conda install pytictoc -c ecf conda update pytictoc -c ecf
USAGE
>> from pytictoc import TicToc >> t = TicToc() #create instance of class >> t.tic() #Start timer >> t.toc() #Time elapsed since t.tic() Elapsed time is 2.612231 seconds. >> t.toc('It has been') #alternative message It has been 16.494467 seconds. >> t.toc(restart=True) #restart timer after reporting time Elapsed time is 36.986837 seconds. >>t.toc() Elapsed time is 2.393425 seconds. >>spam = t.tocvalue() #return elapsed time instead of printing >>spam 20.156261717544602
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pytictoc-1.2.0.tar.gz
(3.7 kB
view hashes)
Built Distribution
Close
Hashes for pytictoc-1.2.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b9cfe44e4e62cae3250b1aec146427ab5568649abc71565c0a68469638984550 |
|
MD5 | 1ceb6dc7deb039612a879f4cf1077a3a |
|
BLAKE2b-256 | 8ebcbcdf16718a9be3883c5a0256680fac9a9438b6c2a3cc75f2963c03281147 |