Since CS:GO's release, multiple people have asked how to get the "SV" and "Var" netgraph values server-side. I don't know of anyone posting anything for this yet (and I did do a quick search), so I finally looked into it.
The attached include, with gamedata, exposes the three values used for this.
It contains three functions:
PHP Code:
float GetFrameTimeStdDev();
float GetFrameStartTimeStdDev();
float GetFrameComputationTime();
For example, to reproduce the netgraph display line, you can do:
PHP Code:
#include <sourcemod>
#include <sv-var>
public void OnPluginStart()
{
RegServerCmd("show_sv_stats", show_sv_stats);
}
public Action show_sv_stats(int argc)
{
PrintToServer("sv:%5.1f +-%4.1f ms var: %6.3f ms", GetFrameComputationTime()*1000.0,
GetFrameTimeStdDev() * 1000.0, GetFrameStartTimeStdDev() * 1000.0 );
return Plugin_Handled;
}
Here's some test output:
Code:
Server empty, hibernating
sv:123.0 +- 9.9 ms var: 10.091 ms
Server empty, awake
sv: 0.2 +- 0.5 ms var: 0.551 ms
Server with 12 bots
sv: 6.5 +- 3.1 ms var: 4.416 ms
I haven't tested the Linux gamedata, but it should work. Let me know otherwise.