| // Copyright (c) 2014 The ANGLE Project Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| // WindowsTimer.cpp: Implementation of a high precision timer class on Windows |
| #include "windows/WindowsTimer.h" |
| WindowsTimer::WindowsTimer() : mRunning(false), mStartTime(0), mStopTime(0) |
| void WindowsTimer::start() |
| QueryPerformanceFrequency(&frequency); |
| mFrequency = frequency.QuadPart; |
| QueryPerformanceCounter(&curTime); |
| mStartTime = curTime.QuadPart; |
| void WindowsTimer::stop() |
| QueryPerformanceCounter(&curTime); |
| mStopTime = curTime.QuadPart; |
| double WindowsTimer::getElapsedTime() const |
| QueryPerformanceCounter(&curTime); |
| endTime = curTime.QuadPart; |
| return static_cast<double>(endTime - mStartTime) / mFrequency; |
| return new WindowsTimer(); |