Skipped Turns ... what to know about?
I played around a little and now i am even more confused :). I changed my whole code and now it runs all mostly under 1 ms. But still 'skipped turns' from time to time but with awkward times.
The output is:
System.out.format("[%d] %d [%d][%d] %d\n", getTime(),System.nanoTime() - start,onScanEventTime,onScanBotTime,onScanTimeDiff);
[94] 233000 [94][94] 113000 [95] 159000 [95][95] 41000 [96] 19648000 [96][96] 19506000 <---- no skip at 19 ms [97] 230000 [97][97] 84000 [98] 367000 [98][98] 232000
[145] 911000 [145][145] 152000 [146] 183000 [0][0] 0 < --- no scan [147] 283000 [147][147] 129000 SYSTEM: TassieDevil* (1) skipped turn 148 [148] 9762000 [148][148] 9543000 < ---- skip at 9 ms [149] 149000 [0][0] 0 [150] 141000 [0][0] 0 [151] 200000 [0][0] 0 [152] 148000 [0][0] 0 [153] 148000 [0][0] 0 [154] 257000 [154][154] 105000 [155] 199000 [155][155] 97000
As you can see the times are always the same for onScannedRobot(...) and run(). My first thought about the run() .. while loop was like yours. The loop runs to execute every turn and print out the time spend but without the setXXX(...) stuff doing. My guess about this was then i can see at least the time that brought me the skipping turn. But as you can see the spend time for the skipped turns are still under 15ms (i guess this is the most time you can spend right?) .
The other side is, i do really nothing special that could cause the system to skip turns, just a couple of minor loops and every turn it is almost the same stuff (just minor differences). Does the garbage collector need every than an now a little more time to remove dead objects? Because i make every new scan a new MessageObject for communication with the team mate.
And there you can see the skipped turn gets his scan event like every turn.
[64] 1224000 [64][64] 1074000 [65] 165000 [65][65] 46000 SYSTEM: TassieDevil* (2) skipped turn 66 [66] 207000 [66][66] 106000 < --- reached the end of onScannedRobot(..) and set the vars [67] 229000 [67][67] 45000
I'm still sure i missed something important but still can't see it :(