SunStudio 11: unable to get collector to work
I'm using BEA WebLogic 8 & java jdk 1.4.2_08.
I have written a servlet in C++ and it works fine with Weblogic.
However I need to look at the bottlenecks when I have multiple threads running.
I have tried using LD_PRELOAD when starting weblogic and then attaching to the proces with dbx.
I set up the collector and enter cont to dbx.
However dbx comes back with the following error:
(dbx) cont
Creating experiment database test.6.er ...
dbx: can't find a system call entry point -- program not linked with libc?
libc appears in the list of shared libraries for the process.
Any ideas how to get this all working?
Thanks
Damian
# 1
We have a pretty long web page on how to profile WebLogic. I need to find out how to get that page accessible from outside. For now, I believe I can post a launch script referred from that page:
#!/bin/sh
#@(#)collectlaunch.sh.txt 1.1 06/01/20
#
# This script is used by the WebLogic NodeManager to start up Managed servers
# on Unix systems under the control of an Admin server. The Admin
# server supplies the arguments to this script.
# The script is invoked with 4 arguments:
#Arg1: is the command line used to start up a Managed server
#Arg2: is the file to which stdout is to be redirected to
#Arg3: is the file to which stderr is to be redirected to
#Arg4: is the file into which the process id of the Managed server
#is saved.
# This script uses just one variable:
# JAVA_HOME - which is used to determine the Java version that is
# to be used to start up the WebLogic Managed server.
# set up WL_HOME, the root directory of your WebLogic installation
WL_HOME="/apps/infra/weblogic/8.1/PO/INT4/weblogic81"
# set up common environment
. "${WL_HOME}/common/bin/commEnv.sh"
# verify that JAVA_HOME points to a real Java
#? But why check for javac, as opposed to java? Only java is needed
if [ ! -f "$JAVA_HOME/bin/javac" ]; then
echo "The JDK wasn't found in directory $JAVA_HOME." > $3
exit 1 # fail if not found
fi
#last steps -- commented out here, and repeated below
# Spawn the Java
# "$JAVA_HOME/bin/java" $1 >$2 2>$3 &
#
# Save its PID, write it to the file named in the fourth argument
# PID=$!
# echo $PID > $4
############################################################################### ############
#Begin customization, to enable Sun Studio Data collection on the launched server
# Set NEWARG1 to the argument to be used for invoking the JVM
# NEWARG1=`echo $1`
# At this point, massage NEWARG1 if there are any arguments to be removed
#when profiling, or extra arguments to add for profiling.
# use sed on arg1 to extract the token beginning with -Dweblogic.Name= and extract the string
#following the = which is the name of the application being launched; set APPNAME to it
APPNAME=`echo $NEWARG1 | sed 's/^.*-Dweblogic.Name=\([^ $]*\).*/\1/'`
# use sed on arg2 to remove the trailing basename to yield the directory in which
#the log files are being written and set APPDIR to it
APPDIR=`dirname $2`
# construct a name for the experiment, EXPNAME, as ${APPDIR}/${APPNAME}.mm.dd.hh.mm.ss.er
#where mm.dd... is the current time stamp
# use that EXPNAME as a -o argument to collect
EXPNAME=${APPDIR}/${APPNAME}.`date '+%m%d_01/20/06M%S'`.er
# construct a name for a script file to send SIGPROF to the process as ${APPDIR}/kill.${APPNAME}
SIG_SCRIPT=${APPDIR}/kill.${APPNAME}
# Set $COLLECTOR to command and arguments -- in this case
#Default clock profiling
#Signal-controlled pause and resume
#Archive copying for portability
#experiment name constructed above
COLLECTOR="collect -j on -y PROF -S off -A copy -o ${EXPNAME}
# Or, use APPNAME to extract COLLECTOR from a configuration file
#e.g., grep for $APPNAME.COLLECTOR, and then sed to extract
#the remainder of the line and set COLLECTOR to it
#
# Or, use APPNAME to extract components for construction of
#COLLECTOR for that application from a configuration file
#Also, could grep for additional Java arguments, etc.
# create a log of the information processed in this script
echo "arg1= " $1 > ${APPDIR}/col.log
echo "arg2= " $2 >> ${APPDIR}/col.log
echo "arg3= " $3 >> ${APPDIR}/col.log
echo "arg4= " $4 >> ${APPDIR}/col.log
echo "" >> ${APPDIR}/col.log
echo "NEWARG1= " ${NEWARG1} >> ${APPDIR}/col.log
echo "" >> ${APPDIR}/col.log
echo "APPNAME= "${APPNAME} >> ${APPDIR}/col.log
echo "APPDIR= "${APPDIR} >> ${APPDIR}/col.log
echo "SIG_SCRIPT= "${SIG_SCRIPT} >> ${APPDIR}/col.log
echo "EXPNAME= "${EXPNAME} >> ${APPDIR}/col.log
echo "" >> ${APPDIR}/col.log
echo "COLLECTOR= "${COLLECTOR} >> ${APPDIR}/col.log
echo "" >> ${APPDIR}/col.log
echo "COMMAND= ${COLLECTOR} \"${JAVA_HOME}/bin/java\" ${NEWARG1} >$2 2>$3 &" >> ${APPDIR}/col.log
echo "" >> ${APPDIR}/col.log
# Now actually spawn the JVM under COLLECTOR
${COLLECTOR} "${JAVA_HOME}/bin/java" ${NEWARG1} >$2 2>$3 &
# Save the PID, write it to the fourth argument (as in original script)
PID=$!
echo $PID > $4
# and write it to the collector log file
echo "PID= " $PID >> ${APPDIR}/col.log
# write a script to send SIGPROF to the process
#and make the script executable by anyone
echo "#!/bin/sh" > ${SIG_SCRIPT}
echo "kill -PROF $PID" >> ${SIG_SCRIPT}
chmod 777 ${SIG_SCRIPT}