org.expasy.jpl.commons.base.mem
Class MemoryAgent

java.lang.Object
  extended by org.expasy.jpl.commons.base.mem.MemoryAgent

public final class MemoryAgent
extends Object

This agent trace sizeof of running objects. Implemented and extended code from http://www.javaspecialists.eu/archive/Issue142.html

Version:
1.0.0
Author:
nikitin

Constructor Summary
MemoryAgent()
           
 
Method Summary
static long deepSizeOf(Object obj)
          Returns deep size of object, recursively iterating over its fields and superclasses.
static void flushInFile(String filename)
          flush output in file
static void flushInStdout()
          flush output in standard output stream
static boolean isSharedFlyweight(Object obj)
          Returns true if this is a well-known shared flyweight.
static void premain(String agentArgs, Instrumentation instrumentation)
          Initializes agent
static void prettyByteDisabled()
           
static void prettyByteEnabled()
           
static long sizeOf(Object obj)
          Returns object size.
static void switchFlyweightProfilingOff()
           
static void switchFlyweightProfilingOn()
           
static void traceDisabled()
           
static void traceEnabled()
          trace enabled/disabled
static void traceSizesOf(Object o)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MemoryAgent

public MemoryAgent()
Method Detail

premain

public static void premain(String agentArgs,
                           Instrumentation instrumentation)
Initializes agent


flushInFile

public static void flushInFile(String filename)
                        throws FileNotFoundException
flush output in file

Throws:
FileNotFoundException

flushInStdout

public static void flushInStdout()
flush output in standard output stream


traceEnabled

public static void traceEnabled()
trace enabled/disabled


traceDisabled

public static void traceDisabled()

prettyByteEnabled

public static void prettyByteEnabled()

prettyByteDisabled

public static void prettyByteDisabled()

switchFlyweightProfilingOn

public static void switchFlyweightProfilingOn()

switchFlyweightProfilingOff

public static void switchFlyweightProfilingOff()

sizeOf

public static long sizeOf(Object obj)
Returns object size.


deepSizeOf

public static long deepSizeOf(Object obj)
Returns deep size of object, recursively iterating over its fields and superclasses.


traceSizesOf

public static void traceSizesOf(Object o)

isSharedFlyweight

public static boolean isSharedFlyweight(Object obj)
Returns true if this is a well-known shared flyweight. For example, interned Strings, Booleans and Number objects



Copyright (c) 2012 Swiss Institute of Bioinformatics. All rights reserved.