Record Class DrawStats

java.lang.Object
java.lang.Record
com.botwithus.bot.api.draw.DrawStats
Record Components:
count - retained commands, all connections
capacity - DrawLimits.MAX_COMMANDS
textSlotsUsed - retained text commands
textSlotCapacity - DrawLimits.MAX_TEXT_COMMANDS
polySlotsUsed - retained polyline commands
polySlotCapacity - DrawLimits.MAX_POLY_COMMANDS
liveTargets - component highlights awaiting per-tick resolution
dropped - commands refused for want of a slot, all connections, since the producer started. A malformed command, an over-long key and an out-of-range coordinate are rejected before the store is touched and do not land here — this counter is not a way to detect them. Not to be confused with DrawBatchResult.dropped(), which is per-call and does count those: same name, different scope, and different membership.
resolveFailures - component rects the game thread could not resolve
resolveOverflow - ticks on which more than DrawLimits.RESOLVED_COMPONENTS_PER_TICK highlights were live. Non-zero means some highlight geometry is lagging the game by a tick or more; collection rotates, so nothing is starved permanently.
isEnabled - drawing is switched on
hasPresented - the renderer has delivered at least one frame
presentFailures - failed uploads
isResolverLive - the per-tick component resolve has run at least once
backendPresents - uploads that reached the screen, cumulative. Useful as a progress counter — a value higher than one sampled earlier means a frame was delivered in between. Do not compare it against the producer's frame counter: a frame whose dirty region is empty is processed without uploading anything, so they differ in normal operation and neither "equal" nor "unequal" means healthy.
backend - which renderer is live, as the producer names it
surfaceWidth - overlay surface width in pixels
surfaceHeight - overlay surface height in pixels

public record DrawStats(int count, int capacity, int textSlotsUsed, int textSlotCapacity, int polySlotsUsed, int polySlotCapacity, int liveTargets, long dropped, long resolveFailures, long resolveOverflow, boolean isEnabled, boolean hasPresented, long presentFailures, boolean isResolverLive, long backendPresents, String backend, int surfaceWidth, int surfaceHeight) extends Record
The producer's own account of its overlay: how full the store is, what it has refused, and whether the renderer is alive.

The failure this exists to catch is an overlay that has silently died while looking perfectly healthy. Three fields are the ones worth asserting on:

  • presentFailures() — uploads that failed. The real health check, and falsifiable: break the present and it climbs.
  • hasPresented() — the renderer has drawn at least one frame. False means a dead overlay, which otherwise looks exactly like an idle one.
  • isResolverLive() — the game thread has returned resolved geometry at least once. "Rect unresolved" is also the initial state, so asserting only that would pass just as happily with the per-tick refresh never having run.

Do not build a check on frames matching presents. They answer different questions and differ in normal operation; the producer reports their difference as a diagnostic rather than a verdict, and this record deliberately does not carry either counter.

  • Constructor Details

    • DrawStats

      public DrawStats(int count, int capacity, int textSlotsUsed, int textSlotCapacity, int polySlotsUsed, int polySlotCapacity, int liveTargets, long dropped, long resolveFailures, long resolveOverflow, boolean isEnabled, boolean hasPresented, long presentFailures, boolean isResolverLive, long backendPresents, String backend, int surfaceWidth, int surfaceHeight)
      Creates an instance of a DrawStats record class.
      Parameters:
      count - the value for the count record component
      capacity - the value for the capacity record component
      textSlotsUsed - the value for the textSlotsUsed record component
      textSlotCapacity - the value for the textSlotCapacity record component
      polySlotsUsed - the value for the polySlotsUsed record component
      polySlotCapacity - the value for the polySlotCapacity record component
      liveTargets - the value for the liveTargets record component
      dropped - the value for the dropped record component
      resolveFailures - the value for the resolveFailures record component
      resolveOverflow - the value for the resolveOverflow record component
      isEnabled - the value for the isEnabled record component
      hasPresented - the value for the hasPresented record component
      presentFailures - the value for the presentFailures record component
      isResolverLive - the value for the isResolverLive record component
      backendPresents - the value for the backendPresents record component
      backend - the value for the backend record component
      surfaceWidth - the value for the surfaceWidth record component
      surfaceHeight - the value for the surfaceHeight record component
  • Method Details

    • isFull

      public boolean isFull()
      True when the store has no room for another command.
    • isResolveLagging

      public boolean isResolveLagging()
      True when more component highlights are live than the producer resolves per tick, so some of their geometry is a tick or more behind the game.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • count

      public int count()
      Returns the value of the count record component.
      Returns:
      the value of the count record component
    • capacity

      public int capacity()
      Returns the value of the capacity record component.
      Returns:
      the value of the capacity record component
    • textSlotsUsed

      public int textSlotsUsed()
      Returns the value of the textSlotsUsed record component.
      Returns:
      the value of the textSlotsUsed record component
    • textSlotCapacity

      public int textSlotCapacity()
      Returns the value of the textSlotCapacity record component.
      Returns:
      the value of the textSlotCapacity record component
    • polySlotsUsed

      public int polySlotsUsed()
      Returns the value of the polySlotsUsed record component.
      Returns:
      the value of the polySlotsUsed record component
    • polySlotCapacity

      public int polySlotCapacity()
      Returns the value of the polySlotCapacity record component.
      Returns:
      the value of the polySlotCapacity record component
    • liveTargets

      public int liveTargets()
      Returns the value of the liveTargets record component.
      Returns:
      the value of the liveTargets record component
    • dropped

      public long dropped()
      Returns the value of the dropped record component.
      Returns:
      the value of the dropped record component
    • resolveFailures

      public long resolveFailures()
      Returns the value of the resolveFailures record component.
      Returns:
      the value of the resolveFailures record component
    • resolveOverflow

      public long resolveOverflow()
      Returns the value of the resolveOverflow record component.
      Returns:
      the value of the resolveOverflow record component
    • isEnabled

      public boolean isEnabled()
      Returns the value of the isEnabled record component.
      Returns:
      the value of the isEnabled record component
    • hasPresented

      public boolean hasPresented()
      Returns the value of the hasPresented record component.
      Returns:
      the value of the hasPresented record component
    • presentFailures

      public long presentFailures()
      Returns the value of the presentFailures record component.
      Returns:
      the value of the presentFailures record component
    • isResolverLive

      public boolean isResolverLive()
      Returns the value of the isResolverLive record component.
      Returns:
      the value of the isResolverLive record component
    • backendPresents

      public long backendPresents()
      Returns the value of the backendPresents record component.
      Returns:
      the value of the backendPresents record component
    • backend

      public String backend()
      Returns the value of the backend record component.
      Returns:
      the value of the backend record component
    • surfaceWidth

      public int surfaceWidth()
      Returns the value of the surfaceWidth record component.
      Returns:
      the value of the surfaceWidth record component
    • surfaceHeight

      public int surfaceHeight()
      Returns the value of the surfaceHeight record component.
      Returns:
      the value of the surfaceHeight record component