[] 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;
	};

	diag_log text format ["[MILSIM] (server) Average Server Execution: %1 times per frame", _counter / (diag_frameNo - _frameNo)];

	missionNamespace setVariable ["milsim_raw_cps", _counter / (diag_frameNo - _frameNo)];
	publicVariable "milsim_raw_cps";

	// 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
	};

	diag_log text format ["[MILSIM] (server) Average Server Execution: %1 times per frame", _counter / (diag_frameNo - _frameNo)];

	missionNamespace setVariable ["milsim_cps", _counter / (diag_frameNo - _frameNo)];
	publicVariable "milsim_cps";

	["milsim_serverEfficiency", [ [ ["float", "milsim_raw_cps", missionNamespace getVariable ["milsim_raw_cps", -1]], ["float", "milsim_cps", missionNamespace getVariable ["milsim_cps", -1]] ] ] ] call CBA_fnc_localEvent;
};

nil;