tickcount/printf bug
#1

So I'm doing this simple execution time measuring:

Код:
new tick = tickcount();
(....)
printf("TIMER: MainTimer %i ms @ %i players", tickcount() - tick, Iter_Count(Player));
And all I get is 0ms, 20ms or 40ms [ONLY THREE VALUES!], even at loaded server, so i did it the other way:

Код:
new tick = tickcount();
new tick2;
(...)
tick2 = tickcount();
printf("%i %i", tick, tick2);
printf("TIMER: MainTimer %i ms @ %i players", tick2 - tick, Iter_Count(Player));
And I see that tick = tick2

What the hell is wrong with it? Also I remember that last time i used it it was working good but the times were always rounded to full 10s (10ms, 130ms 230ms etc)

Also using GetTickCount instead gives proper results (I think)
Reply
#2

The code executes too fast. Try looping it with 10.000 iterations and then see what happens.
Reply
#3

There is no way that timers full of stuff looping through all connected players execute in less than 1ms, last time it was working properly, main timer executed in 20-180ms, rest in about 20-40ms
Also notice that the results printed are only 0, 20 or 40ms, there is definitely something weird here, I'll try to check it more on normal and bare script

EDIT: Checked the data again using Excel, looks like GetTickCount is OK (but timers execute surprisingly fast, no more than 100ms at heavy load), and tickcount gives very repeatable results but not only 0 20 and 40, looks like the server is trolling me, I give up on optimisation there and thinking if ticks are ok or not x_x
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)