WPILibC++ 2023.4.3
frc::Tracer Class Reference

A class for keeping track of how much time it takes for different parts of code to execute. More...

#include <frc/Tracer.h>

Public Member Functions

 Tracer ()
 Constructs a Tracer instance. More...
 
void ResetTimer ()
 Restarts the epoch timer. More...
 
void ClearEpochs ()
 Clears all epochs. More...
 
void AddEpoch (std::string_view epochName)
 Adds time since last epoch to the list printed by PrintEpochs(). More...
 
void PrintEpochs ()
 Prints list of epochs added so far and their times to the DriverStation. More...
 
void PrintEpochs (wpi::raw_ostream &os)
 Prints list of epochs added so far and their times to a stream. More...
 

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 to calls to AddEpoch() 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()

frc::Tracer::Tracer ( )

Constructs a Tracer instance.

Member Function Documentation

◆ AddEpoch()

void frc::Tracer::AddEpoch ( std::string_view  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.

Parameters
epochNameThe name to associate with the epoch.

◆ ClearEpochs()

void frc::Tracer::ClearEpochs ( )

Clears all epochs.

◆ PrintEpochs() [1/2]

void frc::Tracer::PrintEpochs ( )

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

◆ PrintEpochs() [2/2]

void frc::Tracer::PrintEpochs ( wpi::raw_ostream os)

Prints list of epochs added so far and their times to a stream.

Parameters
osoutput stream

◆ ResetTimer()

void frc::Tracer::ResetTimer ( )

Restarts the epoch timer.


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