Robot Core Documentation
Loading...
Searching...
No Matches
edu.wpi.first.wpilibj.Tracer Class Reference

Public Member Functions

 Tracer ()
 
void clearEpochs ()
 
final void resetTimer ()
 
void addEpoch (String epochName)
 
void printEpochs ()
 
void printEpochs (Consumer< String > output)
 

Detailed Description

A class for keeping track of how much time it takes for different parts of code to execute. This is done with epochs, that are added by calls to addEpoch(String), and can be printed with a call to printEpochs().

Epochs are a way to partition the time elapsed so that when overruns occur, one can determine which parts of an operation consumed the most time.

Constructor & Destructor Documentation

◆ Tracer()

edu.wpi.first.wpilibj.Tracer.Tracer ( )

Tracer constructor.

Member Function Documentation

◆ addEpoch()

void edu.wpi.first.wpilibj.Tracer.addEpoch ( String epochName)

Adds time since last epoch to the list printed by printEpochs().

Epochs are a way to partition the time elapsed so that when overruns occur, one can determine which parts of an operation consumed the most time.

This should be called immediately after execution has finished, with a call to this method or resetTimer() before execution.

Parameters
epochNameThe name to associate with the epoch.

◆ clearEpochs()

void edu.wpi.first.wpilibj.Tracer.clearEpochs ( )

Clears all epochs.

◆ printEpochs() [1/2]

void edu.wpi.first.wpilibj.Tracer.printEpochs ( )

Prints list of epochs added so far and their times to the DriverStation.

◆ printEpochs() [2/2]

void edu.wpi.first.wpilibj.Tracer.printEpochs ( Consumer< String > output)

Prints list of epochs added so far and their times to the entered String consumer.

This overload can be useful for logging to a file, etc.

Parameters
outputthe stream that the output is sent to

◆ resetTimer()

final void edu.wpi.first.wpilibj.Tracer.resetTimer ( )

Restarts the epoch timer.


The documentation for this class was generated from the following file: