Skip to main content

Literally another code timer (with fancy plotting)

Project description

Repository: https://github.com/dangcpham/anothertimer

Just another timer for code timing. anothertimer enables easy timing for code runs, saving timing data, and provides basic plotting capabilities. Example usage:

from anothertimer import Timer
timer = Timer()
timer.tic()
#some code here
timer.toc()

Saving and loading data (modes ‘a’ for append and ‘w’ for write):

timer.dump('example.csv', mode='a')
timer.load('example2.csv')

Plotting can be done via:

timer.plot()

Check out example.py on GitHub for some more features (stopwatch/sections) and plots!

Installation

pip install anothertimer

Dependecies

  1. Standard Python libraries (typing, time, os, csv).

  2. matplotlib (optional) - for plotting.

Overhead

Measured by pstats on example.py, core functionalities causes minimal (<0.001s) overhead. Plotting causes some overhead (due to matplotlib plotting, on the order of a few seconds), so plot carefully.

Precision

Currently, anothertimer uses the time.time() function to keep track of time. The precision is in the sub-second range (read more about Python timing at https://www.python.org/dev/peps/pep-0564/, https://stackoverflow.com/questions/1938048/high-precision-clock-in-python). Currently, it is not a good idea to use this package for high precision applications, consider the timeit module.

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

anothertimer-1.05.tar.gz (5.4 kB view details)

Uploaded Source

File details

Details for the file anothertimer-1.05.tar.gz.

File metadata

  • Download URL: anothertimer-1.05.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3.post20200330 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

File hashes

Hashes for anothertimer-1.05.tar.gz
Algorithm Hash digest
SHA256 4eb0b3ff5fe8a305579d6118296d9e88fef11aa6c3fcc3c0aa9cf709b3f9ff1c
MD5 76530ae01ae28fa0af7f793284354c72
BLAKE2b-256 535feb7ebbcd12f5f55237a35ff2263f00042e1b90ea8f08d7b53f8308124edb

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