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

Server FPS


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Nikkii
Member
Join Date: Feb 2012
Old 04-05-2013 , 01:10   Server FPS
Reply With Quote #1

I've been wondering if there's a way to get the server FPS from inside a plugin that's more direct than this post, since I'd have to parse the entire string when I only want the FPS value (GetServerNetStats already exists for the network information), and possibly CPU too (This is easily done through another language and linux's /proc though, so it's not a big deal)

Edit: This is for TF2.
__________________
Owner of ProbablyAServer, a server without game changing mods and donation benefits

RCON Helper | [TF2] LogUpload | CCC Donator Tags | PHP Steam API Wrapper

Last edited by Nikkii; 04-07-2013 at 04:32.
Nikkii is offline
GoD-Tony
Veteran Member
Join Date: Jul 2005
Old 04-06-2013 , 08:23   Re: Server FPS
Reply With Quote #2

You can give this a try. Untested on Linux though (the offset might be 35).
Attached Files
File Type: zip serverfps.zip (1.4 KB, 264 views)
__________________

Last edited by GoD-Tony; 04-06-2013 at 11:56.
GoD-Tony is offline
berni
SourceMod Plugin Approver
Join Date: May 2007
Location: Austria
Old 04-06-2013 , 10:09   Re: Server FPS
Reply With Quote #3

If I remember right, you can also simply use GetTickInterval to calculate it.
__________________
Why reinvent the wheel ? Download smlib with over 350 useful functions.

When people ask me "Plz" just because it's shorter than "Please" I feel perfectly justified to answer "No" because it's shorter than "Yes"
powered by Core i7 3770k | 32GB DDR3 1886Mhz | 2x Vertex4 SSD Raid0
berni is offline
zeroibis
Veteran Member
Join Date: Jun 2007
Old 04-06-2013 , 15:15   Re: Server FPS
Reply With Quote #4

Yea you should likely just look at your current tick as fps should be basically the same as it is now capped to tick rate last time I checked.
__________________
zeroibis is offline
GoD-Tony
Veteran Member
Join Date: Jul 2005
Old 04-06-2013 , 15:52   Re: Server FPS
Reply With Quote #5

Personally I'd prefer the real value over something estimated based on tickrate. The current framerate should give a better idea of how the server is performing at any given time. While the above example requires gamedata, it's unlikely to break because it uses the engine's public interface.

The CPU usage value however is only accurate if the process is assigned to a single core (at least on Windows).
__________________
GoD-Tony is offline
Nikkii
Member
Join Date: Feb 2012
Old 04-07-2013 , 04:29   Re: Server FPS
Reply With Quote #6

Quote:
Originally Posted by GoD-Tony View Post
You can give this a try. Untested on Linux though (the offset might be 35).
It's not able to find the engine tool it seems, this is on Linux of course. I also forgot to mention this is Team Fortress 2, not CS:S or any other game, though it should be pretty close.

PHP Code:
L 04/07/2013 04:27:03: [SMPlugin encountered error 25Call was aborted
L 04
/07/2013 04:27:03: [SMNative "SetFailState" reportedpEngineTool (VENGINETOOL003) == Address_Null
L 04
/07/2013 04:27:03: [SMDisplaying call stack trace for plugin "stats.smx":
L 04/07/2013 04:27:03: [SM]   [0]  Line 75, /tf2/match/orangebox/tf/addons/sourcemod/scripting/include/serverfps.inc::GetEngineTool()
L 04/07/2013 04:27:03: [SM]   [1]  Line 26, /tf2/match/orangebox/tf/addons/sourcemod/scripting/include/serverfps.inc::GetServerFPS()
L 04/07/2013 04:27:03: [SM]   [2]  Line 20stats.sp::OnPluginStart() 
Quote:
Originally Posted by zeroibis View Post
Yea you should likely just look at your current tick as fps should be basically the same as it is now capped to tick rate last time I checked.
It won't always be that, It SHOULD be at 66, however multiple factors could make it drop (Plugins performing expensive operations in OnGameFrame, the server not having enough CPU power, etc), and I want to make an easier way to parse the FPS so I can finish a 'tf2 top' type system which I can monitor all of my servers with, as currently I'm calling 'stats' via rcon and using regex on it in PHP, which isn't the best way to do it for sure.
__________________
Owner of ProbablyAServer, a server without game changing mods and donation benefits

RCON Helper | [TF2] LogUpload | CCC Donator Tags | PHP Steam API Wrapper

Last edited by Nikkii; 04-07-2013 at 04:32.
Nikkii is offline
GoD-Tony
Veteran Member
Join Date: Jul 2005
Old 04-07-2013 , 06:10   Re: Server FPS
Reply With Quote #7

Quote:
Originally Posted by Nikkii View Post
It's not able to find the engine tool it seems, this is on Linux of course. I also forgot to mention this is Team Fortress 2, not CS:S or any other game, though it should be pretty close.
Odd, apparently that interface doesn't exist on the Linux bin. I've attached an alternative method.
Attached Files
File Type: zip serverfps.zip (1.2 KB, 190 views)
__________________
GoD-Tony is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 04-07-2013 , 06:28   Re: Server FPS
Reply With Quote #8

Considering how simple parsing the string is, it seems much saner to just use ServerCommandEx to execute "stats" and then a trivial regex to extract the FPS.
__________________
asherkin is offline
GoD-Tony
Veteran Member
Join Date: Jul 2005
Old 04-07-2013 , 06:38   Re: Server FPS
Reply With Quote #9

Quote:
Originally Posted by asherkin View Post
Considering how simple parsing the string is, it seems much saner to just use ServerCommandEx to execute "stats" and then a trivial regex to extract the FPS.
This is true depending on how often you'd like to poll the stats. A while ago I had a plugin that grabbed these values once per second to determine dips in performance, and the console spam + string parsing didn't sit well with me.
__________________
GoD-Tony is offline
Nikkii
Member
Join Date: Feb 2012
Old 04-07-2013 , 11:28   Re: Server FPS
Reply With Quote #10

Quote:
Originally Posted by GoD-Tony View Post
This is true depending on how often you'd like to poll the stats. A while ago I had a plugin that grabbed these values once per second to determine dips in performance, and the console spam + string parsing didn't sit well with me.
Exactly why I'm looking for an alternate method I already have a working version of what I want, but having 'stats' polled once every 5 seconds is VERY spammy. I'll try it out later, just about to get some sleep.

Anyway, the second version works, thanks
__________________
Owner of ProbablyAServer, a server without game changing mods and donation benefits

RCON Helper | [TF2] LogUpload | CCC Donator Tags | PHP Steam API Wrapper

Last edited by Nikkii; 04-09-2013 at 09:19.
Nikkii is offline
Reply



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 11:30.


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