Mantid
Loading...
Searching...
No Matches
AlgoTimeRegister.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
10#include <mutex>
11#include <thread>
12#include <vector>
13
14#include "MantidAPI/DllConfig.h"
15
16namespace Mantid {
17namespace Instrumentation {
18
23public:
25 struct Info {
26 std::string m_name;
27 std::thread::id m_threadId;
30
31 Info(const std::string &nm, const std::thread::id &id, const Kernel::time_point_ns &be,
32 const Kernel::time_point_ns &en)
33 : m_name(nm), m_threadId(id), m_begin(be), m_end(en) {}
34 };
35
36 class Dump {
39
40 const std::string m_name;
41
42 public:
43 Dump(AlgoTimeRegister &atr, const std::string &nm);
44 ~Dump();
45 };
46
47 void addTime(const std::string &name, const std::thread::id thread_id, const Kernel::time_point_ns &begin,
48 const Kernel::time_point_ns &end);
49 void addTime(const std::string &name, const Kernel::time_point_ns &begin, const Kernel::time_point_ns &end);
52
53private:
54 std::mutex m_mutex;
55 std::vector<Info> m_info;
57};
58
59} // namespace Instrumentation
60} // namespace Mantid
AlgoTimeRegister : simple class to dump information about executed algorithms.
static AlgoTimeRegister globalAlgoTimeRegister
void addTime(const std::string &name, const std::thread::id thread_id, const Kernel::time_point_ns &begin, const Kernel::time_point_ns &end)
std::chrono::time_point< std::chrono::high_resolution_clock > time_point_ns
Definition: Algorithm.h:45
Helper class which provides the Collimation Length for SANS instruments.
Info(const std::string &nm, const std::thread::id &id, const Kernel::time_point_ns &be, const Kernel::time_point_ns &en)