|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.cassandra.utils.ObjectSizes
public class ObjectSizes
Modified version of the code from. https://github.com/twitter/commons/blob/master /src/java/com/twitter/common/objectsize/ObjectSizeCalculator.java Difference is that we don't use reflection.
Nested Class Summary | |
---|---|
static interface |
ObjectSizes.MemoryLayoutSpecification
Describes constant memory overheads for various constructs in a JVM implementation. |
Field Summary | |
---|---|
static ObjectSizes.MemoryLayoutSpecification |
SPEC
|
Constructor Summary | |
---|---|
ObjectSizes()
|
Method Summary | |
---|---|
static long |
getArraySize(byte[] bytes)
Memory a byte array consumes |
static long |
getArraySize(int length,
long elementSize)
Memory an array will consume |
static long |
getFieldSize(long fieldsSize)
Memory a class consumes, including the object header and the size of the fields. |
static int |
getReferenceSize()
|
static long |
getSize(java.nio.ByteBuffer buffer)
Memory a byte buffer consumes |
static long |
getSuperClassFieldSize(long fieldsSize)
Memory a super class consumes, given the primitive field sizes |
static long |
measureDeep(java.lang.Object pojo)
|
static long |
roundTo(long x,
int multiple)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final ObjectSizes.MemoryLayoutSpecification SPEC
Constructor Detail |
---|
public ObjectSizes()
Method Detail |
---|
public static long getFieldSize(long fieldsSize)
fieldsSize
- Total size of the primitive fields of a class
public static long getSuperClassFieldSize(long fieldsSize)
fieldsSize
- Total size of the primitive fields of the super class
public static long getArraySize(int length, long elementSize)
length
- Number of elements in the arrayelementSize
- In-memory size of each element's primitive stored
public static long getArraySize(byte[] bytes)
bytes
- byte array to get memory size
public static long getSize(java.nio.ByteBuffer buffer)
buffer
- ByteBuffer to calculate in memory size
public static long roundTo(long x, int multiple)
public static int getReferenceSize()
public static long measureDeep(java.lang.Object pojo)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |