WASM DEBUG

The WASM Debug Window

The WASM Debug window is activated from the Debug menu and can be used get information about the different WASM modules that are currently loaded. When you first open the window you will need to select the module that should be displayed by choosing one from the Module drop-down list at the top of the window. Once one has been selected, the window will update to show additional information, as explained in the sections below.

 

 

Module Overview

The Module Overview section gives you information on the module currently selected:

The Module Section Of The WASM Debug MenuHere you can see the Status of the module, which will be listed with one of the following messages:

  • UNKNOWN: This should never appear and if it does then it means there is an unknown error with the module.
  • COMPILING: The WASM file is being converted to a DLL.
  • INITIALISING: The DLL has been created and it is being loaded.
  • READY: The WASM module is loaded and ready to be used.
  • FAILED: The compilation of the WASM to a DLL failed (you can look at the console to get more information).
  • DIRTY: The WASM module was ready but an error occured in the user's code (you can check the console to get more information). In this state, the WASM module won't be used.

 

After that you have the Is Encrypted status, which will be either true or false. If it's true, then there will be less information shown, as the encryption process makes certain things irrelevant. Below this - if the module isn't encrypted - you can see the Dll Path and then WASM Build Type and the DLL Build Type.

NOTE: If the DLL Build Type is set to Debug, it's because you have enabled WASM Debug Mode.

These should be the same and ideally be Release for a production package (mismatching build types will be flagged with an error message, as shown in the image below).

WASM Debug Mismatched Build Type Error

 

Next you have the LinearMemory Size, which is the memory used by this module (note that if this keeps growing it may indicate a memory leak), then finally we have the No Data Written At Address 0 message. When working with WASM, address 0 is a valid address so that mean a pointer value can be 0 and can be de-referenced without crashing (in contrast, if using C++ then de-referencing a nulltpr will cause a crash). So even if this is valid with WASM, it shouldn’t be made, and having some data at address 0 indicates an "error" in your code.NOTE: This is a WIP feature still.

 

 

Gauges

The gauge section focus on the different gauges linked to the selected module:

The Gauges Section Of The WASM Debug WindowHere you will first see listed the WASM Gauge Registered which is the number of gauges within the selected module. Next you'll get shown the Total Execution Time Per Update which is a constantly updating value showing the time (in microseconds) that the module requires to update.

 

The last part of this section is used for selecting a specific gauge from the WASM module to have more information displayed about it. The list of gauges shown here is built up from the panel.cfg file. For example, consider this image:

Here we're inspecting the "Demo" gauge, This was defined in the panel.cfg file like this:

htmlgauge00=WasmInstrument/WasmInstrument.html?wasm_module=SampleWasmModule.wasm&wasm_gauge=Demo, 0,0,1024,768

 

It is worth noting that some additional, custom parameters can be added to this definition. One of the things this permits you to do is have multiple gauges that use the same name, but have different parameter values. For example: 

htmlgauge00=WasmInstrument/WasmInstrument.html?wasm_module=SampleWasmModule.wasm&wasm_gauge=Demo, 0,0,1024,768
htmlgauge00=WasmInstrument/WasmInstrument.html?wasm_module=SampleWasmModule.wasm&wasm_gauge=Demo, 0,0,1024,768, Param1
htmlgauge01=WasmInstrument/WasmInstrument.html?wasm_module=SampleWasmModule.wasm&wasm_gauge=Demo, 0,0,1024,768, Param2

When the CFG file is set up like this the parameter values will be displayed after the name in the list.

 

 

Gauge Status

Once you've selected a gauge from the drop-down list, you will be presented with information on the status of the gauge:

The Status Of The Selected Gauge In The WASM Debug Window

The different status messages you can have are:

  • UNKNOWN: This should never appear and if it does then it means there is an unknown error with the gauge (and probably the module).
  • LOADING: The gauge is being loaded.
  • READY: The gauge is ready to be used.
  • FAILED: Something has happened that has caused the gauge to fail and not work.

 

Next you're shown the Liveview Name which is the name of the Coherent liveview, and you'll also be shown the Liveview Status which will be one of the following:

  • IDLE
  • LOADING
  • READY
  • OBSOLETE

 

Finally you have two boolean identifiers to tell you if it Has Gauge Callback or Has Mouse Callback.

 

 

Execution Times

This final section shows the computed the execution times for the selected gauge each time that gauge callback is called as an itemised list that breaks down the individual events that are called each frame:

The Execution Times For A WASM Gauge In The WASM Debug Window

Note that if this window is opened after a flight has started, then the execution times may read 0.0 or be inaccurate, since some of the times are only computed once when the gauge is initialised. Restarting the flight with this window open will show the correct values.