@InterfaceAudience.Private public class ClassSize extends Object
Modifier and Type | Field and Description |
---|---|
static int |
ARRAY
Array overhead
|
static int |
ARRAYLIST
Overhead for ArrayList(0)
|
static int |
ATOMIC_BOOLEAN
Overhead for AtomicBoolean
|
static int |
ATOMIC_INTEGER
Overhead for AtomicInteger
|
static int |
ATOMIC_LONG
Overhead for AtomicLong
|
static int |
BYTE_BUFFER
Overhead for ByteBuffer
|
static int |
CELL_SKIPLIST_SET
Overhead for CellSkipListSet
|
static int |
CONCURRENT_HASHMAP
Overhead for ConcurrentHashMap
|
static int |
CONCURRENT_HASHMAP_ENTRY
Overhead for ConcurrentHashMap.Entry
|
static int |
CONCURRENT_HASHMAP_SEGMENT
Overhead for ConcurrentHashMap.Segment
|
static int |
CONCURRENT_SKIPLISTMAP
Overhead for ConcurrentSkipListMap
|
static int |
CONCURRENT_SKIPLISTMAP_ENTRY
Overhead for ConcurrentSkipListMap Entry
|
static int |
COPYONWRITE_ARRAYLIST
Overhead for CopyOnWriteArrayList
|
static int |
COPYONWRITE_ARRAYSET
Overhead for CopyOnWriteArraySet
|
static int |
INTEGER
Overhead for an Integer
|
private static org.apache.commons.logging.Log |
LOG |
static int |
MAP_ENTRY
Overhead for entry in map
|
private static int |
nrOfRefsPerObj |
static int |
OBJECT
Object overhead is minimum 2 * reference size (8 bytes on 64-bit)
|
static int |
REENTRANT_LOCK
Overhead for ReentrantReadWriteLock
|
static int |
REFERENCE
Reference size is 8 bytes on 64-bit, 4 bytes on 32-bit
|
static int |
STRING
String overhead
|
static int |
TIMERANGE
Overhead for timerange
|
static int |
TIMERANGE_TRACKER
Overhead for TimeRangeTracker
|
static int |
TREEMAP
Overhead for TreeMap
|
Constructor and Description |
---|
ClassSize() |
Modifier and Type | Method and Description |
---|---|
static int |
align(int num)
Aligns a number to 8.
|
static long |
align(long num)
Aligns a number to 8.
|
static long |
estimateBase(Class cl,
boolean debug)
Estimate the static space taken up by the fields of a class.
|
private static long |
estimateBaseFromCoefficients(int[] coeff,
boolean debug)
Estimate the static space taken up by a class instance given the
coefficients returned by getSizeCoefficients.
|
private static int[] |
getSizeCoefficients(Class cl,
boolean debug)
The estimate of the size of a class instance depends on whether the JVM
uses 32 or 64 bit addresses, that is it depends on the size of an object
reference.
|
static boolean |
is32BitJVM()
Determines if we are running in a 32-bit JVM.
|
private static final org.apache.commons.logging.Log LOG
private static int nrOfRefsPerObj
public static final int ARRAY
public static final int ARRAYLIST
public static final int BYTE_BUFFER
public static final int INTEGER
public static final int MAP_ENTRY
public static final int OBJECT
public static final int REFERENCE
public static final int STRING
public static final int TREEMAP
public static final int CONCURRENT_HASHMAP
public static final int CONCURRENT_HASHMAP_ENTRY
public static final int CONCURRENT_HASHMAP_SEGMENT
public static final int CONCURRENT_SKIPLISTMAP
public static final int CONCURRENT_SKIPLISTMAP_ENTRY
public static final int REENTRANT_LOCK
public static final int ATOMIC_LONG
public static final int ATOMIC_INTEGER
public static final int ATOMIC_BOOLEAN
public static final int COPYONWRITE_ARRAYSET
public static final int COPYONWRITE_ARRAYLIST
public static final int TIMERANGE
public static final int TIMERANGE_TRACKER
public static final int CELL_SKIPLIST_SET
private static int[] getSizeCoefficients(Class cl, boolean debug)
cl
- A class whose instance size is to be estimateddebug
- debug flagprivate static long estimateBaseFromCoefficients(int[] coeff, boolean debug)
coeff
- the coefficientsdebug
- debug flagpublic static long estimateBase(Class cl, boolean debug)
cl
- classdebug
- debug flagpublic static int align(int num)
num
- number to align to 8public static long align(long num)
num
- number to align to 8public static boolean is32BitJVM()
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.