Reputation: 253
I think I need to setup some profiler, or somehow configure the class loader to save this info. Here what I need: When ever a JVM runs,I need to execute a process that keep track of java files being loaded by the class loader. Across all the threads (and processes also, but that is another JVM).
So in the output I need to have information how many times which class was used.
Can you offer some tools and configuration examples for these? That's better be a command line tool & free.
Upvotes: 1
Views: 674
Reputation: 11543
If you just need to see which classes were loaded you can run with
java -verbose:class com.your.Class
Upvotes: 0
Reputation: 11130
Profilers will certainly give you that information, but you need to run the JVM under profiling, for which there is a performance cost.
If you are planning on collecting this information on-demand from production systems, you are probably going to need to instrument the classes/packages you are interested in with JMX. Then you can use something like HP OpenView or Nagios to monitor the values. http://www.ibm.com/developerworks/java/library/j-jtp09196/index.html talks about how getting started in JMX. Perhaps the JVM already collects some of this stuff, I don't know.
The downside of the JMX approach is that you have to know beforehand what you want to collect and instrument the target classes appropriately.
Upvotes: 1