add stopwatch
This commit is contained in:
21
BasaltPresenter/Presenter/stopwatch.hpp
Normal file
21
BasaltPresenter/Presenter/stopwatch.hpp
Normal file
@@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
#include <chrono>
|
||||
|
||||
namespace basalt::presenter::stopwatch {
|
||||
|
||||
/**
|
||||
* @brief 一个简单的FPS计算器,每隔指定次数统计一次FPS并输出
|
||||
*/
|
||||
class Stopwatch {
|
||||
public:
|
||||
Stopwatch(size_t interval);
|
||||
~Stopwatch();
|
||||
|
||||
void tick();
|
||||
|
||||
private:
|
||||
std::chrono::steady_clock::time_point start_point;
|
||||
size_t interval, counter;
|
||||
};
|
||||
|
||||
} // namespace basalt::presenter::stopwatch
|
||||
Reference in New Issue
Block a user