1 // 2 // Copyright 2019 The ANGLE Project Authors. All rights reserved. 3 // Use of this source code is governed by a BSD-style license that can be 4 // found in the LICENSE file. 5 // 6 7 #ifndef SAMPLE_UTIL_TIMER_H 8 #define SAMPLE_UTIL_TIMER_H 9 10 class Timer final 11 { 12 public: 13 Timer(); ~Timer()14 ~Timer() {} 15 16 // Use start() and stop() to record the duration and use getElapsedWallClockTime() to query that 17 // duration. If getElapsedWallClockTime() is called in between, it will report the elapsed time 18 // since start(). 19 void start(); 20 void stop(); 21 double getElapsedWallClockTime() const; 22 double getElapsedCpuTime() const; 23 24 private: 25 bool mRunning; 26 double mStartTime; 27 double mStopTime; 28 double mStartCpuTime; 29 double mStopCpuTime; 30 }; 31 32 #endif // SAMPLE_UTIL_TIMER_H 33