Austin Schuh | 1e69f94 | 2020-11-14 15:06:14 -0800 | [diff] [blame^] | 1 | /*----------------------------------------------------------------------------*/ |
| 2 | /* Copyright (c) 2020 FIRST. All Rights Reserved. */ |
| 3 | /* Open Source Software - may be modified and shared by FRC teams. The code */ |
| 4 | /* must be accompanied by the FIRST BSD license file in the root directory of */ |
| 5 | /* the project. */ |
| 6 | /*----------------------------------------------------------------------------*/ |
| 7 | |
| 8 | #include "frc/ScopedTracer.h" |
| 9 | |
| 10 | #include <wpi/raw_ostream.h> |
| 11 | |
| 12 | using namespace frc; |
| 13 | |
| 14 | ScopedTracer::ScopedTracer(wpi::Twine name, wpi::raw_ostream& os) |
| 15 | : m_name(name.str()), m_os(os) { |
| 16 | m_tracer.ResetTimer(); |
| 17 | } |
| 18 | |
| 19 | ScopedTracer::~ScopedTracer() { |
| 20 | m_tracer.AddEpoch(m_name); |
| 21 | m_tracer.PrintEpochs(m_os); |
| 22 | } |