[Plugin] Performance profiler
#21

Quote:
Originally Posted by leong124
View Post
robanswe: Try to use the binary search method to comment out parts of your script, and see which part of it does the recursion.

Zeex: I got a problem. When I check the output of this plugin, I found that there are 19 Itter_OnGameModeInit there while there's about 4-5 hooked OnGameModeInit only in my gamemode.
Also, all of them are Itter_OnGameModeInit, while they should have different names IMO (since they are hooked with different names and get called like a chain).
Finally thanks for taking my suggestion
Ty I tryed that but it will also take ages. But I might have an other idea when I look at the result of this plugin this stands out:
pawn Code:
Function                            Calls                  Time per call, µs             Overall time, µs       Overall time, %
operator<=(Float:,Float:)             16                        59813777819859                  957020445117739         99.65

Can this be the problem? If so what the hell is "operator<=(Float:,Float: )"? Where can I find the function?









Edit:

I fixed the warning problem but I still got the problem that it seems like the data I get from this plugin is WAY wrong.. Just look at this:

pawn Code:
Function                                Calls                     Time per call, µs             Overall time, µs               Overall time, %
operator<=(Float:,Float:)               10                        1767756274039915           17677562740399150                   99.99
ContainsIPEx                                10                        147201389626                    1472013896257                        0.01
operator-(Float:,_:)                        1                                 2990482326                       2990482326                              0.00
operator!=(Float:,Float:)                69                            1718595953                      118583120736                       0.00
operator>=(Float:,_:)                279                           3136081                             874966490                              0.00
Just look at the total time o.0 When I ******d that I found out that 1767756274039915 µs is about 56 YEARS! I did only run the server for 10 mins so 56 years is kinda impossible....
Reply
#22

I'm currently trying to fix an important bug which can sometimes mess up everything (this is related to Call[Local/Remote]Function and calling public from outside in general), and I guess the impossibly-huge-numbers problem has something to do with that
Reply
#23

Quote:
Originally Posted by 0x5A656578
View Post
I'm currently trying to fix an important bug which can sometimes mess up everything (this is related to Call[Local/Remote]Function and calling public from outside in general), and I guess the impossibly-huge-numbers problem has something to do with that
That's good to hear Also isn't it possible to fix so you can see standard public functions like: public OnPlayerUpdate(playerid) or public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) ? Because that would be extremely nice to know how fast they are.


Edit:
One more thing that would be great is if you can add support for monotoning many scripts at the same time. Like: Profiler_Init("gamemodes/lvdm.amx","filterscripts/test.amx");
Reply
#24

I have finished a new version (v2.0 alpha):

https://github.com/downloads/Zeex/pr...filer-2.0a.zip (only Windows version for now)

Changes:
  • Publics are profiled correcly (I hope), including callbacks and those called via CallLocalFunction and CallRemoteFunction
  • Now you don't have to call any Profiler_* functions (they are simply deleted), you just add scripts to the file located in <server>/plugins/profiler.cfg, one per line, e.g.
    Code:
    gamemodes/lvdm.amx
    filterscripts/fsdebug.amx
    filterscripts/adminspec.amx
  • Directory separators in profiler.cfg are significant - on Windows you use '\' and on Linux you put '/' (maybe I will fix this later)
Reply
#25

Quote:
Originally Posted by 0x5A656578
View Post
I have finished a new version (v2.0 alpha):

https://github.com/downloads/Zeex/pr...filer-2.0a.zip (only Windows version for now)

Changes:
  • Publics are profiled correcly (I hope), including callbacks and those called via CallLocalFunction and CallRemoteFunction
  • Now you don't have to call any Profiler_* functions (they are simply deleted), you just add scripts to the file located in <server>/plugins/profiler.cfg, one per line, e.g.
    Code:
    gamemodes/lvdm.amx
    filterscripts/fsdebug.amx
    filterscripts/adminspec.amx
  • Directory separators in profiler.cfg are significant - on Windows you use '\' and on Linux you put '/' (maybe I will fix this later)
