Raised This Month: $222 Target: $400
 55% 

amxmodx profiler


Post New Thread Reply   
 
Thread Tools Display Modes
danielkza
AMX Mod X Plugin Approver
Join Date: May 2007
Location: São Paulo - Brasil
Old 03-03-2009 , 12:05   Re: amxmodx profiler
Reply With Quote #31

Quote:
Originally Posted by joaquimandrade View Post
I use it. The recent dll didn't work but, the previous one did. (1.8.0)
I found out what the problem is. 1.8.1 doesn't work at all, and 1.8.0 only works if you don't try to use the profiling natives.
__________________

Community / No support through PM
danielkza is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 03-03-2009 , 18:23   Re: amxmodx profiler
Reply With Quote #32

It works fine for me. Both. ( Tested under windows xp, mm1.19p32 )
Arkshine is offline
danielkza
AMX Mod X Plugin Approver
Join Date: May 2007
Location: São Paulo - Brasil
Old 03-03-2009 , 18:40   Re: amxmodx profiler
Reply With Quote #33

Quote:
Originally Posted by arkshine View Post
It works fine for me. Both. ( Tested under windows xp, mm1.19p32 )
Did you try running a plugin that actually uses the profiler natives?
__________________

Community / No support through PM
danielkza is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 03-03-2009 , 18:59   Re: amxmodx profiler
Reply With Quote #34

Ah using the natives. You're right it crashes my server too. Just after StopProfile() call. Most likely it crashes when the profiler object is destroyed because value is well given.

Last edited by Arkshine; 03-03-2009 at 19:02.
Arkshine is offline
vittu
SuperHero Moderator
Join Date: Oct 2004
Location: L.A. County, CA
Old 03-18-2009 , 23:57   Re: amxmodx profiler
Reply With Quote #35

Sawce, any chance on updating this to not crash with csx (or any other module that uses a <mod>stats.amxx plugin)?
vittu is offline
Send a message via AIM to vittu Send a message via MSN to vittu Send a message via Yahoo to vittu
diamond-optic
Veteran Member
Join Date: May 2005
Location: Upstate New York
Old 03-26-2009 , 01:53   Re: amxmodx profiler
Reply With Quote #36

linux binary is crashing for me on startup too...


Quote:
./hlds_run: line 342: 15203 Segmentation fault $HL_CMD
__________________
diamond-optic is offline
Send a message via AIM to diamond-optic
Old 04-06-2009, 06:50
Empowers
This message has been deleted by Empowers. Reason: Sorry got it
stupok
Veteran Member
Join Date: Feb 2006
Old 04-17-2009 , 01:08   Re: amxmodx profiler
Reply With Quote #37

Quote:
Originally Posted by Lee View Post
I'd appreciate it if someone who isn't lazy would make a comparison of get_players() and looping over each slot, but I'll understand if I get ignored.
Ok.

Quote:
Originally Posted by sawce View Post
I'm fairly certain get_players would technically be faster
You are correct, sir.


Here's an example, but your mileage may vary depending on your specific applications. If you give me some ideas, then I might test them. According to the results of this test, get_players() is one order of magnitude faster than iterating through each client.

I had 32 bots connected to my server at the time of this test.

Code:
date: Thu Apr 16 23:59:26 2009 map: de_dust
type |                             name |      calls | time / min / max
-------------------------------------------------------------------
   n |                  register_plugin |          1 | 0.000001 / 0.000001 / 0.000001
   n |                   get_maxplayers |          1 | 0.000000 / 0.000000 / 0.000000
   n |                  register_srvcmd |          1 | 0.000066 / 0.000066 / 0.000066
   n |                       server_cmd |          1 | 0.000003 / 0.000003 / 0.000003
   n |                is_user_connected |     320000 | 0.096525 / 0.000000 / 0.000064
   n |                      get_players |      10000 | 0.006736 / 0.000001 / 0.000042
   p |                           cmd_go |          1 | 0.006293 / 0.006293 / 0.006293
   p |                      plugin_init |          1 | 0.000002 / 0.000002 / 0.000002
   f |         IterateThroughAllPlayers |      10000 | 0.108971 / 0.000010 / 0.000211
   f |                    UseGetPlayers |      10000 | 0.009358 / 0.000001 / 0.000042
0 natives, 0 public callbacks, 2 function calls were not executed.

TOTAL TIME FOR:
	IterateThroughAllPlayers
		0.205496
	UseGetPlayers
		0.016094
PHP Code:
#include <amxmodx>
#include <amxmisc>

#define PLUGIN    "Get Players"
#define AUTHOR    "stupok"
#define VERSION    "1.0"

new g_iMaxPlayers

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
g_iMaxPlayers get_maxplayers()
    
    
register_srvcmd"go""cmd_go" )
}

