timing.cpp 787 B

1234567891011121314151617181920212223242526272829
  1. //===-- timing.cpp ----------------------------------------------*- C++ -*-===//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. #include "timing.h"
  9. namespace scudo {
  10. Timer::~Timer() {
  11. if (Manager)
  12. Manager->report(*this);
  13. }
  14. ScopedTimer::ScopedTimer(TimingManager &Manager, const char *Name)
  15. : Timer(Manager.getOrCreateTimer(Name)) {
  16. start();
  17. }
  18. ScopedTimer::ScopedTimer(TimingManager &Manager, const Timer &Nest,
  19. const char *Name)
  20. : Timer(Manager.nest(Nest, Name)) {
  21. start();
  22. }
  23. } // namespace scudo