[AETHER-1265] Integrate Java profiler in TOST env
- Adds a dockerfile to build ONOS image with profiler agent enabled
- Prevents the overriding of the JAVA_OPTS when using the profiler
- Deploy profiler also in the atomix nodes when using stc
Change-Id: I00d5091428083f44360989c701350b7fead66038
diff --git a/tools/package/bin/onos-service b/tools/package/bin/onos-service
index d465a0d..b0ef25f 100755
--- a/tools/package/bin/onos-service
+++ b/tools/package/bin/onos-service
@@ -10,15 +10,20 @@
# Do modify the keystore location/password and truststore location/password accordingly
#export JAVA_OPTS="${JAVA_OPTS:--Dio.atomix.enableNettyTLS=true -Djavax.net.ssl.keyStore=/home/ubuntu/onos.jks -Djavax.net.ssl.keyStorePassword=222222 -Djavax.net.ssl.trustStore=/home/ubuntu/onos.jks -Djavax.net.ssl.trustStorePassword=222222}"
-export JAVA_OPTS=${JAVA_OPTS:--XX:+UseG1GC -XX:MaxGCPauseMillis=200 -Dkaraf.log.console=INFO -Dds.lock.timeout.milliseconds=10000}
-
-set -e # exit on error
-set -u # exit on undefined variable
-
# If ONOS_HOME is set, respect its value.
# If ONOS_HOME is not set (e.g. in the init or service environment),
# set it based on this script's path.
ONOS_HOME=${ONOS_HOME:-$(cd $(dirname $0)/.. >/dev/null 2>&1 && pwd)}
+
+JAVA_OPTS="${JAVA_OPTS:--XX:+UseG1GC -XX:MaxGCPauseMillis=200 -Dkaraf.log.console=INFO -Dds.lock.timeout.milliseconds=10000}"
+if [ ! -z "$ONOS_YOURKIT" ]; then
+ JAVA_OPTS+=" -agentpath:$ONOS_HOME/libyjpagent.so=listen=all"
+fi
+export JAVA_OPTS=${JAVA_OPTS}
+
+set -e # exit on error
+set -u # exit on undefined variable
+
KARAF_ARGS=server
SYS_APPS=drivers
ONOS_APPS=${ONOS_APPS:-gui2} # Activate GUI2 unless specific apps were named