Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
ITimerMng.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2026 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4// See the top-level COPYRIGHT file for details.
5// SPDX-License-Identifier: Apache-2.0
6//-----------------------------------------------------------------------------
7/*---------------------------------------------------------------------------*/
8/* ITimerMng.h (C) 2000-2025 */
9/* */
10/* Interface of a timer manager. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_CORE_ITIMERMNG_H
13#define ARCANE_CORE_ITIMERMNG_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
18
19/*---------------------------------------------------------------------------*/
20/*---------------------------------------------------------------------------*/
21
22namespace Arcane
23{
24
25/*---------------------------------------------------------------------------*/
26/*---------------------------------------------------------------------------*/
27
28/*!
29 * \brief Interface of a timer manager.
30 *
31 * This manager is used exclusively by the architecture's timers (Timer)
32 * and must not be used directly.
33 *
34 * A timer uses the beginTimer() method to indicate
35 * to this manager that it wishes to start a time measurement, and
36 * the endTimer() method to indicate that the measurement is finished and
37 * to obtain the time elapsed since the call to beginTimer(). It is also
38 * possible to obtain the elapsed time without stopping the timer by calling
39 * the getTime() function.
40 *
41 * Timers of the same type nest within each other and must respect
42 * the stack principle for calls to beginTimer() and endTimer(): the
43 * timer calling endTimer() must be the last one to have called beginTimer().
44 *
45 * The type of time used is determined by Timer::type(). It is either
46 * CPU time or real time.
47 *
48 */
50{
51 public:
52
53 /*!
54 * \brief Frees resources.
55 * \pre !hasTimer()
56 */
57 virtual ~ITimerMng() = default;
58
59 public:
60
61 /*!
62 * \brief Attaches the timer \a timer to this manager.
63 *
64 * \pre !\a timer
65 * \pre !hasTimer(\a timer)
66 * \post hasTimer(\a timer)
67 */
68 virtual void beginTimer(Timer* timer) = 0;
69
70 /*!
71 * \brief Releases the timer \a timer.
72 *
73 * \return the time elapsed since the call to beginTimer().
74 *
75 * \pre !\a timer
76 * \pre hasTimer(\a timer)
77 * \post !hasTimer(\a timer)
78 */
79 virtual Real endTimer(Timer* timer) = 0;
80
81 /*!
82 * \brief Time elapsed since the last call to beginTimer().
83 *
84 * \pre !\a timer
85 * \pre hasTimer(\a timer)
86 */
87 virtual Real getTime(Timer* timer) = 0;
88
89 /*!
90 * \brief Indicates if the timer \a timer is registered.
91 *
92 * \pre !\a timer
93 * \deprecated This function will eventually be removed. Do not use it.
94 */
95 ARCCORE_DEPRECATED_2019("Do not use this method")
96 virtual bool hasTimer(Timer* timer) = 0;
97};
98
99/*---------------------------------------------------------------------------*/
100/*---------------------------------------------------------------------------*/
101
102} // namespace Arcane
103
104/*---------------------------------------------------------------------------*/
105/*---------------------------------------------------------------------------*/
106
107#endif
Declarations of Arcane's general types.
Interface of a timer manager.
Definition ITimerMng.h:50
virtual Real endTimer(Timer *timer)=0
Releases the timer timer.
virtual bool hasTimer(Timer *timer)=0
Indicates if the timer timer is registered.
virtual void beginTimer(Timer *timer)=0
Attaches the timer timer to this manager.
virtual ~ITimerMng()=default
Frees resources.
virtual Real getTime(Timer *timer)=0
Time elapsed since the last call to beginTimer().
Management of a timer.
Definition Timer.h:63
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
double Real
Type representing a real number.