big refactor, WIP!

This commit is contained in:
2024-02-06 01:52:25 -08:00
parent f588ffa4a0
commit 0a64d9e170
74 changed files with 1024 additions and 701 deletions

View File

@@ -0,0 +1,40 @@
#include "..\script_component.hpp"
[] spawn {
// warning: while loop without suspension executes multiple times per frame
private _counter = 0;
private _endTime = diag_tickTime + 5;
private _frameNo = diag_frameNo;
while { diag_tickTime < _endTime } do
{
_counter = _counter + 1;
};
// in an empty mission, the _counter may go well over 2000 times per frame!
[
LEVEL_INFO,
QUOTE(COMPONENT),
format ["Average Execution: %1 times per frame", _counter / (diag_frameNo - _frameNo)],
[["playerRawCPS", _counter / (diag_frameNo - _frameNo)]]
] call EFUNC(common,log);
player setVariable [QGVAR(player_raw_cps), _counter / (diag_frameNo - _frameNo), true];
// with suspension
private _counter = 0;
private _endTime = diag_tickTime + 5;
private _frameNo = diag_frameNo;
while { diag_tickTime < _endTime } do
{
_counter = _counter + 1;
uiSleep 0.001; // waits at least 1 frame
};
// _counter says one per frame, as expected
[
LEVEL_INFO,
QUOTE(COMPONENT),
format ["Average Execution: %1 times per frame", _counter / (diag_frameNo - _frameNo)],
[["playerCPS", _counter / (diag_frameNo - _frameNo)]]
] call EFUNC(common,log);
player setVariable [QGVAR(player_cps), _counter / (diag_frameNo - _frameNo), true];
};
nil;