Name | perfwatch JSON |
Version |
1.6.5
JSON |
| download |
home_page | None |
Summary | Python code performace metrics calculation tool |
upload_time | 2024-08-21 05:21:55 |
maintainer | None |
docs_url | None |
author | Khushiyant |
requires_python | <4.0,>=3.10 |
license | MIT |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Perfwatch
Perfwatch is a python package that allows you to monitor the performance of your code. It is designed to be used in a Jupyter notebook, but can also be used in a Python script.
## Table of Contents
- [Installation](#installation)
- [Usage](#usage)
- [Development](#development)
- [Usage](#usage)
- [Available Profiler Types](#available-profiler-types)
- [Basic Usage](#basic-usage)
- [Customizing Profiling](#customizing-profiling)
- [Logging](#logging)
- [License](#license)
## Installation
To install perfwatch, run the following command:
```bash
pip install perfwatch
```
## Development
To install perfwatch for development, clone the repository and run the following command:
```bash
poetry install
```
To setup pre-commit hooks, run the following command:
```bash
poetry run pre-commit install
```
To run the tests, run the following command:
```bash
poetry run pytest
```
## Usage
### Available Profiler Types
The profiler supports the following profiler types:
- `cpu`: Profiles CPU usage using the `cProfile` module.
- `memory`: Profiles memory usage using the `memory_profiler` module.
- `thread`: Profiles thread creation and usage.
- `io`: Profiles I/O operations.
- `network`: Profiles network traffic using the `NetworkProfiler` class.
- `gpu`: Profiles GPU usage using the `GPUProfiler` class.
- `cache`: Profiles cache performance (not implemented).
- `exception`: Profiles exception handling (not implemented).
- `system`: Profiles system performance (not implemented).
- `distributed`: Profiles distributed system performance (not implemented).
- `line`: Profiles line-by-line execution using the `line_profiler` module.
- `time`: Profiles execution time.
### Basic Usage
```python
from perfwatch import watch
@watch(["line", "cpu", "time"])
def test():
for _ in range(1000000):
pass
if __name__ == "__main__":
test()
```
#### Customizing Profiling
You can customize the profiling behavior by passing additional keyword arguments to the `watch` decorator. For example:
```python
@watch(["network"], packet_src="localhost")
def my_function(x, y):
# function implementation
pass
```
#### Logging
You can log the profiling results to a file by assigning `LOG_FILE_PATH` envar to desired file location
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
Raw data
{
"_id": null,
"home_page": null,
"name": "perfwatch",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.10",
"maintainer_email": null,
"keywords": null,
"author": "Khushiyant",
"author_email": "khushiyant2002@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/c0/73/b7f67ea4bad7b4a6b07ae121d687969fdf4baa4a66a1a9f3e1ee0de6b1f4/perfwatch-1.6.5.tar.gz",
"platform": null,
"description": "# Perfwatch\n\nPerfwatch is a python package that allows you to monitor the performance of your code. It is designed to be used in a Jupyter notebook, but can also be used in a Python script.\n\n## Table of Contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Development](#development)\n- [Usage](#usage)\n - [Available Profiler Types](#available-profiler-types)\n - [Basic Usage](#basic-usage)\n - [Customizing Profiling](#customizing-profiling)\n - [Logging](#logging)\n- [License](#license)\n\n## Installation\n\nTo install perfwatch, run the following command:\n\n```bash\npip install perfwatch\n```\n\n## Development\n\nTo install perfwatch for development, clone the repository and run the following command:\n\n```bash\npoetry install\n```\nTo setup pre-commit hooks, run the following command:\n\n```bash\npoetry run pre-commit install\n```\n\nTo run the tests, run the following command:\n\n```bash\npoetry run pytest\n```\n\n## Usage\n\n### Available Profiler Types\n\nThe profiler supports the following profiler types:\n\n- `cpu`: Profiles CPU usage using the\u00a0`cProfile`\u00a0module.\n- `memory`: Profiles memory usage using the\u00a0`memory_profiler`\u00a0module.\n- `thread`: Profiles thread creation and usage.\n- `io`: Profiles I/O operations.\n- `network`: Profiles network traffic using the\u00a0`NetworkProfiler`\u00a0class.\n- `gpu`: Profiles GPU usage using the\u00a0`GPUProfiler`\u00a0class.\n- `cache`: Profiles cache performance (not implemented).\n- `exception`: Profiles exception handling (not implemented).\n- `system`: Profiles system performance (not implemented).\n- `distributed`: Profiles distributed system performance (not implemented).\n- `line`: Profiles line-by-line execution using the\u00a0`line_profiler`\u00a0module.\n- `time`: Profiles execution time.\n\n\n### Basic Usage\n```python\nfrom perfwatch import watch\n\n@watch([\"line\", \"cpu\", \"time\"])\ndef test():\n for _ in range(1000000):\n pass\n\nif __name__ == \"__main__\":\n test()\n```\n\n#### Customizing Profiling\n\nYou can customize the profiling behavior by passing additional keyword arguments to the\u00a0`watch`\u00a0decorator. For example:\n\n```python\n@watch([\"network\"], packet_src=\"localhost\")\ndef my_function(x, y):\n # function implementation\n pass\n```\n\n#### Logging\n\nYou can log the profiling results to a file by assigning `LOG_FILE_PATH` envar to desired file location\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python code performace metrics calculation tool",
"version": "1.6.5",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "01bd4a75abf4a8dc26cb404a3efc32b58af19e0f981f17c50dd0845a8c0de1e7",
"md5": "a5bf9e9b0057685572a70bb2b367175b",
"sha256": "b7011e4164ae68c9ebfd949fa47d17c47c313881a99cefccfca417ae5a3cf987"
},
"downloads": -1,
"filename": "perfwatch-1.6.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a5bf9e9b0057685572a70bb2b367175b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.10",
"size": 11756,
"upload_time": "2024-08-21T05:21:53",
"upload_time_iso_8601": "2024-08-21T05:21:53.916786Z",
"url": "https://files.pythonhosted.org/packages/01/bd/4a75abf4a8dc26cb404a3efc32b58af19e0f981f17c50dd0845a8c0de1e7/perfwatch-1.6.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c073b7f67ea4bad7b4a6b07ae121d687969fdf4baa4a66a1a9f3e1ee0de6b1f4",
"md5": "d8726aa1ba5e1bbc4eac4d1b96276550",
"sha256": "f5557b235a241669496405709c163aeb1eaa3583c27bd3216615eaa2b2352a11"
},
"downloads": -1,
"filename": "perfwatch-1.6.5.tar.gz",
"has_sig": false,
"md5_digest": "d8726aa1ba5e1bbc4eac4d1b96276550",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.10",
"size": 7956,
"upload_time": "2024-08-21T05:21:55",
"upload_time_iso_8601": "2024-08-21T05:21:55.057782Z",
"url": "https://files.pythonhosted.org/packages/c0/73/b7f67ea4bad7b4a6b07ae121d687969fdf4baa4a66a1a9f3e1ee0de6b1f4/perfwatch-1.6.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-21 05:21:55",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "perfwatch"
}