2020年2月11日火曜日

Timer Overhead(in MIT App Inventor)

In general, talking about "timer interrupts" is difficult for laymen. This article, apart from the details, describes the overhead of the timer (to do something at regular intervals) at the user program level.

Suppose the timer shown below adds 1 every second (initial value is 0) and stops at 600 times. The elapsed time should be just 10 minutes. Because the addition and judgment in the loop should take less than 0.1ms. However, it actually took 4 to 5 seconds more than 10 minutes. Normally this may not be a problem, but in some cases a correction is required.


As a result of measuring the overhead for operating the timer once, it was found to be about 7.3 ms as shown in the figure below. This is surprisingly large! Then the actual interval of the timer should be shortened accordingly. That will almost finish in exactly 10 minutes (600 seconds). Such usage would also be useful.

0 件のコメント:

コメントを投稿