Bookmark this site!


ant java Shark: XrunShark

You want to use Shark to profile your java code - and you want an ant target that runs your jar file under Shark. You have to call the jvm with the option -XrunShark

Create a new target in your build.xml file

<target name="profile" depends="jar"
        description="Run jar file (no args) with Shark profiler">
     <java jar="${jarfile}" fork="yes" failonerror="true">
         <jvmarg value="-XrunShark"/>

Start Shark, then run
ant profile

Shark is a profiling tool included in the CHUD package. CHUD is an optional install which comes with XCode Tools. The CHUD installer is in the Packages folder, and installs Shark in /Developer/Applications/Performance Tools

No comments: