Austin Schuh | 812d0d1 | 2021-11-04 20:16:48 -0700 | [diff] [blame^] | 1 | // 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 Schuh | 1e69f94 | 2020-11-14 15:06:14 -0800 | [diff] [blame] | 4 | |
| 5 | #include "frc/ScopedTracer.h" |
| 6 | |
| 7 | #include <wpi/raw_ostream.h> |
| 8 | |
| 9 | using namespace frc; |
| 10 | |
Austin Schuh | 812d0d1 | 2021-11-04 20:16:48 -0700 | [diff] [blame^] | 11 | ScopedTracer::ScopedTracer(std::string_view name, wpi::raw_ostream& os) |
| 12 | : m_name(name), m_os(os) { |
Austin Schuh | 1e69f94 | 2020-11-14 15:06:14 -0800 | [diff] [blame] | 13 | m_tracer.ResetTimer(); |
| 14 | } |
| 15 | |
| 16 | ScopedTracer::~ScopedTracer() { |
| 17 | m_tracer.AddEpoch(m_name); |
| 18 | m_tracer.PrintEpochs(m_os); |
| 19 | } |