{ "info": { "author": "Elie Bursztein", "author_email": "code@elie.net", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "Intended Audience :: Education", "Intended Audience :: Science/Research", "License :: OSI Approved :: Apache Software License", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3", "Topic :: Software Development :: Debuggers", "Topic :: Software Development :: Libraries", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Software Development :: Testing" ], "description": "# PerfCounters\n\n[![Build Status](https://travis-ci.com/ebursztein/perfcounters.svg?branch=master)](https://travis-ci.com/ebursztein/perfcounters)\n[![Coverage Status](https://coveralls.io/repos/github/ebursztein/perfcounters/badge.svg?branch=master)](https://coveralls.io/github/ebursztein/perfcounters?branch=master)\n[![license](https://img.shields.io/badge/license-Apache%202-blue.svg?maxAge=2592000)](https://github.com/ebursztein/perfcounters/blob/master/LICENSE)\n\nEasily add performance counters to your python code.\n\nPerfCounter is a thoroughly tested library that make it easy to add multiple counters to any python code to measure intermediate timing and values. Its various reporting mechanisms makes it easy to analyze and report performance measurement regardless of your workflow.\n\n## Installation\n\nThe easiest way to install perfcounters is via pip:\n\n```bash\npip install --user -U perfcounters\n```\n\n## Type of counter available\n\nPerfcounters natively support two kind of counters: `timing counters` and `value counters`.\n\n### Timing counter usage\n\nTiming counters are used to measure time elapsed in a section of the code. They are started with the `start(...)` method and are stopped with the `stop(...)` method or `stop_all(...)` method.\n\nHere is a simple example:\n\n```python\ncounters = PerfCounters() # init counter collection\ncounters.start('loop') # start a timing counter\n\n#do something in the code\n\ncounters.stop('loop') # stop counter\ncounters.report() # report all counters\n```\n\n### Value counter usage\n\nCounters used to track values. They are either directly set to a given value with the `set()` method or incremented with the `increment()` method. \n\nHere is a basic example:\n\n```python\ncounters = PerfCounters() \ncounters.set('mycounter', 39) # set counter value to 39\n\n#do something in the code\n\ncounters.increment('mycounter', 3) # increment counter by 3\ncounters.get('mycounter') # get the value of the counter\n42\n```\n\n## End to end example\n\nHere is an end to end example that demonstrate all the basic feature of the librairy:\n\n```python\nfrom perfcounters import PerfCounters\nfrom random import randint\n\n# init counters\ncounters = PerfCounters() \n\nnum_iterations = randint(100000, 1000000)\n\n# setting a value counter to a given value\ncounters.set('num_iterations', num_iterations)\n\n# starting a timing counter\ncounters.start('loop')\n\nfor i in range(1000):\n v = randint(0, 1000000)\n\n # incrementing a value counter to sum the generated values\n counters.increment('total_value', v)\n\n# stopping a timing counter\ncounters.stop('loop')\n\n# reporting counters\ncounters.report()\n```\n\nThis basic example will produce a result like this:\n\n```bash\n\n-=[Value counters]=-\n\n+----------------+-----------+\n| name | value |\n+================+===========+\n| total_value | 494280557 |\n+----------------+-----------+\n| num_iterations | 372159 |\n+----------------+-----------+\n\n-=[Timing counters]=-\n\n+--------+------------+\n| name | value |\n+========+============+\n| loop | 0.00195169 |\n+--------+------------+\n```\n\n*Note*: you technically don't need to stop a timing counter before a report. If you don't do it the value reported will be the delta between start time and the time the `report()` function was called. The counter will keep running until it is stopped.\n\nAdditional examples are available in the documentation [advanced usage guide](https://github.com/ebursztein/perfcounters/tree/master/docs/advanced_usage.md) and a description of all the available functions are availble in the [API documentation page](https://github.com/ebursztein/perfcounters/tree/master/docs/api.md)\n\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/ebursztein/perfcounters", "keywords": "", "license": "Apache 2", "maintainer": "", "maintainer_email": "", "name": "perfcounters", "package_url": "https://pypi.org/project/perfcounters/", "platform": "", "project_url": "https://pypi.org/project/perfcounters/", "project_urls": { "Homepage": "https://github.com/ebursztein/perfcounters" }, "release_url": "https://pypi.org/project/perfcounters/1.0.6/", "requires_dist": [ "tabulate", "numpy" ], "requires_python": "", "summary": "Easily add performance counters to your code", "version": "1.0.6" }, "last_serial": 5794664, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "f2f0035bfe39b09899c6f51c859e3802", "sha256": "58128dccd011a130dab84c21aa36ef03799027c663226acfa14f3c7f371ca533" }, "downloads": -1, "filename": "perfcounters-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "f2f0035bfe39b09899c6f51c859e3802", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7809, "upload_time": "2018-11-18T05:56:58", "url": "https://files.pythonhosted.org/packages/2f/ef/8bc60d68ffb842a7212b2503c1677561e3ab0a6af10f4056006edeefda78/perfcounters-1.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9d08b73dba7cb4d8505b29c4ca97c3be", "sha256": "5056b6aead051dcda27422db6e61b56007184cfa1fa3a0c97b94c170d520dce3" }, "downloads": -1, "filename": "perfcounters-1.0.0.tar.gz", "has_sig": false, "md5_digest": "9d08b73dba7cb4d8505b29c4ca97c3be", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5770, "upload_time": "2018-11-18T05:57:00", "url": "https://files.pythonhosted.org/packages/7b/6d/2a25ad5bb2968b2e49e2fd7d5300a162c1793a3347ec09d188a49e2fe799/perfcounters-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "a7b10f81e1bc2c5f98cfcf7fd813a416", "sha256": "a54b39cd10c2e7464a417fcbdfb48797a46b910ae1a2ced94979d0316eff62d3" }, "downloads": -1, "filename": "perfcounters-1.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "a7b10f81e1bc2c5f98cfcf7fd813a416", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9453, "upload_time": "2018-11-18T06:56:59", "url": "https://files.pythonhosted.org/packages/82/02/1383e1d80e9681e451130687b6bc5cfa327903021ed12bbe04437df49ed1/perfcounters-1.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "fee866ab7b04d2755543d47396874bc0", "sha256": "80a854862a719d513b5db66cf487748c12afe09e739682c10482b9f4b8d7f7a6" }, "downloads": -1, "filename": "perfcounters-1.0.1.tar.gz", "has_sig": false, "md5_digest": "fee866ab7b04d2755543d47396874bc0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6522, "upload_time": "2018-11-18T06:57:01", "url": "https://files.pythonhosted.org/packages/ed/b0/b0ddeb3c3dfdf479deb71a40d060f11e9c42294d5952b46dcd1f046c431b/perfcounters-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "676d14e843914a70d05f24eef37127e8", "sha256": "954fbfe9a42f3f13510e3aad0207a78126a2e12777895f26874ec47b3ba367de" }, "downloads": -1, "filename": "perfcounters-1.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "676d14e843914a70d05f24eef37127e8", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9015, "upload_time": "2018-11-19T03:04:21", "url": "https://files.pythonhosted.org/packages/b2/11/9cbcd7249d357f09fc055318983a71459c397cfbba2f358122b8ad96a0fe/perfcounters-1.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e76db4ed20f9647018ab3facd8c456a0", "sha256": "92dd74f4456c7291c4795132d1322f833ae5f2dc5110939af7aa4977dcf1b253" }, "downloads": -1, "filename": "perfcounters-1.0.2.tar.gz", "has_sig": false, "md5_digest": "e76db4ed20f9647018ab3facd8c456a0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5957, "upload_time": "2018-11-19T03:04:24", "url": "https://files.pythonhosted.org/packages/d4/8f/c8e3e18fe16f7f64e130b47ba89c052629b4facaee6e7a21bab4e12371d9/perfcounters-1.0.2.tar.gz" } ], "1.0.3": [ { "comment_text": "", "digests": { "md5": "282d850a6050901cf573d5f5a4b5ba13", "sha256": "9c4c557d55e05e0eff28e5a161cfd4e258edabe4759d428e3250d027d3bac3b3" }, "downloads": -1, "filename": "perfcounters-1.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "282d850a6050901cf573d5f5a4b5ba13", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8994, "upload_time": "2018-12-05T05:19:38", "url": "https://files.pythonhosted.org/packages/c3/ad/c0524950b9c10e6ef20366515bae82f6b6f277f055fd3eb5331187a22512/perfcounters-1.0.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9dc7d3bd599843a2086d3bf711bc2ad2", "sha256": "7ecd4b0168ae0089ef4ecb9a9860effb79a4248cc5fff94a8d432ae45444d0f5" }, "downloads": -1, "filename": "perfcounters-1.0.3.tar.gz", "has_sig": false, "md5_digest": "9dc7d3bd599843a2086d3bf711bc2ad2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5943, "upload_time": "2018-12-05T05:19:41", "url": "https://files.pythonhosted.org/packages/e2/a8/cc1599ffc08e4645e22fff1fbccf5a30e474dbf6f8352f39b005e1be1110/perfcounters-1.0.3.tar.gz" } ], "1.0.5": [ { "comment_text": "", "digests": { "md5": "7f700a19561d57c29845e6d35ade9288", "sha256": "3c2c42e50e1bcfa57c55a61c2d480ab8df974e6c40d3af091c69b2ddb7db1ba1" }, "downloads": -1, "filename": "perfcounters-1.0.5-py3-none-any.whl", "has_sig": false, "md5_digest": "7f700a19561d57c29845e6d35ade9288", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9335, "upload_time": "2019-09-07T01:02:34", "url": "https://files.pythonhosted.org/packages/ff/e4/251e421d8acb9c8485e8da69927bf75602e74b578c38ea1ae8cc7c662923/perfcounters-1.0.5-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2a0d6858498483231f55c1e6f6c7c88c", "sha256": "3392f9f7ed954d388d2678a8a16c61419994a6a154dd46d6037d0ff3d32b1e4c" }, "downloads": -1, "filename": "perfcounters-1.0.5.tar.gz", "has_sig": false, "md5_digest": "2a0d6858498483231f55c1e6f6c7c88c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6269, "upload_time": "2019-09-07T01:02:40", "url": "https://files.pythonhosted.org/packages/b5/40/67ba36cdf8cf2f4874b1af9e9dbabf1da7efda95173f9c46347381a5670e/perfcounters-1.0.5.tar.gz" } ], "1.0.6": [ { "comment_text": "", "digests": { "md5": "e587a4ae18552d53efa39f7259a11357", "sha256": "ec7a51107adee6bacf3d3c68f1d3284136e9c294d55df9e5248afa72b21b907d" }, "downloads": -1, "filename": "perfcounters-1.0.6-py3-none-any.whl", "has_sig": false, "md5_digest": "e587a4ae18552d53efa39f7259a11357", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9340, "upload_time": "2019-09-07T01:16:10", "url": "https://files.pythonhosted.org/packages/24/9a/559f5fd377c262ee1e27a7901fdb97b3b6084c7ecaf607876fd2190f199b/perfcounters-1.0.6-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "18ae9efe10405ddf74ff35f183b0ea6c", "sha256": "9b608d4c85b12c6f7e68446896448be83005ebf964a37d2d17d0fad0e3cb6f01" }, "downloads": -1, "filename": "perfcounters-1.0.6.tar.gz", "has_sig": false, "md5_digest": "18ae9efe10405ddf74ff35f183b0ea6c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6270, "upload_time": "2019-09-07T01:16:11", "url": "https://files.pythonhosted.org/packages/57/b0/d0b898b2a8fb73951c40928cbc64ce7fb1db7caf362e7e95f6debf34744d/perfcounters-1.0.6.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "e587a4ae18552d53efa39f7259a11357", "sha256": "ec7a51107adee6bacf3d3c68f1d3284136e9c294d55df9e5248afa72b21b907d" }, "downloads": -1, "filename": "perfcounters-1.0.6-py3-none-any.whl", "has_sig": false, "md5_digest": "e587a4ae18552d53efa39f7259a11357", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9340, "upload_time": "2019-09-07T01:16:10", "url": "https://files.pythonhosted.org/packages/24/9a/559f5fd377c262ee1e27a7901fdb97b3b6084c7ecaf607876fd2190f199b/perfcounters-1.0.6-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "18ae9efe10405ddf74ff35f183b0ea6c", "sha256": "9b608d4c85b12c6f7e68446896448be83005ebf964a37d2d17d0fad0e3cb6f01" }, "downloads": -1, "filename": "perfcounters-1.0.6.tar.gz", "has_sig": false, "md5_digest": "18ae9efe10405ddf74ff35f183b0ea6c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6270, "upload_time": "2019-09-07T01:16:11", "url": "https://files.pythonhosted.org/packages/57/b0/d0b898b2a8fb73951c40928cbc64ce7fb1db7caf362e7e95f6debf34744d/perfcounters-1.0.6.tar.gz" } ] }