views:

52

answers:

2

I have a Tomcat-powered webapp that builds to a war and is deployed. It's been used for a few somewhat different tasks over the years, and it has lots and lots and lots of classes and libraries.

I'd like to do some sort of automated census of used and unused classes (and maybe even dependencies) and get a report back for which classes, methods, or even lines that have not been executed over a few days of production use.

Is there a tool that could generate such a report for me?

+2  A: 

You're looking for a code coverage tool.

For Java, try EMMA:

http://emma.sourceforge.net/

desau
EMMA looks perfect, thank you!
CaptainAwesomePants
A: 

If you are talking about statistics of unused code (functionally) in production system you can start with simply enabling the "-verbose:class" as startup parameter. I don't think Sun JDK (at least JDK 5)supports regular expression to restrict the log to specific package(s).

It's better to analyze the unused method/block using static analysis tools like PMD/Sonar rather than instrumenting to method/line level.

Baski