Git Product home page Git Product logo

arma3basicscriptprofiler's Introduction

Basic SQF Profile

This is a really basic profiler intend to measure functions elapsed time.

Setup

Profiler needs to instrument methods, it's designed to instrument methods using PREP / PREPMAIN from CBA.

You need to add the following declaration in the file addons\main\script_macros.hpp.

For a CBA style mod (.sqf files in the addon directory) :

#ifdef PROFILER
    #define PREP_RET(fncName)         [QPATHTOF(DOUBLES(fnc,fncName).sqf),QFUNC(fncName),true,false] call bsp_fnc_compileFunction
    #define PREP_VOID(fncName)        [QPATHTOF(DOUBLES(fnc,fncName).sqf),QFUNC(fncName),false,false] call bsp_fnc_compileFunction
    #define PREP_RET_HF(fncName)      [QPATHTOF(DOUBLES(fnc,fncName).sqf),QFUNC(fncName),true,true] call bsp_fnc_compileFunction
    #define PREP_VOID_HF(fncName)     [QPATHTOF(DOUBLES(fnc,fncName).sqf),QFUNC(fncName),false,true] call bsp_fnc_compileFunction
    #define PREPMAIN_RET(fncName)     [QPATHTOF(DOUBLES(fnc,fncName).sqf),QFUNCMAIN(fncName),true,false] call bsp_fnc_compileFunction
    #define PREPMAIN_VOID(fncName)    [QPATHTOF(DOUBLES(fnc,fncName).sqf),QFUNCMAIN(fncName),false,false] call bsp_fnc_compileFunction
    #define PREPMAIN_RET_HF(fncName)  [QPATHTOF(DOUBLES(fnc,fncName).sqf),QFUNCMAIN(fncName),true,true] call bsp_fnc_compileFunction
    #define PREPMAIN_VOID_HF(fncName) [QPATHTOF(DOUBLES(fnc,fncName).sqf),QFUNCMAIN(fncName),false,true] call bsp_fnc_compileFunction
#else
    #define PREP_RET(fncName)         PREP(fncName)
    #define PREP_VOID(fncName)        PREP(fncName)
    #define PREP_RET_HF(fncName)      PREP(fncName)
    #define PREP_VOID_HF(fncName)     PREP(fncName)
    #define PREPMAIN_RET(fncName)     PREPMAIN(fncName)
    #define PREPMAIN_VOID(fncName)    PREPMAIN(fncName)
    #define PREPMAIN_RET_HF(fncName)  PREPMAIN(fncName)
    #define PREPMAIN_VOID_HF(fncName) PREPMAIN(fncName)
#endif

For an ACE style mod (.sqf files in the functions sub-directory) :

#ifdef PROFILER
    #define PREP_RET(fncName)         [QPATHTOF(functions\DOUBLES(fnc,fncName).sqf),QFUNC(fncName),true,false] call bsp_fnc_compileFunction
    #define PREP_VOID(fncName)        [QPATHTOF(functions\DOUBLES(fnc,fncName).sqf),QFUNC(fncName),false,false] call bsp_fnc_compileFunction
    #define PREP_RET_HF(fncName)      [QPATHTOF(functions\DOUBLES(fnc,fncName).sqf),QFUNC(fncName),true,true] call bsp_fnc_compileFunction
    #define PREP_VOID_HF(fncName)     [QPATHTOF(functions\DOUBLES(fnc,fncName).sqf),QFUNC(fncName),false,true] call bsp_fnc_compileFunction
    #define PREPMAIN_RET(fncName)     [QPATHTOF(functions\DOUBLES(fnc,fncName).sqf),QFUNCMAIN(fncName),true,false] call bsp_fnc_compileFunction
    #define PREPMAIN_VOID(fncName)    [QPATHTOF(functions\DOUBLES(fnc,fncName).sqf),QFUNCMAIN(fncName),false,false] call bsp_fnc_compileFunction
    #define PREPMAIN_RET_HF(fncName)  [QPATHTOF(functions\DOUBLES(fnc,fncName).sqf),QFUNCMAIN(fncName),true,true] call bsp_fnc_compileFunction
    #define PREPMAIN_VOID_HF(fncName) [QPATHTOF(functions\DOUBLES(fnc,fncName).sqf),QFUNCMAIN(fncName),false,true] call bsp_fnc_compileFunction
#else
    #define PREP_RET(fncName)         PREP(fncName)
    #define PREP_VOID(fncName)        PREP(fncName)
    #define PREP_RET_HF(fncName)      PREP(fncName)
    #define PREP_VOID_HF(fncName)     PREP(fncName)
    #define PREPMAIN_RET(fncName)     PREPMAIN(fncName)
    #define PREPMAIN_VOID(fncName)    PREPMAIN(fncName)
    #define PREPMAIN_RET_HF(fncName)  PREPMAIN(fncName)
    #define PREPMAIN_VOID_HF(fncName) PREPMAIN(fncName)
#endif

Then, in the addons\*\XEH_PREP.hpp files,

  • replace PREP by
    • PREP_RET if the function returns a value
    • PREP_VOID if the function returns nothing
    • PREP_RET_HF if the function returns a value and is Per Frame Handler
    • PREP_VOID_HF if the function returns nothing and is Per Frame Handler
  • replace PREPMAIN by
    • PREPMAIN_RET if the function returns a value
    • PREPMAIN_VOID if the function returns nothing
    • PREPMAIN_RET_HF if the function returns a value and is Per Frame Handler
    • PREPMAIN_VOID_HF if the function returns nothing and is Per Frame Handler

arma3basicscriptprofiler's People

Contributors

jetelain avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.