mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Added: ACE Event stack debugging output, use DEBUG_EVENTS in main\script_debug
Added: PFH Perfcounter tracking+output, use ENABLE_PERFORMANCE_COUNTERS in main\script_debug and then call ace_common_fnc_dumpPerformanceCounters
This commit is contained in:
parent
ba00a31523
commit
d81d1b3176
@ -7,7 +7,6 @@ private ["_eventType", "_event", "_eventName", "_eventArgs", "_eventNames", "_ev
|
|||||||
_eventType = _this select 0;
|
_eventType = _this select 0;
|
||||||
_event = _this select 1;
|
_event = _this select 1;
|
||||||
|
|
||||||
|
|
||||||
if(_eventType == "ACEg") then {
|
if(_eventType == "ACEg") then {
|
||||||
_eventName = _event select 0;
|
_eventName = _event select 0;
|
||||||
_eventArgs = _event select 1;
|
_eventArgs = _event select 1;
|
||||||
@ -16,9 +15,18 @@ if(_eventType == "ACEg") then {
|
|||||||
_eventIndex = _eventNames find _eventName;
|
_eventIndex = _eventNames find _eventName;
|
||||||
if(_eventIndex != -1) then {
|
if(_eventIndex != -1) then {
|
||||||
_events = (GVAR(events) select 1) select _eventIndex;
|
_events = (GVAR(events) select 1) select _eventIndex;
|
||||||
|
|
||||||
|
#ifdef DEBUG_EVENTS
|
||||||
|
diag_log text format[ARR_2("* Net Event %1",_eventName)];
|
||||||
|
diag_log text format[ARR_2(" args=%1",_eventArgs)];
|
||||||
|
#endif
|
||||||
|
|
||||||
{
|
{
|
||||||
if(!isNil "_x") then {
|
if(!isNil "_x") then {
|
||||||
_eventArgs call CALLSTACK_NAMED(_x, format[ARR_3("Net Event %1 ID: %2",_eventName,_forEachIndex)]);
|
_eventArgs call CALLSTACK_NAMED(_x, format[ARR_3("Net Event %1 ID: %2",_eventName,_forEachIndex)]);
|
||||||
|
#ifdef DEBUG_EVENTS_CALLSTACK
|
||||||
|
diag_log text format[ARR_2(" ID: %1",_forEachIndex)];
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
} forEach _events;
|
} forEach _events;
|
||||||
};
|
};
|
||||||
|
@ -2,16 +2,16 @@
|
|||||||
#define DEBUG_MODE_FULL
|
#define DEBUG_MODE_FULL
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
/*
|
|
||||||
diag_log text format["REGISTERED ACE PFH HANDLERS"];
|
diag_log text format["REGISTERED ACE PFH HANDLERS"];
|
||||||
diag_log text format["-------------------------------------------"];
|
diag_log text format["-------------------------------------------"];
|
||||||
if(!isNil "ACE_PFH") then {
|
if(!isNil "ACE_PFH_COUNTER") then {
|
||||||
{
|
{
|
||||||
private["_pfh"];
|
private["_pfh"];
|
||||||
_pfh = _x select 0;
|
_pfh = _x select 0;
|
||||||
diag_log text format["Registered PFH: id=%1, %1:%2", (_pfh select 0), (_pfh select 1), (_pfh select 2) ];
|
diag_log text format["Registered PFH: id=%1, %1:%2", (_pfh select 0), (_pfh select 1), (_pfh select 2) ];
|
||||||
} forEach ACE_PFH;
|
} forEach ACE_PFH_COUNTER;
|
||||||
};*/
|
};
|
||||||
|
|
||||||
diag_log text format["ACE COUNTER RESULTS"];
|
diag_log text format["ACE COUNTER RESULTS"];
|
||||||
diag_log text format["-------------------------------------------"];
|
diag_log text format["-------------------------------------------"];
|
||||||
|
@ -19,9 +19,17 @@ _eventNames = GVAR(events) select 0;
|
|||||||
_eventIndex = _eventNames find _eventName;
|
_eventIndex = _eventNames find _eventName;
|
||||||
if(_eventIndex != -1) then {
|
if(_eventIndex != -1) then {
|
||||||
_events = (GVAR(events) select 1) select _eventIndex;
|
_events = (GVAR(events) select 1) select _eventIndex;
|
||||||
|
#ifdef DEBUG_EVENTS
|
||||||
|
diag_log text format[ARR_2("* Local Event: %1",_eventName)];
|
||||||
|
diag_log text format[ARR_2(" args=%1",_eventArgs)];
|
||||||
|
#endif
|
||||||
|
|
||||||
{
|
{
|
||||||
if(!isNil "_x") then {
|
if(!isNil "_x") then {
|
||||||
_eventArgs call CALLSTACK_NAMED(_x, format[ARR_3("Local Event %1 ID: %2",_eventName,_forEachIndex)]);
|
_eventArgs call CALLSTACK_NAMED(_x, format[ARR_3("Local Event %1 ID: %2",_eventName,_forEachIndex)]);
|
||||||
|
#ifdef DEBUG_EVENTS_CALLSTACK
|
||||||
|
diag_log text format[ARR_2(" ID: %1",_forEachIndex)];
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
} forEach _events;
|
} forEach _events;
|
||||||
};
|
};
|
@ -16,6 +16,10 @@ private ["_eventName", "_eventArgs"];
|
|||||||
_eventName = _this select 0;
|
_eventName = _this select 0;
|
||||||
_eventArgs = _this select 1;
|
_eventArgs = _this select 1;
|
||||||
|
|
||||||
|
#ifdef DEBUG_EVENTS
|
||||||
|
diag_log text format[ARR_2("* Server Event: %1",_eventName)];
|
||||||
|
diag_log text format[ARR_2(" args=%1",_eventArgs)];
|
||||||
|
#endif
|
||||||
|
|
||||||
ACEg = [_eventName, _eventArgs];
|
ACEg = [_eventName, _eventArgs];
|
||||||
if(!isServer) then {
|
if(!isServer) then {
|
||||||
|
@ -21,6 +21,11 @@ _eventName = _this select 0;
|
|||||||
_eventTargets = _this select 1;
|
_eventTargets = _this select 1;
|
||||||
_eventArgs = _this select 2;
|
_eventArgs = _this select 2;
|
||||||
|
|
||||||
|
#ifdef DEBUG_EVENTS
|
||||||
|
diag_log text format[ARR_3("* Target Event: %1 - %2",_eventName,_eventTargets)];
|
||||||
|
diag_log text format[ARR_2(" args=%1",_eventArgs)];
|
||||||
|
#endif
|
||||||
|
|
||||||
ACEc = [_eventName, _eventTargets, _eventArgs];
|
ACEc = [_eventName, _eventTargets, _eventArgs];
|
||||||
if(!isServer) then {
|
if(!isServer) then {
|
||||||
publicVariableServer "ACEc";
|
publicVariableServer "ACEc";
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
STACK TRACING
|
STACK TRACING
|
||||||
**/
|
**/
|
||||||
//#define ENABLE_CALLSTACK
|
//#define ENABLE_CALLSTACK
|
||||||
|
//#define ENABLE_PERFORMANCE_COUNTERS
|
||||||
|
//#define DEBUG_EVENTS
|
||||||
|
|
||||||
#ifdef ENABLE_CALLSTACK
|
#ifdef ENABLE_CALLSTACK
|
||||||
|
|
||||||
@ -29,7 +31,7 @@ PERFORMANCE COUNTERS SECTION
|
|||||||
//#define ENABLE_PERFORMANCE_COUNTERS
|
//#define ENABLE_PERFORMANCE_COUNTERS
|
||||||
|
|
||||||
#ifdef ENABLE_PERFORMANCE_COUNTERS
|
#ifdef ENABLE_PERFORMANCE_COUNTERS
|
||||||
#define ADDPFH(function, timing, args) call { _ret = [function, timing, args, #function] call EFUNC(sys_sync,perFrame_add); if(isNil "ACE_PFH" ) then { ACE_PFH=[]; }; ACE_PFH pushBack [[_ret, __FILE__, __LINE__], [function, timing, args]]; _ret }
|
#define CBA_fnc_addPerFrameHandler { _ret = [(_this select 0), (_this select 1), (_this select 2), #function] call CBA_fnc_addPerFrameHandler; if(isNil "ACE_PFH_COUNTER" ) then { ACE_PFH_COUNTER=[]; }; ACE_PFH_COUNTER pushBack [[_ret, __FILE__, __LINE__], [(_this select 0), (_this select 1), (_this select 2)]]; _ret }
|
||||||
|
|
||||||
#define CREATE_COUNTER(x) if(isNil "ACE_COUNTERS" ) then { ACE_COUNTERS=[]; }; GVAR(DOUBLES(x,counter))=[]; GVAR(DOUBLES(x,counter)) set[0, QUOTE(GVAR(DOUBLES(x,counter)))]; GVAR(DOUBLES(x,counter)) set[1, diag_tickTime]; ACE_COUNTERS pushBack GVAR(DOUBLES(x,counter));
|
#define CREATE_COUNTER(x) if(isNil "ACE_COUNTERS" ) then { ACE_COUNTERS=[]; }; GVAR(DOUBLES(x,counter))=[]; GVAR(DOUBLES(x,counter)) set[0, QUOTE(GVAR(DOUBLES(x,counter)))]; GVAR(DOUBLES(x,counter)) set[1, diag_tickTime]; ACE_COUNTERS pushBack GVAR(DOUBLES(x,counter));
|
||||||
#define BEGIN_COUNTER(x) if(isNil QUOTE(GVAR(DOUBLES(x,counter)))) then { CREATE_COUNTER(x) }; GVAR(DOUBLES(x,counter)) set[2, diag_tickTime];
|
#define BEGIN_COUNTER(x) if(isNil QUOTE(GVAR(DOUBLES(x,counter)))) then { CREATE_COUNTER(x) }; GVAR(DOUBLES(x,counter)) set[2, diag_tickTime];
|
||||||
@ -37,8 +39,6 @@ PERFORMANCE COUNTERS SECTION
|
|||||||
|
|
||||||
#define DUMP_COUNTERS ([__FILE__, __LINE__] call ACE_DUMPCOUNTERS_FNC)
|
#define DUMP_COUNTERS ([__FILE__, __LINE__] call ACE_DUMPCOUNTERS_FNC)
|
||||||
#else
|
#else
|
||||||
#define ADDPFH(function, timing, args) [function, timing, args, #function] call EFUNC(sys_sync,perFrame_add)
|
|
||||||
|
|
||||||
#define CREATE_COUNTER(x) /* disabled */
|
#define CREATE_COUNTER(x) /* disabled */
|
||||||
#define BEGIN_COUNTER(x) /* disabled */
|
#define BEGIN_COUNTER(x) /* disabled */
|
||||||
#define END_COUNTER(x) /* disabled */
|
#define END_COUNTER(x) /* disabled */
|
||||||
|
Loading…
Reference in New Issue
Block a user