{"id":27639828,"url":"https://github.com/dbohdan/memsparkline","last_synced_at":"2025-04-23T22:34:41.250Z","repository":{"id":257827173,"uuid":"872366606","full_name":"dbohdan/memsparkline","owner":"dbohdan","description":"Track the RAM usage of a process and its descendants in real time","archived":false,"fork":false,"pushed_at":"2025-01-03T11:49:49.000Z","size":163,"stargazers_count":27,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-02T21:23:19.674Z","etag":null,"topics":["benchmarking","go","golang","memory-usage","monitoring","performance","sparklines"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dbohdan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-14T10:09:12.000Z","updated_at":"2025-01-03T11:49:52.000Z","dependencies_parsed_at":null,"dependency_job_id":"732b0a2f-7be3-40e0-8bc1-0ddd228a9f05","html_url":"https://github.com/dbohdan/memsparkline","commit_stats":null,"previous_names":["dbohdan/memsparkline"],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbohdan%2Fmemsparkline","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbohdan%2Fmemsparkline/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbohdan%2Fmemsparkline/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbohdan%2Fmemsparkline/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dbohdan","download_url":"https://codeload.github.com/dbohdan/memsparkline/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250528204,"owners_count":21445507,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["benchmarking","go","golang","memory-usage","monitoring","performance","sparklines"],"created_at":"2025-04-23T22:34:40.740Z","updated_at":"2025-04-23T22:34:41.238Z","avatar_url":"https://github.com/dbohdan.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# memsparkline\n\nTrack the RAM usage ([resident set size](https://en.wikipedia.org/wiki/Resident_set_size)) of a process, its children, its children's children, etc. in real time with a Unicode text [sparkline](https://en.wikipedia.org/wiki/Sparkline).\nSee the average and the maximum usage after the process exits, as well as the run time.\n\n## Examples\n\n```none\n\u003e memsparkline -- chromium-browser --incognito http://localhost:8081/\n▁▁▁▁▄▇▇▇█ 789.5\n avg: 371.0\n max: 789.5\ntime: 0:00:12.0\n```\n\n```none\n\u003e memsparkline -n -o log du /usr/ \u003e/dev/null 2\u003e\u00261 \u0026\n\u003e tail -f log\n█ 2.8\n▆█ 3.3\n▆▇█ 3.6\n▆▇▇█ 3.9\n▆▇▇█▆ 3.3\n▆▇▇█▆▆ 3.3\n▆▇▇█▆▆▆ 3.3\n▆▇▇█▆▆▆▆ 3.3\n▄▅▅▆▅▅▅▅█ 5.2\n▄▅▅▆▅▅▅▅██ 5.2\n avg: 3.7\n max: 5.2\ntime: 0:00:10.1\n```\n\n## Installation\n\n### Prebuilt binaries\n\nPrebuilt binaries for\nFreeBSD (amd64),\nLinux (aarch64, riscv64, x86_64),\nmacOS (arm64, x86_64),\nOpenBSD (amd64),\nand Windows (amd64, x86)\nare attached to [releases](https://github.com/dbohdan/memsparkline/releases).\n\n### Go\n\nInstall Go, then run the following command:\n\n```shell\ngo install dbohdan.com/memsparkline@latest\n```\n\n## Build requirements\n\n- Go 1.21\n- OS supported by [gopsutil](https://github.com/shirou/gopsutil)\n- [Task](https://taskfile.dev/) (go-task) 3.28\n\n## Compatibility and limitations\n\nmemsparkline works on POSIX systems supported by [gopsutil](https://github.com/shirou/gopsutil).\nIt has been tested on Debian, Ubuntu, FreeBSD, and OpenBSD.\nUnfortunately, gopsutil doesn't support NetBSD.\nNetBSD users can install the last [Python release](https://pypi.org/project/memsparkline/) of memsparkline.\n\nAlthough memsparkline seems to work on Windows, Windows support has received little testing outside of [CI](https://en.wikipedia.org/wiki/Continuous_integration).\nThe sparkline displays incorrectly in the Command Prompt and [ConEmu](https://conemu.github.io/) on Windows 7 with the stock console fonts.\nIt displays correctly on Windows 10 with the font NSimSun.\n\n## Operation\n\n### Usage\n\n```none\nUsage: memsparkline [-h] [-v] [-d path] [-l n] [-m fmt] [-n] [-o path] [-q] [-t\nfmt] [-w ms] [--] command [arg ...]\n\nTrack the RAM usage (resident set size) of a process and its descendants in\nreal time.\n\nArguments:\n  command\n          Command to run\n\n  [arg ...]\n          Arguments to the command\n\nOptions:\n  -h, --help\n          Print this help message and exit\n\n  -v, --version\n          Print the version number and exit\n\n  -d, --dump path\n          File to append full memory usage history to when finished\n\n  -l, --length n\n          Sparkline length (default: 20)\n\n  -m, --mem-format fmt\n          Format string for memory amounts (default: '%.1f')\n\n  -n, --newlines\n          Print new sparkline on new line instead of over previous\n\n  -o, --output path\n          Output file to append to ('-' for standard error)\n\n  -q, --quiet\n          Do not print sparklines, only final report\n\n  -r, --record ms\n          How frequently to record/report memory usage in ms (default: 1000)\n\n  -s, --sample ms\n          How frequently to sample memory usage in ms (default: 200)\n\n  -t, --time-format fmt\n          Format string for run time (default: '%d:%02d:%04.1f')\n\n  -w, --wait ms\n          Set '--sample' and '--record' time simultaneously (that both options\noverride)\n```\n\n### Samples and records\n\nmemsparkline differentiates between _samples_ and _records_.\nSamples are measurements of memory usage.\nRecords are information about memory usage printed to the chosen output (given by `--output`) and added to history (saved using the `--dump` option).\n\nThere is a separate setting for the sample time and the record time.\nThe sample time determines the interval between when memory usage is measured.\nThe record time determines the interval between when a record is made (written to the output and added to history).\nWhen sampling is more frequent than recording (as with the default settings),\nmemsparkline uses the highest sampled value since the last record.\n\nA short sample time like 5 ms can result in high CPU usage,\nup to 100% of one CPU core.\nTo reduce CPU usage, sample less frequently.\nThe default sample time of 200 ms results in memsparkline using around 15% of a 2019 x86-64 core on the developer's machine.\n\nRecords are only created when at least one sample has been taken.\nSetting the record time shorter than the sample time is allowed for convenience, but no record is added when there are no samples.\n\n## License\n\nMIT.\n\n## See also\n\nmemusg and spark (both linked below) inspired this project.\n\n### Tracking memory usage\n\n* [DragonFly BSD](https://man.dragonflybsd.org/?command=time\u0026section=ANY),\n  [FreeBSD](https://man.freebsd.org/cgi/man.cgi?query=time\u0026format=html),\n  [macOS](https://ss64.com/osx/time.html),\n  [NetBSD](https://man.netbsd.org/time.1),\n  and [OpenBSD](https://man.openbsd.org/time)\n  time(1) flag `-l`.\n* [GNU time(1)](https://linux.die.net/man/1/time) flag `-v`.\n* [memusg](http://gist.github.com/526585) — a Bash script for FreeBSD, Linux, and macOS that measures the peak resident set size of a process.\n\n### Sparklines\n\n* [spark](https://github.com/holman/spark) — a Bash script that generates a Unicode text sparkline from a list of numbers.\n* [sparkline.tcl](https://wiki.tcl-lang.org/page/Sparkline) — a Tcl script inspired by spark made by the developer of this project.\n  Adds a `--min` and `--max` option for setting the scale.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdbohdan%2Fmemsparkline","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdbohdan%2Fmemsparkline","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdbohdan%2Fmemsparkline/lists"}