Class MemoryEstimations
- java.lang.Object
-
- org.neo4j.graphalgo.core.utils.mem.MemoryEstimations
-
public final class MemoryEstimations extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MemoryEstimations.Builder
static interface
MemoryEstimations.MemoryEstimationSetup
static interface
MemoryEstimations.MemoryRangeModifier
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
RESIDENT_MEMORY
static java.lang.String
TEMPORARY_MEMORY
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static MemoryEstimation
andThen(java.lang.String description, MemoryEstimation delegate, MemoryEstimations.MemoryRangeModifier andThen)
Updates a givenMemoryEstimation
by applying aMemoryEstimations.MemoryRangeModifier
.static MemoryEstimation
andThen(MemoryEstimation delegate, java.util.function.UnaryOperator<MemoryRange> andThen)
Updates the memory range of givenMemoryEstimation
by applying a given function.static MemoryEstimation
andThen(MemoryEstimation delegate, MemoryEstimations.MemoryRangeModifier andThen)
Updates a givenMemoryEstimation
by applying aMemoryEstimations.MemoryRangeModifier
.static MemoryEstimations.Builder
builder()
Creates a newMemoryEstimations.Builder
with an empty description.static MemoryEstimations.Builder
builder(java.lang.Class<?> type)
Creates a newMemoryEstimations.Builder
from the given class type.static MemoryEstimations.Builder
builder(java.lang.String description)
Creates a newMemoryEstimations.Builder
using the given description.static MemoryEstimations.Builder
builder(java.lang.String description, java.lang.Class<?> type)
Creates a newMemoryEstimations.Builder
using the given description and class type.static MemoryEstimation
delegateEstimation(MemoryEstimation delegate, java.lang.String description)
static MemoryEstimation
empty()
static MemoryEstimation
maxEstimation(java.lang.String description, java.util.List<MemoryEstimation> components)
static MemoryEstimation
maxEstimation(java.util.List<MemoryEstimation> components)
static MemoryEstimation
of(java.lang.Class<?> instanceType)
Creates aMemoryEstimation
for the fields of the given class.static MemoryEstimation
of(java.lang.String description, MemoryRange range)
static MemoryEstimation
of(java.lang.String description, MemoryResident resident)
Creates aMemoryEstimation
using the givenMemoryResident
function.static MemoryEstimation
setup(java.lang.String description, java.util.function.Function<GraphDimensions,MemoryEstimation> fn)
Creates aMemoryEstimation
using the given function.static MemoryEstimation
setup(java.lang.String description, MemoryEstimations.MemoryEstimationSetup setup)
Creates aMemoryEstimation
using the givenMemoryEstimations.MemoryEstimationSetup
function.
-
-
-
Field Detail
-
RESIDENT_MEMORY
public static final java.lang.String RESIDENT_MEMORY
- See Also:
- Constant Field Values
-
TEMPORARY_MEMORY
public static final java.lang.String TEMPORARY_MEMORY
- See Also:
- Constant Field Values
-
-
Method Detail
-
empty
public static MemoryEstimation empty()
-
maxEstimation
public static MemoryEstimation maxEstimation(java.util.List<MemoryEstimation> components)
-
maxEstimation
public static MemoryEstimation maxEstimation(java.lang.String description, java.util.List<MemoryEstimation> components)
-
delegateEstimation
public static MemoryEstimation delegateEstimation(MemoryEstimation delegate, java.lang.String description)
-
of
public static MemoryEstimation of(java.lang.Class<?> instanceType)
Creates aMemoryEstimation
for the fields of the given class.- Parameters:
instanceType
- class- Returns:
- memory estimation
-
of
public static MemoryEstimation of(java.lang.String description, MemoryResident resident)
Creates aMemoryEstimation
using the givenMemoryResident
function. Inputs to that function are theGraphDimensions
and the number of available threads.- Parameters:
description
- description of the sub-componentresident
- function to compute aMemoryRange
- Returns:
- memory estimation
-
of
public static MemoryEstimation of(java.lang.String description, MemoryRange range)
-
setup
public static MemoryEstimation setup(java.lang.String description, MemoryEstimations.MemoryEstimationSetup setup)
Creates aMemoryEstimation
using the givenMemoryEstimations.MemoryEstimationSetup
function. Inputs to that function are theGraphDimensions
and the number of available threads.- Parameters:
description
- description of the sub-componentsetup
- function to compute aMemoryEstimation
- Returns:
- memory estimation
-
setup
public static MemoryEstimation setup(java.lang.String description, java.util.function.Function<GraphDimensions,MemoryEstimation> fn)
Creates aMemoryEstimation
using the given function. Inputs to that function are theGraphDimensions
.- Parameters:
description
- description of the sub-componentfn
- function to compute aMemoryEstimation
- Returns:
- memory estimation
-
andThen
public static MemoryEstimation andThen(MemoryEstimation delegate, MemoryEstimations.MemoryRangeModifier andThen)
Updates a givenMemoryEstimation
by applying aMemoryEstimations.MemoryRangeModifier
. The description is inherited fromdelegate.description()
.- Parameters:
delegate
- memory estimation to modifyandThen
- function to update the memory estimation- Returns:
- updated memory estimation
-
andThen
public static MemoryEstimation andThen(MemoryEstimation delegate, java.util.function.UnaryOperator<MemoryRange> andThen)
Updates the memory range of givenMemoryEstimation
by applying a given function. The description is inherited fromdelegate.description()
.- Parameters:
delegate
- memory estimation to modifyandThen
- function to update the memory range of the delegate- Returns:
- updated memory estimation
-
andThen
public static MemoryEstimation andThen(java.lang.String description, MemoryEstimation delegate, MemoryEstimations.MemoryRangeModifier andThen)
Updates a givenMemoryEstimation
by applying aMemoryEstimations.MemoryRangeModifier
.- Parameters:
description
- new description of the memory estimationdelegate
- memory estimation to modifyandThen
- function to update the memory estimation- Returns:
- updated memory estimation
-
builder
public static MemoryEstimations.Builder builder()
Creates a newMemoryEstimations.Builder
with an empty description.- Returns:
- builder
-
builder
public static MemoryEstimations.Builder builder(java.lang.String description)
Creates a newMemoryEstimations.Builder
using the given description.- Returns:
- builder
-
builder
public static MemoryEstimations.Builder builder(java.lang.Class<?> type)
Creates a newMemoryEstimations.Builder
from the given class type. The description is inferred from the class type bytype.getSimpleName()
.- Returns:
- builder
-
builder
public static MemoryEstimations.Builder builder(java.lang.String description, java.lang.Class<?> type)
Creates a newMemoryEstimations.Builder
using the given description and class type.- Parameters:
description
- description of the componenttype
- class type- Returns:
- builder
-
-