• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Server] Script performance testing
#1
Question 
How can I detect how fast a function is running using gettickcount??If anyone can give me an example, or if you know another method.
  Reply
#2
PHP Code:
public OnPlayerConnect(playerid)

{

? ? new 
count GetTickCount();

? ? 
//Rest of OnPlayerConnect

? ? printf("Time taken to execute OnPlayerConnect: %d"GetTickCount() - count);

? ? return 
1;


  Reply
#3
You just get the tick count at the start of your code and at the end where it is supposed to stop.





Code:
new tickcountstart,tickcountend;

tickcountstart=GetTickCount();

printf("Start: %d",tickcountstart);



CreateDynamicObject(...);

CreateDynamicObject(...);

CreateDynamicObject(...);

CreateDynamicObject(...);

CreateDynamicObject(...);



tickcountend=GetTickCount();

printf("End: %d",tickcountend);

printf("Difference: %d - %d = %d",tickcountend, tickcountstart, tickcountend-tickcountstart);
  Reply
#4
thanks
  Reply
#5
You also may want to read this (and use y_profiling): https://github.com/pawn-lang/YSI-Include...eatures.md
  Reply
#6
Using GetTickCount is not the right way to do this at all. It only tells you how long a single piece of code might take to run (and very very very inaccurately). It won't tell you which parts are actually slow, nor which parts are run a lot. You need the profiler plugin.
  Reply


Forum Jump: