Mantid
Loading...
Searching...
No Matches
Timer.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2007 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8
9//----------------------------------------------------------------------
10// Includes
11//----------------------------------------------------------------------
12#include "MantidKernel/DllConfig.h"
13#include <chrono>
14#include <iosfwd>
15#include <string>
16
17namespace Mantid {
18namespace Kernel {
19
20using time_point_ns = std::chrono::time_point<std::chrono::high_resolution_clock>;
21
27class MANTID_KERNEL_DLL Timer {
28public:
29 Timer();
30 virtual ~Timer() = default;
31
32 float elapsed(bool reset = true);
33 float elapsed_no_reset() const;
34 std::string str() const;
35 void reset();
36
37private:
39};
40
41MANTID_KERNEL_DLL std::ostream &operator<<(std::ostream &, const Timer &);
42
43} // namespace Kernel
44} // namespace Mantid
A simple class that provides a wall-clock (not processor time) timer.
Definition: Timer.h:27
virtual ~Timer()=default
time_point_ns m_start
The starting time.
Definition: Timer.h:38
std::chrono::time_point< std::chrono::high_resolution_clock > time_point_ns
Definition: Algorithm.h:45
MANTID_KERNEL_DLL std::ostream & operator<<(std::ostream &, CPUTimer &)
Convenience function to provide for easier debug printing.
Definition: CPUTimer.cpp:86
Helper class which provides the Collimation Length for SANS instruments.