{"id":17114762,"url":"https://github.com/raomuyang/cmd-oscillo","last_synced_at":"2025-04-13T04:07:05.077Z","repository":{"id":53533771,"uuid":"174478141","full_name":"raomuyang/cmd-oscillo","owner":"raomuyang","description":"Record the system load at the execution of the command line and display it graphically","archived":false,"fork":false,"pushed_at":"2021-03-25T22:29:12.000Z","size":1917,"stargazers_count":8,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-26T21:07:57.583Z","etag":null,"topics":["cpu","load","memory","system-load"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/raomuyang.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}},"created_at":"2019-03-08T05:59:35.000Z","updated_at":"2021-12-10T14:27:19.000Z","dependencies_parsed_at":"2022-08-20T12:20:27.956Z","dependency_job_id":null,"html_url":"https://github.com/raomuyang/cmd-oscillo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raomuyang%2Fcmd-oscillo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raomuyang%2Fcmd-oscillo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raomuyang%2Fcmd-oscillo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raomuyang%2Fcmd-oscillo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/raomuyang","download_url":"https://codeload.github.com/raomuyang/cmd-oscillo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248190506,"owners_count":21062282,"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":["cpu","load","memory","system-load"],"created_at":"2024-10-14T17:20:05.652Z","updated_at":"2025-04-13T04:07:05.055Z","avatar_url":"https://github.com/raomuyang.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# oscillo\n\n记录命令执行过程中对系统产生的负载，以图片的形式展现出来\n\nRecord the system load at the execution of the command line and display it graphically\n\n![demo](https://raw.githubusercontent.com/raomuyang/cmd-oscillo/master/demo/metrix.log.png)\n\n![demo](https://raw.githubusercontent.com/raomuyang/cmd-oscillo/master/demo/cli.png)\n\n## 安装方式 / Installation\n* Install from pypi\n```shell\npip install oscillo\n```\n\n* Install from local\n```shell\npython setup.py install\n```\n\n\n## 使用方式 / Usage\n\n\n### 通过命令行参数启动 / Boot start by command line parameter\n\n命令行参数的格式是 `\"\u003cname\u003e: \u003ccommand [args]\u003e\"`：\n\n* `name`: 命令行的别名/id (任意字符串)，当`--commands/-c`参数指定多个命令时，该值将作为命令的唯一标识，不可重复\n* `command [args]`: 需要测试资源消耗的命令，比如 `gzip file.ext`\n\n示例如下，监控gzip压缩一个文件时耗费的cpu、memory和时间：\n \n``` \noscillo -c 'gzip: gzip file.ext' -o output-file\n```\n\n* -c 代表将执行一个linux cmd 命令。参数后面可以跟以空格隔开的多个参数\n\n* -o 结果输出文件:\n\n命令执行完成后，会在当前目录下生成一个`\u003coutput-file\u003e.log` 文件。文本结构是json 格式. 数据结构如下\n```\n{\n  \"test\": {\n            \"elapsed\": 0.022143125534057617,  //总执行时间\n            \"cpu\": [], \n            \"memory\": []\n          }\n}\n\n```\n同时会产生一个`\u003coutput-file\u003e.png`文件，`\u003coutput-file\u003e`由`-o`参数指定，默认值为`metrix`\n\n`-c/--commands` 可以接受多个参数，以空格隔开，任务会线性执行。使用场景：对比多个命令对资源的消耗\n\ne.g.:\n对比`gzip`和`tar`命令对资源的消耗：\n\n```shell\noscillo -c 't1: gzip file.ext'  't2: tar czf target.tar.gz file1' -o output\n```\n\n在控制台上，`oscillo`会打印summary信息，其中包含\b命令的耗时、最大内存使用、最大cpu使用、退出码等，效果如下：\n\n![demo](https://raw.githubusercontent.com/raomuyang/cmd-oscillo/master/demo/metrix.log.png)\n\n![demo](https://raw.githubusercontent.com/raomuyang/cmd-oscillo/master/demo/compare-gzip.png)\n\n### 通过配置文件启动 / Boot start by config file\n\n当命令很长或者很多时，可以使用配置文件启动\nWhe the commands is too many, you can boot start by config file\n\n```shell\noscillo --config \u003c/path/to/config-file.yml\u003e [-g]\n```\n\n## 配置文件模板 / Config file\n\n\n\nThe command line in commands will be executed in order\n\n```yml\n# Demo\ncommands:\n  -\n    name: gzip\n    cmd: gzip big-file\n  \n  -\n    name: tar\n    cmd: tar -zcf tmp.tar.gz big-file\n\noutput: gzip-and-tar-gz\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraomuyang%2Fcmd-oscillo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fraomuyang%2Fcmd-oscillo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraomuyang%2Fcmd-oscillo/lists"}