NWNX:EE  8193.36.12
Profiler

Readme

Acquires shared hooks to expose various useful metrics.

Environment Variables

Variable Name Type Default Value
NWNX_PROFILER_ENABLE_OVERHEAD_COMPENSATION bool true
NWNX_PROFILER_OVERHEAD_COMPENSATION_FORCE int64_t none
NWNX_PROFILER_OVERHEAD_COMPENSATION_RUNS size_t 500
NWNX_PROFILER_OVERHEAD_COMPENSATION_RECALIBRATE bool false
NWNX_PROFILER_OVERHEAD_COMPENSATION_RECALIBRATION_PERIOD uint32_t 1000
NWNX_PROFILER_ENABLE_AI_MASTER_UPDATES bool true
NWNX_PROFILER_AI_MASTER_UPDATES_OVERKILL bool false
NWNX_PROFILER_ENABLE_MAIN_LOOP bool true
NWNX_PROFILER_ENABLE_NET_LAYER bool true
NWNX_PROFILER_ENABLE_NET_MESSAGES bool true
NWNX_PROFILER_ENABLE_OBJECT_AI_UPDATES bool false
NWNX_PROFILER_ENABLE_OBJECT_EVENT_HANDLERS bool false
NWNX_PROFILER_ENABLE_PATHING bool true
NWNX_PROFILER_ENABLE_SCRIPTS bool true
NWNX_PROFILER_SCRIPTS_AREA_TIMINGS bool true
NWNX_PROFILER_SCRIPTS_TYPE_TIMINGS bool true
NWNX_PROFILER_ENABLE_TICKRATE bool true

Files

file  nwnx_profiler.nss
 

Functions

void NWNX_Profiler_PushPerfScope (string name, string tag0_tag="", string tag0_value="")
 Push a timing metric scope - note that every push must be matched by a corresponding pop. More...
 
void NWNX_Profiler_PopPerfScope ()
 Pops a timing metric. More...
 

Function Documentation

◆ NWNX_Profiler_PushPerfScope()

void NWNX_Profiler_PushPerfScope ( string  name,
string  tag0_tag = "",
string  tag0_value = "" 
)

Push a timing metric scope - note that every push must be matched by a corresponding pop.

A timing metric contains the following information.

{
metricName: [name], // Mandatory, from user code
metricFields: { time, nanoseconds }, // Automatically captured by the push/pop pair
metricTags: { [tag0_tag], [tag0_value] } // Optional, from user code, can be used to
filter metrics based on some category or,
constant e.g. objectType or area
}

If you don't understand how this works and you wish to use it, you should research the Metrics system (see Metrics.hpp) as well as googling about how InfluxDB stores metrics.

Note
It's possible to have more than one tag pair per metric, It is just limited to one arbitrarily here. You can edit the prototype to include more and the C++ code will cope with it correctly.
Parameters
nameThe name to use for your metric.
tag0_tagAn optional tag to filter your metrics.
tag0_valueThe tag's value for which to filter.

Definition at line 40 of file nwnx_profiler.nss.

◆ NWNX_Profiler_PopPerfScope()

void NWNX_Profiler_PopPerfScope ( )

Pops a timing metric.

Remarks
A metric must already be pushed.

Definition at line 55 of file nwnx_profiler.nss.