开发者

How to measure performance of a Java application?

开发者 https://www.devze.com 2023-01-17 19:31 出处:网络
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

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 meas开发者_开发百科ure 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.


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.


Try to enable the JVM with Dtrace. It has a lot of performance probes which help you get what ever you want.

0

精彩评论

暂无评论...
验证码 换一张
取 消