Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to measure performance of a Java application?

I have a CPU intensive multi-threaded Java application and I'm looking for ways to measure its performance at run time (useful for automation). I tried a few options

System.currentTimeMillis();
System.nanoTime();
ThreadMXBean.getThreadCPUTime();

The first two measure real time. The last measures CPU time for only one thread. I want to measure the CPU-time for all threads spawned by the process.

Before resurrecting an old machine and dedicate it for this task, I would like to see what options I have now.

I run Linux and a platform dependent solution is acceptable, but least desirable.

like image 405
Alexandru Avatar asked Sep 23 '10 09:09

Alexandru


1 Answers

Try perf4j: http://perf4j.codehaus.org/ I recommend using it along with AOP, but it's not a must. See http://perf4j.codehaus.org/devguide.html#Using_Spring_AOP_to_Integrate_Timing_Aspects for more details on AOP.

like image 153
Eran Harel Avatar answered Oct 17 '22 06:10

Eran Harel