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.
I am a professor emeritus of CS at Kanagawa Institute of Technology, Japan. Originally my specialty was parallel and distributed systems. My current interests include machine learning, natural language processing, creating mobile apps with MIT App Inventor, and quantum computing. In the web version of this blog, clicking the icon on the right (a plastic sphere) will take you to the "List of Quantum Computing Articles". - Fujio Yamamoto (for e-mail, add "@ieee.org" after "yamamotof")
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.
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.
登録:
コメントの投稿 (Atom)
0 件のコメント:
コメントを投稿