7 #include <system_error> 11 #include "../_cexports/c_utilities.h" 13 #include "../global.hpp" 17 #include "utilities.hpp" 18 #include "system_info.hpp" 26 inline HandleGuard<Utilities::StopWatch>::HandleGuard(
void * handle) noexcept
27 : HandleGuard<Utilities::StopWatch>(handle, [](
void* handle) { CVB_CALL_CAPI(TWDestroy(handle)); })
61 auto stopWatch = Internal::DoBoolCallObjectOut<StopWatch>([&](
void* & handle)
67 return CVB_CALL_CAPI(TWCreateEx(&handle));
70 return CVB_CALL_CAPI(TWCreate(&handle));
109 return handle_.Handle();
141 if(!CVB_CALL_CAPI(TWStartStopWatch(
Handle(), static_cast<short>(0))))
142 SystemInfo::ThrowLastError();
153 if(!CVB_CALL_CAPI(TWReadStopWatch(
Handle(), static_cast<short>(0), &value)))
154 SystemInfo::ThrowLastError();
173 : handle_(std::move(guard))
178 HandleGuard<StopWatch> handle_;
186 using Utilities::StopWatch;
void * Handle() const noexcept
Classic API stop watch handle.
Definition: stop_watch.hpp:107
static std::unique_ptr< StopWatch > Create(StopWatchMode mode=StopWatchMode::MultiCPU)
Create a StopWatch object.
Definition: stop_watch.hpp:59
StopWatchMode Mode() const noexcept
Mode for which the stop watch was created.
Definition: stop_watch.hpp:163
static std::unique_ptr< StopWatch > FromHandle(HandleGuard< StopWatch > &&guard, StopWatchMode mode)
Creates a stop watch from a classic API handle.
Definition: stop_watch.hpp:122
StopWatch(StopWatchMode mode=StopWatchMode::MultiCPU)
Create a StopWatch object.
Definition: stop_watch.hpp:85
Root namespace for the Image Manager interface.
Definition: version.hpp:11
std::chrono::milliseconds TimeSpan() const
Gets the time, that has elapsed since start (or since the construction of the object,...
Definition: stop_watch.hpp:150
void Start()
Start (or re-start) the stopwatch.
Definition: stop_watch.hpp:139
StopWatchMode
Mode at which the StopWatch should work.
Definition: utilities.hpp:30
Speed measurement object.
Definition: stop_watch.hpp:46