|
|
1.1 ! root 1: // ! 2: // nono ! 3: // Copyright (C) 2020 nono project ! 4: // Licensed under nono-license.txt ! 5: // ! 6: ! 7: #pragma once ! 8: ! 9: #include "header.h" ! 10: #include <list> ! 11: #include <chrono> ! 12: ! 13: using namespace std::chrono; ! 14: ! 15: // ! 16: // パフォーマンス測定。 ! 17: // 定期的に実行される区間の平均所要時間を測定する。 ! 18: // (今の所レンダラ用) ! 19: // ! 20: class PerfCounter ! 21: { ! 22: public: ! 23: // xxx は1回の結果を表示するのにかかるループ回数 ! 24: PerfCounter(int xxx); ! 25: ~PerfCounter() { } ! 26: ! 27: // 測定開始。 ! 28: void Start() { ! 29: start = system_clock::now(); ! 30: } ! 31: ! 32: // 測定終了 ! 33: void End() { ! 34: end = system_clock::now(); ! 35: PrintResult(); ! 36: } ! 37: ! 38: private: ! 39: // 結果の集計と表示 ! 40: void PrintResult(); ! 41: ! 42: system_clock::time_point start {}; ! 43: system_clock::time_point end {}; ! 44: ! 45: int xxx {}; // XXX 名前なんだろ ! 46: int total_elapsed {}; ! 47: int total_count {}; ! 48: std::list<int> fpsarray {}; ! 49: };
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.