2020-12-26 14:12:05 -08:00
|
|
|
// Copyright (c) FIRST and other WPILib contributors.
|
|
|
|
|
// Open Source Software; you can modify and/or share it under the terms of
|
|
|
|
|
// the WPILib BSD license file in the root directory of this project.
|
2020-09-27 03:10:11 -04:00
|
|
|
|
|
|
|
|
#include "frc/ScopedTracer.h"
|
|
|
|
|
|
|
|
|
|
#include <wpi/raw_ostream.h>
|
|
|
|
|
|
|
|
|
|
using namespace frc;
|
|
|
|
|
|
2021-05-26 17:44:18 -07:00
|
|
|
ScopedTracer::ScopedTracer(std::string_view name, wpi::raw_ostream& os)
|
|
|
|
|
: m_name(name), m_os(os) {
|
2020-09-27 03:10:11 -04:00
|
|
|
m_tracer.ResetTimer();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ScopedTracer::~ScopedTracer() {
|
|
|
|
|
m_tracer.AddEpoch(m_name);
|
|
|
|
|
m_tracer.PrintEpochs(m_os);
|
|
|
|
|
}
|