123456789101112131415161718192021222324252627282930313233343536 |
- //
- // 资源加载类
- //
- #ifndef RUPerfTimer_h
- #define RUPerfTimer_h
- #include "cocos2d.h"
- #include "RUDefine.h"
- NS_RU_BEGIN
- #define gPerfTimer(key) redutils::PerfTimer::instance(key)
- class PerfTimer : public Ref {
- public:
- static PerfTimer* instance(std::string key4Loader);
- void start();
- void stop();
- void clear();
- void dump(int indent = 0);
- private:
- PerfTimer() = default;
- ~PerfTimer() = default;
-
- private:
- static std::unordered_map<std::string, PerfTimer*> _gPerfTimers;
- std::string _perfTimerName; //仅起log输出用
- std::chrono::steady_clock::time_point _startTime;
- std::chrono::steady_clock::time_point _endTime;
- std::chrono::steady_clock::duration _duration = std::chrono::steady_clock::duration::zero();
- };
- NS_RU_END
- #endif /* RUPerfTimer_h */
|