SA-MP Forums Archive
How do I measure the runtime of my include? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How do I measure the runtime of my include? (/showthread.php?tid=260177)



How do I measure the runtime of my include? - KoczkaHUN - 07.06.2011

I made a test command-include, and I want to measure its speed.
I tried to do that:
(include)
pawn Код:
new timr;
public OnPlayerCommandText(playerid, cmdtext[])
{
    timr = GetTickCount();
    // lots of code
        return CallLocalFunction(cmdname, "is", playerid, params);
    // code
}
// code
(filterscript)
pawn Код:
KCMD:teszt1(playerid, params[])
{
    new now = GetTickCount();
    new msg[92];
    format(msg, sizeof msg, "It took %d ms! (%d - %d)", now - timr, timr, now);
    return SendClientMessage(playerid, 0x00ff00aa, msg);
}
it just write 0 ms, and two Tick-values that are the same.

How can I determine the real run time of the include?


Re: How do I measure the runtime of my include? - Mauzen - 07.06.2011

Normally you can do it exactly that way. The problem probably is, that the code takes less than 1 ms to run. To get useable values, call the code more often with a for loop. Try at least 10000 times, and you should get a good time. If it still is less than 100ms just increase it, just dont start with too many loops, or you might have to wait for ages


Re: How do I measure the runtime of my include? - KoczkaHUN - 08.06.2011

Yes I did with a loop of 100000 anyway thanks