File:  [Isaki's NoNo m68k/m88k emulator] / nono / lib / perfcounter.h
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Wed Apr 29 17:04:40 2026 UTC (2 months, 3 weeks ago) by root
Branches: MAIN, Isaki
CVS tags: v014, v013, v012, v011, v010, v009, v008, v007, v006, HEAD
nono 0.1.2

//
// nono
// Copyright (C) 2020 nono project
// Licensed under nono-license.txt
//

#pragma once

#include "header.h"
#include <list>
#include <chrono>

using namespace std::chrono;

//
// パフォーマンス測定。
// 定期的に実行される区間の平均所要時間を測定する。
// (今の所レンダラ用)
//
class PerfCounter
{
 public:
	// xxx は1回の結果を表示するのにかかるループ回数
	PerfCounter(int xxx);
	~PerfCounter() { }

	// 測定開始。
	void Start() {
		start = system_clock::now();
	}

	// 測定終了
	void End() {
		end = system_clock::now();
		PrintResult();
	}

 private:
	// 結果の集計と表示
	void PrintResult();

	system_clock::time_point start {};
	system_clock::time_point end {};

	int xxx {};		// XXX 名前なんだろ
	int total_elapsed {};
	int total_count {};
	std::list<int> fpsarray {};
};

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.