Package org.ehcache.sizeof.impl
Class AgentLoader
java.lang.Object
org.ehcache.sizeof.impl.AgentLoader
This will try to load the agent using the Attach API of JDK6.
If you are on an older JDK (v5) you can still use the agent by adding the -javaagent:[pathTojar] to your VM
startup script
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static boolean
Checks whether the agent is available(package private) static long
agentSizeOf
(Object obj) Returns the size of this Java object as calculated by the loaded agent.private static File
private static Class
<?> (package private) static boolean
Attempts to load the agent through the Attach APIprivate static void
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
SIZEOF_AGENT_CLASSNAME
- See Also:
-
VIRTUAL_MACHINE_CLASSNAME
- See Also:
-
VIRTUAL_MACHINE_ATTACH
-
VIRTUAL_MACHINE_DETACH
-
VIRTUAL_MACHINE_LOAD_AGENT
-
instrumentation
-
INSTRUMENTATION_INSTANCE_SYSTEM_PROPERTY_NAME
- See Also:
-
-
Constructor Details
-
AgentLoader
AgentLoader()
-
-
Method Details
-
getVirtualMachineClass
- Throws:
ClassNotFoundException
-
getPossibleToolsJars
-
loadAgent
static boolean loadAgent()Attempts to load the agent through the Attach API- Returns:
- true if agent was loaded (which could have happened thought the -javaagent switch)
-
warnIfOSX
private static void warnIfOSX() -
getAgentFile
- Throws:
IOException
-
agentIsAvailable
static boolean agentIsAvailable()Checks whether the agent is available- Returns:
- true if available
-
agentSizeOf
Returns the size of this Java object as calculated by the loaded agent.- Parameters:
obj
- object to be sized- Returns:
- size of the object in bytes
-