kokkos-utils
0.0.1
Loading...
Searching...
No Matches
Timer.hpp
Go to the documentation of this file.
1
#ifndef KOKKOS_UTILS_TIMER_TIMER_HPP
2
#define KOKKOS_UTILS_TIMER_TIMER_HPP
3
4
#include "
kokkos-utils/timer/Duration.hpp
"
5
#include "
kokkos-utils/timer/Event.hpp
"
6
7
namespace
Kokkos::utils::timer
8
{
15
template
<Kokkos::utils::concepts::ExecutionSpace Exec>
16
class
Timer
17
{
18
public
:
19
using
event_t
=
Event<Exec>
;
20
21
public
:
23
void
reset
(
const
Exec& exec)
24
{
25
tick.record(exec);
26
started =
true
;
27
}
28
30
void
stop
(
const
Exec& exec)
31
{
32
tock.record(exec);
33
stopped =
true
;
34
}
35
37
bool
is_valid
()
const
{
return
started && stopped; }
38
45
template
<
typename
Duration = milliseconds>
46
Duration
duration
() {
return
tick.template
duration<Duration>
(tock); }
47
48
private
:
49
event_t
tick {}, tock {};
50
bool
started =
false
, stopped =
false
;
51
};
52
53
}
// namespace Kokkos::utils::timer
54
55
#endif
// KOKKOS_UTILS_TIMER_TIMER_HPP
Duration.hpp
Event.hpp
Kokkos::utils::timer::Timer
Measure elapsed time between events.
Definition
Timer.hpp:17
Kokkos::utils::timer::Timer::stop
void stop(const Exec &exec)
Stop the timer.
Definition
Timer.hpp:30
Kokkos::utils::timer::Timer::reset
void reset(const Exec &exec)
Reset the timer.
Definition
Timer.hpp:23
Kokkos::utils::timer::Timer::event_t
Event< Exec > event_t
Definition
Timer.hpp:19
Kokkos::utils::timer::Timer::is_valid
bool is_valid() const
Returns true if reset and stop have been called.
Definition
Timer.hpp:37
Kokkos::utils::timer::Timer::duration
Duration duration()
Definition
Timer.hpp:46
Kokkos::utils::timer
Definition
Duration.hpp:7
Kokkos::utils::timer::Event
Event.
Definition
Event.hpp:29
include
kokkos-utils
timer
Timer.hpp
Generated on Thu Apr 17 2025 12:50:27 for kokkos-utils by
1.13.2