Enum Class CoverageMode
- All Implemented Interfaces:
Serializable, Comparable<CoverageMode>, Constable
Coverage tracking modes that control how probe hits are recorded.
Different modes trade off between performance and information richness. The mode affects the generated code for probe recording.
-
Nested Class Summary
Nested classes/interfaces inherited from class Enum
Enum.EnumDesc<E> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionstatic CoverageModeReturns the enum constant of this class with the specified name.static CoverageMode[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
SET
Boolean coverage tracking (default, fastest).Each probe is a boolean flag:
probes[id] = true- Answers: "Was this code executed?"
- Storage: 1 byte per probe (boolean array)
- Performance: Minimal overhead (~4 JVM instructions per probe)
- Use case: Standard coverage analysis, CI/CD gates
-
COUNT
Count-based coverage tracking.Each probe increments a counter:
probes[id]++- Answers: "How many times was this code executed?"
- Storage: 4 bytes per probe (int array)
- Performance: Slightly more overhead than SET
- Use case: Hot spot analysis, performance profiling
-
ATOMIC
Thread-safe atomic counting.Each probe uses atomic increment:
AtomicIntegerArray.incrementAndGet(id)- Answers: "How many times was this code executed?" (thread-safe)
- Storage: AtomicIntegerArray (~16+ bytes per probe)
- Performance: Higher overhead due to atomic operations
- Use case: Multi-threaded applications, parallel test execution
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-