blob: f6370ec5928f1a218386ffe58e7c752e7bcef08c [file] [log] [blame]
Thomas Vachuska2d7c50d2015-02-18 17:08:09 -08001#!/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
Jonathan Hart2130f562016-03-02 18:59:07 -08008export JPROFILER_ROOT=${JPROFILER_ROOT:-/opt/jprofiler9}
Thomas Vachuska2d7c50d2015-02-18 17:08:09 -08009
10ssh $ONOS_USER@${1:-$OCI} "
Parvathi MH12bfd3d2020-01-30 10:31:10 +053011 pid=\$(ps -ef | grep org.apache.karaf.main.Main | grep -v grep | cut -c10-15 | tr -d ' ')
Thomas Vachuska2d7c50d2015-02-18 17:08:09 -080012 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"