============
py-stopwatch
============
.. image:: https://img.shields.io/pypi/v/py-stopwatch?color=success
:target: https://pypi.python.org/pypi/py_stopwatch
.. image:: https://readthedocs.org/projects/py-stopwatch/badge/?version=latest
:target: https://py-stopwatch.readthedocs.io/en/latest/?badge=latest
:alt: Documentation Status
.. image:: https://img.shields.io/pypi/pyversions/py-stopwatch
:target: https://pypi.python.org/pypi/py-stopwatch
:alt: Python Version Support
.. image:: https://img.shields.io/github/issues/hrishikeshrt/py_stopwatch
:target: https://github.com/hrishikeshrt/py_stopwatch/issues
:alt: GitHub Issues
.. image:: https://img.shields.io/github/followers/hrishikeshrt?style=social
:target: https://github.com/hrishikeshrt
:alt: GitHub Followers
.. image:: https://img.shields.io/twitter/follow/hrishikeshrt?style=social
:target: https://twitter.com/hrishikeshrt
:alt: Twitter Followers
Stopwatch class for timing portions of python code.
* Free software: MIT license
* Documentation: https://py-stopwatch.readthedocs.io.
Features
========
* Tick-based stopwatch
* Support for Pause/Resume
* Support for multiple named-ticks
* Utility functions for time between different ticks
* No third party requirements.
Usage
=====
.. code-block:: python
from stopwatch import Stopwatch
t = Stopwatch()
t.start()
print("Started ..")
time.sleep(0.24)
print(f"t.tick(): {t.tick():.4f} seconds")
time.sleep(0.48)
print(f"t.tick(): {t.tick():.4f} seconds")
time.sleep(0.16)
print(f"t.tick('Named Tick-1'): {t.tick('Named Tick-1'):.4f} seconds")
t.pause()
print("Paused ..")
time.sleep(0.12)
t.resume()
print("Resumed ..")
print(f"t.last(): {t.last():.4f} seconds")
time.sleep(0.12)
print(f"t.tick(): {t.tick():.4f} seconds")
time.sleep(0.12)
print(f"t.tick('Named Tick-2'): {t.tick('Named Tick-2'):.4f} seconds")
t.stop()
print("Timer stopped.")
print("---")
print(f"Total pause: {t.time_paused:.2f} seconds.")
print(f"Total runtime: {t.time_active:.2f} seconds.")
print(f"Total time: {t.time_total:.2f} seconds.")
tij = t.get_time_elapsed(start_key='Named Tick-1', end_key='Named Tick-2')
print(f"Time between 'Named Tick-1' and 'Named Tick-2': {tij:.4f}")
History
=======
0.0.1 (2021-04-13)
------------------
* First release on PyPI.
Raw data
{
"_id": null,
"home_page": "https://github.com/hrishikeshrt/py_stopwatch",
"name": "py-stopwatch",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": "stopwatch",
"author": "Hrishikesh Terdalkar",
"author_email": "hrishikeshrt@linuxmail.org",
"download_url": "https://files.pythonhosted.org/packages/a1/ad/a27f9d07ba29358cb54078329d16512745dd32b837d4a1f42eaee829f0c0/py_stopwatch-0.2.2.tar.gz",
"platform": null,
"description": "============\npy-stopwatch\n============\n\n.. image:: https://img.shields.io/pypi/v/py-stopwatch?color=success\n :target: https://pypi.python.org/pypi/py_stopwatch\n\n.. image:: https://readthedocs.org/projects/py-stopwatch/badge/?version=latest\n :target: https://py-stopwatch.readthedocs.io/en/latest/?badge=latest\n :alt: Documentation Status\n\n.. image:: https://img.shields.io/pypi/pyversions/py-stopwatch\n :target: https://pypi.python.org/pypi/py-stopwatch\n :alt: Python Version Support\n\n.. image:: https://img.shields.io/github/issues/hrishikeshrt/py_stopwatch\n :target: https://github.com/hrishikeshrt/py_stopwatch/issues\n :alt: GitHub Issues\n\n.. image:: https://img.shields.io/github/followers/hrishikeshrt?style=social\n :target: https://github.com/hrishikeshrt\n :alt: GitHub Followers\n\n.. image:: https://img.shields.io/twitter/follow/hrishikeshrt?style=social\n :target: https://twitter.com/hrishikeshrt\n :alt: Twitter Followers\n\n\nStopwatch class for timing portions of python code.\n\n* Free software: MIT license\n* Documentation: https://py-stopwatch.readthedocs.io.\n\n\nFeatures\n========\n\n* Tick-based stopwatch\n* Support for Pause/Resume\n* Support for multiple named-ticks\n* Utility functions for time between different ticks\n* No third party requirements.\n\nUsage\n=====\n\n.. code-block:: python\n\n from stopwatch import Stopwatch\n t = Stopwatch()\n t.start()\n print(\"Started ..\")\n time.sleep(0.24)\n print(f\"t.tick(): {t.tick():.4f} seconds\")\n time.sleep(0.48)\n print(f\"t.tick(): {t.tick():.4f} seconds\")\n time.sleep(0.16)\n print(f\"t.tick('Named Tick-1'): {t.tick('Named Tick-1'):.4f} seconds\")\n t.pause()\n print(\"Paused ..\")\n time.sleep(0.12)\n t.resume()\n print(\"Resumed ..\")\n print(f\"t.last(): {t.last():.4f} seconds\")\n time.sleep(0.12)\n print(f\"t.tick(): {t.tick():.4f} seconds\")\n time.sleep(0.12)\n print(f\"t.tick('Named Tick-2'): {t.tick('Named Tick-2'):.4f} seconds\")\n t.stop()\n print(\"Timer stopped.\")\n print(\"---\")\n print(f\"Total pause: {t.time_paused:.2f} seconds.\")\n print(f\"Total runtime: {t.time_active:.2f} seconds.\")\n print(f\"Total time: {t.time_total:.2f} seconds.\")\n tij = t.get_time_elapsed(start_key='Named Tick-1', end_key='Named Tick-2')\n print(f\"Time between 'Named Tick-1' and 'Named Tick-2': {tij:.4f}\")\n\n\nHistory\n=======\n\n0.0.1 (2021-04-13)\n------------------\n\n* First release on PyPI.\n",
"bugtrack_url": null,
"license": "MIT license",
"summary": "Stopwatch class for timing portions of python code",
"version": "0.2.2",
"project_urls": {
"Homepage": "https://github.com/hrishikeshrt/py_stopwatch"
},
"split_keywords": [
"stopwatch"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "9e6729b22e483f6d65f3a476e4287ca8351a2502e644fa955ff5ed6d40a6507c",
"md5": "8e5504f8a680cfbeae73d4583657dd98",
"sha256": "c30e4e771723724abc928f86c095b36998ceeac7cb2381dceebcbf9f622ab67e"
},
"downloads": -1,
"filename": "py_stopwatch-0.2.2-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "8e5504f8a680cfbeae73d4583657dd98",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": ">=3.6",
"size": 6307,
"upload_time": "2024-11-27T17:59:54",
"upload_time_iso_8601": "2024-11-27T17:59:54.833405Z",
"url": "https://files.pythonhosted.org/packages/9e/67/29b22e483f6d65f3a476e4287ca8351a2502e644fa955ff5ed6d40a6507c/py_stopwatch-0.2.2-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "a1ada27f9d07ba29358cb54078329d16512745dd32b837d4a1f42eaee829f0c0",
"md5": "877c4513137c3d841a46b999d556cd18",
"sha256": "ed3dc70415a14f8a351a74ccd27a78f49f82f3fde8d63283ea3cf7acd389ce46"
},
"downloads": -1,
"filename": "py_stopwatch-0.2.2.tar.gz",
"has_sig": false,
"md5_digest": "877c4513137c3d841a46b999d556cd18",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 12624,
"upload_time": "2024-11-27T17:59:56",
"upload_time_iso_8601": "2024-11-27T17:59:56.449513Z",
"url": "https://files.pythonhosted.org/packages/a1/ad/a27f9d07ba29358cb54078329d16512745dd32b837d4a1f42eaee829f0c0/py_stopwatch-0.2.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-27 17:59:56",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "hrishikeshrt",
"github_project": "py_stopwatch",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"tox": true,
"lcname": "py-stopwatch"
}