Raised This Month: $12 Target: $400
 3% 

[CS:GO] Getting "SV" and "Var" values


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
psychonic

BAFFLED
Join Date: May 2008
Old 02-28-2017 , 15:33   [CS:GO] Getting "SV" and "Var" values
Reply With Quote #1

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.0GetFrameStartTimeStdDev() * 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.
Attached Files
File Type: inc sv-var.inc (1.5 KB, 573 views)
File Type: txt sv-var.games.txt (1.0 KB, 633 views)

Last edited by psychonic; 03-01-2017 at 06:50.
psychonic is offline
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 18:02.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode