Jump to content

How to monitor the FPS?


Loopan

Recommended Posts

image.png

For some reason I lost text.

I took Raspberry Pi4 and installed Grafana (frontend in screenshot) and Prometheus (metrics database).

On DCS host I installed the windows_exporter (collects metrics and sends exports it to prometheus) and lua script that collects FPS.

I did imlement LuaExportAfterNextFrame which calculates the FPS after at least 4 seconds.

I can send you the example but currently, since it is work in progress, it breaks SRS connection for some reason (possibly I overrode a function I do not need, or have a syntax error somewhere).

This way I have the means of recording and keeping the performance data for longer time, and if necessary compare the performance.


Edited by okopanja
Link to comment
Share on other sites

local start_time = nil
local fps_counter = 0
local file_path = "C:/Users/XXXXw/Saved Games/windows_exporter/textfile_inputs/dcs.prom"

function LuaExportStart()
	-- on startup open export file
	start_time = LoGetModelTime()
end

function LuaExportStop()
	-- on stop, close the export file
	export_file = io.open(file_path, "w")
	export_file:write("# HELP dcs_fps DCS frames per second\n")
	export_file:write("# TYPE dcs_fps gauge\n")
	export_file:write(string.format("dcs_fps %.2f\n", 0 ))
	export_file:close()
end

function LuaExportBeforeNextFrame()
-- Works just before every simulation frame.
end

function LuaExportAfterNextFrame()
-- Works just after every simulation frame.
	local end_time = LoGetModelTime()
	fps_counter = fps_counter + 1
	local interval = end_time - start_time
	if interval >= 4.0 then
		export_file = io.open(file_path, "w")
		export_file:write("# HELP dcs_fps DCS frames per second\n")
		export_file:write("# TYPE dcs_fps gauge\n")
		export_file:write(string.format("dcs_fps %.2f\n", fps_counter / interval ))
		export_file:close()
		start_time = end_time
		fps_counter = 0
	end
end

function LuaExportActivityNextEvent(t)
	return t
end

As seen it writes metric in the file, which is later read by windows_exporter, and exposed via HTTP interface toward prometheus.


Edited by okopanja
Link to comment
Share on other sites

On 1/21/2022 at 11:04 AM, Hiob said:

@maximov Is there a way (.lua) to modify the font size and colour of the RCtrl+Pause Stats? Thank you!

This used to work...

Larger FPS Indicator Mod.rar

  • Thanks 1

Win11 Pro 64-bit, Ryzen 5800X3D, Corsair H115i, Gigabyte X570S UD, EVGA 3080Ti XC3 Ultra 12GB, 64 GB DDR4 G.Skill 3600. Monitors: LG 27GL850-B27 2560x1440 + Samsung SyncMaster 2443 1920x1200, HOTAS: Warthog with Virpil WarBRD base, MFG Crosswind combat pedals, TrackIR4, Rift-S.

Personal Wish List: A6 Intruder, Vietnam theater, decent ATC module, better VR performance!

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...