Raised This Month: $255 Target: $400
 63% 

Notices

amxmodx profiler


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
sawce
The null pointer exception error and virtual machine bug
Join Date: Oct 2004
Old 03-01-2008 , 02:17   amxmodx profiler
Reply With Quote #1

This is a profiler built into amxmodx's core - it really is only useful to people trying to find bottlenecks in their plugins.

What is a profiler? It basically tells you how long your plugin spends executing stuff.

To install it, just replace the amxmodx_mm_i386.so or amxmodx_mm.dll files (remember to backup your old ones) with the provided binaries. You do not need to recompile any plugins or change any modules.

Then configure plugins to be profiled like you would to get plugins debugged.

There is a new cvar, "amx_profile", its configuration is identical to "amx_debug":
0 = no plugins will be profiled
1 = only specified plugins will be profiled (default)
2 = all plugins will be profiled

To specify a plugin for profiling (for amx_profile mode 1), open up plugins.ini, and after the plugin name, add "profile".

For example, "admin.amxx" would become "admin.amxx profile"

Note: You cannot profile a plugin in debug mode.


When a plugin is being profiled, there is a very slight overhead. It should be unnoticeable, and you should be able to profile plugins on a production environment.

At map change, all plugins that are being profiled will get their profile data appended to amxmodx/data/profiles/<pluginname.amxx>.txt

The profiler will read the time it takes to execute native calls, public function calls (from forwards), and function calls (direct public function / stock function calls).

Additionally, it provides two new natives (they are not available in amxmodx's official core) to allow you to profile special chunks of code yourself. Documentation for these is available in the "profiler.inc" file.

Source is available here

Any issues with this version post here, do not file a bug report for it.

Edit:
New version for 1.8.2 and bugs fixed is available here: https://forums.alliedmods.net/showpo...0&postcount=87
Attached Files
File Type: zip amxmodx-1.8.0.3660-profiler.zip (520.1 KB, 763 views)
File Type: zip amxmodx-1.8.1.3746-profiler.zip (542.1 KB, 1576 views)
__________________
fyren sucks

Last edited by xPaw; 08-13-2011 at 10:07.
sawce is offline
sawce
The null pointer exception error and virtual machine bug
Join Date: Oct 2004
Old 03-01-2008 , 02:20   Re: amxmodx profiler
Reply With Quote #2

Here's an example profile report from admincmd.amxx

Code:
date: Fri Feb 29 01:42:55 2008 map: de_dust
type |                             name |      calls | time / min / max
-------------------------------------------------------------------
   n |                   get_user_flags |         14 | 0.000010 / 0.000000 / 0.000005
   n |              is_dedicated_server |         14 | 0.000011 / 0.000000 / 0.000002
   n |                        read_argc |         14 | 0.000014 / 0.000000 / 0.000005
   n |                 get_cvar_pointer |         16 | 0.000207 / 0.000001 / 0.000032
   n |                            equal |         14 | 0.000008 / 0.000000 / 0.000001
   n |                  register_plugin |          1 | 0.000027 / 0.000027 / 0.000027
   n |              register_dictionary |          3 | 0.044636 / 0.001157 / 0.037203
   n |                  register_concmd |         17 | 0.002244 / 0.000088 / 0.000327
   n |                   register_clcmd |          3 | 0.000119 / 0.000034 / 0.000046
   n |                       server_cmd |         14 | 0.000087 / 0.000001 / 0.000032
   n |                        read_argv |         28 | 0.000031 / 0.000000 / 0.000006
   n |                  get_pcvar_flags |         10 | 0.000002 / 0.000000 / 0.000001
   n |                  set_pcvar_flags |         10 | 0.000004 / 0.000000 / 0.000001
   p |                          cmdCvar |         14 | 0.000101 / 0.000001 / 0.000014
   p |                       plugin_cfg |          1 | 0.000020 / 0.000020 / 0.000020
   p |                      plugin_init |          1 | 0.000051 / 0.000051 / 0.000051
   f |                       cmd_access |         14 | 0.000062 / 0.000001 / 0.000015
50 natives, 21 public callbacks, 33 function calls were not executed.
Type "n" is native call, type "p" is public function call from a forward, and type "f" is direct function call.

Note that it doesn't add up recursive calls.

For example: If function a() calls function b(), for the duration that b() is executing, the profiler for function a() is not keeping track of time. As soon as b() stops executing, a() will continue tallying up time.
__________________
fyren sucks
sawce is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 03-01-2008 , 02:41   Re: amxmodx profiler
Reply With Quote #3

neat!
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
pRED*
Join Date: Dec 2006
Old 03-01-2008 , 04:11   Re: amxmodx profiler
Reply With Quote #4

sawce if I could steal that trophy of yours and re-award it to you - I would.

It's that amazing.
pRED* is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 03-01-2008 , 04:29   Re: amxmodx profiler
Reply With Quote #5

Quote:
It's that amazing.
__________________
Working on : CS Weapon Mod (72%) , MonsterAI (PAUSED),

Arkshine is offline
Xanimos
Veteran Member
Join Date: Apr 2005
Location: Florida
Old 03-01-2008 , 04:47   Re: amxmodx profiler
Reply With Quote #6

Your karma status could not be more accurate.
__________________
Xanimos is offline
Send a message via AIM to Xanimos Send a message via MSN to Xanimos
BAILOPAN
Join Date: Jan 2004
Old 03-01-2008 , 11:37   Re: amxmodx profiler
Reply With Quote #7

Irrefutable proof that there is nothing that sawce cannot do!

I need to steal this for SourceMod.
__________________
egg
BAILOPAN is offline
Styles
Veteran Member
Join Date: Jul 2004
Location: California
Old 03-01-2008 , 20:18   Re: amxmodx profiler
Reply With Quote #8

wow this is awsome
Styles is offline
Send a message via AIM to Styles Send a message via MSN to Styles
hoboman
Senior Member
Join Date: Jul 2007
Old 03-13-2008 , 01:08   Re: amxmodx profiler
Reply With Quote #9

would it be possible for you to make something that logs at which function ( or maybe even the certain portion of the function ) a certain plugin is when the server crashes or reboots
__________________
hoboman is offline
sawce
The null pointer exception error and virtual machine bug
Join Date: Oct 2004
Old 03-13-2008 , 01:49   Re: amxmodx profiler
Reply With Quote #10

use binlogging
__________________
fyren sucks
sawce 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:06.


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