{ "info": { "author": "Mateusz Bysiek", "author_email": "mateusz.bysiek@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 2 - Pre-Alpha", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3 :: Only" ], "description": ".. role:: python(code)\n :language: python\n\n\n======\ntiming\n======\n\n.. image:: https://img.shields.io/pypi/v/timing.svg\n :target: https://pypi.org/project/timing\n :alt: package version from PyPI\n\n.. image:: https://travis-ci.com/mbdevpl/timing.svg?branch=master\n :target: https://travis-ci.com/mbdevpl/timing\n :alt: build status from Travis CI\n\n.. image:: https://codecov.io/gh/mbdevpl/timing/branch/master/graph/badge.svg\n :target: https://codecov.io/gh/mbdevpl/timing\n :alt: test coverage from Codecov\n\n.. image:: https://img.shields.io/github/license/mbdevpl/timing.svg\n :target: https://github.com/mbdevpl/timing/blob/master/NOTICE\n :alt: license\n\nTiming module was created to simplify logging of timings of selected parts of an application.\n\n.. contents::\n :backlinks: none\n\n\nHow to use\n==========\n\nRecommended initialization is as follows.\n\n.. code:: python\n\n import timing\n\n _TIME = timing.get_timing_group(__name__) # type: timing.TimingGroup\n\n\nThis follows the conventions of :python:`logging` module.\n\n.. code:: python\n\n import logging\n\n _LOG = logging.getLogger(__name__)\n\nAny name can be used instead of :python:`__name__`.\nHowever, if a names of format :python:`module.sub.subsub` are used, this will create a timing\nhierarchy where each timing data is stored in its proper location and can be queried easier.\n\nThe resulting :python:`_TIME` object is used to create individual timers,\nand will handle storing results in cache, which later can be used to obtain timing statistics.\n\nYou can obtain the timer object directly via :python:`start(name)` method.\nYou'll need to manually call :python:`stop()` in this case.\n\n.. code:: python\n\n timer = _TIME.start('spam') # type: timing.Timing\n spam()\n more_spam()\n timer.stop()\n\n\nYou can also obtain the timer object indirectly via :python:`measure(name)` context manager.\nThe context manager will take care of calling :python:`stop()` at the end.\n\n.. code:: python\n\n with _TIME.measure('ham') as timer: # type: timing.Timing\n ham()\n more_ham()\n\n\nAnd if you want to time many repetitions of the same action (e.g. for statistical significance)\nyou can use :python:`measure_many(name[, samples][, threshold])` generator.\n\nYou can decide how many times you want to measure via :python:`samples` parameter\nand how many seconds at most you want to spend on measurements via :python:`threshold` parameter\n\n.. code:: python\n\n for timer in _TIME.measure_many('eggs', samples=1000): # type: timing.Timing\n eggs()\n more_eggs()\n\n for timer in _TIME.measure_many('bacon', threshold=0.5): # type: timing.Timing\n bacon()\n more_bacon()\n\n for timer in _TIME.measure_many('tomatoes', samples=500, threshold=0.5): # type: timing.Timing\n tomatoes()\n more_tomatoes()\n\n\nAlso, you can use :python:`measure` and :python:`measure(name)` as decorator.\nIn this scenario you cannot access the timings directly, but the results will be stored\nin the timing group object, as well as in the global cache unless you configure the timing\nto not use the cache.\n\n.. code:: python\n\n import timing\n\n _TIME = timing.get_timing_group(__name__)\n\n @_TIME.measure\n def recipe():\n ham()\n eggs()\n bacon()\n\n @_TIME.measure('the_best_recipe')\n def bad_recipe():\n spam()\n spam()\n spam()\n\n\nThen, after calling each function the results can be accessed through :python:`summary` property.\n\n.. code:: python\n\n recipe()\n bad_recipe()\n bad_recipe()\n\n assert _TIME.summary['recipe']['samples'] == 1\n assert _TIME.summary['the_best_recipe']['samples'] == 2\n\n\nThe :python:`summary` property is dynamically computed on first access. Subsequent accesses\nwill not recompute the values, so if you need to access the updated results,\ncall the :python:`summarize()` method.\n\n.. code:: python\n\n recipe()\n assert _TIME.summary['recipe']['samples'] == 1\n\n bad_recipe()\n bad_recipe()\n assert _TIME.summary['the_best_recipe']['samples'] == 2 # will fail\n _TIME.summarize()\n assert _TIME.summary['the_best_recipe']['samples'] == 2 # ok\n\n\nFurther API and documentation are in development.\n\n\nSee these examples in action in `examples.ipynb `_ notebook.\n\n\nRequirements\n============\n\nPython version 3.5 or later.\n\nPython libraries as specified in `requirements.txt `_.\n\nBuilding and running tests additionally requires packages listed in `test_requirements.txt `_.\n\nTested on Linux and OS X.\n\n\n", "description_content_type": "text/x-rst; charset=UTF-8", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/mbdevpl/timing", "keywords": "timing,timer,time measurement,profiling,reproducibility", "license": "Apache License 2.0", "maintainer": "Mateusz Bysiek", "maintainer_email": "mateusz.bysiek@gmail.com", "name": "timing", "package_url": "https://pypi.org/project/timing/", "platform": "", "project_url": "https://pypi.org/project/timing/", "project_urls": { "Homepage": "https://github.com/mbdevpl/timing" }, "release_url": "https://pypi.org/project/timing/0.4.0/", "requires_dist": [ "numpy", "version-query" ], "requires_python": ">=3.5", "summary": "Simplify logging of timings of selected parts of an application.", "version": "0.4.0" }, "last_serial": 5465581, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "2ccf673aa1ab4ad477db205f48ab9224", "sha256": "ffd008e8df70749fa6eef3b249dece06530bacedc35eee1ee72e5aa0757a9498" }, "downloads": -1, "filename": "timing-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "2ccf673aa1ab4ad477db205f48ab9224", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.4", "size": 4411, "upload_time": "2018-07-31T08:30:44", "url": "https://files.pythonhosted.org/packages/e6/97/2aa062ae7fb2533ddc27b411d55696da59184a5491735787e5b612cc3f70/timing-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b07af25dca521282513c20b6e3d72f22", "sha256": "fc904a130a7d10ae12d47e2f9012387b46b431ada3e1f5a0ccebe8cf17c59908" }, "downloads": -1, "filename": "timing-0.1.0.tar.gz", "has_sig": false, "md5_digest": "b07af25dca521282513c20b6e3d72f22", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.4", "size": 14674, "upload_time": "2018-07-31T08:30:46", "url": "https://files.pythonhosted.org/packages/83/f2/f1acb9d3e32216ffaf682a46c955b97d56a80dcdead9559f0638f3c7a5e1/timing-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "4cc361911d39e11eaa23b5a477dd0ac6", "sha256": "8a7d99394e0eb98cb97c0d662228f232cf22a479a90e076ccbefffc168ecc6be" }, "downloads": -1, "filename": "timing-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "4cc361911d39e11eaa23b5a477dd0ac6", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.4", "size": 4423, "upload_time": "2018-08-01T02:39:52", "url": "https://files.pythonhosted.org/packages/28/4b/9bcc51c6ffaf50198c32d33b683fd4e99aa0391981919286ed47e60eec62/timing-0.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "060603a381d5fbf973e485c2bdbb3147", "sha256": "f3296d7a6f98066ee331ad66eb380409a3147d6bc717e9848fbaa5e579b4fdf9" }, "downloads": -1, "filename": "timing-0.1.1.tar.gz", "has_sig": false, "md5_digest": "060603a381d5fbf973e485c2bdbb3147", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.4", "size": 14685, "upload_time": "2018-08-01T02:39:53", "url": "https://files.pythonhosted.org/packages/29/db/5acee423d4837b78e9ebdca77a416c676d3e782dabbbbfb1092cbd48533c/timing-0.1.1.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "ba72273a71644878d53ef96072b3f229", "sha256": "a98643722f5e8004cf132f3c667ede037688b9e0f7957dc4ff8821da7e303af2" }, "downloads": -1, "filename": "timing-0.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "ba72273a71644878d53ef96072b3f229", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.5", "size": 10563, "upload_time": "2019-02-19T03:33:41", "url": "https://files.pythonhosted.org/packages/81/34/ade03f539e3f30623cebd1ebbe3bc25b27b303a8551dac9a3fba79a18c3d/timing-0.2.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0f912016e5c03d5001a722ac5e2733bb", "sha256": "183b7544e8dffa985857596b3d61dcdf7f2952303c87352d77c513f616f6df5a" }, "downloads": -1, "filename": "timing-0.2.0.tar.gz", "has_sig": false, "md5_digest": "0f912016e5c03d5001a722ac5e2733bb", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 17375, "upload_time": "2019-02-19T03:33:43", "url": "https://files.pythonhosted.org/packages/66/0d/fa74d8164db29e6630b8f108317689f84cd30b16e355ec713cb816bc0c89/timing-0.2.0.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "3bd5261372ee13c52f74a5f33fb77867", "sha256": "c22b183538249ff9036e2b12be49ed4a14e7d056f2794c9498cf7e39f30a32b8" }, "downloads": -1, "filename": "timing-0.3.0-py3-none-any.whl", "has_sig": false, "md5_digest": "3bd5261372ee13c52f74a5f33fb77867", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.5", "size": 11109, "upload_time": "2019-06-12T13:49:25", "url": "https://files.pythonhosted.org/packages/13/7d/55cb6d911558dabaf3492d04150a7886eb6c7846319b2b289789aa208883/timing-0.3.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "bd7ff0890b49ef0618ebba276fa25831", "sha256": "6ac2d297309f3ab0f058237e4b604d5cf742cfe185ad437dba63e64000b6e491" }, "downloads": -1, "filename": "timing-0.3.0.tar.gz", "has_sig": false, "md5_digest": "bd7ff0890b49ef0618ebba276fa25831", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 18577, "upload_time": "2019-06-12T13:49:27", "url": "https://files.pythonhosted.org/packages/fd/54/5c2d9b24db2660725276bf575a1d6428bdff6d684f1f2e5c44535b20c403/timing-0.3.0.tar.gz" } ], "0.4.0": [ { "comment_text": "", "digests": { "md5": "3f9ccd258257635cecf70ad9429718cc", "sha256": "5957dd5a03691f00190f1e261e61ceb28d1635b105d43934060d46f87b7777db" }, "downloads": -1, "filename": "timing-0.4.0-py3-none-any.whl", "has_sig": false, "md5_digest": "3f9ccd258257635cecf70ad9429718cc", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.5", "size": 12828, "upload_time": "2019-06-29T14:44:24", "url": "https://files.pythonhosted.org/packages/7d/1e/ee0ea69ff906e99d2d63044f87504e74ccccc5b9b110b5a7fe88a109ed92/timing-0.4.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d5427d61659734ebb207228a62617536", "sha256": "b714ce66e94e9bbb6b205cfe4a768be6d14c11b202baf5026a2582b1cee2c3c4" }, "downloads": -1, "filename": "timing-0.4.0.tar.gz", "has_sig": false, "md5_digest": "d5427d61659734ebb207228a62617536", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 18403, "upload_time": "2019-06-29T14:44:26", "url": "https://files.pythonhosted.org/packages/4a/b1/2a3efe78bb97b94e3a68ae865ba5b3065545cf828ee212f466329fa66625/timing-0.4.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "3f9ccd258257635cecf70ad9429718cc", "sha256": "5957dd5a03691f00190f1e261e61ceb28d1635b105d43934060d46f87b7777db" }, "downloads": -1, "filename": "timing-0.4.0-py3-none-any.whl", "has_sig": false, "md5_digest": "3f9ccd258257635cecf70ad9429718cc", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.5", "size": 12828, "upload_time": "2019-06-29T14:44:24", "url": "https://files.pythonhosted.org/packages/7d/1e/ee0ea69ff906e99d2d63044f87504e74ccccc5b9b110b5a7fe88a109ed92/timing-0.4.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d5427d61659734ebb207228a62617536", "sha256": "b714ce66e94e9bbb6b205cfe4a768be6d14c11b202baf5026a2582b1cee2c3c4" }, "downloads": -1, "filename": "timing-0.4.0.tar.gz", "has_sig": false, "md5_digest": "d5427d61659734ebb207228a62617536", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 18403, "upload_time": "2019-06-29T14:44:26", "url": "https://files.pythonhosted.org/packages/4a/b1/2a3efe78bb97b94e3a68ae865ba5b3065545cf828ee212f466329fa66625/timing-0.4.0.tar.gz" } ] }