Actium Posted December 19, 2024 Posted December 19, 2024 (edited) TL;DR: FPSmon.lua sends warnings messages to global chat if the server simulation frame rate or peak frame time falls below or exceeds configurable thresholds to help identify situations where low server performance may cause excessive lag. The simulation frame rate of the DCS server may deteriorate rapidly when the server is overloaded. Particularly missions with many actively engaged units exchanging shots may cause extreme frame times (far) in excess of 1 second. Low server simulation frame rates will limit the update rate of units other than the own on every client. While DCS clients extrapolate server frames for smooth movement of other units, extrapolation has its limits. When the DCS extrapolator is pushed beyond its limits, units move smoothly (on a continuously differentiable line), then jump suddenly, only to move smoothly again afterwards. Reasons include network issues (high ping or packet loss) or excessive server simulation frame times. Whereas ping is shown in the player list, DCS includes no metric or mechanism to warn about server performance issues (low frame rate or high frame times). The WebGUI does not issue direct warnings either. However, it does serve as a canary by updating/responding sluggishly if the server is extremely overloaded. This script periodically checks the average server simulation frame rate and peak frame time within a configurable interval (defaults to 30 seconds). If the frame rate falls below or the frame time exceeds their respective, configurable threshold, a warning message including both values is sent to global chat and also logged to the default DCS log file (Logs/dcs.log). The chat messages are also visible in the WebGUI. The following example screenshot illustrates chat output of three frame time outliers despite good average frame rate. The final warning message indicates a low average frame rate and therefore an overloaded server. Optionally, every periodic measurement can be logged by setting fpsmon_verbose = true in autoexec.cfg (see below). When enabled, this results in the following dcs.log content (when disabled, no INFO messages will be logged): 2024-12-19 16:10:46.310 INFO FPSmon.lua (Main): avg_fps=111.10 peak_frame_time=0.013 2024-12-19 16:11:16.315 INFO FPSmon.lua (Main): avg_fps=111.08 peak_frame_time=0.011 2024-12-19 16:11:46.316 INFO FPSmon.lua (Main): avg_fps=111.09 peak_frame_time=0.014 2024-12-19 16:12:16.325 INFO FPSmon.lua (Main): avg_fps=111.10 peak_frame_time=0.010 2024-12-19 16:12:46.329 INFO FPSmon.lua (Main): avg_fps=111.09 peak_frame_time=0.010 2024-12-19 16:13:16.332 INFO FPSmon.lua (Main): avg_fps=110.82 peak_frame_time=0.077 2024-12-19 16:13:46.337 WARNING FPSmon.lua (Main): avg_fps=108.35 peak_frame_time=0.756 2024-12-19 16:14:16.341 WARNING FPSmon.lua (Main): avg_fps=103.02 peak_frame_time=0.757 2024-12-19 16:14:46.348 INFO FPSmon.lua (Main): avg_fps=111.07 peak_frame_time=0.013 2024-12-19 16:15:16.352 INFO FPSmon.lua (Main): avg_fps=111.12 peak_frame_time=0.010 The intention behind this script is to help both mission development and deployment. During development, mission designers and server administrators can identify performance bottlenecks early on. If frame times grow too high, the mission should be simplified or the server hardware upgraded. In deployment, the script transparently informs and warns players of server performance issues, to faciliate pinpointing the cause of laggy units. Install by downloading FPSmon.lua into the DCS Scripts/Hooks folder, e.g.: %USERPROFILE%\Saved Games\DCS.dcs_serverrelease\Scripts\Hooks Optionally, the script can be configured via your autoexec.cfg. Without configuration, the script will use default values. If desired, add the following to %USERPROFILE%\Saved Games\DCS.*\Config\autoexec.cfg and modify the values to suit your needs: -- configure Scripts/Hooks/FPSmon.lua: -- interval of FPS log and chat messages (seconds), use zero (0) to disable (number) fpsmon_interval = 30 -- always log frame rate and peak frame time at every interval even if tresholds are not exceeded (boolean: true|false) fpsmon_verbose = false -- FPS (Hz) and frame time (seconds) thresholds to send warning messages to global chat (number: >0) fpsmon_warn_fps = 5 fpsmon_warn_time = 0.5 Edited February 28 by Actium
Actium Posted February 28 Author Posted February 28 Recently stumbled over the DCS.getConfigValue() function while digging inside DCS' Lua guts. The undocumented function will read values from the "config" Lua environment/state (net.dostring("config", ...)), e.g., values set in autoexec.cfg. As this enables much simpler configuration than setting environment variables, I've modified FPSmon.lua to use it. Thus, the optional configuration is now handled via autoexec.cfg. Updated the first post accordingly. Also removed the attachement and linked to the script on my Github account, to facilitate minor updates.
Recommended Posts