Mantid
Loading...
Searching...
No Matches
CPUTimer.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 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#include "MantidKernel/DllConfig.h"
10#include "MantidKernel/Timer.h"
11#include <ctime>
12#include <iosfwd>
13#include <string>
14
15namespace Mantid {
16namespace Kernel {
17
24class MANTID_KERNEL_DLL CPUTimer {
25public:
26 CPUTimer();
27 float elapsedCPU(bool doReset = true);
28 float elapsedWallClock(bool doReset = true);
29 void reset();
30 float CPUfraction(bool doReset = true);
31 std::string str();
32
33private:
35 clock_t m_start;
36
39};
40
41MANTID_KERNEL_DLL std::ostream &operator<<(std::ostream &, CPUTimer &);
42
43} // namespace Kernel
44} // namespace Mantid
CPUTimer : Timer that uses the CPU time, rather than wall-clock time to measure execution time.
Definition: CPUTimer.h:24
Timer m_wallClockTime
The regular (wall-clock time).
Definition: CPUTimer.h:38
clock_t m_start
The starting time (implementation dependent format)
Definition: CPUTimer.h:35
A simple class that provides a wall-clock (not processor time) timer.
Definition: Timer.h:27
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.