Last active
August 26, 2019 10:59
-
-
Save kapb14/195feb1ca3f15a20139634543093eeb1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $status = file_get_contents('/proc/' . getmypid() . '/status'); | |
| print $status . "\n"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # https://abdussamad.com/archives/488-Memory-usage-of-a-process-under-Linux.html | |
| # curl -Os https://gist.githubusercontent.com/kapb14/195feb1ca3f15a20139634543093eeb1/raw/817277fff1bf3c2c9e3940db2d24089167475d4c/psmem.sh && chmod +x psmem.sh && cp -v psmem.sh /sbin/psmem | |
| # git clone https://gist.github.com/195feb1ca3f15a20139634543093eeb1.git /opt/psmem && chmod +x /opt/psmem/psmem.sh && ln -s /opt/psmem/psmem.sh /sbin/psmem | |
| if [[ -z "$1" ]] | |
| then | |
| echo "Usage: $(basename $0) PROCESS_NAME" | |
| echo "Example: $(basename $0) httpd" | |
| exit 1 | |
| else | |
| ps -C $1 -O rss | gawk '{ count ++; sum += $2 }; END {count --; print "Number of processes =",count; print "Memory usage per process =",sum/1024/count, "MB"; print "Total memory usage =", sum/1024, "MB" ;};' | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment