Addresses for ptrFrameTimeStdDev and ptrFrameTimeStartStdDev from the first post are in the wrong order
sv-var.inc
PHP Code:
#include <sourcemod>
static Address ptrFrameTimeStdDev = Address_Null;
static Address ptrFrameTimeStartStdDev = Address_Null;
static Address ptrFrameComputationTime = Address_Null;
float GetFrameTimeStdDev()
{
if (ptrFrameTimeStdDev == Address_Null)
{
LoadSVVarGameConf();
}
return view_as<float>(LoadFromAddress(ptrFrameTimeStdDev, NumberType_Int32));
}
float GetFrameStartTimeStdDev()
{
if (ptrFrameTimeStartStdDev == Address_Null)
{
LoadSVVarGameConf();
}
return view_as<float>(LoadFromAddress(ptrFrameTimeStartStdDev, NumberType_Int32));
}
float GetFrameComputationTime()
{
if (ptrFrameComputationTime == Address_Null)
{
LoadSVVarGameConf();
}
return view_as<float>(LoadFromAddress(ptrFrameComputationTime, NumberType_Int32));
}
static void LoadSVVarGameConf()
{
Handle hConfig = LoadGameConfigFile("sv-var.games");
if (hConfig == null)
ThrowError("Failed to load sv-var.games");
ptrFrameTimeStdDev = GameConfGetAddress(hConfig, "host_frametime_stddeviation");
if (ptrFrameTimeStdDev == Address_Null)
ThrowError("Failed to look up host_frametime_stddeviation address");
ptrFrameTimeStartStdDev = GameConfGetAddress(hConfig, "host_framestarttime_stddeviation");
if (ptrFrameTimeStartStdDev == Address_Null)
ThrowError("Failed to look up host_framestarttime_stddeviation address");
ptrFrameComputationTime = GameConfGetAddress(hConfig, "host_frameendtime_computationduration");
if (ptrFrameComputationTime == Address_Null)
ThrowError("Failed to look up host_frameendtime_computationduration");
delete hConfig;
}
Code:
stats;show_sv_stats
CPU NetIn NetOut Uptime Maps FPS Players Svms +-ms ~tick
10.0 0.0 0.0 6 0 127.57 0 0.13 0.36 0.19
sv:0.13 +-0.36 ms var: 0.19 ms