blob: 806510f1a35aa920c2f9e2f9a3eee95f8f1fb9cd [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} "
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"