Class LoggingProfiler

java.lang.Object
frc.lib.profiling.LoggingProfiler
All Implemented Interfaces:
Profiler

public final class LoggingProfiler extends Object implements Profiler
This logger saves runtime performance metrics to memory. These metrics are subsequently written to a file when save is called.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    Performance metrics for a given state of the profile stack.
  • Constructor Summary

    Constructors
    Constructor
    Description
    LoggingProfiler(LongSupplier timeGetter, double timeDivisor)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Called at the bottom of the main loop.
    void
    pop()
    The profile stack is popped.
    void
    push(String location)
    The profile stack is pushed with the location as its top.
    void
    Reset logger.
    void
    Write profile data to a file.
    void
    Called at the top of the main loop.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface frc.lib.profiling.Profiler

    swap
  • Constructor Details

    • LoggingProfiler

      public LoggingProfiler(LongSupplier timeGetter, double timeDivisor)
      Parameters:
      timeGetter - a supplier for the current time.
      timeDivisor - a conversion factor turning the units of timeGetter to the units output to a file.
  • Method Details

    • save

      public void save()
      Description copied from interface: Profiler
      Write profile data to a file.
      Specified by:
      save in interface Profiler
    • startTick

      public void startTick()
      Description copied from interface: Profiler
      Called at the top of the main loop. Indicates the profiler is at "root" and records the start time. Within the main loop, no meaningful work should occur before this call.
      Specified by:
      startTick in interface Profiler
    • endTick

      public void endTick()
      Description copied from interface: Profiler
      Called at the bottom of the main loop. Indicates the profiler's "root" is finished, and its time usage metrics are updated. Within the main loop, no meaningful work should occur after this call.
      Specified by:
      endTick in interface Profiler
    • push

      public void push(String location)
      Description copied from interface: Profiler
      The profile stack is pushed with the location as its top. Must be accompanied by a call to pop.
      Specified by:
      push in interface Profiler
    • pop

      public void pop()
      Description copied from interface: Profiler
      The profile stack is popped. Must be preceded (at some point) by a call to push.
      Specified by:
      pop in interface Profiler
    • reset

      public void reset()
      Description copied from interface: Profiler
      Reset logger.
      Specified by:
      reset in interface Profiler