17#ifndef KOKKOSP_SCOPED_REGION_HPP
18#define KOKKOSP_SCOPED_REGION_HPP
19#ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
20#define KOKKOS_IMPL_PUBLIC_INCLUDE
21#define KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_PROFILING_SCOPEDREGION
24#include <Kokkos_Macros.hpp>
25#include <impl/Kokkos_Profiling.hpp>
29namespace Kokkos::Profiling {
31class [[nodiscard]] ScopedRegion {
33 ScopedRegion(ScopedRegion
const &) =
delete;
34 ScopedRegion &operator=(ScopedRegion
const &) =
delete;
36#if defined(__has_cpp_attribute) && __has_cpp_attribute(nodiscard) >= 201907
39 explicit ScopedRegion(std::string
const &name) {
40 Kokkos::Profiling::pushRegion(name);
42 ~ScopedRegion() { Kokkos::Profiling::popRegion(); }
47#ifdef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_PROFILING_SCOPEDREGION
48#undef KOKKOS_IMPL_PUBLIC_INCLUDE
49#undef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_PROFILING_SCOPEDREGION