Bash script that reports the number of threads of a Java process: Difference between revisions
Jump to navigation
Jump to search
(Created page with "<pre> #!/bin/bash function java-process-pid() { ps -ef | grep "java \-jar.*threads\.jar" | grep -v "grep" | awk '{print $2}' } function thread-count() { pid=$1...") |
(No difference)
|
Latest revision as of 04:05, 22 April 2017
#!/bin/bash function java-process-pid() { ps -ef | grep "java \-jar.*threads\.jar" | grep -v "grep" | awk '{print $2}' } function thread-count() { pid=$1 cat /proc/${pid}/status | grep "^Threads" | awk '{print $2}' } pid=$(java-process-pid) thread-count ${pid}