Kokkos Core Kernels Package
Version of the Day
Toggle main menu visibility
Loading...
Searching...
No Matches
core
src
Kokkos_Profiling_ScopedRegion.hpp
1
//@HEADER
2
// ************************************************************************
3
//
4
// Kokkos v. 4.0
5
// Copyright (2022) National Technology & Engineering
6
// Solutions of Sandia, LLC (NTESS).
7
//
8
// Under the terms of Contract DE-NA0003525 with NTESS,
9
// the U.S. Government retains certain rights in this software.
10
//
11
// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
12
// See https://kokkos.org/LICENSE for license information.
13
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
14
//
15
//@HEADER
16
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_PROFILING_SCOPEDREGION
22
#endif
23
24
#include <Kokkos_Macros.hpp>
25
#include <impl/Kokkos_Profiling.hpp>
26
27
#include <string>
28
29
namespace
Kokkos::Profiling {
30
31
class
[[nodiscard]] ScopedRegion {
32
public
:
33
ScopedRegion(ScopedRegion
const
&) =
delete
;
34
ScopedRegion &operator=(ScopedRegion
const
&) =
delete
;
35
36
#if defined(__has_cpp_attribute) && __has_cpp_attribute(nodiscard) >= 201907
37
[[nodiscard]]
38
#endif
39
explicit
ScopedRegion(std::string
const
&name) {
40
Kokkos::Profiling::pushRegion(name);
41
}
42
~ScopedRegion() { Kokkos::Profiling::popRegion(); }
43
};
44
45
}
// namespace Kokkos::Profiling
46
47
#ifdef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_CORE
48
#undef KOKKOS_IMPL_PUBLIC_INCLUDE
49
#undef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_PROFILING_SCOPEDREGION
50
#endif
51
#endif
Generated by
1.17.0