Skip to content

An experimental Java 11 Agent to intercept JDK Collection calls, compute metrics and provide some advices (WIP)

License

Notifications You must be signed in to change notification settings

manoelcampos/java-collections-advisor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Java Collections Advisor Build Status

1. Introduction

2. Build and Running

In order to just try the agent you have two options:

  • run the com.manoelcampos.collectionsadvisor.AgentEntry class from the agent dir in your IDE;
  • or execute the agent/run.sh script.

2.1. Running an independent app

If you are building your own app and want to load the agent during application startup, check the sample-app project. Execute the sample-app/run.sh script to build and run the app using the agent.

The sample app has no agent code and the instrumentation happens in runtime.

3. Results after running the agent with your app

Current results are very basic since this is a working in progress. The agent is not giving any advice about collections utilization yet. Check an example of the agent results over a sample app using some Collections.

# Collections Advisor Agent
## Intercepted java.util.Collection methods calls from com.sample package

java.util.ArrayList from com.sample.ArrayListRegularSample:
  	Calls: 23 Lookups: 10 Clear Ups: 0
	Capacity changes: 1 -> inc 1 dec 0 | Size changes: 11 -> inc 10 dec 1
	Inserts: 10 -> head 0 middle 0 tail 10 moves 0
	Removals: 1 -> head 0 middle 0 tail 1 moves 0
java.util.ArrayList from com.sample.ArrayListAsQueueSample:
  	Calls: 31 Lookups: 0 Clear Ups: 0
	Capacity changes: 1 -> inc 1 dec 0 | Size changes: 20 -> inc 10 dec 10
	Inserts: 10 -> head 0 middle 0 tail 10 moves 0
	Removals: 10 -> head 9 middle 0 tail 1 moves 45
java.util.ArrayList from com.sample.ArrayListHeadAddSample:
  	Calls: 10 Lookups: 0 Clear Ups: 0
	Capacity changes: 1 -> inc 1 dec 0 | Size changes: 10 -> inc 10 dec 0
	Inserts: 10 -> head 9 middle 0 tail 1 moves 45
	Removals: 0 -> head 0 middle 0 tail 0 moves 0
java.util.LinkedList from com.sample.LinkedListSample:
  	Calls: 22 Lookups: 10 Clear Ups: 1
	Capacity changes: 0 -> inc 0 dec 0 | Size changes: 11 -> inc 10 dec 1
	Inserts: 10 -> head 0 middle 0 tail 10 moves 0
	Removals: 0 -> head 0 middle 0 tail 0 moves 0

4. References

About

An experimental Java 11 Agent to intercept JDK Collection calls, compute metrics and provide some advices (WIP)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published