Thomas Vachuska | 2d7c50d | 2015-02-18 17:08:09 -0800 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # ----------------------------------------------------------------------------- |
| 3 | # Remotely instruments the ONOS JVM for profiling with jprofiler. |
| 4 | # ----------------------------------------------------------------------------- |
| 5 | |
| 6 | [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 |
| 7 | . $ONOS_ROOT/tools/build/envDefaults |
| 8 | export JPROFILER_ROOT=${JPROFILER_ROOT:-/opt/jprofiler8} |
| 9 | |
| 10 | ssh $ONOS_USER@${1:-$OCI} " |
| 11 | pid=\$(ps -ef | grep karaf.jar | grep -v grep | cut -c10-15 | tr -d ' ') |
| 12 | if [ -n \"\$pid\" ]; then |
| 13 | echo \"Enabling profiling for ONOS process \$pid on \$(hostname)...\" |
| 14 | $JPROFILER_ROOT/bin/jpenable --gui --pid=\$pid --port=8849 |
| 15 | else |
| 16 | echo \"ONOS process is not running...\" |
| 17 | exit 1 |
| 18 | fi |
| 19 | " |