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 getElapsedTime() to query that 17 // duration. If getElapsedTime() is called in between, it will report the elapsed time since 18 // start(). 19 void start(); 20 void stop(); 21 double getElapsedTime() const; 22 23 private: 24 bool mRunning; 25 double mStartTime; 26 double mStopTime; 27 }; 28 29 #endif // SAMPLE_UTIL_TIMER_H 30