https://github.com/epickrram/object-tracker
Tracking object creation in the JVM
https://github.com/epickrram/object-tracker
Last synced: 9 months ago
JSON representation
Tracking object creation in the JVM
- Host: GitHub
- URL: https://github.com/epickrram/object-tracker
- Owner: epickrram
- Created: 2013-01-12T06:15:01.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2013-01-12T06:30:17.000Z (almost 13 years ago)
- Last Synced: 2025-02-15T12:17:02.919Z (11 months ago)
- Language: Java
- Size: 133 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
object-tracker
==============
Tracking object creation in the JVM
Introduction
------------
Object-tracker consists of a JVM agent that modifies your java objects in order to track their creation. This information can then be written to a file for later analysis.
Usage
-----
Download the bundle with dependencies from the download page, and unzip. Add the following arguments to the command line when starting java:
-javaagent:./object-tracker-agent-0.1/object-tracker-agent-0.1.jar
-cp ./object-tracker-agent-0.1/javassist.jar:./object-tracker-agent-0.1/juxtapose-1.0.jar
Opening jconsole, look for the MBean named `com.epickrram.tools:type=ObjectInstanceCounter`. To write object count data to disk, invoke the `dumpObjectCreationCounts` method, supplying a target filename.
Object-tracker will write out a csv containing the current snapshot of the tracked object creation counts:
classname,count
com.epickrram.testing.TestObjectTwo,48
com.epickrram.testing.TestObjectOne,24
Configuration
-------------
You must specify at least an inclusion filter to tell Object-tracker what classes to track.
Configuration by file
---------------------
Specify a system property `com.epickrram.tool.object-tracker.config.file` that points to a properties file with the following entries:
* `com.epickrram.tool.object-tracker.config.include` Semi-colon separated regexes to specify classes to include (e.g. `com.mycompany;com.external.library`)
* `com.epickrram.tool.object-tracker.config.exclude` Semi-colon separated regexes to specify classes to exclude
Configuration by property
-------------------------
For simple regexes, just use the above system property keys to specify a single include/exclude regex.
Caveats
-------
Attempting to monitor creation of any of the JDK classes (i.e. `java.lang`, `java.util`) will fail with a nasty exception.
Dependencies
------------
Object-tracker uses:
* [juxtapose](https://github.com/epickrram/juxtapose) for MBean management
* [javassist](http://www.jboss.org/javassist) for byte-code manipulation