Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

FramePacer class

オープン
#12 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
15/100
issue の種類
機能追加
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
cpp

調査の方向性

実装ファイル、テスト、エントリーポイントのいずれも指定されていません。まず engine のプロセスおよびタイミングのコードを特定し、その後、目標が frame pacing、checkpoint の統計情報、またはシステムレベルの原因の診断のいずれであるかを明確にしてから、完了の定義を決めてください。

索引モデルが issue の本文から書いたものです。

説明

Can use in any process, not just the core engine processes.

class FramePacer {
vector<string> checkpoint_names;
vector<CheckpointStats> checkpoint_stats;
Stat<float> metric_too_expensive_to_retrieve_every_checkpoint?;//maybe temperatures?

//Any of these function calls might sleep or busy wait if you're ahead of schedule if the frame pacing control is enabled
void StartFrame(float wait_multiplier, float target_frame_time);//doesn't have to be a frame, just the largest unit of work

void EndFrame(float wait_multiplier);

void StartCheckpoint(int id, float wait_multiplier);
void EndCheckpoint(int id, float wait_multiplier);
//wait_multiplier multiplies the amount of time to wait to maintain frame pacing, 0 of course means never wait. A value greater than 1.0 would rarely be useful unless you know that a certain frame is going to be too fast for some reason? If you know the frame is going to be too fast before you take input then wouldn't you just do a sleep for a set amount of time outside of this function?
//Or maybe I just need a Split function that works like live split and automatically keeps track of what checkpoint you're on? Or maybe keep the explicit StartFrame and EndFrame but inside of that just use a split function?

//Maybe I should provide a sleep function in this class so it can intelligently track it and determine if it should busy wait or sleep?
void Sleep(float ms);
};

template<class T>//or maybe just always float?
class Stat {
T avg;
T lowest;
T highest;
T one_percent_low;
T one_percent_high;
};

class CheckpointStats {
Stat<float> time_ms;
Stat<int> cache_misses;
Stat<int> cache_hits;
Stat<float> cache_hit_rate;
Stat<int> instructions_executed;
Stat<int> cycles_executed;
Stat<int> branches;
Stat<float> gpu_load;
//Temperatures? Clock speeds? Some stats might be too expensive to retrieve every checkpoint?
};

Could I try to determine the cause of a hiccup? If it was GPU time, or which thread didn't get enough CPU time, if there were more cache misses than the average frame, maybe CPU clock speed changed, maybe something else on the system was using the CPU

Maybe with BTS I could count how many instructions were executed to see if a frame executed more instructions than average, or if more jumps were executed than average? It sounds like enabling it slows things down a lot though. https://stackoverflow.com/a/4531402

The FramePacer class could also determine how long certain checkpoints took to run for the frame. It might also be able to track all those other metrics per checkpoint. Imagine it telling you which part of the frame caused the extra cache misses that caused the stutter.

Maybe target_frame_time should be a member instead of function argument? Checkpoints could return how ahead/behind schedule they are/were? But if it sleeps when ahead, how will the program adapt to being ahead of schedule?

主要言語
C++
スター
0
フォーク
0
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Die4Ever/AsyncGameEngine のほかの issue

Die4Ever/AsyncGameEngine の issue をすべて見る

似ている issue

C++ の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。