17#ifndef KOKKOSP_PROFILE_SECTION_HPP
18#define KOKKOSP_PROFILE_SECTION_HPP
19#ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
20#define KOKKOS_IMPL_PUBLIC_INCLUDE
21#define KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_PROFILING_PROFILESECTION
24#include <Kokkos_Macros.hpp>
25#include <impl/Kokkos_Profiling.hpp>
29namespace Kokkos::Profiling {
31class [[nodiscard]] ProfilingSection {
35 ProfilingSection(ProfilingSection
const&) =
delete;
36 ProfilingSection& operator=(ProfilingSection
const&) =
delete;
38#if defined(__has_cpp_attribute) && __has_cpp_attribute(nodiscard) >= 201907
41 explicit ProfilingSection(
const std::string& sectionName) {
42 Kokkos::Profiling::createProfileSection(sectionName, §ionID);
45 void start() { Kokkos::Profiling::startSection(sectionID); }
47 void stop() { Kokkos::Profiling::stopSection(sectionID); }
49 ~ProfilingSection() { Kokkos::Profiling::destroyProfileSection(sectionID); }
54#ifdef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_PROFILING_PROFILESECTION
55#undef KOKKOS_IMPL_PUBLIC_INCLUDE
56#undef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_PROFILING_PROFILESECTION