How do I measure the runtime of my include?
#1

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?
Reply
#2

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
Reply
#3

Yes I did with a loop of 100000 anyway thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)