2014-02-28 22:05:51 +04:00
|
|
|
//
|
|
|
|
// 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.
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef SAMPLE_UTIL_TIMER_H
|
|
|
|
#define SAMPLE_UTIL_TIMER_H
|
|
|
|
|
2018-12-29 18:29:33 +03:00
|
|
|
#include "util/util_export.h"
|
2016-08-13 03:40:14 +03:00
|
|
|
|
2018-12-29 18:29:33 +03:00
|
|
|
class ANGLE_UTIL_EXPORT Timer
|
2014-02-28 22:05:51 +04:00
|
|
|
{
|
|
|
|
public:
|
2015-04-06 19:02:37 +03:00
|
|
|
virtual ~Timer() {}
|
2018-10-22 18:53:51 +03:00
|
|
|
|
|
|
|
// Timer functionality: Use start() and stop() to record the duration and use getElapsedTime()
|
|
|
|
// to query that duration. If getElapsedTime() is called in between, it will report the elapsed
|
|
|
|
// time since start().
|
2018-12-29 18:29:33 +03:00
|
|
|
virtual void start() = 0;
|
|
|
|
virtual void stop() = 0;
|
2014-02-28 22:05:51 +04:00
|
|
|
virtual double getElapsedTime() const = 0;
|
2018-10-22 18:53:51 +03:00
|
|
|
|
|
|
|
// Timestamp functionality: Use getAbsoluteTime() to get an absolute time with an unknown
|
|
|
|
// origin. This time moves forward regardless of start()/stop().
|
|
|
|
virtual double getAbsoluteTime() = 0;
|
2014-02-28 22:05:51 +04:00
|
|
|
};
|
|
|
|
|
2018-12-29 18:29:33 +03:00
|
|
|
ANGLE_UTIL_EXPORT Timer *CreateTimer();
|
2014-08-05 19:39:15 +04:00
|
|
|
|
2018-12-29 18:29:33 +03:00
|
|
|
#endif // SAMPLE_UTIL_TIMER_H
|