blob: 3c8fc80745efa6ff464390f08cec89aba3bdcd4e [file] [log] [blame]
Austin Schuh812d0d12021-11-04 20:16:48 -07001// Copyright (c) FIRST and other WPILib contributors.
2// Open Source Software; you can modify and/or share it under the terms of
3// the WPILib BSD license file in the root directory of this project.
Austin Schuh1e69f942020-11-14 15:06:14 -08004
5#include "frc/ScopedTracer.h"
6
7#include <wpi/raw_ostream.h>
8
9using namespace frc;
10
Austin Schuh812d0d12021-11-04 20:16:48 -070011ScopedTracer::ScopedTracer(std::string_view name, wpi::raw_ostream& os)
12 : m_name(name), m_os(os) {
Austin Schuh1e69f942020-11-14 15:06:14 -080013 m_tracer.ResetTimer();
14}
15
16ScopedTracer::~ScopedTracer() {
17 m_tracer.AddEpoch(m_name);
18 m_tracer.PrintEpochs(m_os);
19}