SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 23/07/2011, 11:42 AM   #11
0x5A656578
Guest
 
Posts: n/a
Default Re: Performance profiler

Ah! I haven't mention anywhere: the script you're profiling must have debug symbols in it i.e. compiled with either -d3 or -d2 flag.

Sorry I should have said this in the first post. I will upload an update soon to fix that.
  Reply With Quote
Old 23/07/2011, 11:59 AM   #12
robanswe
Huge Clucker
 
Join Date: Oct 2007
Posts: 371
Reputation: 26
Default Re: Performance profiler

When I turn on the -d3 flag I get this:

Header size: 9140 bytes
Code size: 2099416 bytes
Data size: 2306236 bytes
Stack/heap size: 16384 bytes; estimated max. usage: unknown, due to recursion
Total requirements: 4431176 bytes

The server starts but it seems to be just half working it seems like the server can't change/access some variables. So how to fix this. Also the debug info I get from this plugin seems wired look at this:

Function Calls Time per call Overall time Overall time, %
operator<=(Float:,Float 11 44926983329134 494196816620469 100.39
operator!=(Float:,Float 4 6349021761 25396087044 0.01
mysql_query 355 21821 7746483 0.00
__________________
robanswe is offline   Reply With Quote
Old 23/07/2011, 12:06 PM   #13
leong124
High-roller
 
leong124's Avatar
 
Join Date: Jun 2008
Location: Hong Kong, China
Posts: 1,549
Reputation: 134
Default Re: Performance profiler

You may have stack overflow in your script due to resursion(s).
Check which part of your script uses recursion and fix it.
It could be caused by faulty script causing a function calling itself at some circumstances.
__________________
[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, 12:17 PM   #14
robanswe
Huge Clucker
 
Join Date: Oct 2007
Posts: 371
Reputation: 26
Default Re: Performance profiler

Quote:
Originally Posted by leong124 View Post
You may have stack overflow in your script due to resursion(s).
Check which part of your script uses recursion and fix it.
It could be caused by faulty script causing a function calling itself at some circumstances.
But I doesn't get that massage without the d3 flag o.0
__________________
robanswe is offline   Reply With Quote
Old 23/07/2011, 12:24 PM   #15
leong124
High-roller
 
leong124's Avatar
 
Join Date: Jun 2008
Location: Hong Kong, China
Posts: 1,549
Reputation: 134
Default Re: Performance profiler

The debug label acts like that. IMHO it will do more checking to ensure your script is safe.
Even you don't have a stack overflow, it will still show the message.

Again, nice plugin Zeex
You are swesome
__________________
[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, 12:24 PM   #16
Babul
High-roller
 
Babul's Avatar
 
Join Date: Sep 2009
Location: in a cement block
Posts: 1,897
Reputation: 251
Default Re: Performance profiler

robanswe: in your compiler command line options, add the -S8192 or maybe -S65536
Code:
"%in%" -o"%out%" -d2 -O0 -S65536 -w203 -w204
this is my command line parameter, using PawnStudio. debugmode 2, no optimizing, stack/heapsize set to 64kB, and some warnings to supress (warning 203 and 204, they are annoying for me lol).
pay attention to the -S65536, its setting the stack/heap size, as mentioned.
if you got long if{}else if{}... or switch(){case{}case{}... then a too-low set -S can cause yor problem aswell, and the -S setting to a higher size will solve it
@1516594552: thank you for sharing this, i always wanted to check out how efficient my method in getting closest players is. now i can test it. TY! rep+++
edit: lol @ this
Code:
Function		Calls		Time per call	Overall time	Overall time, %
ShowTDStatus		7		13338		93364		82.22
i guess i got something to optimize... well, that was a profiling for 20 seconds gameplay only, but it points to the right direction where to optimize the unbelievable waste of CPU time in the textdraw routine.
it took me like 10 minutes to get the profiler.html output! thanks again :P
__________________
FireWorks

new sscanf2 custom specifiers available for Download, read the Release Topic

Last edited by Babul; 23/07/2011 at 02:52 PM.
Babul is offline   Reply With Quote
Old 23/07/2011, 03:23 PM   #17
leong124
High-roller
 
leong124's Avatar
 
Join Date: Jun 2008
Location: Hong Kong, China
Posts: 1,549
Reputation: 134
Default Re: Performance profiler

IMO the unit of time should be shown.
I guess this should be us (micro second), because it is impossible to be ms or s.
__________________
[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, 03:37 PM   #18
robanswe
Huge Clucker
 
Join Date: Oct 2007
Posts: 371
Reputation: 26
Default Re: Performance profiler

Quote:
Originally Posted by Babul View Post
robanswe: in your compiler command line options, add the -S8192 or maybe -S65536
Code:
"%in%" -o"%out%" -d2 -O0 -S65536 -w203 -w204
this is my command line parameter, using PawnStudio. debugmode 2, no optimizing, stack/heapsize set to 64kB, and some warnings to supress (warning 203 and 204, they are annoying for me lol).
pay attention to the -S65536, its setting the stack/heap size, as mentioned.
if you got long if{}else if{}... or switch(){case{}case{}... then a too-low set -S can cause yor problem aswell, and the -S setting to a higher size will solve it

I tested this but it didn't help I think I have some big problem somewhere like:

public test()
{
test();
}

Is there anyway to find things like this? I mean my gm is over 40k lines o.0
__________________
robanswe is offline   Reply With Quote
Old 23/07/2011, 04:31 PM   #19
AirKite
Gangsta
 
AirKite's Avatar
 
Join Date: Feb 2009
Posts: 740
Reputation: 21
Default Re: Performance profiler

Very nice. Useful plugin!
AirKite is offline   Reply With Quote
Old 23/07/2011, 04:32 PM   #20
0x5A656578
Guest
 
Posts: n/a
Default Re: Performance profiler

A minor update (v1.5):

- Stats not reset in Profiler_Start anymore, you now have Profiler_ResetStats for this
- Profiler_PrintStats now takes an extra parameter which specifies output data sorting mode (by calls, time, times per call or not sorted)
- Time units appear in output table column names (microseconds)
  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 10:29 AM
Bad performance on a great PC Juan Dover Client Support 20 13/02/2011 08:34 PM
Performance issues gamer931215 Everything and Nothing 3 26/08/2010 10:54 PM
SQL performance Dabombber Help Archive 7 24/09/2009 04:49 PM
9400 GT - GTA:SA Performance rafay Everything and Nothing 14 09/06/2009 05:23 PM


All times are GMT. The time now is 03:05 PM.


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