SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Plugin Development

Reply
 
Thread Tools Display Modes
Old 23/07/2011, 03:50 AM   #1
0x5A656578
Guest
 
Posts: n/a
Default Performance profiler

Performance profiler

This plugin can count how many times each of functions is called and how much time it takes to execute. This information is outputted in one of the currently supported formats: HTML , XML or and plain text.

Profiling begins right after a script gets loaded and stops when you unload it (i.e. when you close the server or do gmx/fsunload/fsreload). At unloading time, all statistical data is saved to a file called <script_name>-profile.<format> in .amx directory. The <format> part depends on your output format choice (see below).

Profiler adds a few extra server.cfg variables:
  • profile_gamemode <0|1>

    If set to 1, profiler will profile currently running game mode. Default value is 0.

  • profile_filterscripts <fs1> <fs2> ...

    A list of filter scripts to be profiled. Can be empty.

  • profile_format <xml|html|txt>

    Set statistics output format. Default is html. Note for HTML: it is possible to sort stats by clicking on column names!!

  • call_graph <0|1>

    Set this option to 1 if you want profiler to generate a call graph. The graph is generated as a GraphViz dot file.

  • call_graph_format <format>

    If specified, profiler will try to convert the .gv file into one of the formats supported by dot.

    The dot program is invoked as follows:

    Code:
     <install_path>/dot -T<format> <some_script-calls.gv> -O
    On Windows, install_path is looked up in registry first, then in GV_HOME environment variable (as on *nix). If GraphViz install path is not found it is assumed to be already in PATH.

Download

https://github.com/Zeex/samp-plugin-profiler/releases

Source code

https://github.com/Zeex/samp-plugin-profiler

Last edited by dugi; 21/06/2016 at 02:17 PM.
  Reply With Quote
Old 23/07/2011, 04:03 AM   #2
Lorenc_
High-roller
 
Lorenc_'s Avatar
 
Join Date: Jan 2010
Location: Australia
Posts: 4,291
Reputation: 1088
Default Re: Performance profiler

This is sweet, I'll be trying this out now, thanks mate
Lorenc_ is offline   Reply With Quote
Old 23/07/2011, 04:20 AM   #3
0x5A656578
Guest
 
Posts: n/a
Default Re: Performance profiler

Quote:
Originally Posted by SPAWN_METAL View Post
after
Code:
Profiler_Start("gamemodes/universal_mode.amx");
It's very cool plugin but not work with my gamemode =(
May plugins create this bug?
Hmm try updating crashdetect or don't load it
  Reply With Quote
Old 23/07/2011, 05:38 AM   #4
Kyosaur
High-roller
 
Kyosaur's Avatar
 
Join Date: Mar 2008
Location: USA - California
Posts: 1,015
Reputation: 330
Default Re: Performance profiler

This is pretty neat, thanks for releasing it (gonna dive into the source *drool*).
__________________
[Tutorial]: Plugin development guide.
[Tutorial]: An indepth look at binary.


Follow me on twitter for updates on all my projects.
Kyosaur is offline   Reply With Quote
Old 23/07/2011, 07:09 AM   #5
Burridge
High-roller
 
Burridge's Avatar
 
Join Date: Nov 2008
Location: England
Posts: 2,144
Reputation: 35
Default Re: Performance profiler

Awesome plugin. Will take a better look when I get home.
Burridge is offline   Reply With Quote
Old 23/07/2011, 08:57 AM   #6
RyDeR`
High-roller
 
RyDeR`'s Avatar
 
Join Date: Feb 2009
Location: Belgium
Posts: 3,094
Reputation: 691
Default Re: Performance profiler

Very nice and advanced plugins you release in here. I really like it, good job.
__________________

Sup?
RyDeR` is offline   Reply With Quote
Old 23/07/2011, 09:11 AM   #7
leong124
High-roller
 
leong124's Avatar
 
Join Date: Jun 2008
Location: Hong Kong, China
Posts: 1,568
Reputation: 134
Default Re: Performance profiler

When I do this in OnGameModeExit the server crashes when I close the server/ change the gamemode:
Code:
Profiler_Stop();
Profiler_PrintStats("scriptfiles/test.html");
crashdetect says that it is crashed by Profiler_PrintStats.
It is still crashing without the crashdetect plugin.

I put
Code:
Profiler_Init("gamemodes/scfri.amx");
Profiler_Start();
in OnGameModeInit.

I'm not sure if I used it wrongly...
__________________
[KDT_MS]hk_shade

Sorry for my bad English and my weakness in expressing myself.
leong124 is offline   Reply With Quote
Old 23/07/2011, 09:18 AM   #8
Calgon
Godfather
 
Calgon's Avatar
 
Join Date: Jan 2009
Posts: 6,474
Reputation: 1055
Default Re: Performance profiler

Brilliant, thank you. I'll certainly make good use of this in the near future.
__________________
Calgon is offline   Reply With Quote
Old 23/07/2011, 09:32 AM   #9
QuaTTrO
Gangsta
 
QuaTTrO's Avatar
 
Join Date: Aug 2009
Posts: 564
Reputation: 66
Default Re: Performance profiler

Dont work in my gamemode its crashing server... ;/
__________________


QuaTTrO is offline   Reply With Quote
Old 23/07/2011, 10:04 AM   #10
Mauzen
Godfather
 
Mauzen's Avatar
 
Join Date: Jun 2007
Location: Western Germany
Posts: 5,069
Reputation: 1505
Default Re: Performance profiler

Sounds nice, but also doesnt work for me. When stopping and saving on gamemode exit, nothing happens. If I stop and save with a command only the file with the header is created, but it shows no functions, and the server crashes. (windows version, R1 server)
Would be great if this really works, as i am doing a lot of optimizing work atm, so this would be really handy.
Mauzen is offline   Reply With Quote
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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Timers performance Zamaroht Scripting Help 5 30/08/2012 09:29 AM
Bad performance on a great PC Juan Dover Client Support 20 13/02/2011 07:34 PM
Performance issues gamer931215 Everything and Nothing 3 26/08/2010 09:54 PM
SQL performance Dabombber Help Archive 7 24/09/2009 03:49 PM
9400 GT - GTA:SA Performance rafay Everything and Nothing 14 09/06/2009 04:23 PM


All times are GMT. The time now is 07:25 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.