kokkos-utils
0.0.5
Toggle main menu visibility
Loading...
Searching...
No Matches
SequenceOfRegionTimerListener.hpp
Go to the documentation of this file.
1
#ifndef KOKKOS_UTILS_CALLBACKS_SEQUENCEOFREGIONTIMERLISTENER_HPP
2
#define KOKKOS_UTILS_CALLBACKS_SEQUENCEOFREGIONTIMERLISTENER_HPP
3
4
#include "
kokkos-utils/callbacks/RegionTimerListener.hpp
"
5
6
namespace
Kokkos::utils::callbacks
7
{
17
template
<Matcher MatcherType>
18
struct
SequenceOfRegionTimerListener
19
{
20
public
:
21
using
region_timer_t
=
RegionTimerListener<MatcherType>
;
22
using
matcher_t
=
typename
region_timer_t::matcher_t
;
23
using
timer_t
=
typename
region_timer_t::timer_t
;
24
25
template
<
typename
... Ms>
26
explicit
SequenceOfRegionTimerListener
(Ms&&... matchers_)
27
:
matchers
{std::forward<Ms>(matchers_)...},
28
timers
(
matchers
.size())
29
{}
30
31
void
reset
() {
current
= 0; }
32
34
bool
all_matched
()
const
{
35
return
current
==
timers
.size();
36
}
37
39
void
operator()
(
const
PushRegionEvent
& event)
40
{
41
if
(
all_matched
())
return
;
42
43
const
auto
matched =
matchers
.at(
current
).operator()(event);
44
45
if
(matched)
46
timers
.at(
current
).start();
47
}
48
50
void
operator()
(
const
PopRegionEvent
& event)
51
{
52
if
(
all_matched
())
return
;
53
54
const
auto
matched =
matchers
.at(
current
).operator()(event);
55
56
if
(matched)
57
{
58
timers
.at(
current
).stop();
59
++
current
;
60
}
61
}
62
63
public
:
64
std::vector<matcher_t>
matchers
;
65
std::vector<timer_t>
timers
;
66
67
private
:
68
size_t
current
= 0;
69
};
70
71
}
// namespace Kokkos::utils::callbacks
72
73
#endif
// KOKKOS_UTILS_CALLBACKS_SEQUENCEOFREGIONTIMERLISTENER_HPP
RegionTimerListener.hpp
Kokkos::utils::callbacks
Definition
BeginEndTimerListener.hpp:12
Kokkos::utils::callbacks::PopRegionEvent
Pop-region event associated with Kokkos::Tools::Experimental::EventSet::pop_region.
Definition
Events.hpp:192
Kokkos::utils::callbacks::PushRegionEvent
Push-region event associated with Kokkos::Tools::Experimental::EventSet::push_region.
Definition
Events.hpp:184
Kokkos::utils::callbacks::RegionTimerListener
Timer listener for a profiling region that matches MatcherType.
Definition
RegionTimerListener.hpp:26
Kokkos::utils::callbacks::RegionTimerListener::timer_t
TimerType timer_t
Definition
RegionTimerListener.hpp:29
Kokkos::utils::callbacks::RegionTimerListener::matcher_t
EventTypeMatcher< region_matcher_t, PushRegionEvent, PopRegionEvent > matcher_t
Definition
RegionTimerListener.hpp:28
Kokkos::utils::callbacks::SequenceOfRegionTimerListener::matchers
std::vector< matcher_t > matchers
Definition
SequenceOfRegionTimerListener.hpp:64
Kokkos::utils::callbacks::SequenceOfRegionTimerListener::SequenceOfRegionTimerListener
SequenceOfRegionTimerListener(Ms &&... matchers_)
Definition
SequenceOfRegionTimerListener.hpp:26
Kokkos::utils::callbacks::SequenceOfRegionTimerListener::timers
std::vector< timer_t > timers
Definition
SequenceOfRegionTimerListener.hpp:65
Kokkos::utils::callbacks::SequenceOfRegionTimerListener::region_timer_t
RegionTimerListener< MatcherType > region_timer_t
Definition
SequenceOfRegionTimerListener.hpp:21
Kokkos::utils::callbacks::SequenceOfRegionTimerListener::matcher_t
typename region_timer_t::matcher_t matcher_t
Definition
SequenceOfRegionTimerListener.hpp:22
Kokkos::utils::callbacks::SequenceOfRegionTimerListener::reset
void reset()
Definition
SequenceOfRegionTimerListener.hpp:31
Kokkos::utils::callbacks::SequenceOfRegionTimerListener::current
size_t current
Definition
SequenceOfRegionTimerListener.hpp:68
Kokkos::utils::callbacks::SequenceOfRegionTimerListener::operator()
void operator()(const PushRegionEvent &event)
Deal with a Kokkos::utils::callbacks::PushRegionEvent event. Only the current timer is auditioned.
Definition
SequenceOfRegionTimerListener.hpp:39
Kokkos::utils::callbacks::SequenceOfRegionTimerListener::all_matched
bool all_matched() const
Returns true if all regions were correctly matched and timed.
Definition
SequenceOfRegionTimerListener.hpp:34
Kokkos::utils::callbacks::SequenceOfRegionTimerListener::timer_t
typename region_timer_t::timer_t timer_t
Definition
SequenceOfRegionTimerListener.hpp:23
Kokkos::utils::callbacks::SequenceOfRegionTimerListener::operator()
void operator()(const PopRegionEvent &event)
Deal with a Kokkos::utils::callbacks::PopRegionEvent event. If the current timer matches,...
Definition
SequenceOfRegionTimerListener.hpp:50
include
kokkos-utils
callbacks
SequenceOfRegionTimerListener.hpp
Generated on
for kokkos-utils by
1.18.0