kokkos-utils 0.0.1
 
Loading...
Searching...
No Matches
EventInProfileSectionRegexMatcher.hpp
Go to the documentation of this file.
1#ifndef KOKKOS_UTILS_CALLBACKS_EVENTINPROFILESECTIONREGEXMATCHER_HPP
2#define KOKKOS_UTILS_CALLBACKS_EVENTINPROFILESECTIONREGEXMATCHER_HPP
3
4#include <regex>
5
6#include "Kokkos_NumericTraits.hpp"
7
9
11{
12
19{
20 static constexpr uint32_t invalid_section_id = Kokkos::Experimental::finite_max_v<uint32_t>;
21
23 {
24 if (std::regex_search(event.name, this->regex))
25 {
26 if (section_id != invalid_section_id) Kokkos::abort("EventInProfileSectionRegexMatcher cannot match a create event twice.");
27 section_id = event.section_id;
28 }
29 return false;
30 }
31
33 {
34 if (event.section_id == section_id) recording = true;
35 return false;
36 }
37
39 {
40 if (event.section_id == section_id) recording = false;
41 return false;
42 }
43
44 template <Event EventType>
45 bool operator()(const EventType& /* event */) const {
46 return recording;
47 }
48
49 std::regex regex;
51 bool recording = false;
52};
53
54} // namespace Kokkos::utils::callbacks
55
56#endif // KOKKOS_UTILS_CALLBACKS_EVENTINPROFILESECTIONREGEXMATCHER_HPP
Create-profile-section event associated with Kokkos::Tools::Experimental::EventSet::create_profile_se...
Definition Events.hpp:112
Matcher to select events that occur within a profile section.
Start-profile-section event associated with Kokkos::Tools::Experimental::EventSet::start_profile_sect...
Definition Events.hpp:119
Stop-profile-section event associated with Kokkos::Tools::Experimental::EventSet::stop_profile_sectio...
Definition Events.hpp:125