17 #ifndef KOKKOS_TIMER_HPP
18 #define KOKKOS_TIMER_HPP
19 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
20 #define KOKKOS_IMPL_PUBLIC_INCLUDE
21 #define KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_TIMER
24 #include <Kokkos_Macros.hpp>
27 #if defined(KOKKOS_COMPILER_GNU) && (KOKKOS_COMPILER_GNU == 1030) && \
28 defined(KOKKOS_COMPILER_NVCC)
38 #if defined(KOKKOS_COMPILER_GNU) && (KOKKOS_COMPILER_GNU == 1030) && \
39 defined(KOKKOS_COMPILER_NVCC)
45 inline void reset() { gettimeofday(&m_old,
nullptr); }
47 inline ~Timer() =
default;
49 inline Timer() { reset(); }
51 Timer(
const Timer&) =
delete;
52 Timer& operator=(
const Timer&) =
delete;
54 inline double seconds()
const {
57 gettimeofday(&m_new,
nullptr);
59 return ((
double)(m_new.tv_sec - m_old.tv_sec)) +
60 ((double)(m_new.tv_usec - m_old.tv_usec) * 1.0e-6);
66 std::chrono::high_resolution_clock::time_point m_old;
69 inline void reset() { m_old = std::chrono::high_resolution_clock::now(); }
71 inline ~Timer() =
default;
73 inline Timer() { reset(); }
76 Timer& operator=(
const Timer&);
78 inline double seconds()
const {
79 std::chrono::high_resolution_clock::time_point m_new =
80 std::chrono::high_resolution_clock::now();
81 return std::chrono::duration_cast<std::chrono::duration<double> >(m_new -
90 #ifdef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_TIMER
91 #undef KOKKOS_IMPL_PUBLIC_INCLUDE
92 #undef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_TIMER