[RFC PATCH] Enable profiling of OpenNMS on start-up

1 message Options
Embed this post
Permalink
Alex Bennee-3

[RFC PATCH] Enable profiling of OpenNMS on start-up

Reply Threaded More More options
Print post
Permalink
Hi,

I don't know how developers deal with profiling OpenNMS (the wiki was
bare) but I recently encountered some issues with OpenNMS going into a
deep CPU bound spin. I supply the following patch for comment, I only
chose TIJMP as it's packaged on Ubuntu. If there is a better open
source profiling tool I'm all ears.

>From 6ccb082bfcd9966318b49c645a44ff2489a7da77 Mon Sep 17 00:00:00 2001
From: Alex Bennee <[hidden email]>
Date: Wed, 16 Sep 2009 14:45:42 +0100
Subject: [PATCH] Add support for the TIJMP profiler to the opennms
startup script

---
 opennms-daemon/src/main/filtered/bin/opennms |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/opennms-daemon/src/main/filtered/bin/opennms
b/opennms-daemon/src/main/filtered/bin/opennms
index 4b1cf7b..2cdc7dd 100755
--- a/opennms-daemon/src/main/filtered/bin/opennms
+++ b/opennms-daemon/src/main/filtered/bin/opennms
@@ -101,7 +101,7 @@ fi
 show_help () {
  cat <<END

-Usage: $0 [-n] [-t] [-c timeout] [-v] [-Q] <command> [<service>]
+Usage: $0 [-n] [-t] [-p] [-c timeout] [-v] [-Q] <command> [<service>]

   command options: start|stop|restart|status|check|pause|resume|kill

@@ -112,6 +112,7 @@ Usage: $0 [-n] [-t] [-c timeout] [-v] [-Q]
<command> [<service>]

       -n  "No execute" mode.  Don't call Java to do anything.
       -t  Test mode.  Enable JPDA on port 8001.
+      -p  Enable TIJMP profiler
       -c  Controller HTTP connection timeout in seconds.
       -v  Verbose mode.  When used with the "status" command, gives the
           results for all OpenNMS services.  When used with "start", enables
@@ -248,6 +249,12 @@ doStart(){
  JPDA="-Xdebug -Xnoagent -Djava.compiler=none
-Xrunjdwp:transport=dt_socket,server=y,address=8001,suspend=n"
  fi

+ # See: http://www.khelekore.org/jmp/tijmp/
+ if [ $PROFILE -gt 0 ]; then
+ echo "- enabling TIJMP Profiling"
+ JPDA="-Dtijmp.jar=/usr/share/java/tijmp-0.6.jar -agentlib:tijmp ${JPDA}"
+ fi
+

  if [ "$SERVICE" = "" ]; then
  APP_VM_PARMS="$JPDA $MANAGER_OPTIONS"
@@ -485,12 +492,13 @@ if [ x"$ADDITIONAL_CONTROLLER_OPTIONS" != x"" ]; then
 fi

 TEST=0
+PROFILE=0
 NOEXECUTE=""
 VERBOSE=0

 NAME="opennms"

-while getopts c:ntvQ c; do
+while getopts c:ntvpQ c; do
  case $c in
  c)
  APP_PARMS_CONTROLLER="$APP_PARMS_CONTROLLER -t $OPTARG"
@@ -504,6 +512,9 @@ while getopts c:ntvQ c; do
  t)
  TEST=1
  ;;
+ p)
+ PROFILE=1
+ ;;
  v)
  VERBOSE=1
  VERBOSE_GC=1
--
1.6.4.3



--
Alex, homepage: http://www.bennee.com/~alex/
http://www.half-llama.co.uk

------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Please read the OpenNMS Mailing List FAQ:
http://www.opennms.org/index.php/Mailing_List_FAQ

opennms-devel mailing list

To *unsubscribe* or change your subscription options, see the bottom of this page:
https://lists.sourceforge.net/lists/listinfo/opennms-devel