java statistics collection for performance evaluation

Posted by user384706 on Stack Overflow See other posts from Stack Overflow or by user384706
Published on 2010-09-16T16:38:09Z Indexed on 2011/01/08 18:53 UTC
Read the original article Hit count: 216

What is the most efficient way to collect and report performance statistic analysis from an application?
If I have an application that uses a series of network apis, and I want to report statistics at runtime, e.g.

Method doA() was called 3 times and consumed on avg 500ms  
Method doB() was called 5 times and consumed on avg 1200ms etc  

Then, I thought of using a well defined data structure (of collection) that each thread updates per remote call, and this can be used for the report.

But I think that it will make the performance worse, for the time spend for statistics collection. Am I correct? How would I procceed if I used a background thread for this, and the other threads that did the remote calls were unaware of this collection gathering?

Thanks

© Stack Overflow or respective owner

Related posts about java

Related posts about multithreading