blob: ba3492ae61e28a7abb00302d3584fdaa67b03cb3 [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
8export JPROFILER_ROOT=${JPROFILER_ROOT:-/opt/jprofiler8}
9
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"