Class TraceSpan

java.lang.Object
com.aembot.lib.tracing.TraceSpan

public final class TraceSpan extends Object
Represents a single traced span (function call) with timing information. Pre-allocated to avoid GC during robot loop.

Memory-optimized: threadName and category are stored externally in lookup tables. FPGA timestamps are computed at export time from nanos using TraceLoop's reference point.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    byte
    Category index into Tracer.getCategories()
    boolean
    Whether this span has completed (endSpan was called)
    byte
    Nesting depth (0 = top level, increases with nested calls)
    long
    End time in nanoseconds
    Name of the traced function (ClassName.methodName or custom)
    long
    Start time in nanoseconds (System.nanoTime) for high precision duration
    long
    Thread ID that this span ran on
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    Get duration in microseconds
    double
    Get duration in milliseconds
    void
    Reset this span for reuse

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • startNanos

      public long startNanos
      Start time in nanoseconds (System.nanoTime) for high precision duration
    • endNanos

      public long endNanos
      End time in nanoseconds
    • name

      public String name
      Name of the traced function (ClassName.methodName or custom)
    • depth

      public byte depth
      Nesting depth (0 = top level, increases with nested calls)
    • threadId

      public long threadId
      Thread ID that this span ran on
    • categoryIndex

      public byte categoryIndex
      Category index into Tracer.getCategories()
    • complete

      public boolean complete
      Whether this span has completed (endSpan was called)
  • Constructor Details

    • TraceSpan

      public TraceSpan()
  • Method Details

    • reset

      public void reset()
      Reset this span for reuse
    • getDurationMicros

      public double getDurationMicros()
      Get duration in microseconds
    • getDurationMillis

      public double getDurationMillis()
      Get duration in milliseconds