public 
cmd_go()
{
    for( new 
010000i++ )
    {
        
IterateThroughAllPlayers()
    }
    
    for( new 
010000i++ )
    {
        
UseGetPlayers()
    }
    
    
server_cmd"quit" )
}

IterateThroughAllPlayers()
{
    for( new 
1<= g_iMaxPlayersi++ )
    {
        if( 
is_user_connected) )
        {
            
//
        
}
    }
}

UseGetPlayers()
{
    static 
aPlayers[32], iPlayersNumid
    
    get_players
aPlayersiPlayersNum"" )
    
    for( new 
0iPlayersNumi++ )
    {
        
id aPlayers[i]
    }

__________________

Last edited by stupok; 04-17-2009 at 01:12.
stupok is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 04-17-2009 , 16:12   Re: amxmodx profiler
Reply With Quote #38

Quote:
Originally Posted by stupok View Post
Here's an example, but your mileage may vary depending on your specific applications. If you give me some ideas, then I might test them.
Try saving whether a player is connected into a global during client_authorized and client_disconnect.
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
Michael_Jim
Member
Join Date: Apr 2005
Location: Germany
Old 04-17-2009 , 18:23   Re: amxmodx profiler
Reply With Quote #39

Quote:
Originally Posted by diamond-optic View Post
linux binary is crashing for me on startup too...
same here. no chance to run it
__________________
Besucht meinen Server | visit my server
Spielzimmer - HLstatsX Premium: 188.40.62.148:27015
Michael_Jim is offline
stupok
Veteran Member
Join Date: Feb 2006
Old 04-18-2009 , 12:55   Re: amxmodx profiler
Reply With Quote #40

Quote:
Originally Posted by Emp` View Post
Try saving whether a player is connected into a global during client_authorized and client_disconnect.
Ok.

Caching the results of cient_authorized() and client_disconnect() increases the speed of IterateThroughAllPlayers() tremendously. Now, the get_players() method is one order of magnitude slower than iterating through each player.

Here are the results: (NOTE: the previous post had 10,000 iterations, this had 1,000,000 iterations)

Code:
32 BOTS, CACHED CONNECT/DISCONNECT

date: Sat Apr 18 11:46:00 2009 map: de_dust
type |                             name |      calls | time / min / max
-------------------------------------------------------------------
   n |                  register_plugin |          1 | 0.000001 / 0.000001 / 0.000001
   n |                   get_maxplayers |          1 | 0.000000 / 0.000000 / 0.000000
   n |                  register_srvcmd |          1 | 0.000059 / 0.000059 / 0.000059
   n |                       server_cmd |          1 | 0.000003 / 0.000003 / 0.000003
   n |                      get_players |    1000000 | 0.660214 / 0.000001 / 0.001794
   p |                client_authorized |         32 | 0.000019 / 0.000001 / 0.000001
   p |                client_disconnect |         32 | 0.000010 / 0.000000 / 0.000000
   p |                           cmd_go |          1 | 0.623259 / 0.623259 / 0.623259
   p |                      plugin_init |          1 | 0.000002 / 0.000002 / 0.000002
   f |         IterateThroughAllPlayers |    1000000 | 0.604227 / 0.000001 / 0.001491
   f |                    UseGetPlayers |    1000000 | 0.934782 / 0.000001 / 0.001892
0 natives, 0 public callbacks, 4 function calls were not executed.

TOTAL TIME FOR:
	IterateThroughAllPlayers
		0.604227
	UseGetPlayers
		1.594996
Here's the plugin:

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

#define PLUGIN    "Get Players"
#define AUTHOR    "stupok"
#define VERSION    "1.0"

new g_iMaxPlayers
new g_bClientConnected[33]

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
g_iMaxPlayers get_maxplayers()
    
    
register_srvcmd"go""cmd_go" )
}

public 
cmd_go()
{
    for( new 
01000000i++ )
    {
        
IterateThroughAllPlayers()
    }
    
    for( new 
01000000i++ )
    {
        
UseGetPlayers()
    }
    
    
server_cmd"quit" )
}

public 
client_authorizedid )
    
g_bClientConnected[id] = true

public client_disconnectid )
    
g_bClientConnected[id] = false

IterateThroughAllPlayers
()
{
    for( new 
1<= g_iMaxPlayersi++ )
    {
        if( 
g_bClientConnected[i] )
        {
            
//
        
}
    }
}

UseGetPlayers()
{
    static 
aPlayers[32], iPlayersNumid
    
    get_players
aPlayersiPlayersNum"" )
    
    for( new 
0iPlayersNumi++ )
    {
        
id aPlayers[i]
    }

__________________
stupok is offline
Reply


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 22:54.


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