Package io.perfmark.java9
Class SecretGenerator.VarHandleGenerator
java.lang.Object
io.perfmark.impl.Generator
io.perfmark.java9.SecretGenerator.VarHandleGenerator
- Enclosing class:
SecretGenerator
This class let's PerfMark have fairly low overhead detection if it is enabled, with reasonable
time between enabled and other threads noticing. Since this uses Java 9 APIs, it may not be
available.
-
Field Summary
FieldsFields inherited from class io.perfmark.impl.Generator
FAILURE, GEN_OFFSET -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongReturns the approximate cost to read the generation.longReturns the approximate cost to change the generation.longGets the current generation, shifted left byGenerator.GEN_OFFSET.voidsetGeneration(long generation) Sets the current generation count.
-
Field Details
-
GEN
-
gen
private long gen
-
-
Constructor Details
-
VarHandleGenerator
public VarHandleGenerator()
-
-
Method Details
-
setGeneration
public void setGeneration(long generation) Description copied from class:GeneratorSets the current generation count. This should be eventually noticeable for callers ofGenerator.getGeneration(). An odd number means the library is enabled, while an even number means the library is disabled.- Overrides:
setGenerationin classGenerator- Parameters:
generation- the generation id, shifted left byGenerator.GEN_OFFSET.
-
getGeneration
public long getGeneration()Description copied from class:GeneratorGets the current generation, shifted left byGenerator.GEN_OFFSET. An odd number means the library is enabled, while an even number means the library is disabled.- Overrides:
getGenerationin classGenerator- Returns:
- the current generation or
Generator.FAILURE.
-
costOfSetNanos
public long costOfSetNanos()Description copied from class:GeneratorReturns the approximate cost to change the generation.- Overrides:
costOfSetNanosin classGenerator- Returns:
- an approximate number of nanoseconds needed to change the generator value.
-
costOfGetNanos
public long costOfGetNanos()Description copied from class:GeneratorReturns the approximate cost to read the generation.- Overrides:
costOfGetNanosin classGenerator- Returns:
- an approximate number of nanoseconds needed to read the generator value.
-