mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
Simplify collecting time into debug counters
This commit is contained in:
1 parent
74b750e30d
commit
024cb73716
2 files changed
+19
-14
No files matched your search
@@ -45,3 +45,19 @@ private:
|
||||
int64_t nsecs_;
|
||||
#endif
|
||||
};
|
||||
|
||||
class TimeCollector {
|
||||
public:
|
||||
TimeCollector(double *target, bool enable) : target_(enable ? target : nullptr) {
|
||||
if (enable)
|
||||
startTime_ = time_now_d();
|
||||
}
|
||||
~TimeCollector() {
|
||||
if (target_) {
|
||||
*target_ += time_now_d() - startTime_;
|
||||
}
|
||||
}
|
||||
private:
|
||||
double startTime_;
|
||||
double *target_;
|
||||
};
|
||||
Reference in new issue
Block a user