views:

341

answers:

3

Hi all,

I was wondering if anyone has found any plugins that attach a profiler to a JVM to automatically monitor performance during a unit or integration test. I would like to correlate performance to a particular page view and then drill down into all the methods invoked, memory used, run time, etc.

Does Yourkit or JBoss Profiler support these options or is it even possible?

Thanks, Walter

+2  A: 

A quick search on Google allowed me to find this: maven-yourkit-plugin . Never tried it myself though.

Pascal Thivent
It's worth noting from the plugin site: *It's very immature and unstable. I'll start soon to rewrite a bit this plugin.*
Rich Seller
To me, *immature and unstable* doesn't mean it's worth nothing. Actually, without testing, I can't say what it means but I guess it's far from perfect.
Pascal Thivent
@Pascal I dd not say "worth nothing", I said *worth noting*, as in *please be aware that*. FWIW I upvoted your answer
Rich Seller
@Rich My bad, I apologize for the misunderstanding.
Pascal Thivent
apology accepted. I misread people calling me a count all the time.
Rich Seller
+1  A: 

This blog by velo from Sonatype describes how to profile your tests using Maven.

It configures the surefire plugin to point to the yourkit installation, then configure the surefire plugin to use the yourkit agent dll:

<profile>
  <!-- http://www.yourkit.com/docs/80/help/agent.jsp -->
  <id>yourkit-profile</id> 
  <properties>
    <yourkit.home>C:\Arquivos de programas\YourKit Java Profiler 8.0.13</yourkit.home>
  </properties>
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <argLine>-agentpath:"${yourkit.home}\bin\win32\yjpagent.dll"</argLine>
        </configuration>
      </plugin>
    </plugins>
  </build>
</profile>

Later in the same blog it describes how to configure the build to use the API to take memory snapshots. That should allow you to do the correlation you described.

Rich Seller
Hi Rich,Thanks for your reply - I'm running OpenSolaris and see they have a release for that, looks like I would just need to point to the .so instead of the .dll?
I guess so (no pun intended), the main thing is that the agent for the system is available for surefire execution. If the .so is the equivalent on Solaris then that would make sense.
Rich Seller
A: 

You might want to first try using the right performance instrumentation and measurement approach before worrying about an actual maven plug-in.

http://williamlouth.wordpress.com/2009/01/08/junit-performance-testing-instrumentation-and-assertion/

William Louth
Good catch - I will look into that. I'll have to see what I can do with my integration tests running Selenium / HtmlUnit.
This should be adequate for now although I know eventually, I'd like to have access to the same information the profilers like Yourkit or Netbeans give you.