Raised This Month: $ Target: $400
 0% 

checking latency between server frames


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Voi
Veteran Member
Join Date: Sep 2006
Location: Gdansk, Poland
Old 10-21-2010 , 12:18   checking latency between server frames
Reply With Quote #1

I want to check the latency in miliseconds between each server frame. After i issue the "check_fps" command i want it to save each value from server_frame(), and when I issue the command again I want it to save all the values in a file, one value at a line.

PHP Code:
#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Server fps latency checker"
#define VERSION "0"
#define AUTHOR "twoj_stary"

new on_off
new Float:lastframetime

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_srvcmd("check_fps""switch_check")
}

server_frame()
{
    if(
on_off)
    {
    
// (halflife_time() - lastframetime)*1000.0  save the value
    
lastframetime == halflife_time()
    }
}

switch_check()
{
    if(!
on_off)
    {
        
server_print("starting to check latency of each server frame")
        
on_off 1
    
}
    else
    {
        
on_off 0
        server_print
("stopped checking, saving report file to %s"/*FILE+PATH*/)
    }

Attached Files
File Type: sma Get Plugin or Get Source (voi_latency_checker.sma - 606 views - 846 Bytes)
__________________

Last edited by Voi; 10-21-2010 at 12:25.
Voi is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 10-21-2010 , 13:14   Re: checking latency between server frames
Reply With Quote #2

So . . . what's the question?
__________________
fysiks is offline
Voi
Veteran Member
Join Date: Sep 2006
Location: Gdansk, Poland
Old 10-21-2010 , 13:43   Re: checking latency between server frames
Reply With Quote #3

Quote:
After i issue the "check_fps" command i want it to save each value from server_frame(), and when I issue the command again I want it to save all the values in a file, one value at a line.
I don't know how to save the milisecond value and later save them all in a file one value at line.

I hope its clear now
__________________
Voi is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 10-21-2010 , 13:52   Re: checking latency between server frames
Reply With Quote #4

write_file()
__________________
fysiks is offline
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 10-21-2010 , 17:32   Re: checking latency between server frames
Reply With Quote #5

PHP Code:
#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Server fps latency checker"
#define VERSION "0"
#define AUTHOR "twoj_stary"

new bool:on_off
new g_fh

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_srvcmd("check_fps""switch_check")
}

public 
server_frame()
{
    static 
Float:last_frame
    
if(!on_off)
        return
    new 
Float:curr_frame get_gametime()
    new 
tmp[16]
    
formatex(tmp15"%f^n"curr_frame-last_frame)
    
fputs(g_fhtmp)
    
last_frame curr_frame
}

public 
switch_check()
{
    static 
filename[128]
    if(!(
on_off=!on_off))
    {
        
server_print("stopped checking, saving report file to %s"filename)
        
fclose(g_fh)
        return
    }

    
get_basedir(filename127)
    
format(filename127,  "%s/logs/frame_time_%d.log"filenameget_systime())
    
g_fh fopen(filename"wt")
    if(!
g_fh)
    {
        
on_off=false
        server_print
("failed to open log file %s"filename)
        return
    }
    
server_print("starting to check latency of each server frame")
}

public 
plugin_end()
{
    if(
g_fh)
        
fclose(g_fh)

__________________
Impossible is Nothing
Sylwester is offline
Voi
Veteran Member
Join Date: Sep 2006
Location: Gdansk, Poland
Old 10-21-2010 , 20:14   Re: checking latency between server frames
Reply With Quote #6

Thanks/Dziekuje
__________________
Voi 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 10:21.


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