//1// Copyright 2019 The ANGLE Project Authors. All rights reserved.2// Use of this source code is governed by a BSD-style license that can be3// found in the LICENSE file.4//5// Timer.cpp: Implementation of a high precision timer class.6//78#include "util/Timer.h"910#include "common/system_utils.h"1112Timer::Timer() : mRunning(false), mStartTime(0), mStopTime(0) {}1314void Timer::start()15{16mStartTime = angle::GetCurrentTime();17mRunning = true;18}1920void Timer::stop()21{22mStopTime = angle::GetCurrentTime();23mRunning = false;24}2526double Timer::getElapsedTime() const27{28double endTime;29if (mRunning)30{31endTime = angle::GetCurrentTime();32}33else34{35endTime = mStopTime;36}3738return endTime - mStartTime;39}404142