BELFEM 0.9.0
Berkeley Lab Finite Element Framework
Loading...
Searching...
No Matches
cl_Timer.hpp
Go to the documentation of this file.
1/*
2 * BELFEM -- The Berkeley Lab Finite Element Framework
3 * Copyright (c) 2026, The Regents of the University of California,
4 * through Lawrence Berkeley National Laboratory (subject to receipt of any required
5 * approvals from the U.S. Dept. of Energy). All rights reserved.
6 *
7 * Developers: Christian Messe, Gregory Giard
8 *
9 * See the top-level LICENSE file for the complete license and disclaimer.
10 */
11
12#ifndef BELFEM_CL_TIMER_HPP
13#define BELFEM_CL_TIMER_HPP
14
15#include <chrono>
16
17namespace belfem
18{
19//------------------------------------------------------------------------------
20
27 class Timer
28 {
29 std::chrono::time_point<std::chrono::high_resolution_clock> mStart;
30//------------------------------------------------------------------------------
31 public:
32//------------------------------------------------------------------------------
33
34 inline Timer() : mStart( std::chrono::high_resolution_clock::now() ) {}
35
36//------------------------------------------------------------------------------
37
38 ~Timer() = default;
39
40//------------------------------------------------------------------------------
41
42 inline uint64_t
44 {
45 return ( unsigned int )
46 ( std::chrono::duration_cast<std::chrono::milliseconds>
47 ( std::chrono::high_resolution_clock::now() - mStart ).count() );
48 }
49
50//------------------------------------------------------------------------------
51
52 inline uint64_t
54 {
55 unsigned int aTime = this->stop();
56 mStart = std::chrono::high_resolution_clock::now();
57 return aTime ;
58 }
59
60//------------------------------------------------------------------------------
61
62 inline void
64 {
65 mStart = std::chrono::high_resolution_clock::now();
66 }
67
68//------------------------------------------------------------------------------
69 };
70
71//------------------------------------------------------------------------------
72}
73#endif //BELFEM_CL_TIMER_HPP
~Timer()=default
uint64_t stop()
Definition cl_Timer.hpp:43
uint64_t next()
Definition cl_Timer.hpp:53
void reset()
Definition cl_Timer.hpp:63
Timer()
Definition cl_Timer.hpp:34
USER GUIDES:
Definition cl_Capacitor.cpp:16