Thomas Vachuska
Committed by Gerrit Code Review

Adding tool to remotely enable ONOS JVM profiling.

Change-Id: I72d317b4ee9c16e161231ba5c3008aa311117493
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 +"