Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Main - Update ENABLE_PERFORMANCE_COUNTERS macro #10614

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

PabstMirror
Copy link
Contributor

When ENABLE_PERFORMANCE_COUNTERS defined the extra #function causes

error[SPE2]: unparseable syntax
   ┌─ addons/attach/functions/fnc_placeApprove.sqf:64:84
   │
64 │                 }, 0, [_startingPosShifted, _endPosShifted, CBA_missionTime]] call CBA_fnc_addPerFrameHandler;
   │                                                                                    ^ unparseable syntax

@PabstMirror PabstMirror added this to the Ongoing milestone Jan 2, 2025
@@ -43,7 +43,7 @@ PERFORMANCE COUNTERS SECTION
// To Use: [] call ace_common_fnc_dumpPerformanceCounters;

#ifdef ENABLE_PERFORMANCE_COUNTERS
#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 CBA_fnc_addPerFrameHandler { private _ret = [(_this select 0), (_this select 1), (_this select 2)] 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 }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this is faster, it's at least more readable:

Suggested change
#define CBA_fnc_addPerFrameHandler { private _ret = [(_this select 0), (_this select 1), (_this select 2)] 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 CBA_fnc_addPerFrameHandler { private _ret = (_this select [0, 2]) call CBA_fnc_addPerFrameHandler; if(isNil "ACE_PFH_COUNTER" ) then { ACE_PFH_COUNTER=[]; }; ACE_PFH_COUNTER pushBack [[_ret, __FILE__, __LINE__], (_this select [0, 2])]; _ret }

The changed parts don't need the parenthesis, though, but I'm sure they'll be wanted regardless.

And yes, I know this is a debugging code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants