public static class SimpleMapIndex.IndexCalculator extends SimpleMemoryCalculator
calculator used to calculate the cost of a homogeneous index (holding all values of a single type).| Modifier and Type | Class and Description |
|---|---|
static class |
SimpleMapIndex.IndexCalculator.CalculatorState
The CalculatorState identifies the method used by the calculator to calculate the cost of a key or a value type.
|
Base.LoggingWriter, Base.StackFrame| Modifier and Type | Field and Description |
|---|---|
protected static int |
DEFAULT_SIZE
The default size of an entry used if the calculator is unable to calculate the size.
|
protected static int |
ENTRY_OVERHEAD
The average memory cost of creating SegmentedHashMap$Entry or SafeHashMap$Entry.
|
protected static int |
INFLATION_OVERHEAD
The memory cost of inflating an InflatableSet.
|
protected ConfigurableCacheMap.UnitCalculator |
m_calculator
The
ConfigurableCacheMap.UnitCalculator used to calculate the size of SimpleMapIndex.IndexCalculator.CalculatorState.CONFIGURED types. into Binary to approximate the size. |
protected int |
m_cbFixed
If the state is
SimpleMapIndex.IndexCalculator.CalculatorState.FIXED, contains a cached cost per instance. |
protected Converter |
m_converter
The
Converter used to convert SimpleMapIndex.IndexCalculator.CalculatorState.UNKNOWN types into Binary to approximate the size. |
protected SimpleMapIndex |
m_index
The container index.
|
protected SimpleMapIndex.IndexCalculator.CalculatorState |
m_state
The
SimpleMapIndex.IndexCalculator.CalculatorState of this calculator. |
protected static int |
MAP_OVERHEAD
The memory cost of a SegmentedHashMap used as the Forward Index.
|
protected static int |
SET_OVERHEAD
The memory cost of creating an InflatableSet.
|
MAP_FIXED_SIZES, MAP_PRIMITIVE_SIZES, SIZE_BASIC_OBJECT, SIZE_BIGDECIMAL, SIZE_BIGINTEGER, SIZE_BINARY, SIZE_BOOLEAN, SIZE_BYTE, SIZE_CHARACTER, SIZE_DATE, SIZE_DOUBLE, SIZE_ENTRY, SIZE_FLOAT, SIZE_INTEGER, SIZE_LONG, SIZE_OBJECT, SIZE_OBJECT_REF, SIZE_SHORT, SIZE_STRING, SIZE_TIMESTAMP| Constructor and Description |
|---|
IndexCalculator(BackingMapContext ctx, SimpleMapIndex index)
Construct an IndexCalculator which allows for conversion of items into a serialized format.
|
| Modifier and Type | Method and Description |
|---|---|
protected SimpleMapIndex.IndexCalculator.CalculatorState |
getCalculatorState(Class clz)
Determine which method to use to count the size of an instance of the specified class.
|
protected Converter |
getConverter()
Return the converter used by this IndexCalculator, or null.
|
protected int |
getEntrySize()
Return the size of a map entry.
|
protected SimpleMapIndex.IndexCalculator.CalculatorState |
initialize(Object o)
Initialize the calculator based on the type of the specified object assuming that the indexed values are homogeneous (of the same type).
|
int |
sizeOf(Object o)
Estimate the number of bytes of memory consumed by the given object.
|
calculateShallowSize, calculateUnits, getName, isInnerClass, main, padMemorySize, sizeOfazzert, azzert, azzert, azzertFailed, breakLines, breakLines, capitalize, checkNotEmpty, checkNotNull, checkRange, computeSafeWaitTime, decimalValue, dup, dup, ensureBigDecimal, ensureClassLoader, ensureRuntimeException, ensureRuntimeException, equals, equalsDeep, err, err, err, err, err, escape, formatDateTime, getCallerStackFrame, getCommonMonitor, getCommonMonitor, getCommonMonitor, getContextClassLoader, getContextClassLoader, getDeepMessage, getErr, getLastSafeTimeMillis, getLog, getMaxDecDigits, getMaxHexDigits, getOriginalException, getOut, getRandom, getRandomBinary, getRandomBinary, getRandomString, getSafeTimeMillis, getStackFrame, getStackFrames, getStackTrace, getStackTrace, getThreadFactory, getTimeZone, getUpTimeMillis, hashCode, hexValue, indentString, indentString, isDecimal, isHex, isLogEcho, isOctal, log, log, log, log, log, makeInteger, makeLong, makeThread, mod, mod, octalValue, out, out, out, out, out, pad, parseBandwidth, parseBandwidth, parseDelimitedString, parseHex, parseHex, parseMemorySize, parseMemorySize, parsePercentage, parseTime, parseTime, parseTimeNanos, parseTimeNanos, printStackTrace, randomize, randomize, randomize, read, read, read, read, read, read, read, replace, setErr, setLog, setLogEcho, setOut, sleep, toBandwidthString, toBandwidthString, toCharEscape, toCrc, toCrc, toCrc, toCrc, toCrc, toDecString, toDelimitedString, toDelimitedString, toDelimitedString, toDelimitedString, toHex, toHex, toHexDump, toHexEscape, toHexEscape, toHexEscape, toHexEscape, toHexString, toMemorySizeString, toMemorySizeString, toQuotedCharEscape, toQuotedStringEscape, toSqlString, toString, toString, toStringEscape, toUnicodeEscape, trace, trace, trace, trace, trace, trace, trace, trace, trace, truncateString, truncateString, waitprotected SimpleMapIndex m_index
protected SimpleMapIndex.IndexCalculator.CalculatorState m_state
SimpleMapIndex.IndexCalculator.CalculatorState of this calculator.protected int m_cbFixed
SimpleMapIndex.IndexCalculator.CalculatorState.FIXED, contains a cached cost per instance.protected final Converter m_converter
Converter used to convert SimpleMapIndex.IndexCalculator.CalculatorState.UNKNOWN types into Binary to approximate the size.protected final ConfigurableCacheMap.UnitCalculator m_calculator
ConfigurableCacheMap.UnitCalculator used to calculate the size of SimpleMapIndex.IndexCalculator.CalculatorState.CONFIGURED types. into Binary to approximate the size. The calculator is initialized iff the BackingMapContext associated with the index represents a ConfigurableCacheMapprotected static final int MAP_OVERHEAD
protected static final int ENTRY_OVERHEAD
protected static final int SET_OVERHEAD
This cost does not include post inflation of the set; INFLATION_OVERHEAD should be considered as a one-off memory cost to be added post inflation.
protected static final int INFLATION_OVERHEAD
protected static final int DEFAULT_SIZE
public IndexCalculator(BackingMapContext ctx, SimpleMapIndex index)
Note: ExternalizableHelper.CONVERTER_TO_BINARY can be used to convert Serializable or ExternalizableLite objects
ctx - the BackingMapContext associated with the indexed cacheindex - the container index for this calculator (used only for logging)protected SimpleMapIndex.IndexCalculator.CalculatorState getCalculatorState(Class clz)
clz - the type of objects that this calculator will operate onSimpleMapIndex.IndexCalculator.CalculatorStateprotected SimpleMapIndex.IndexCalculator.CalculatorState initialize(Object o)
o - an instance of the value to calculate the size forSimpleMapIndex.IndexCalculator.CalculatorStateprotected int getEntrySize()
getEntrySize in class SimpleMemoryCalculatorpublic int sizeOf(Object o)
The calculation is based on the class of the given object, with reference types assumed to be aligned on a 8-byte boundary:
sizeOf in class SimpleMemoryCalculatoro - the object to measure the size ofprotected Converter getConverter()