# plot_and_log_memory_usage
Scripts for logging CPU and GPU memory usage and subsequently plotting for analysis and debugging
# Installing
Install:
```
pip install plot_and_log_memory_usage
```
# Usage
## Log Memory Usage
Logs memory usage to a file at a given frequency and filepath
```
log_memory_usage --help
usage: log_memory_usage [-h] [--log-period-sec FLOAT] [--log-folderpath PATH] [--print-updates | --no-print-updates]
╭─ arguments ───────────────────────────────────────────────────────────╮
│ -h, --help show this help message and exit │
│ --log-period-sec FLOAT (default: 5.0) │
│ --log-folderpath PATH (default: /home/tylerlum/logged_memory_usage) │
│ --print-updates, --no-print-updates │
│ (default: True) │
╰───────────────────────────────────────────────────────────────────────╯
```
Example:
```
log_memory_usage
Logging to /home/tylerlum/logged_memory_usage/2024-01-13_02-24-22-299722.csv
2024-01-13_02-24-22-324923,7241.94140625,31747.50390625,784.0,4096.0
2024-01-13_02-24-27-381178,7046.80078125,31747.50390625,765.0,4096.0
2024-01-13_02-24-32-504417,7045.4765625,31747.50390625,765.0,4096.0
...
```
## Plot Logged Memory Usage
Creates a plot of the memory usage from the log file for a given timerange
```
plot_logged_memory_usage --help
usage: plot_logged_memory_usage [-h] [OPTIONS]
╭─ options ─────────────────────────────────────────────────────────────╮
│ -h, --help show this help message and exit │
│ --end-datetime-str STR (default: 2024-01-13_02-49-51-581943) │
│ --start-datetime-str {None}|STR │
│ (default: None) │
│ --lookback-seconds {None}|FLOAT │
│ (default: None) │
│ --log-folderpath PATH (default: /home/tylerlum/logged_memory_usage) │
│ --save-filepath {None}|PATH │
│ (default: None) │
╰───────────────────────────────────────────────────────────────────────╯
```
You must specify either a start datetime (in the above format) OR lookback seconds (seconds before end datetime)
Example:
```
plot_logged_memory_usage --lookback-seconds 60
```
![plot_logged_memory_usage](https://github.com/tylerlum/plot_and_log_memory_usage/assets/26510814/e451e88e-493e-4009-aeca-706f0a0fa7fd)
```
plot_logged_memory_usage --start-datetime-str "2024-01-13_02-21-50-512677" --save-filepath "output.png"
Saving plot to output.png
```
Raw data
{
"_id": null,
"home_page": "https://github.com/tylerlum/plot_and_log_memory_usage",
"name": "plot-and-log-memory-usage",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "python,memory,usage,plot,logging",
"author": "Tyler Lum",
"author_email": "tylergwlum@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/16/32/9827c3ef585a830e2dca29b069d0181cf63c85f27d21d9532ab23ce9252e/plot_and_log_memory_usage-0.0.1.tar.gz",
"platform": null,
"description": "# plot_and_log_memory_usage\n\nScripts for logging CPU and GPU memory usage and subsequently plotting for analysis and debugging\n\n# Installing\n\nInstall:\n\n```\npip install plot_and_log_memory_usage\n```\n\n# Usage\n\n## Log Memory Usage\n\nLogs memory usage to a file at a given frequency and filepath\n\n```\nlog_memory_usage --help\n\nusage: log_memory_usage [-h] [--log-period-sec FLOAT] [--log-folderpath PATH] [--print-updates | --no-print-updates]\n\n\u256d\u2500 arguments \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256e\n\u2502 -h, --help show this help message and exit \u2502\n\u2502 --log-period-sec FLOAT (default: 5.0) \u2502\n\u2502 --log-folderpath PATH (default: /home/tylerlum/logged_memory_usage) \u2502\n\u2502 --print-updates, --no-print-updates \u2502\n\u2502 (default: True) \u2502\n\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256f\n```\n\nExample:\n```\nlog_memory_usage\n\nLogging to /home/tylerlum/logged_memory_usage/2024-01-13_02-24-22-299722.csv\n2024-01-13_02-24-22-324923,7241.94140625,31747.50390625,784.0,4096.0\n2024-01-13_02-24-27-381178,7046.80078125,31747.50390625,765.0,4096.0\n2024-01-13_02-24-32-504417,7045.4765625,31747.50390625,765.0,4096.0\n...\n```\n\n## Plot Logged Memory Usage\n\nCreates a plot of the memory usage from the log file for a given timerange\n\n```\nplot_logged_memory_usage --help\n\nusage: plot_logged_memory_usage [-h] [OPTIONS]\n\n\u256d\u2500 options \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256e\n\u2502 -h, --help show this help message and exit \u2502\n\u2502 --end-datetime-str STR (default: 2024-01-13_02-49-51-581943) \u2502\n\u2502 --start-datetime-str {None}|STR \u2502\n\u2502 (default: None) \u2502\n\u2502 --lookback-seconds {None}|FLOAT \u2502\n\u2502 (default: None) \u2502\n\u2502 --log-folderpath PATH (default: /home/tylerlum/logged_memory_usage) \u2502\n\u2502 --save-filepath {None}|PATH \u2502\n\u2502 (default: None) \u2502\n\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256f\n```\n\nYou must specify either a start datetime (in the above format) OR lookback seconds (seconds before end datetime)\n\nExample:\n\n```\nplot_logged_memory_usage --lookback-seconds 60\n```\n\n![plot_logged_memory_usage](https://github.com/tylerlum/plot_and_log_memory_usage/assets/26510814/e451e88e-493e-4009-aeca-706f0a0fa7fd)\n\n```\nplot_logged_memory_usage --start-datetime-str \"2024-01-13_02-21-50-512677\" --save-filepath \"output.png\"\n\nSaving plot to output.png\n```\n",
"bugtrack_url": null,
"license": "",
"summary": "Scripts for logging CPU and GPU memory usage and subsequently plotting for analysis and debugging",
"version": "0.0.1",
"project_urls": {
"Homepage": "https://github.com/tylerlum/plot_and_log_memory_usage"
},
"split_keywords": [
"python",
"memory",
"usage",
"plot",
"logging"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "fcdd9fc8ff6cae39aa793f3f50fca0a8b953619b4e3d39b27957d849718bbbf3",
"md5": "02e40c04b9a546191c9617176a7972d3",
"sha256": "b2a3e69e0111e2392853539648582ed0755b3acebd0220ddf2b57273d54b95fc"
},
"downloads": -1,
"filename": "plot_and_log_memory_usage-0.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "02e40c04b9a546191c9617176a7972d3",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 7115,
"upload_time": "2024-01-13T10:52:45",
"upload_time_iso_8601": "2024-01-13T10:52:45.717708Z",
"url": "https://files.pythonhosted.org/packages/fc/dd/9fc8ff6cae39aa793f3f50fca0a8b953619b4e3d39b27957d849718bbbf3/plot_and_log_memory_usage-0.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "16329827c3ef585a830e2dca29b069d0181cf63c85f27d21d9532ab23ce9252e",
"md5": "ff78b30a0e54aa0a8c530d1c06d52ac1",
"sha256": "a44d9254eff26a20ebd395c36779f26512fc047daf4b5655d6e99a34ce2f7bec"
},
"downloads": -1,
"filename": "plot_and_log_memory_usage-0.0.1.tar.gz",
"has_sig": false,
"md5_digest": "ff78b30a0e54aa0a8c530d1c06d52ac1",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 5751,
"upload_time": "2024-01-13T10:52:47",
"upload_time_iso_8601": "2024-01-13T10:52:47.519719Z",
"url": "https://files.pythonhosted.org/packages/16/32/9827c3ef585a830e2dca29b069d0181cf63c85f27d21d9532ab23ce9252e/plot_and_log_memory_usage-0.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-01-13 10:52:47",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "tylerlum",
"github_project": "plot_and_log_memory_usage",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "plot-and-log-memory-usage"
}