{"id":48926389,"url":"https://github.com/amarjeetanandsingh/jps_stat","last_synced_at":"2026-04-17T07:02:54.521Z","repository":{"id":132938386,"uuid":"102264410","full_name":"amarjeetanandsingh/jps_stat","owner":"amarjeetanandsingh","description":"Bash script to moniter current_heap_memory , max_heap_till_now , current_ram , max_ram_used , current_cpu_by_jvm details of all java programs running on current linux system","archived":false,"fork":false,"pushed_at":"2024-05-12T05:15:12.000Z","size":95,"stargazers_count":112,"open_issues_count":2,"forks_count":88,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-05-12T06:23:26.911Z","etag":null,"topics":["bash","java","jps","jstat","memory","track"],"latest_commit_sha":null,"homepage":"","language":"Shell","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/amarjeetanandsingh.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}},"created_at":"2017-09-03T12:53:14.000Z","updated_at":"2024-05-12T05:15:16.000Z","dependencies_parsed_at":"2023-10-20T16:44:09.135Z","dependency_job_id":"e044e787-2b65-4f09-99d0-f3167917fb53","html_url":"https://github.com/amarjeetanandsingh/jps_stat","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/amarjeetanandsingh/jps_stat","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amarjeetanandsingh%2Fjps_stat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amarjeetanandsingh%2Fjps_stat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amarjeetanandsingh%2Fjps_stat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amarjeetanandsingh%2Fjps_stat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amarjeetanandsingh","download_url":"https://codeload.github.com/amarjeetanandsingh/jps_stat/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amarjeetanandsingh%2Fjps_stat/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31918838,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-16T18:22:33.417Z","status":"online","status_checked_at":"2026-04-17T02:00:06.879Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["bash","java","jps","jstat","memory","track"],"created_at":"2026-04-17T07:02:52.090Z","updated_at":"2026-04-17T07:02:54.506Z","avatar_url":"https://github.com/amarjeetanandsingh.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jps_stat\n\n###### A bash script to moniter **current_heap_memory** , **max_heap_till_now** , **current_ram** , **max_ram_used** , **current_cpu_by_jvm** details of all java programs running on current linux system.\n\n## How to use\n* Clone this repo and extract and open the folder\n* Right click on ` jpsstat.sh ` file and select ` properties `\n* Under ` Permissions ` tab, check the ` Allow executing file as program ` option.\n* Now open this folder in terminal and enter ` ./jpsstat.sh `\n* This will list the  **current_heap_memory** , **max_heap_till_now**, **current_ram_use**, **max_ram_used** and **current_cpu_use** of all running java processes on your linux system with live refresh.\n\n## Options\nThis tool expects options in ` ./jpsstat.sh [option] ` format.\n* ` -l ` : use this option to display the full package name for the application's main class or the full path name to the application's JAR file\n* ` -h ` : display the help details. You can also use ` -help `\n\nExample: `./jpsstat.sh -l ` or `./jpsstat.sh -h`\n\n## How to stop\n* Press ` ctrl+c ` to stop the script and enter ` reset ` to clear your screen\n\n## Output\n\u003cimg src=\"images/output.gif\" \u003e\n\n## Script details\n* This uses ` jps ` command to get the list of all processes running java programs (_jvm instances_)\n* Then for each _process_id_ obtained from jps, it runs ` jstat -gc \u003cprocess_id\u003e `\n* It calculates Heap memory by adding following fields of ` jstat -gc ` output - \n  * ` S0U `: Survivor space 0 utilization\n  * ` S1U `: Survivor space 1 utilization\n  * ` EU ` : Eden space utilization\n  * ` OU ` : Old space utilization\n* It tracks cpu uses using ` ps -p \u003cprocess_id\u003e -o %cpu ` command \n* It uses the ` rss ` field of the output of ` /proc/\u003cpid\u003e/statm ` command to get the memory(RAM) used by the java process.\n* It uses ` tput cuu \u003c# of lines\u003e ` to refresh screen\n* All the decimal values in the output is truncated using ` %.* `\n\n\n## Troubleshooting\n1.  Getting error as ` ./jpsstat.sh: 38: ./jpsstat.sh: Syntax error: \"(\" unexpected `\n    - Make sure you run the script as ` ./jpsstat.sh ` and not as ` sh ./jpsstat.sh `\n    - Use ` bash --version ` to make sure your bash version is \u003e= 4.0\n2. Getting error as ` bash: ./jpsstat.sh: Permission denied `\n    - Make sure you have given the permission to the \"jpsstat.sh\" file to execute as program.\n    - Either use ` chmod 777 jpsstat.sh ` command or follow *[How to use](https://github.com/amarjeetanandsingh/jps_stat#how-to-use)* section to give execute permission to script file.\n\n## Requirements\n* Jdk\n* Linux System _(Tested on Ubuntu 16.04 LTS)_\n* Bash version \u003e=  4.0\n\n\n## License\nMIT License\n\nCopyright (c) 2017 Amarjeet Anand\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famarjeetanandsingh%2Fjps_stat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famarjeetanandsingh%2Fjps_stat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famarjeetanandsingh%2Fjps_stat/lists"}