Viskores  1.0
Timer.h
Go to the documentation of this file.
1 //============================================================================
2 // The contents of this file are covered by the Viskores license. See
3 // LICENSE.txt for details.
4 //
5 // By contributing to this file, all contributors agree to the Developer
6 // Certificate of Origin Version 1.1 (DCO 1.1) as stated in DCO.txt.
7 //============================================================================
8 
9 //============================================================================
10 // Copyright (c) Kitware, Inc.
11 // All rights reserved.
12 // See LICENSE.txt for details.
13 //
14 // This software is distributed WITHOUT ANY WARRANTY; without even
15 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
16 // PURPOSE. See the above copyright notice for more information.
17 //============================================================================
18 #ifndef viskores_cont_Timer_h
19 #define viskores_cont_Timer_h
20 
22 
24 
25 #include <memory>
26 
27 namespace viskores
28 {
29 namespace cont
30 {
31 namespace detail
32 {
33 struct EnabledDeviceTimerImpls;
34 }
35 
51 class VISKORES_CONT_EXPORT Timer
52 {
53 public:
55  Timer();
56 
58 
60 
65  VISKORES_CONT void Reset();
66 
69 
73  VISKORES_CONT void Start();
74 
79  VISKORES_CONT void Stop();
80 
84  VISKORES_CONT bool Started() const;
85 
90  VISKORES_CONT bool Stopped() const;
91 
93  VISKORES_CONT bool Ready() const;
94 
103  viskores::Float64 GetElapsedTime() const;
104 
109  VISKORES_CONT viskores::cont::DeviceAdapterId GetDevice() const { return this->Device; }
110 
119  VISKORES_CONT void Synchronize() const;
120 
121 private:
123  VISKORES_CONT Timer(const Timer&) = delete;
124  VISKORES_CONT void operator=(const Timer&) = delete;
125 
127  std::unique_ptr<detail::EnabledDeviceTimerImpls> Internal;
128 };
129 }
130 } // namespace viskores::cont
131 
132 #endif //viskores_cont_Timer_h
viskores::cont::Timer
A class that can be used to time operations in Viskores that might be occuring in parallel.
Definition: Timer.h:51
DeviceAdapterTag.h
viskores::cont::Timer::Internal
std::unique_ptr< detail::EnabledDeviceTimerImpls > Internal
Definition: Timer.h:127
VISKORES_CONT
#define VISKORES_CONT
Definition: ExportMacros.h:65
viskores
Groups connected points that have the same field value.
Definition: Atomic.h:27
viskores::cont::Timer::GetDevice
viskores::cont::DeviceAdapterId GetDevice() const
Returns the id of the device adapter for which this timer is synchronized.
Definition: Timer.h:109
viskores::cont::DeviceAdapterId
An object used to specify a device.
Definition: DeviceAdapterTag.h:66
viskores::cont::Timer::Device
viskores::cont::DeviceAdapterId Device
Definition: Timer.h:126
viskores::Float64
double Float64
Base type to use for 64-bit floating-point numbers.
Definition: Types.h:169
viskores_cont_export.h