1 Reply Latest reply on Aug 18, 2006 1:55 PM by msolnit

    Mac OS X:  Success!

    msolnit

      Hi everyone. I have successfully built and tested the Memory Profiler (JVMTI) on Mac OS X Intel. I'll e-mail the binary and compile script to Clebert, and hopefully it can be included in the next release.

      For those of you who wish to reproduce at home:

      1) Download the latest CR4 release.

      The following steps produce an Intel binary of the JVMPI library (Runtime Profiler):
      2) chmod +x jboss-profiler-1.0.CR4/jvmpi-src/macos/compile.sh
      3) jboss-profiler-1.0.CR4/jvmpi-src/macos/compile.sh

      The following steps produce an Intel binary of the JVMTI library (Memory Profiler):
      4) Convert the jboss-profiler-1.0.CR4/jvmpi-src/macos/compile.sh file from a DOS text file into a Unix text file. The way that I did this (lacking a version of dos2unix) was to simply open the file in an editor, copy and paste the contents into a new file, and then save the new file over the old one.
      5) chmod +x jboss-profiler-1.0.CR4/jvmpi-src/macos/compile.sh
      6) jboss-profiler-1.0.CR4/jvmti-src/macos/compile.sh

      The following steps install the two profiler libraries where Mac Java can find them:
      7) cp jboss-profiler-1.0.CR4/jvmpi-src/macos/libjbossInspector.jnilib /Library/Java/Extensions
      8) cp jboss-profiler-1.0.CR4/jvmti-src/macos/libjbossAgent.jnilib /Library/Java/Extensions

      The following step alters JBoss so that it loads the Memory Profiler agent:
      9) Edit JBOSS_HOME/bin/run.conf and add the following line to the end: JAVA_OPTS="$JAVA_OPTS -agentlib:jbossAgent"

      The following steps run a short test:
      10) Start (or re-start) JBoss.
      11) Browse to http://localhost:8080/jmx-console/HtmlAdaptor?action=inspectMBean&name=jboss.profiler%3Ambean%3DJVMTIClass
      12) Find the "java.lang.String listClassesHTMLReport()" operation and invoke.

      You should get a nice HTML report. If so, you're done!

      Sincerely,
      Matt

        • 1. Re: Mac OS X:  Success!
          msolnit

          P.S. Additional notes:

          1. I would like to try to figure out how to produce a Universal Binary. Does anyone have experience with this?

          2. Step 6 in the instructions above will produce some compiler warnings, but the binary should be fine. If the warnings bug you, then here is an alternate version you can try (not sure why this works, I'm not a GCC expert):

          #!/bin/sh
          
          rm -f *.jnilib
          rm -f *.o
          
          _INCLUDES="-I$JAVA_HOME/include"
          
          gcc $_OPTS $_INCLUDES -c ../native-src/jbossAgent.cpp
          gcc $_OPTS $_INCLUDES -c ../native-src/jbossAgentJNI.cpp
          gcc $_OPTS $_INCLUDES -c ../native-src/jbossAgentUtilities.cpp
          
          g++ -O0 -bundle -I$JAVA_HOME/include -o libjbossAgent.jnilib *.o
          


          -- Matt