Great but how to save the result now then? It seems like you have removed: Profiler_PrintStats();
Reply
#26

Quote:
Originally Posted by robanswe
View Post
Great but how to save the result now then? It seems like you have removed: Profiler_PrintStats();
OK seems like I missed this - it saves the result to the same directory where the script is, and adds .prof to the filename, e.g. gamemodes/lvdm.amx.prof. Don't worry about the extension - it's still HTML, just open in a web browser like before.
Reply
#27

Quote:
Originally Posted by 0x5A656578
View Post
OK seems like I missed this - it saves the result to the same directory where the script is, and adds .prof to the filename, e.g. gamemodes/lvdm.amx.prof. Don't worry about the extension - it's still HTML, just open in a web browser like before.
When does it save it because I can't find it?
Reply
#28

Whenever script gets unloaded, try doing gmx or reloadfs
Reply
#29

Quote:
Originally Posted by 0x5A656578
View Post
Whenever script gets unloaded, try doing gmx or reloadfs
Idk what I'm doing wrong I have tried both gmx and exit and I doesn't get any file. I have created an file profiler.cfg in the plugin fouler with this: gamemodes/lvdm.amx on the first line. Btw I'm on w7 64bit with no UAC.
Reply
#30

Quote:
Originally Posted by 0x5A656578
Посмотреть сообщение
I
  • ...
  • Directory separators in profiler.cfg are significant - on Windows you use '\' and on Linux you put '/' (maybe I will fix this later)
Код:
gamemodes\lvdm.amx
Reply
#31

Quote:
Originally Posted by 0x5A656578
Посмотреть сообщение
Код:
gamemodes\lvdm.amx
When I changed that my server crashes. I tried that before but I did think it was wrong when it just crashed.
Reply
#32

Does it print anything to log?
Reply
#33

Quote:
Originally Posted by 0x5A656578
Посмотреть сообщение
Does it print anything to log?
I debuged my code and found where it crashed note this code works without this plugin:

http://pastebin.com/2sAywMgq

"debug: 2.3" gets printed "debug: 2.4" does not.



Edit: Updated the code look igain. http://pastebin.com/2sAywMgq

Edit 2: Note I got #define MAX_MISSION_BOMBS 300 But it seems to only run like 15 times

Edit 3: The code that seems to crash it?
pawn Код:
stock Float:GetDistanceBetweenPoints(Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2)
{
    return floatadd(floatadd(floatsqroot(floatpower(floatsub(x1,x2),2)),floatsqroot(floatpower(floatsub(y1,y2),2))),floatsqroot(floatpower(floatsub(z1,z2),2)));
}

Edit 4: One good thing is that it seems to work when I comment that code out and the plugin seems to work like it should now. All times are correct and the public standard functions seems to be in the result.


Edit 5: Damn seems like this plugin also crash me when I login..


Edit 6: Here is the code that crash the server when I try to open the login dialog:

pawn Код:
format(tstring,sizeof(tstring),"Welcome back, %s!\n\nPlease enter your password to continue!",PlayerName(playerid));
    ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Login",tstring,"Login","Reset");

Edit 7: Doesn't think it is "PlayerName(playerid)" that crash the server because that function is also called when the player connects and the server doesn't crash when the player connect it's first when the dialog (edit 6) code runs.
Reply
#34

Very useful, good job
Reply
#35

Nice work.
Reply
#36

Instead of your crash, mine occurs instantly when the script is loaded.
Reply
#37

I just noticed Zeex's github has 2.0a3 for download.
https://github.com/downloads/Zeex/pr...iler-2.0a3.zip
Going to test in a sec.
Reply
#38

Quote:
Originally Posted by leong124
Посмотреть сообщение
Instead of your crash, mine occurs instantly when the script is loaded.
Are you sure have you debugged: main() and public OnGameModeInit() ?
Reply
#39

It seems like the new version 2.0a2 fixed the first problem I had with the server crashing when starting the server. But now it crash when doing gmx instead..
Reply
#40

This doesn't work for me. I've everything loaded and at the right directories, but there's no .prof file in my gamemodes directory. Help please!
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)