[wpilibc] Output Tracer to DriverStation by default (#2469)

This matches the Java behavior.

Also optimizes Java to only create a StringBuffer and call
DriverStation.reportWarning if there is data to output.
This commit is contained in:
Peter Johnson
2020-04-05 23:09:21 -07:00
committed by GitHub
parent cb51029335
commit b46b5df16a
3 changed files with 32 additions and 10 deletions

View File

@@ -14,6 +14,10 @@
#include <wpi/StringMap.h>
#include <wpi/StringRef.h>
namespace wpi {
class raw_ostream;
} // namespace wpi
namespace frc {
/**
* A class for keeping track of how much time it takes for different parts of
@@ -51,10 +55,17 @@ class Tracer {
void AddEpoch(wpi::StringRef epochName);
/**
* Prints list of epochs added so far and their times.
* Prints list of epochs added so far and their times to the DriverStation.
*/
void PrintEpochs();
/**
* Prints list of epochs added so far and their times to a stream.
*
* @param os output stream
*/
void PrintEpochs(wpi::raw_ostream& os);
private:
static constexpr std::chrono::milliseconds kMinPrintPeriod{1000};