Enum Class CoverageMode

java.lang.Object
java.lang.Enum<CoverageMode>
org.ek9lang.compiler.ir.CoverageMode
All Implemented Interfaces:
Serializable, Comparable<CoverageMode>, Constable

public enum CoverageMode extends Enum<CoverageMode>
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.

  • Enum Constant Details

    • SET

      public static final CoverageMode 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

      public static final CoverageMode 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

      public static final CoverageMode 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

      public static CoverageMode[] 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

      public static CoverageMode valueOf(String name)
      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 name
      NullPointerException - if the argument is null