From c774db944064edcb24adbca19c3826e629c8f5b2 Mon Sep 17 00:00:00 2001 From: commy2 Date: Wed, 24 Aug 2016 09:34:23 +0200 Subject: [PATCH] delete obsolete 'FUNC(perf_loop)' --- addons/diagnostic/CfgEventHandlers.hpp | 6 - addons/diagnostic/XEH_preInit.sqf | 2 - addons/diagnostic/XEH_preStart.sqf | 3 - addons/diagnostic/fnc_perf_loop.sqf | 161 ------------------------- 4 files changed, 172 deletions(-) delete mode 100644 addons/diagnostic/XEH_preStart.sqf delete mode 100644 addons/diagnostic/fnc_perf_loop.sqf diff --git a/addons/diagnostic/CfgEventHandlers.hpp b/addons/diagnostic/CfgEventHandlers.hpp index 63b96e1ed..ea49e36f3 100644 --- a/addons/diagnostic/CfgEventHandlers.hpp +++ b/addons/diagnostic/CfgEventHandlers.hpp @@ -1,10 +1,4 @@ -class Extended_PreStart_EventHandlers { - class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_preStart)); - }; -}; - class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); diff --git a/addons/diagnostic/XEH_preInit.sqf b/addons/diagnostic/XEH_preInit.sqf index 2b2e99f0f..f55bee403 100644 --- a/addons/diagnostic/XEH_preInit.sqf +++ b/addons/diagnostic/XEH_preInit.sqf @@ -5,5 +5,3 @@ LOG(MSG_INIT); [QUOTE(GVAR(debug)), { _this call (uiNamespace getVariable "CBA_fnc_debug") }] call (uiNamespace getVariable "CBA_fnc_addEventHandler"); - -PREP(perf_loop); diff --git a/addons/diagnostic/XEH_preStart.sqf b/addons/diagnostic/XEH_preStart.sqf deleted file mode 100644 index eb6d8c1b0..000000000 --- a/addons/diagnostic/XEH_preStart.sqf +++ /dev/null @@ -1,3 +0,0 @@ -#include "script_component.hpp" - -PREP(perf_loop); diff --git a/addons/diagnostic/fnc_perf_loop.sqf b/addons/diagnostic/fnc_perf_loop.sqf deleted file mode 100644 index 95bd67619..000000000 --- a/addons/diagnostic/fnc_perf_loop.sqf +++ /dev/null @@ -1,161 +0,0 @@ -/* - Script performance measurements, by Sickboy. Originally by Rommel -*/ -// #define DEBUG_MODE_FULL -#include "script_component.hpp" -#define DELAY 1 -#define DIFF 1.1 -#define HIGH_DIFF 2 -#define INTERVAL 10 -#define LAG_INTERVAL 2 // INTERVAL -#define DEFAULT_VALUES diag_tickTime, time, diag_fps, diag_fpsMin - -/* - // For usage outside CBA - #define QUOTE(A) #A - #define GVAR(A) my_##A -*/ - -// temp -//GVAR(lag) = true; - -private ["_entry", "_create", "_dump", "_f"]; - -if (isNil QGVAR(running)) then { GVAR(running) = false }; -if (GVAR(running)) exitWith {}; // Already running -GVAR(running) = true; - -FUNC(lag) = { - //_unit = if (isNull player) then { allUnits select 0 } else { player }; - for "_i" from 0 to 100 do { - { _unit = _x; call compile format["nearestObjects [call compile ""_unit"", [""All""], 5000]"] } forEach allUnits; - }; -}; - -FUNC(lag3) = { - // Piece of ace_sys_maptools that caused lags for sys_missileguidance - DOUBLES(ADDON,compassRuler) = ""; - DOUBLES(ADDON,compassRose) = ""; - while { true } do { - if("ace_sys_maptools_tools_tools_tools" in ["A", "B", "C"]) then { - } else { - _actionId = -1; - deleteMarkerLocal QUOTE(DOUBLES(ADDON,compassRuler)); - deleteMarkerLocal QUOTE(DOUBLES(ADDON,compassRose)); - GVAR(MouseDown) = false; - GVAR(DragOK) = false; - GVAR(OffDrag) = false; - GVAR(LastDragPosition) = []; - GVAR(RulerStartPos) = []; - GVAR(MouseShift) = false; - GVAR(LastDragAzimuth) = -1000; - GVAR(MapLineSegmentStart) = [0, 0, 0]; - GVAR(MapLineColor) = 0; - GVAR(MapPreviousDir) = 0; - GVAR(RulerKeyDown) = -1000; - }; - }; - -}; - -FUNC(lag2) = { - { deleteVehicle _x } forEach _objects; // _x setDamage 1 - _objects = []; - for "_i" from 0 to 100 do { - _logic = "LOGIC" createVehicleLocal [0, 0, 0]; - _objects pushBack _logic; - }; -}; - - -GVAR(logs) = []; GVAR(ar) = []; -if (isNil QGVAR(log)) then { GVAR(log) = true }; -if (isNil QGVAR(lag)) then { GVAR(lag) = false }; -if (isNil QGVAR(interactive)) then { GVAR(interactive) = true }; - -_dump = { - //diag_log format ["%1 %2 %3 %4 %5",count allunits,time,diag_ticktime,diag_fpsmin,diag_fps]; -}; - -_create = { - private "_pid"; - _pid = SLX_XEH_STR spawn _dump; - waituntil {scriptDone _pid}; -}; - -waitUntil {SLX_XEH_MACHINE select 5}; // waitUntil player ready etc -TRACE_1("Started",GVAR(running)); - -if (time == 0) then { sleep 0.001 }; // Sleep until after the briefing - -// Induce lag by executing commands -if (GVAR(lag)) then { - SLX_XEH_STR spawn { - // By HojO - for "_i" from 0 to 100 do { - _null = SLX_XEH_STR spawn { while{true} do {_LagMyGame = sin(cos(tan(sin(cos(tan(sin(cos(tan(0.12345678)))))))));} }; - }; - /* - private ["_nextTime", "_objects", "_logic"]; - _nextTime = time + LAG_INTERVAL; - _objects = []; - while {GVAR(lag)} do { - waitUntil {time > _nextTime}; - TRACE_1("Lag Started",""); - // SLX_XEH_STR spawn FUNC(lag3); - call FUNC(lag); - _nextTime = time + LAG_INTERVAL; - TRACE_1("Lag Ended",""); - }; - */ - }; -}; - -// Output logged information and add warnings when appropriate -SLX_XEH_STR spawn { - private ["_nextTime", "_limit", "_high", "_a", "_b", "_deltaTick", "_deltaTime", "_log", "_do", "_ar"]; - _nextTime = time + INTERVAL; - _limit = DELAY * DIFF; - _high = DELAY * HIGH_DIFF; - while {GVAR(log)} do { - waitUntil {time > _nextTime}; - _ar = GVAR(ar); GVAR(ar) = []; - _log = ["Current", DEFAULT_VALUES]; - GVAR(logs) pushBack _log; - { - // TODO: Also compare the delta between the previous few entries? - _a = _x select 0; _b = _x select 1; - _deltaTick = (_b select 0) - (_a select 0); - _deltaTime = (_b select 1) - (_a select 1); - _log = ["Delta", _a, _b, _deltaTick, _deltaTime]; - _do = false; - if (_deltaTime > _limit) then { _do = true; if (_deltaTime > _high) then { _log pushBack "WARNING: Large deltaTime"; _log pushBack _deltaTime } }; - if (_deltaTick > _limit) then { _do = true; if (_deltaTick > _high) then { _log pushBack "WARNING: Large deltaTick"; _log pushBack _deltaTick } }; - if (_do) then { GVAR(logs) pushBack _log }; - } forEach _ar; - if (GVAR(interactive)) then { - // Output at each iteration - { diag_log _x } forEach GVAR(logs); - GVAR(logs) = []; - }; - _nextTime = time + INTERVAL; - }; - if !(GVAR(interactive)) then { - // Output at exit - { diag_log _x } forEach GVAR(log); - }; - GVAR(log) = []; -}; - -// Sleep for DELAY seconds, then execute a simple command, and log the delta between the logged times and ticktimes -while {GVAR(log)} do { - _entry = [[DEFAULT_VALUES]]; - sleep DELAY; - [] call _create; - _entry pushBack [DEFAULT_VALUES]; - GVAR(ar) pushBack _entry; -}; - -GVAR(ar) = []; -GVAR(running) = false; -TRACE_1("Exit",GVAR(running));